85
85
import org .truffleruby .language .methods .SharedMethodInfo ;
86
86
import org .truffleruby .parser .lexer .RubyLexer ;
87
87
import org .truffleruby .parser .parser .ParserConfiguration ;
88
- import org .truffleruby .parser .scope .StaticScope ;
89
88
import org .truffleruby .shared .Metrics ;
90
89
import org .prism .Nodes ;
91
90
import org .prism .ParseResult ;
@@ -126,14 +125,12 @@ public RootCallTarget parse(RubySource rubySource, ParserContext parserContext,
126
125
127
126
final Source source = rubySource .getSource ();
128
127
129
- final StaticScope staticScope = new StaticScope (StaticScope .Type .LOCAL , null );
130
-
131
128
// TODO: check if we still need this for YARP
132
129
/* Note that jruby-parser will be mistaken about how deep the existing variables are, but that doesn't matter as
133
130
* we look them up ourselves after being told they're in some parent scope. */
134
131
135
132
final TranslatorEnvironment parentEnvironment ;
136
- final ArrayList < ArrayList <String >> localVariableNames = new ArrayList <>();
133
+ final List < List <String >> localVariableNames = new ArrayList <>();
137
134
138
135
int blockDepth = 0 ;
139
136
if (parentFrame != null ) {
@@ -145,9 +142,7 @@ public RootCallTarget parse(RubySource rubySource, ParserContext parserContext,
145
142
for (Object identifier : FrameDescriptorNamesIterator .iterate (frame .getFrameDescriptor ())) {
146
143
if (!BindingNodes .isHiddenVariable (identifier )) {
147
144
final String name = (String ) identifier ;
148
- staticScope .addVariableThisScope (name .intern ()); // StaticScope expects interned var names
149
-
150
- names .add (name );
145
+ names .add (name .intern ()); // intern() for footprint
151
146
}
152
147
}
153
148
@@ -162,9 +157,7 @@ public RootCallTarget parse(RubySource rubySource, ParserContext parserContext,
162
157
}
163
158
164
159
if (argumentNames != null ) {
165
- for (String name : argumentNames ) {
166
- staticScope .addVariableThisScope (name .intern ()); // StaticScope expects interned var names
167
- }
160
+ // TODO: add these variables and treat it more like an eval case
168
161
}
169
162
170
163
String sourcePath = rubySource .getSourcePath (language );
@@ -259,9 +252,7 @@ public RootCallTarget parse(RubySource rubySource, ParserContext parserContext,
259
252
truffleNode = context .getMetricsProfiler ().callWithMetrics (
260
253
"translating" ,
261
254
source .getName (),
262
- () -> {
263
- return node .accept (translator );
264
- });
255
+ () -> node .accept (translator ));
265
256
} finally {
266
257
printParseTranslateExecuteMetric ("after-translate" , context , source );
267
258
}
@@ -402,16 +393,8 @@ private String getMethodName(ParserContext parserContext, MaterializedFrame pare
402
393
}
403
394
404
395
public static org .prism .ParseResult parseToYARPAST (RubyContext context , RubyLanguage language ,
405
- RubySource rubySource , StaticScope blockScope , ArrayList < ArrayList <String >> localVariableNames ,
396
+ RubySource rubySource , List < List <String >> localVariableNames ,
406
397
ParserConfiguration configuration , RubyDeferredWarnings rubyWarnings , ParseEnvironment parseEnvironment ) {
407
- // LexerSource lexerSource = new LexerSource(rubySource);
408
- // We only need to pass in current scope if we are evaluating as a block (which
409
- // is only done for evals). We need to pass this in so that we can appropriately scope
410
- // down to captured scopes when we are parsing.
411
- if (blockScope != null ) {
412
- configuration .parseAsBlock (blockScope );
413
- }
414
-
415
398
TruffleSafepoint .poll (DummyNode .INSTANCE );
416
399
417
400
// YARP begin
0 commit comments