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

Unified Diff: pkg/front_end/lib/src/fasta/parser/dart2js_native.dart

Issue 2832353002: Add support for building patched_sdk and platform.dill for dart2js: (Closed)
Patch Set: rebase Created 3 years, 8 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/parser/dart2js_native.dart
diff --git a/pkg/front_end/lib/src/fasta/parser/dart2js_native.dart b/pkg/front_end/lib/src/fasta/parser/dart2js_native.dart
new file mode 100644
index 0000000000000000000000000000000000000000..7b231777815a4cfac5a82f16ac3a103e5c54d8dc
--- /dev/null
+++ b/pkg/front_end/lib/src/fasta/parser/dart2js_native.dart
@@ -0,0 +1,27 @@
+// Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file
ahe 2017/04/27 13:34:34 Can this live in package:compiler somehow?
Siggi Cherem (dart-lang) 2017/04/28 21:37:20 Done.
+// for details. All rights reserved. Use of this source code is governed by a
+// BSD-style license that can be found in the LICENSE file.
+
+/// Implements support for Dart2js native method bodies of this form:
+///
+/// methodDeclaration() native;
+///
+/// This support is kept separate from parser.dart as this isn't specified in
+/// the Dart Language Specification, we hope to remove this syntax and replace
+/// it with the external modifier.
+library fasta.parser.dart2js_native;
+
+import '../scanner/token.dart' show Token;
+
+import 'parser.dart' show optional;
+
+/// When parsing a Dart2js library file, we may encounter a native clause
+/// instead of a function body. This method skips such a clause.
+///
+/// This method is designed to be called when encountering
+/// [ErrorKind.ExpectedBlockToSkip] in [Listener.handleUnrecoverableError].
+Token skipDart2jsNativeClause(Token token) {
+ if (!optional("native", token)) return null;
+ if (!optional(";", token.next)) return null;
+ return token;
+}

Powered by Google App Engine
This is Rietveld 408576698