|
48 | 48 | import org.truffleruby.RubyContext;
|
49 | 49 | import org.truffleruby.RubyLanguage;
|
50 | 50 | import org.truffleruby.annotations.Split;
|
51 |
| -import org.truffleruby.aot.ParserCache; |
52 | 51 | import org.truffleruby.core.CoreLibrary;
|
53 | 52 | import org.truffleruby.core.DummyNode;
|
54 | 53 | import org.truffleruby.core.binding.BindingNodes;
|
@@ -158,22 +157,13 @@ public RootCallTarget parse(RubySource rubySource, ParserContext parserContext,
|
158 | 157 |
|
159 | 158 | final String sourcePath = rubySource.getSourcePath(language).intern();
|
160 | 159 |
|
161 |
| - // Only use the cache while loading top-level core library files, as eval() later could use |
162 |
| - // the same Source name but should not use the cache. For instance, |
163 |
| - // TOPLEVEL_BINDING.eval("self") would use the cache which is wrong. |
164 |
| - final ParseResult parseResult; |
165 |
| - if (ParserCache.INSTANCE != null && parserContext == ParserContext.TOP_LEVEL && |
166 |
| - ParserCache.INSTANCE.containsKey(source.getName())) { |
167 |
| - parseResult = ParserCache.INSTANCE.get(source.getName()).getLeft(); |
168 |
| - } else { |
169 |
| - printParseTranslateExecuteMetric("before-parsing", context, source); |
170 |
| - parseResult = context.getMetricsProfiler().callWithMetrics( |
171 |
| - "parsing", |
172 |
| - source.getName(), |
173 |
| - () -> parseToYARPAST(rubySource, sourcePath, yarpSource, localsInScopes, |
174 |
| - language.options.FROZEN_STRING_LITERALS)); |
175 |
| - printParseTranslateExecuteMetric("after-parsing", context, source); |
176 |
| - } |
| 160 | + printParseTranslateExecuteMetric("before-parsing", context, source); |
| 161 | + final ParseResult parseResult = context.getMetricsProfiler().callWithMetrics( |
| 162 | + "parsing", |
| 163 | + source.getName(), |
| 164 | + () -> parseToYARPAST(rubySource, sourcePath, yarpSource, localsInScopes, |
| 165 | + language.options.FROZEN_STRING_LITERALS)); |
| 166 | + printParseTranslateExecuteMetric("after-parsing", context, source); |
177 | 167 |
|
178 | 168 | handleWarningsErrorsPrimitives(context, parseResult, rubySource, sourcePath, parseEnvironment, rubyWarnings);
|
179 | 169 |
|
@@ -458,20 +448,6 @@ public static void handleWarningsErrorsPrimitives(RubyContext context, ParseResu
|
458 | 448 | parseEnvironment.allowTruffleRubyPrimitives = allowTruffleRubyPrimitives;
|
459 | 449 | }
|
460 | 450 |
|
461 |
| - public static void handleWarningsErrorsNoContext(ParseResult parseResult, String sourcePath, |
462 |
| - Nodes.Source yarpSource) { |
463 |
| - if (parseResult.errors.length > 0) { |
464 |
| - var error = parseResult.errors[0]; |
465 |
| - throw CompilerDirectives.shouldNotReachHere("Parse error in " + |
466 |
| - sourcePath + ":" + yarpSource.line(error.location.startOffset) + ": " + error.message); |
467 |
| - } |
468 |
| - |
469 |
| - for (var warning : parseResult.warnings) { |
470 |
| - throw CompilerDirectives.shouldNotReachHere("Warning in " + |
471 |
| - sourcePath + ":" + yarpSource.line(warning.location.startOffset) + ": " + warning.message); |
472 |
| - } |
473 |
| - } |
474 |
| - |
475 | 451 | public static Nodes.Source createYARPSource(byte[] sourceBytes) {
|
476 | 452 | return new Nodes.Source(sourceBytes);
|
477 | 453 | }
|
|
0 commit comments