Chromium Code Reviews| 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 dd5a19da04cac42d274837a21f397c4dd8b4e230..b0feffbf5c6e693ea7a6cc26076d04b291cf911e 100644 |
| --- a/pkg/front_end/lib/src/fasta/source/diet_listener.dart |
| +++ b/pkg/front_end/lib/src/fasta/source/diet_listener.dart |
| @@ -13,14 +13,24 @@ import 'package:kernel/class_hierarchy.dart' show |
| import 'package:kernel/core_types.dart' show |
| CoreTypes; |
| -import 'package:front_end/src/fasta/parser/parser.dart' show |
| +import '../parser/parser.dart' show |
| Parser, |
| optional; |
| -import 'package:front_end/src/fasta/scanner/token.dart' show |
| +import '../scanner/token.dart' show |
| BeginGroupToken, |
| Token; |
| +import '../parser/dart_vm_native.dart' show |
| + removeNativeClause, |
| + skipNativeClause; |
| + |
| +import '../parser/error_kind.dart' show |
| + ErrorKind; |
| + |
| +import '../util/link.dart' show |
| + Link; |
| + |
| import '../errors.dart' show |
| Crash, |
| InputError, |
| @@ -60,6 +70,8 @@ class DietListener extends StackListener { |
| final AstKind astKind; |
| + final bool isDartLibrary; |
| + |
| ClassBuilder currentClass; |
| /// For top-level declarations, this is the library scope. For class members, |
| @@ -69,7 +81,8 @@ class DietListener extends StackListener { |
| DietListener(SourceLibraryBuilder library, this.elementStore, this.hierarchy, |
| this.coreTypes, this.astKind) |
| : library = library, |
| - memberScope = library.scope; |
| + memberScope = library.scope, |
| + isDartLibrary = library.uri.scheme == "dart"; |
| @override |
| Uri get uri => library.uri; |
| @@ -454,6 +467,21 @@ class DietListener extends StackListener { |
| checkEmpty(); |
| } |
| + @override |
| + Token handleUnrecoverableError(Token token, ErrorKind kind, Map arguments) { |
| + if (isDartLibrary && kind == ErrorKind.ExpectedBlockToSkip) { |
|
Siggi Cherem (dart-lang)
2017/02/03 18:16:57
I am guessing the recovery below will be null in t
ahe
2017/02/03 20:03:36
Done.
|
| + Token recover = skipNativeClause(token); |
| + if (recover != null) return recover; |
| + } |
| + return super.handleUnrecoverableError(token, kind, arguments); |
| + } |
| + |
| + @override |
| + Link<Token> handleMemberName(Link<Token> identifiers) { |
| + if (!isDartLibrary || identifiers.isEmpty) return identifiers; |
| + return removeNativeClause(identifiers); |
| + } |
| + |
| void parseFunctionBody(StackListener listener, Token token) { |
| try { |
| Parser parser = new Parser(listener); |