Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(624)

Unified Diff: pkg/front_end/lib/src/fasta/source/diet_listener.dart

Issue 2976543002: Reapply "Tweak public APIs and use them in patch_sdk, dart2js, and kernel-service."" (Closed)
Patch Set: fix Created 3 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/source/diet_listener.dart
diff --git a/pkg/front_end/lib/src/fasta/source/diet_listener.dart b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
index ec1cd61e1b9835231519b9326ad5932a03de9179..5ee99455cdd48491a63628fd4e044614702818b0 100644
--- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart
+++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart
@@ -25,7 +25,8 @@ import '../parser/parser.dart' show MemberKind, Parser, optional;
import '../../scanner/token.dart' show BeginToken, Token;
-import '../parser/dart_vm_native.dart' show removeNativeClause;
+import '../parser/native_support.dart'
+ show removeNativeClause, skipNativeClause;
import '../util/link.dart' show Link;
@@ -48,6 +49,8 @@ class DietListener extends StackListener {
final bool enableNative;
+ final bool stringExpectedAfterNative;
+
final TypeInferenceEngine typeInferenceEngine;
ClassBuilder currentClass;
@@ -64,7 +67,10 @@ class DietListener extends StackListener {
: library = library,
uri = library.fileUri,
memberScope = library.scope,
- enableNative = library.loader.target.enableNative(library);
+ enableNative =
+ library.loader.target.backendTarget.enableNative(library.uri),
+ stringExpectedAfterNative =
+ library.loader.target.backendTarget.nativeExtensionExpectsString;
void discard(int n) {
for (int i = 0; i < n; i++) {
@@ -515,7 +521,7 @@ class DietListener extends StackListener {
@override
Token handleUnrecoverableError(Token token, FastaMessage message) {
if (enableNative && message.code == codeExpectedBlockToSkip) {
- Token recover = library.loader.target.skipNativeClause(token);
+ Token recover = skipNativeClause(token, stringExpectedAfterNative);
if (recover != null) return recover;
}
return super.handleUnrecoverableError(token, message);
@@ -524,7 +530,7 @@ class DietListener extends StackListener {
@override
Link<Token> handleMemberName(Link<Token> identifiers) {
if (!enableNative || identifiers.isEmpty) return identifiers;
- return removeNativeClause(identifiers);
+ return removeNativeClause(identifiers, stringExpectedAfterNative);
}
AsyncMarker getAsyncMarker(StackListener listener) => listener.pop();

Powered by Google App Engine
This is Rietveld 408576698