| Index: pkg/front_end/lib/src/fasta/source/directive_listener.dart
|
| diff --git a/pkg/front_end/lib/src/fasta/source/directive_listener.dart b/pkg/front_end/lib/src/fasta/source/directive_listener.dart
|
| index 278b44a02bb6977e887a4ca222d5a215591b163c..355e3c75115fc70c3981213689bfa8ab24ade50e 100644
|
| --- a/pkg/front_end/lib/src/fasta/source/directive_listener.dart
|
| +++ b/pkg/front_end/lib/src/fasta/source/directive_listener.dart
|
| @@ -7,7 +7,8 @@
|
| library front_end.src.fasta.source.directive_listener;
|
|
|
| import '../fasta_codes.dart' show FastaMessage, codeExpectedBlockToSkip;
|
| -import '../parser/dart_vm_native.dart' show skipNativeClause;
|
| +import '../parser/dart2js_native.dart' show skipDart2jsNativeClause;
|
| +import '../parser/dart_vm_native.dart' show skipVmNativeClause;
|
| import '../parser/listener.dart';
|
| import '../quote.dart';
|
| import '../scanner/token.dart';
|
| @@ -20,9 +21,13 @@ import '../scanner/token.dart';
|
| /// any top-level declaration, but we recommend to continue parsing the entire
|
| /// file in order to gracefully handle input errors.
|
| class DirectiveListener extends Listener {
|
| - /// Whether we accept the native-syntax used by the VM patch files.
|
| + /// Whether we accept the native-syntax used by patch files.
|
| final bool acceptsNativeClause;
|
|
|
| + /// In the precense of native clauses, whether they belong to dart2js patch
|
| + /// files (otherwise to VM patch files).
|
| + final bool targetingDart2js;
|
| +
|
| /// Collects URIs that occur on any import directive.
|
| final Set<String> imports = new Set<String>();
|
|
|
| @@ -32,7 +37,8 @@ class DirectiveListener extends Listener {
|
| /// Collects URIs that occur on any part directive.
|
| final Set<String> parts = new Set<String>();
|
|
|
| - DirectiveListener({this.acceptsNativeClause: false});
|
| + DirectiveListener(
|
| + {this.acceptsNativeClause: false, this.targetingDart2js: false});
|
|
|
| /// Set when entering the context of a directive, null when the parser is not
|
| /// looking at a directive.
|
| @@ -80,7 +86,9 @@ class DirectiveListener extends Listener {
|
| @override
|
| Token handleUnrecoverableError(Token token, FastaMessage message) {
|
| if (acceptsNativeClause && message.code == codeExpectedBlockToSkip) {
|
| - Token recover = skipNativeClause(token);
|
| + Token recover = targetingDart2js
|
| + ? skipDart2jsNativeClause(token)
|
| + : skipVmNativeClause(token);
|
| if (recover != null) return recover;
|
| }
|
| return super.handleUnrecoverableError(token, message);
|
|
|