diff --git a/pkg/front_end/lib/src/fasta/incremental_compiler.dart b/pkg/front_end/lib/src/fasta/incremental_compiler.dart index 2aabaff1867..5e0c376779a 100644 --- a/pkg/front_end/lib/src/fasta/incremental_compiler.dart +++ b/pkg/front_end/lib/src/fasta/incremental_compiler.dart @@ -1731,6 +1731,16 @@ class IncrementalCompiler implements IncrementalKernelGenerator { } } + // Setup scope first in two-step process: + // 1) Create a new SourceLibraryBuilder, add imports and setup (import) + // scope. + // 2) Create a new SourceLibraryBuilder, using a nested scope of the scope + // we just created as the scope. The import scopes have been setup via + // the parent chain. + // This is done to create the correct "layering" (i.e. definitions from + // the "self" library first, then imports while not having dill builders + // directly in the scope of a source builder (which can crash things in + // some circumstances). SourceLibraryBuilder debugLibrary = new SourceLibraryBuilder( importUri: libraryUri, fileUri: debugExprUri, @@ -1784,6 +1794,16 @@ class IncrementalCompiler implements IncrementalKernelGenerator { debugLibrary.addImportsToScope(); _ticker.logMs("Added imports"); } + debugLibrary = new SourceLibraryBuilder( + importUri: libraryUri, + fileUri: debugExprUri, + packageLanguageVersion: + new ImplicitLanguageVersion(libraryBuilder.library.languageVersion), + loader: lastGoodKernelTarget.loader, + scope: debugLibrary.scope.createNestedScope("expression"), + nameOrigin: libraryBuilder, + isUnsupported: libraryBuilder.isUnsupported, + ); HybridFileSystem hfs = lastGoodKernelTarget.fileSystem as HybridFileSystem; diff --git a/pkg/front_end/test/spell_checking_list_code.txt b/pkg/front_end/test/spell_checking_list_code.txt index b338dd608f2..2fe783e09ad 100644 --- a/pkg/front_end/test/spell_checking_list_code.txt +++ b/pkg/front_end/test/spell_checking_list_code.txt @@ -671,6 +671,7 @@ launched launcher layer layered +layering layers layout lc diff --git a/pkg/front_end/testcases/expression.status b/pkg/front_end/testcases/expression.status index 76b0665066c..e9ab4a8a2bb 100644 --- a/pkg/front_end/testcases/expression.status +++ b/pkg/front_end/testcases/expression.status @@ -1,5 +1,3 @@ # Copyright (c) 2018, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. - -platform_isandroid.expression: Crash diff --git a/pkg/front_end/testcases/expression/platform_isandroid.expression.yaml.expect b/pkg/front_end/testcases/expression/platform_isandroid.expression.yaml.expect new file mode 100644 index 00000000000..872d5f9024b --- /dev/null +++ b/pkg/front_end/testcases/expression/platform_isandroid.expression.yaml.expect @@ -0,0 +1,4 @@ +Errors: { +} +static method /*isLegacy, from org-dartlang-debug:synthetic_debug_expression */ debugExpr() → dynamic + return dart.io::Platform::isAndroid;