| 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 | 8 show |
| 9 FastaMessage, | 9 FastaMessage, |
| 10 codeConstFieldWithoutInitializer, | 10 codeConstFieldWithoutInitializer, |
| (...skipping 22 matching lines...) Expand all Loading... |
| 33 import 'package:kernel/clone.dart' show CloneVisitor; | 33 import 'package:kernel/clone.dart' show CloneVisitor; |
| 34 | 34 |
| 35 import 'package:kernel/transformations/flags.dart' show TransformerFlag; | 35 import 'package:kernel/transformations/flags.dart' show TransformerFlag; |
| 36 | 36 |
| 37 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; | 37 import 'package:kernel/class_hierarchy.dart' show ClassHierarchy; |
| 38 | 38 |
| 39 import 'package:kernel/core_types.dart' show CoreTypes; | 39 import 'package:kernel/core_types.dart' show CoreTypes; |
| 40 | 40 |
| 41 import 'frontend_accessors.dart' show buildIsNull, makeBinary, makeLet; | 41 import 'frontend_accessors.dart' show buildIsNull, makeBinary, makeLet; |
| 42 | 42 |
| 43 import '../messages.dart' as messages show getLocationFromUri; |
| 44 |
| 43 import '../../scanner/token.dart' show BeginToken, Token; | 45 import '../../scanner/token.dart' show BeginToken, Token; |
| 44 | 46 |
| 45 import '../scanner/token.dart' show isBinaryOperator, isMinusOperator; | 47 import '../scanner/token.dart' show isBinaryOperator, isMinusOperator; |
| 46 | 48 |
| 47 import '../errors.dart' show InputError, formatUnexpected, internalError; | 49 import '../errors.dart' show InputError, formatUnexpected, internalError; |
| 48 | 50 |
| 49 import '../source/scope_listener.dart' | 51 import '../source/scope_listener.dart' |
| 50 show JumpTargetKind, NullValue, ScopeListener; | 52 show JumpTargetKind, NullValue, ScopeListener; |
| 51 | 53 |
| 52 import '../scope.dart' show ProblemBuilder; | 54 import '../scope.dart' show ProblemBuilder; |
| (...skipping 2936 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2989 Expression wrapInCompileTimeError(Expression expression, String message) { | 2991 Expression wrapInCompileTimeError(Expression expression, String message) { |
| 2990 return new Let( | 2992 return new Let( |
| 2991 new VariableDeclaration.forValue(expression) | 2993 new VariableDeclaration.forValue(expression) |
| 2992 ..fileOffset = expression.fileOffset, | 2994 ..fileOffset = expression.fileOffset, |
| 2993 buildCompileTimeError(message, expression.fileOffset)) | 2995 buildCompileTimeError(message, expression.fileOffset)) |
| 2994 ..fileOffset = expression.fileOffset; | 2996 ..fileOffset = expression.fileOffset; |
| 2995 } | 2997 } |
| 2996 | 2998 |
| 2997 Expression buildFallThroughError(int charOffset) { | 2999 Expression buildFallThroughError(int charOffset) { |
| 2998 warningNotError("Switch case may fall through to next case.", charOffset); | 3000 warningNotError("Switch case may fall through to next case.", charOffset); |
| 2999 Builder constructor = library.loader.getFallThroughError(); | 3001 |
| 3002 Location location = messages.getLocationFromUri(uri, charOffset); |
| 3003 |
| 3000 return new Throw(buildStaticInvocation( | 3004 return new Throw(buildStaticInvocation( |
| 3001 constructor.target, new Arguments.empty(), | 3005 library.loader.coreTypes.fallThroughErrorUrlAndLineConstructor, |
| 3006 new Arguments(<Expression>[ |
| 3007 new StringLiteral(location?.file ?? uri.toString()), |
| 3008 new IntLiteral(location?.line ?? 0) |
| 3009 ]), |
| 3002 charOffset: charOffset)); | 3010 charOffset: charOffset)); |
| 3003 } | 3011 } |
| 3004 | 3012 |
| 3005 Expression buildAbstractClassInstantiationError(String className, | 3013 Expression buildAbstractClassInstantiationError(String className, |
| 3006 [int charOffset = -1]) { | 3014 [int charOffset = -1]) { |
| 3007 warning("The class '$className' is abstract and can't be instantiated.", | 3015 warning("The class '$className' is abstract and can't be instantiated.", |
| 3008 charOffset); | 3016 charOffset); |
| 3009 Builder constructor = library.loader.getAbstractClassInstantiationError(); | 3017 Builder constructor = library.loader.getAbstractClassInstantiationError(); |
| 3010 return new Throw(buildStaticInvocation(constructor.target, | 3018 return new Throw(buildStaticInvocation(constructor.target, |
| 3011 new KernelArguments(<Expression>[new StringLiteral(className)]))); | 3019 new KernelArguments(<Expression>[new StringLiteral(className)]))); |
| (...skipping 658 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3670 if (starToken == null) { | 3678 if (starToken == null) { |
| 3671 return AsyncMarker.Async; | 3679 return AsyncMarker.Async; |
| 3672 } else { | 3680 } else { |
| 3673 assert(identical(starToken.stringValue, "*")); | 3681 assert(identical(starToken.stringValue, "*")); |
| 3674 return AsyncMarker.AsyncStar; | 3682 return AsyncMarker.AsyncStar; |
| 3675 } | 3683 } |
| 3676 } else { | 3684 } else { |
| 3677 return internalError("Unknown async modifier: $asyncToken"); | 3685 return internalError("Unknown async modifier: $asyncToken"); |
| 3678 } | 3686 } |
| 3679 } | 3687 } |
| OLD | NEW |