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

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

Issue 2676823002: Add option --compile-sdk to fasta compile and run. (Closed)
Patch Set: Created 3 years, 10 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/outline_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/source/outline_builder.dart b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
index da33884b3704c78b6793e907c6365c1140f16847..4549589d4596b52b14b563dabd06e9a3170f4987 100644
--- a/pkg/front_end/lib/src/fasta/source/outline_builder.dart
+++ b/pkg/front_end/lib/src/fasta/source/outline_builder.dart
@@ -8,13 +8,16 @@ import 'package:kernel/ast.dart' show
AsyncMarker,
ProcedureKind;
-import 'package:front_end/src/fasta/parser/parser.dart' show
+import '../parser/parser.dart' show
FormalParameterType,
optional;
-import 'package:front_end/src/fasta/scanner/token.dart' show
+import '../scanner/token.dart' show
Token;
+import '../util/link.dart' show
+ Link;
+
import '../combinator.dart' show
Combinator;
@@ -34,6 +37,13 @@ import 'unhandled_listener.dart' show
Unhandled,
UnhandledListener;
+import '../parser/error_kind.dart' show
+ ErrorKind;
+
+import '../parser/dart_vm_native.dart' show
+ removeNativeClause,
+ skipNativeClause;
+
enum MethodBody {
Abstract,
Regular,
@@ -63,7 +73,11 @@ AsyncMarker asyncMarkerFromTokens(Token asyncToken, Token starToken) {
class OutlineBuilder extends UnhandledListener {
final SourceLibraryBuilder library;
- OutlineBuilder(this.library);
+ final bool isDartLibrary;
+
+ OutlineBuilder(SourceLibraryBuilder library)
+ : library = library,
+ isDartLibrary = library.uri.scheme == "dart";
@override
Uri get uri => library.uri;
@@ -525,6 +539,21 @@ class OutlineBuilder extends UnhandledListener {
}
@override
+ Token handleUnrecoverableError(Token token, ErrorKind kind, Map arguments) {
Siggi Cherem (dart-lang) 2017/02/03 18:16:57 to avoid the duplication, maybe move these 2 metho
ahe 2017/02/03 19:34:14 I'm avoiding mixins for critical code based on som
+ if (isDartLibrary && kind == ErrorKind.ExpectedBlockToSkip) {
+ 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);
+ }
+
+ @override
void debugEvent(String name) {
// printEvent(name);
}

Powered by Google App Engine
This is Rietveld 408576698