| 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 '../parser/parser.dart' show FormalParameterType, optional; | 7 import '../parser/parser.dart' show FormalParameterType, optional; |
| 8 | 8 |
| 9 import '../parser/error_kind.dart' show ErrorKind; | 9 import '../parser/error_kind.dart' show ErrorKind; |
| 10 | 10 |
| (...skipping 12 matching lines...) Expand all Loading... |
| 23 import '../parser/dart_vm_native.dart' show skipNativeClause; | 23 import '../parser/dart_vm_native.dart' show skipNativeClause; |
| 24 | 24 |
| 25 import '../scanner/token.dart' | 25 import '../scanner/token.dart' |
| 26 show BeginGroupToken, Token, isBinaryOperator, isMinusOperator; | 26 show BeginGroupToken, Token, isBinaryOperator, isMinusOperator; |
| 27 | 27 |
| 28 import '../errors.dart' show formatUnexpected, internalError; | 28 import '../errors.dart' show formatUnexpected, internalError; |
| 29 | 29 |
| 30 import '../source/scope_listener.dart' | 30 import '../source/scope_listener.dart' |
| 31 show JumpTargetKind, NullValue, ScopeListener; | 31 show JumpTargetKind, NullValue, ScopeListener; |
| 32 | 32 |
| 33 import '../builder/scope.dart' show AccessErrorBuilder, AmbiguousBuilder, Scope; | 33 import '../builder/scope.dart' show ProblemBuilder, Scope; |
| 34 | 34 |
| 35 import '../source/outline_builder.dart' show asyncMarkerFromTokens; | 35 import '../source/outline_builder.dart' show asyncMarkerFromTokens; |
| 36 | 36 |
| 37 import 'builder_accessors.dart'; | 37 import 'builder_accessors.dart'; |
| 38 | 38 |
| 39 import 'frontend_accessors.dart' show buildIsNull, makeBinary, makeLet; | 39 import 'frontend_accessors.dart' show buildIsNull, makeBinary, makeLet; |
| 40 | 40 |
| 41 import 'builder_accessors.dart' as builder_accessors | 41 import 'builder_accessors.dart' as builder_accessors |
| 42 show throwNoSuchMethodError; | 42 show throwNoSuchMethodError; |
| 43 | 43 |
| (...skipping 2216 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2260 return new ExpressionStatement(buildCompileTimeError(error, charOffset)); | 2260 return new ExpressionStatement(buildCompileTimeError(error, charOffset)); |
| 2261 } | 2261 } |
| 2262 | 2262 |
| 2263 @override | 2263 @override |
| 2264 Initializer buildCompileTimeErrorIntializer(error, [int charOffset = -1]) { | 2264 Initializer buildCompileTimeErrorIntializer(error, [int charOffset = -1]) { |
| 2265 return new LocalInitializer(new VariableDeclaration.forValue( | 2265 return new LocalInitializer(new VariableDeclaration.forValue( |
| 2266 buildCompileTimeError(error, charOffset))); | 2266 buildCompileTimeError(error, charOffset))); |
| 2267 } | 2267 } |
| 2268 | 2268 |
| 2269 @override | 2269 @override |
| 2270 Expression buildProblemExpression(Builder builder, String name) { | 2270 Expression buildProblemExpression(ProblemBuilder builder, int charOffset) { |
| 2271 if (builder is AmbiguousBuilder) { | 2271 return buildCompileTimeError(builder.message, charOffset); |
| 2272 return buildCompileTimeError("Duplicated named: '$name'."); | |
| 2273 } else if (builder is AccessErrorBuilder) { | |
| 2274 return buildCompileTimeError("Access error: '$name'."); | |
| 2275 } else { | |
| 2276 return internalError("Unhandled: ${builder.runtimeType}"); | |
| 2277 } | |
| 2278 } | 2272 } |
| 2279 | 2273 |
| 2280 @override | 2274 @override |
| 2281 void handleOperator(Token token) { | 2275 void handleOperator(Token token) { |
| 2282 debugEvent("Operator"); | 2276 debugEvent("Operator"); |
| 2283 push(new Operator(token.stringValue)..fileOffset = token.charOffset); | 2277 push(new Operator(token.stringValue)..fileOffset = token.charOffset); |
| 2284 } | 2278 } |
| 2285 | 2279 |
| 2286 @override | 2280 @override |
| 2287 void handleSymbolVoid(Token token) { | 2281 void handleSymbolVoid(Token token) { |
| (...skipping 294 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2582 users.clear(); | 2576 users.clear(); |
| 2583 } | 2577 } |
| 2584 | 2578 |
| 2585 void resolveGotos(SwitchCase target) { | 2579 void resolveGotos(SwitchCase target) { |
| 2586 assert(isGotoTarget); | 2580 assert(isGotoTarget); |
| 2587 for (ContinueSwitchStatement user in users) { | 2581 for (ContinueSwitchStatement user in users) { |
| 2588 user.target = target; | 2582 user.target = target; |
| 2589 } | 2583 } |
| 2590 users.clear(); | 2584 users.clear(); |
| 2591 } | 2585 } |
| 2586 |
| 2587 @override |
| 2588 String get fullNameForErrors => "<jump-target>"; |
| 2592 } | 2589 } |
| 2593 | 2590 |
| 2594 class LabelTarget extends Builder implements JumpTarget { | 2591 class LabelTarget extends Builder implements JumpTarget { |
| 2595 final JumpTarget breakTarget; | 2592 final JumpTarget breakTarget; |
| 2596 | 2593 |
| 2597 final JumpTarget continueTarget; | 2594 final JumpTarget continueTarget; |
| 2598 | 2595 |
| 2599 final int functionNestingLevel; | 2596 final int functionNestingLevel; |
| 2600 | 2597 |
| 2601 LabelTarget(MemberBuilder member, this.functionNestingLevel, int charOffset) | 2598 LabelTarget(MemberBuilder member, this.functionNestingLevel, int charOffset) |
| (...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2633 breakTarget.resolveBreaks(target); | 2630 breakTarget.resolveBreaks(target); |
| 2634 } | 2631 } |
| 2635 | 2632 |
| 2636 void resolveContinues(LabeledStatement target) { | 2633 void resolveContinues(LabeledStatement target) { |
| 2637 continueTarget.resolveContinues(target); | 2634 continueTarget.resolveContinues(target); |
| 2638 } | 2635 } |
| 2639 | 2636 |
| 2640 void resolveGotos(SwitchCase target) { | 2637 void resolveGotos(SwitchCase target) { |
| 2641 internalError("Unsupported operation."); | 2638 internalError("Unsupported operation."); |
| 2642 } | 2639 } |
| 2640 |
| 2641 @override |
| 2642 String get fullNameForErrors => "<label-target>"; |
| 2643 } | 2643 } |
| 2644 | 2644 |
| 2645 class OptionalFormals { | 2645 class OptionalFormals { |
| 2646 final FormalParameterType kind; | 2646 final FormalParameterType kind; |
| 2647 | 2647 |
| 2648 final List<VariableDeclaration> formals; | 2648 final List<VariableDeclaration> formals; |
| 2649 | 2649 |
| 2650 OptionalFormals(this.kind, this.formals); | 2650 OptionalFormals(this.kind, this.formals); |
| 2651 } | 2651 } |
| 2652 | 2652 |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2747 } else if (node is PrefixBuilder) { | 2747 } else if (node is PrefixBuilder) { |
| 2748 return node.name; | 2748 return node.name; |
| 2749 } else if (node is ThisAccessor) { | 2749 } else if (node is ThisAccessor) { |
| 2750 return node.isSuper ? "super" : "this"; | 2750 return node.isSuper ? "super" : "this"; |
| 2751 } else if (node is BuilderAccessor) { | 2751 } else if (node is BuilderAccessor) { |
| 2752 return node.plainNameForRead; | 2752 return node.plainNameForRead; |
| 2753 } else { | 2753 } else { |
| 2754 return internalError("Unhandled: ${node.runtimeType}"); | 2754 return internalError("Unhandled: ${node.runtimeType}"); |
| 2755 } | 2755 } |
| 2756 } | 2756 } |
| OLD | NEW |