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' | 10 import '../parser/parser.dart' |
(...skipping 466 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
477 initializer = | 477 initializer = |
478 buildSuperInitializer(node.target, node.arguments, token.charOffset); | 478 buildSuperInitializer(node.target, node.arguments, token.charOffset); |
479 } else { | 479 } else { |
480 Expression value = toValue(node); | 480 Expression value = toValue(node); |
481 if (node is! Throw) { | 481 if (node is! Throw) { |
482 value = wrapInCompileTimeError(value, "Expected an initializer."); | 482 value = wrapInCompileTimeError(value, "Expected an initializer."); |
483 } | 483 } |
484 initializer = buildInvalidInitializer(node, token.charOffset); | 484 initializer = buildInvalidInitializer(node, token.charOffset); |
485 } | 485 } |
486 _typeInferrer.inferInitializer(initializer); | 486 _typeInferrer.inferInitializer(initializer); |
487 if (member is KernelConstructorBuilder) { | 487 if (member is KernelConstructorBuilder && !member.isExternal) { |
488 member.addInitializer(initializer); | 488 member.addInitializer(initializer); |
489 } else { | 489 } else { |
490 addCompileTimeError( | 490 addCompileTimeError( |
491 token.charOffset, "Can't have initializers: ${member.name}"); | 491 token.charOffset, "Can't have initializers: ${member.name}"); |
492 } | 492 } |
493 } | 493 } |
494 | 494 |
495 DartType _computeReturnTypeContext(MemberBuilder member) { | 495 DartType _computeReturnTypeContext(MemberBuilder member) { |
496 if (member is KernelProcedureBuilder) { | 496 if (member is KernelProcedureBuilder) { |
497 return member.target.function.returnType; | 497 return member.target.function.returnType; |
(...skipping 2975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3473 if (starToken == null) { | 3473 if (starToken == null) { |
3474 return AsyncMarker.Async; | 3474 return AsyncMarker.Async; |
3475 } else { | 3475 } else { |
3476 assert(identical(starToken.stringValue, "*")); | 3476 assert(identical(starToken.stringValue, "*")); |
3477 return AsyncMarker.AsyncStar; | 3477 return AsyncMarker.AsyncStar; |
3478 } | 3478 } |
3479 } else { | 3479 } else { |
3480 return internalError("Unknown async modifier: $asyncToken"); | 3480 return internalError("Unknown async modifier: $asyncToken"); |
3481 } | 3481 } |
3482 } | 3482 } |
OLD | NEW |