@@ -68,8 +68,11 @@ function parseFile(code, filename, types) {
68
68
function parseStruct ( name , rawName , lines , scopeArgs , filename , startLineIndex ) {
69
69
const fields = [ ] ;
70
70
for ( let i = 0 ; i < lines . length ; i ++ ) {
71
- const line = lines [ i ] ;
72
- if ( line . startsWith ( '#[' ) ) {
71
+ let line = lines [ i ] ;
72
+ const isScopeEntry = line === '#[scope(enter_before)]' ;
73
+ if ( isScopeEntry ) {
74
+ line = lines [ ++ i ] ;
75
+ } else if ( line . startsWith ( '#[' ) ) {
73
76
while ( ! lines [ i ] . endsWith ( ']' ) ) {
74
77
i ++ ;
75
78
}
@@ -86,6 +89,8 @@ function parseStruct(name, rawName, lines, scopeArgs, filename, startLineIndex)
86
89
{ name : innerTypeName , wrappers} = typeAndWrappers ( typeName ) ;
87
90
88
91
fields . push ( { name, typeName, rawName, rawTypeName, innerTypeName, wrappers} ) ;
92
+
93
+ if ( isScopeEntry ) scopeArgs . enterScopeBefore = name ;
89
94
}
90
95
return { kind : 'struct' , name, rawName, fields, scopeArgs} ;
91
96
}
@@ -128,7 +133,7 @@ function parseScopeArgs(argsStr, filename, lineIndex) {
128
133
while ( true ) {
129
134
const [ key ] = matchAndConsume ( / ^ ( [ a - z _ ] + ) \( / ) ;
130
135
assert (
131
- [ 'scope' , 'scope_if' , 'strict_if' , 'enter_scope_before' ] . includes ( key ) ,
136
+ [ 'scope' , 'scope_if' , 'strict_if' ] . includes ( key ) ,
132
137
`Unexpected visited_node macro arg: ${ key } `
133
138
) ;
134
139
0 commit comments