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

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

Issue 2946273002: Implement override-based type inference for instance methods. (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 side-by-side diff with in-line comments
Download patch
Index: pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
diff --git a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
index d3c0fd2b82ac09ce1b2ec329dac03770a3d2d39b..6e35f2bb3faab50a1be03b25d1b652ed71ef01cb 100644
--- a/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
+++ b/pkg/front_end/lib/src/fasta/kernel/kernel_shadow_ast.dart
@@ -1317,6 +1317,9 @@ abstract class KernelMember implements Member {
if (member._accessorNode != null) {
member._accessorNode.overrides.add(overriddenMember);
}
+ if (member is KernelProcedure && member._methodNode != null) {
+ member._methodNode.overrides.add(overriddenMember);
+ }
}
}
@@ -1475,10 +1478,15 @@ class KernelProcedure extends Procedure implements KernelMember {
@override
AccessorNode _accessorNode;
+ MethodNode _methodNode;
+
@override
KernelTypeInferrer _typeInferrer;
+ final bool _hasImplicitReturnType;
+
KernelProcedure(Name name, ProcedureKind kind, FunctionNode function,
+ this._hasImplicitReturnType,
{String fileUri})
: super(name, kind, function, fileUri: fileUri);
@@ -1501,6 +1509,15 @@ class KernelProcedure extends Procedure implements KernelMember {
'setInferredType called on a procedure that is not an accessor');
}
}
+
+ static MethodNode getMethodNode(Procedure procedure) {
+ if (procedure is KernelProcedure) return procedure._methodNode;
+ return null;
+ }
+
+ static bool hasImplicitReturnType(KernelProcedure procedure) {
+ return procedure._hasImplicitReturnType;
+ }
}
/// Concrete shadow object representing an assignment to a property.
@@ -1938,6 +1955,13 @@ class KernelTypeInferenceEngine extends TypeInferenceEngineImpl {
this, uri.toString(), listener, false, thisType, null);
}
+ @override
+ MethodNode createMethodNode(KernelProcedure procedure) {
+ MethodNode methodNode = new MethodNode(procedure);
+ procedure._methodNode = methodNode;
+ return methodNode;
+ }
+
@override
KernelTypeInferrer createTopLevelTypeInferrer(TypeInferenceListener listener,
InterfaceType thisType, KernelMember member) {

Powered by Google App Engine
This is Rietveld 408576698