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

Unified Diff: pkg/compiler/lib/src/inferrer/inferrer_visitor.dart

Issue 1308803002: Make InferrerVisitor implement SemanticSendVisitor directly and delete ResolvedVisitor. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 years, 4 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/compiler/lib/src/inferrer/simple_types_inferrer.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/compiler/lib/src/inferrer/inferrer_visitor.dart
diff --git a/pkg/compiler/lib/src/inferrer/inferrer_visitor.dart b/pkg/compiler/lib/src/inferrer/inferrer_visitor.dart
index 37d29ed976f76b5bee036631a9a6a4f768cdb9a7..ab77d7b8bec4f95d44314233d23993fcc4460d44 100644
--- a/pkg/compiler/lib/src/inferrer/inferrer_visitor.dart
+++ b/pkg/compiler/lib/src/inferrer/inferrer_visitor.dart
@@ -16,7 +16,11 @@ import '../diagnostics/spannable.dart' show
Spannable;
import '../elements/elements.dart';
import '../resolution/operators.dart';
-import '../resolved_visitor.dart';
+import '../resolution/semantic_visitor.dart';
+import '../resolution/send_resolver.dart' show
+ SendResolverMixin;
+import '../resolution/tree_elements.dart' show
+ TreeElements;
import '../tree/tree.dart';
import '../types/types.dart' show
TypeMask;
@@ -683,8 +687,17 @@ class LocalsHandler<T> {
}
}
-abstract class InferrerVisitor
- <T, E extends MinimalInferrerEngine<T>> extends NewResolvedVisitor<T> {
+abstract class InferrerVisitor<T, E extends MinimalInferrerEngine<T>>
+ extends Visitor<T>
+ with SendResolverMixin,
+ SemanticSendResolvedMixin<T, dynamic>,
+ CompoundBulkMixin<T, dynamic>,
+ PrefixBulkMixin<T, dynamic>,
+ PostfixBulkMixin<T, dynamic>,
+ ErrorBulkMixin<T, dynamic>,
+ NewBulkMixin<T, dynamic>,
+ SetBulkMixin<T, dynamic>
+ implements SemanticSendVisitor<T, dynamic> {
final Compiler compiler;
final AstElement analyzedElement;
final TypeSystem<T> types;
@@ -695,6 +708,7 @@ abstract class InferrerVisitor
new Map<JumpTarget, List<LocalsHandler<T>>>();
LocalsHandler<T> locals;
final List<T> cascadeReceiverStack = new List<T>();
+ final TreeElements elements;
bool accumulateIsChecks = false;
bool conditionIsSimple = false;
@@ -720,7 +734,7 @@ abstract class InferrerVisitor
[LocalsHandler<T> handler])
: this.analyzedElement = analyzedElement,
this.locals = handler,
- super(analyzedElement.resolvedAst.elements) {
+ this.elements = analyzedElement.resolvedAst.elements {
if (handler != null) return;
Node node = analyzedElement.node;
FieldInitializationScope<T> fieldScope =
@@ -730,6 +744,12 @@ abstract class InferrerVisitor
locals = new LocalsHandler<T>(inferrer, types, compiler, node, fieldScope);
}
+ @override
+ SemanticSendVisitor get sendVisitor => this;
+
+ @override
+ T apply(Node node, _) => visit(node);
+
T handleSendSet(SendSet node);
T handleDynamicInvoke(Send node);
@@ -743,6 +763,26 @@ abstract class InferrerVisitor
T visitFunctionExpression(FunctionExpression node);
@override
+ T bulkHandleSet(SendSet node, _) {
+ return handleSendSet(node);
+ }
+
+ @override
+ T bulkHandleCompound(SendSet node, _) {
+ return handleSendSet(node);
+ }
+
+ @override
+ T bulkHandlePrefix(SendSet node, _) {
+ return handleSendSet(node);
+ }
+
+ @override
+ T bulkHandlePostfix(SendSet node, _) {
+ return handleSendSet(node);
+ }
+
+ @override
T visitAssert(Send node, Node expression, _) {
if (!compiler.enableUserAssertions) {
return types.nullType;
@@ -821,11 +861,6 @@ abstract class InferrerVisitor
return types.nonNullSubtype(compiler.symbolClass);
}
- T visitTypePrefixSend(Send node) {
- // TODO(johnniwinther): Remove the need for handling this node.
- return types.dynamicType;
- }
-
@override
void previsitDeferredAccess(Send node, PrefixElement prefix, _) {
// Deferred access does not affect inference.
@@ -839,6 +874,30 @@ abstract class InferrerVisitor
return types.dynamicType;
}
+
+ @override
+ T bulkHandleNode(Node node, String message, _) {
+ return internalError(node, message.replaceAll('#', '$node'));
+ }
+
+ @override
Johnni Winther 2015/08/21 10:55:12 These are not used, yet.
+ T visitConstantGet(
+ Send node,
+ ConstantExpression constant,
+ _) {
+ return bulkHandleNode(node, "Constant read `#` unhandled.", _);
+ }
+
+ @override
+ T visitConstantInvoke(
+ Send node,
+ ConstantExpression constant,
+ NodeList arguments,
+ CallStructure callStructure,
+ _) {
+ return bulkHandleNode(node, "Constant invoke `#` unhandled.", _);
+ }
+
T visitClassTypeLiteralGet(
Send node,
ConstantExpression constant,
@@ -928,6 +987,11 @@ abstract class InferrerVisitor
outermostElement.enclosingClass.superclass);
}
+ @override
+ T visitThisGet(Identifier node, _) {
+ return thisType;
+ }
+
T visitIdentifier(Identifier node) {
if (node.isThis()) {
return thisType;
« no previous file with comments | « no previous file | pkg/compiler/lib/src/inferrer/simple_types_inferrer.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698