Index: pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
diff --git a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
index 0a2be2bd99acc854a6c2d7f9b3d4f4e0928229ca..3f7557d1bff3436940651af7a6545f8666548eba 100644 |
--- a/pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
+++ b/pkg/front_end/lib/src/fasta/kernel/body_builder.dart |
@@ -17,6 +17,8 @@ import '../parser/parser.dart' |
import '../parser/identifier_context.dart' show IdentifierContext; |
+import '../parser/native_support.dart' show skipNativeClause; |
+ |
import 'package:front_end/src/fasta/kernel/kernel_shadow_ast.dart'; |
import 'package:front_end/src/fasta/kernel/utils.dart' show offsetForToken; |
@@ -93,6 +95,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { |
final Scope enclosingScope; |
final bool enableNative; |
+ final bool stringExpectedAfterNative; |
/// Whether to ignore an unresolved reference to `main` within the body of |
/// `_getMainClosure` when compiling the current library. |
@@ -180,7 +183,10 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { |
this._typeInferrer) |
: enclosingScope = scope, |
library = library, |
- enableNative = library.loader.target.enableNative(library), |
+ enableNative = |
+ library.loader.target.backendTarget.enableNative(library.uri), |
+ stringExpectedAfterNative = |
+ library.loader.target.backendTarget.nativeExtensionExpectsString, |
ignoreMainInGetMainClosure = library.uri.scheme == 'dart' && |
(library.uri.path == "_builtin" || library.uri.path == "ui"), |
needsImplicitSuperInitializer = |
@@ -2974,7 +2980,7 @@ class BodyBuilder extends ScopeListener<JumpTarget> implements BuilderHelper { |
@override |
Token handleUnrecoverableError(Token token, FastaMessage message) { |
if (enableNative && message.code == codeExpectedFunctionBody) { |
- Token recover = library.loader.target.skipNativeClause(token); |
+ Token recover = skipNativeClause(token, stringExpectedAfterNative); |
if (recover != null) return recover; |
} else if (message.code == codeExpectedButGot) { |
String expected = message.arguments["string"]; |