| 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 'package:front_end/src/fasta/parser/parser.dart' show | 7 import 'package:front_end/src/fasta/parser/parser.dart' show |
| 8 FormalParameterType, | 8 FormalParameterType, |
| 9 optional; | 9 optional; |
| 10 | 10 |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 skipNativeClause; | 29 skipNativeClause; |
| 30 | 30 |
| 31 import 'package:front_end/src/fasta/scanner/token.dart' show | 31 import 'package:front_end/src/fasta/scanner/token.dart' show |
| 32 BeginGroupToken, | 32 BeginGroupToken, |
| 33 Token, | 33 Token, |
| 34 isBinaryOperator, | 34 isBinaryOperator, |
| 35 isMinusOperator; | 35 isMinusOperator; |
| 36 | 36 |
| 37 import '../errors.dart' show | 37 import '../errors.dart' show |
| 38 InputError, | 38 InputError, |
| 39 internalError; | 39 internalError, |
| 40 printUnexpected; |
| 40 | 41 |
| 41 import '../source/scope_listener.dart' show | 42 import '../source/scope_listener.dart' show |
| 42 JumpTargetKind, | 43 JumpTargetKind, |
| 43 NullValue, | 44 NullValue, |
| 44 ScopeListener; | 45 ScopeListener; |
| 45 | 46 |
| 46 import '../builder/scope.dart' show | 47 import '../builder/scope.dart' show |
| 47 AccessErrorBuilder, | 48 AccessErrorBuilder, |
| 48 AmbiguousBuilder, | 49 AmbiguousBuilder, |
| 49 Scope; | 50 Scope; |
| (...skipping 2138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2188 arguments.putIfAbsent("actual", () => token.value); | 2189 arguments.putIfAbsent("actual", () => token.value); |
| 2189 handleRecoverableError(token, ErrorKind.ExpectedButGot, arguments); | 2190 handleRecoverableError(token, ErrorKind.ExpectedButGot, arguments); |
| 2190 } | 2191 } |
| 2191 return token; | 2192 return token; |
| 2192 } | 2193 } |
| 2193 return super.handleUnrecoverableError(token, kind, arguments); | 2194 return super.handleUnrecoverableError(token, kind, arguments); |
| 2194 } | 2195 } |
| 2195 | 2196 |
| 2196 @override | 2197 @override |
| 2197 Expression buildCompileTimeError(error, [int charOffset = -1]) { | 2198 Expression buildCompileTimeError(error, [int charOffset = -1]) { |
| 2198 String message = new InputError(uri, charOffset, error).format(); | 2199 String message = printUnexpected(uri, charOffset, error); |
| 2199 print(message); | |
| 2200 Builder constructor = library.loader.getCompileTimeError(); | 2200 Builder constructor = library.loader.getCompileTimeError(); |
| 2201 return new Throw( | 2201 return new Throw( |
| 2202 buildStaticInvocation(constructor.target, | 2202 buildStaticInvocation(constructor.target, |
| 2203 new Arguments(<Expression>[new StringLiteral(message)]), | 2203 new Arguments(<Expression>[new StringLiteral(message)]), |
| 2204 isConst: false)); // TODO(ahe): Make this const. | 2204 isConst: false)); // TODO(ahe): Make this const. |
| 2205 } | 2205 } |
| 2206 | 2206 |
| 2207 Statement buildCompileTimeErrorStatement(error, [int charOffset = -1]) { | 2207 Statement buildCompileTimeErrorStatement(error, [int charOffset = -1]) { |
| 2208 return new ExpressionStatement(buildCompileTimeError(error, charOffset)); | 2208 return new ExpressionStatement(buildCompileTimeError(error, charOffset)); |
| 2209 } | 2209 } |
| (...skipping 469 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2679 } else if (node is TypeDeclarationBuilder) { | 2679 } else if (node is TypeDeclarationBuilder) { |
| 2680 return node.name; | 2680 return node.name; |
| 2681 } else if (node is PrefixBuilder) { | 2681 } else if (node is PrefixBuilder) { |
| 2682 return node.name; | 2682 return node.name; |
| 2683 } else if (node is ThisPropertyAccessor) { | 2683 } else if (node is ThisPropertyAccessor) { |
| 2684 return node.name.name; | 2684 return node.name.name; |
| 2685 } else { | 2685 } else { |
| 2686 return internalError("Unhandled: ${node.runtimeType}"); | 2686 return internalError("Unhandled: ${node.runtimeType}"); |
| 2687 } | 2687 } |
| 2688 } | 2688 } |
| OLD | NEW |