| 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 20 matching lines...) Expand all Loading... |
| 31 hide InvalidExpression, InvalidInitializer, InvalidStatement; | 31 hide InvalidExpression, InvalidInitializer, InvalidStatement; |
| 32 | 32 |
| 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; |
| 42 | 42 |
| 43 import '../../scanner/token.dart' show BeginToken, Token; | 43 import '../../scanner/token.dart' show BeginToken, Token; |
| 44 | 44 |
| 45 import '../scanner/token.dart' show isBinaryOperator, isMinusOperator; | 45 import '../scanner/token.dart' show isBinaryOperator, isMinusOperator; |
| 46 | 46 |
| 47 import '../errors.dart' show InputError, formatUnexpected, internalError; | 47 import '../errors.dart' show InputError, formatUnexpected, internalError; |
| 48 | 48 |
| 49 import '../source/scope_listener.dart' | 49 import '../source/scope_listener.dart' |
| 50 show JumpTargetKind, NullValue, ScopeListener; | 50 show JumpTargetKind, NullValue, ScopeListener; |
| 51 | 51 |
| (...skipping 3136 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3188 Expression buildMethodInvocation( | 3188 Expression buildMethodInvocation( |
| 3189 Expression receiver, Name name, Arguments arguments, int offset, | 3189 Expression receiver, Name name, Arguments arguments, int offset, |
| 3190 {bool isConstantExpression: false, | 3190 {bool isConstantExpression: false, |
| 3191 bool isNullAware: false, | 3191 bool isNullAware: false, |
| 3192 bool isImplicitCall: false}) { | 3192 bool isImplicitCall: false}) { |
| 3193 if (constantExpressionRequired && !isConstantExpression) { | 3193 if (constantExpressionRequired && !isConstantExpression) { |
| 3194 return buildCompileTimeError("Not a constant expression.", offset); | 3194 return buildCompileTimeError("Not a constant expression.", offset); |
| 3195 } | 3195 } |
| 3196 if (isNullAware) { | 3196 if (isNullAware) { |
| 3197 VariableDeclaration variable = new VariableDeclaration.forValue(receiver); | 3197 VariableDeclaration variable = new VariableDeclaration.forValue(receiver); |
| 3198 return makeLet( | 3198 return new KernelNullAwareMethodInvocation( |
| 3199 variable, | 3199 variable, |
| 3200 new KernelConditionalExpression( | 3200 new ConditionalExpression( |
| 3201 buildIsNull(new VariableGet(variable), offset), | 3201 buildIsNull(new VariableGet(variable), offset), |
| 3202 new NullLiteral(), | 3202 new NullLiteral(), |
| 3203 new MethodInvocation(new VariableGet(variable), name, arguments) | 3203 new MethodInvocation(new VariableGet(variable), name, arguments) |
| 3204 ..fileOffset = offset)); | 3204 ..fileOffset = offset, |
| 3205 const DynamicType()) |
| 3206 ..fileOffset = offset) |
| 3207 ..fileOffset = offset; |
| 3205 } else { | 3208 } else { |
| 3206 return new KernelMethodInvocation(receiver, name, arguments, | 3209 return new KernelMethodInvocation(receiver, name, arguments, |
| 3207 isImplicitCall: isImplicitCall) | 3210 isImplicitCall: isImplicitCall) |
| 3208 ..fileOffset = offset; | 3211 ..fileOffset = offset; |
| 3209 } | 3212 } |
| 3210 } | 3213 } |
| 3211 | 3214 |
| 3212 @override | 3215 @override |
| 3213 void addCompileTimeErrorFromMessage(FastaMessage message) { | 3216 void addCompileTimeErrorFromMessage(FastaMessage message) { |
| 3214 library.addCompileTimeError(message.charOffset, message.message, | 3217 library.addCompileTimeError(message.charOffset, message.message, |
| (...skipping 455 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3670 if (starToken == null) { | 3673 if (starToken == null) { |
| 3671 return AsyncMarker.Async; | 3674 return AsyncMarker.Async; |
| 3672 } else { | 3675 } else { |
| 3673 assert(identical(starToken.stringValue, "*")); | 3676 assert(identical(starToken.stringValue, "*")); |
| 3674 return AsyncMarker.AsyncStar; | 3677 return AsyncMarker.AsyncStar; |
| 3675 } | 3678 } |
| 3676 } else { | 3679 } else { |
| 3677 return internalError("Unknown async modifier: $asyncToken"); | 3680 return internalError("Unknown async modifier: $asyncToken"); |
| 3678 } | 3681 } |
| 3679 } | 3682 } |
| OLD | NEW |