Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // 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.
| |
| 2 // for details. All rights reserved. Use of this source code is governed by a | |
| 3 // BSD-style license that can be found in the LICENSE file. | |
| 4 | |
| 5 /// Implements support for Dart2js native method bodies of this form: | |
| 6 /// | |
| 7 /// methodDeclaration() native; | |
| 8 /// | |
| 9 /// This support is kept separate from parser.dart as this isn't specified in | |
| 10 /// the Dart Language Specification, we hope to remove this syntax and replace | |
| 11 /// it with the external modifier. | |
| 12 library fasta.parser.dart2js_native; | |
| 13 | |
| 14 import '../scanner/token.dart' show Token; | |
| 15 | |
| 16 import 'parser.dart' show optional; | |
| 17 | |
| 18 /// When parsing a Dart2js library file, we may encounter a native clause | |
| 19 /// instead of a function body. This method skips such a clause. | |
| 20 /// | |
| 21 /// This method is designed to be called when encountering | |
| 22 /// [ErrorKind.ExpectedBlockToSkip] in [Listener.handleUnrecoverableError]. | |
| 23 Token skipDart2jsNativeClause(Token token) { | |
| 24 if (!optional("native", token)) return null; | |
| 25 if (!optional(";", token.next)) return null; | |
| 26 return token; | |
| 27 } | |
| OLD | NEW |