OLD | NEW |
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file |
2 // for details. All rights reserved. Use of this source code is governed by a | 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. | 3 // BSD-style license that can be found in the LICENSE file. |
4 | 4 |
5 library fasta.body_builder; | 5 library fasta.body_builder; |
6 | 6 |
7 import '../fasta_codes.dart' | 7 import '../fasta_codes.dart' |
8 show FastaMessage, codeExpectedButGot, codeExpectedFunctionBody; | 8 show FastaMessage, codeExpectedButGot, codeExpectedFunctionBody; |
9 | 9 |
10 import '../parser/parser.dart' show FormalParameterType, optional; | 10 import '../parser/parser.dart' show FormalParameterType, optional; |
(...skipping 21 matching lines...) Expand all Loading... |
32 import 'package:kernel/clone.dart' show CloneVisitor; | 32 import 'package:kernel/clone.dart' show CloneVisitor; |
33 | 33 |
34 import 'package:kernel/transformations/flags.dart' show TransformerFlag; | 34 import 'package:kernel/transformations/flags.dart' show TransformerFlag; |
35 | 35 |
36 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; | 36 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; |
37 | 37 |
38 import 'package:kernel/core_types.dart' show CoreTypes; | 38 import 'package:kernel/core_types.dart' show CoreTypes; |
39 | 39 |
40 import 'frontend_accessors.dart' show buildIsNull, makeBinary, makeLet; | 40 import 'frontend_accessors.dart' show buildIsNull, makeBinary, makeLet; |
41 | 41 |
42 import '../parser/dart_vm_native.dart' show skipNativeClause; | |
43 | |
44 import '../scanner/token.dart' | 42 import '../scanner/token.dart' |
45 show BeginGroupToken, Token, isBinaryOperator, isMinusOperator; | 43 show BeginGroupToken, Token, isBinaryOperator, isMinusOperator; |
46 | 44 |
47 import '../errors.dart' show formatUnexpected, internalError; | 45 import '../errors.dart' show formatUnexpected, internalError; |
48 | 46 |
49 import '../source/scope_listener.dart' | 47 import '../source/scope_listener.dart' |
50 show JumpTargetKind, NullValue, ScopeListener; | 48 show JumpTargetKind, NullValue, ScopeListener; |
51 | 49 |
52 import '../scope.dart' show ProblemBuilder; | 50 import '../scope.dart' show ProblemBuilder; |
53 | 51 |
(...skipping 2464 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2518 @override | 2516 @override |
2519 void handleRecoverableError(Token token, FastaMessage message) { | 2517 void handleRecoverableError(Token token, FastaMessage message) { |
2520 bool silent = hasParserError; | 2518 bool silent = hasParserError; |
2521 super.handleRecoverableError(token, message); | 2519 super.handleRecoverableError(token, message); |
2522 addCompileTimeError(message.charOffset, message.message, silent: silent); | 2520 addCompileTimeError(message.charOffset, message.message, silent: silent); |
2523 } | 2521 } |
2524 | 2522 |
2525 @override | 2523 @override |
2526 Token handleUnrecoverableError(Token token, FastaMessage message) { | 2524 Token handleUnrecoverableError(Token token, FastaMessage message) { |
2527 if (isDartLibrary && message.code == codeExpectedFunctionBody) { | 2525 if (isDartLibrary && message.code == codeExpectedFunctionBody) { |
2528 Token recover = skipNativeClause(token); | 2526 Token recover = library.loader.target.skipNativeClause(token); |
2529 if (recover != null) return recover; | 2527 if (recover != null) return recover; |
2530 } else if (message.code == codeExpectedButGot) { | 2528 } else if (message.code == codeExpectedButGot) { |
2531 String expected = message.arguments["string"]; | 2529 String expected = message.arguments["string"]; |
2532 const List<String> trailing = const <String>[")", "}", ";", ","]; | 2530 const List<String> trailing = const <String>[")", "}", ";", ","]; |
2533 if (trailing.contains(token.stringValue) && trailing.contains(expected)) { | 2531 if (trailing.contains(token.stringValue) && trailing.contains(expected)) { |
2534 handleRecoverableError(token, message); | 2532 handleRecoverableError(token, message); |
2535 return newSyntheticToken(token); | 2533 return newSyntheticToken(token); |
2536 } | 2534 } |
2537 } | 2535 } |
2538 return super.handleUnrecoverableError(token, message); | 2536 return super.handleUnrecoverableError(token, message); |
(...skipping 590 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3129 } else if (node is PrefixBuilder) { | 3127 } else if (node is PrefixBuilder) { |
3130 return node.name; | 3128 return node.name; |
3131 } else if (node is ThisAccessor) { | 3129 } else if (node is ThisAccessor) { |
3132 return node.isSuper ? "super" : "this"; | 3130 return node.isSuper ? "super" : "this"; |
3133 } else if (node is FastaAccessor) { | 3131 } else if (node is FastaAccessor) { |
3134 return node.plainNameForRead; | 3132 return node.plainNameForRead; |
3135 } else { | 3133 } else { |
3136 return internalError("Unhandled: ${node.runtimeType}"); | 3134 return internalError("Unhandled: ${node.runtimeType}"); |
3137 } | 3135 } |
3138 } | 3136 } |
OLD | NEW |