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

Unified Diff: pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart

Issue 2908453002: Infer the types of initializing formals from the corresponding fields. (Closed)
Patch Set: Created 3 years, 7 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart
index d1ffc333984083d1802b3ab91d374438b48d8738..fc014eb7748add4aaa5d9ba3a62a75c4159ed2bb 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_formal_parameter_builder.dart
@@ -12,9 +12,11 @@ import 'kernel_builder.dart'
FormalParameterBuilder,
KernelLibraryBuilder,
KernelTypeBuilder,
- LibraryBuilder,
MetadataBuilder;
+import 'package:front_end/src/fasta/source/source_library_builder.dart'
+ show SourceLibraryBuilder;
+
class KernelFormalParameterBuilder
extends FormalParameterBuilder<KernelTypeBuilder> {
KernelVariableDeclaration declaration;
@@ -33,9 +35,16 @@ class KernelFormalParameterBuilder
KernelVariableDeclaration get target => declaration;
- KernelVariableDeclaration build(LibraryBuilder library) {
- return declaration ??= new KernelVariableDeclaration(name, 0,
- type: type?.build(library), isFinal: isFinal, isConst: isConst)
- ..fileOffset = charOffset;
+ KernelVariableDeclaration build(SourceLibraryBuilder library) {
+ if (declaration == null) {
+ declaration = new KernelVariableDeclaration(name, 0,
+ type: type?.build(library), isFinal: isFinal, isConst: isConst)
+ ..fileOffset = charOffset;
+ if (type == null && hasThis) {
+ library.loader.typeInferenceEngine
+ .recordInitializingFormal(declaration);
+ }
+ }
+ return declaration;
}
}
« no previous file with comments | « no previous file | pkg/front_end/lib/src/fasta/type_inference/type_inference_engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698