Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(498)

Side by Side Diff: pkg/front_end/lib/src/fasta/kernel/body_builder.dart

Issue 2905163002: Perform type inference on redirecting initializers (`C() : this(...);`). (Closed)
Patch Set: Created 3 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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' show FormalParameterType, MemberKind, optional; 10 import '../parser/parser.dart' show FormalParameterType, MemberKind, optional;
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
443 initializer = 443 initializer =
444 buildSuperInitializer(node.target, node.arguments, token.charOffset); 444 buildSuperInitializer(node.target, node.arguments, token.charOffset);
445 } else { 445 } else {
446 if (node is! Throw) { 446 if (node is! Throw) {
447 // TODO(ahe): This is probably an internal error. 447 // TODO(ahe): This is probably an internal error.
448 needsImplicitSuperInitializer = false; 448 needsImplicitSuperInitializer = false;
449 node = wrapInvalid(node); 449 node = wrapInvalid(node);
450 } 450 }
451 initializer = buildInvalidIntializer(node, token.charOffset); 451 initializer = buildInvalidIntializer(node, token.charOffset);
452 } 452 }
453 _typeInferrer.inferInitializer(initializer);
453 if (member is KernelConstructorBuilder) { 454 if (member is KernelConstructorBuilder) {
454 member.addInitializer(initializer); 455 member.addInitializer(initializer);
455 } else { 456 } else {
456 addCompileTimeError( 457 addCompileTimeError(
457 token.charOffset, "Can't have initializers: ${member.name}"); 458 token.charOffset, "Can't have initializers: ${member.name}");
458 } 459 }
459 } 460 }
460 461
461 @override 462 @override
462 void handleNoInitializers() { 463 void handleNoInitializers() {
(...skipping 2177 matching lines...) Expand 10 before | Expand all | Expand 10 after
2640 needsImplicitSuperInitializer = false; 2641 needsImplicitSuperInitializer = false;
2641 return new SuperInitializer(constructor, arguments) 2642 return new SuperInitializer(constructor, arguments)
2642 ..fileOffset = charOffset; 2643 ..fileOffset = charOffset;
2643 } 2644 }
2644 2645
2645 @override 2646 @override
2646 Initializer buildRedirectingInitializer( 2647 Initializer buildRedirectingInitializer(
2647 Constructor constructor, Arguments arguments, 2648 Constructor constructor, Arguments arguments,
2648 [int charOffset = -1]) { 2649 [int charOffset = -1]) {
2649 needsImplicitSuperInitializer = false; 2650 needsImplicitSuperInitializer = false;
2650 return new RedirectingInitializer(constructor, arguments) 2651 return new KernelRedirectingInitializer(constructor, arguments)
2651 ..fileOffset = charOffset; 2652 ..fileOffset = charOffset;
2652 } 2653 }
2653 2654
2654 @override 2655 @override
2655 Expression buildProblemExpression(ProblemBuilder builder, int charOffset) { 2656 Expression buildProblemExpression(ProblemBuilder builder, int charOffset) {
2656 return buildCompileTimeError(builder.message, charOffset); 2657 return buildCompileTimeError(builder.message, charOffset);
2657 } 2658 }
2658 2659
2659 @override 2660 @override
2660 void handleOperator(Token token) { 2661 void handleOperator(Token token) {
(...skipping 530 matching lines...) Expand 10 before | Expand all | Expand 10 after
3191 if (starToken == null) { 3192 if (starToken == null) {
3192 return AsyncMarker.Async; 3193 return AsyncMarker.Async;
3193 } else { 3194 } else {
3194 assert(identical(starToken.stringValue, "*")); 3195 assert(identical(starToken.stringValue, "*"));
3195 return AsyncMarker.AsyncStar; 3196 return AsyncMarker.AsyncStar;
3196 } 3197 }
3197 } else { 3198 } else {
3198 return internalError("Unknown async modifier: $asyncToken"); 3199 return internalError("Unknown async modifier: $asyncToken");
3199 } 3200 }
3200 } 3201 }
OLDNEW
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698