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

Unified Diff: pkg/compiler/lib/src/resolution/send_resolver.dart

Issue 1157333003: Compute more SendStructures on ResolverVisitor. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 5 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
Index: pkg/compiler/lib/src/resolution/send_resolver.dart
diff --git a/pkg/compiler/lib/src/resolution/send_resolver.dart b/pkg/compiler/lib/src/resolution/send_resolver.dart
index a706f1c9a391a86261c3f942f8a11bf9cff3ebc4..71c7ce480bb5dfbf50abe4aa6d1aeffaaa8becbb 100644
--- a/pkg/compiler/lib/src/resolution/send_resolver.dart
+++ b/pkg/compiler/lib/src/resolution/send_resolver.dart
@@ -269,33 +269,17 @@ abstract class SendResolverMixin {
if (node.isOperator) {
String operatorText = node.selector.asOperator().source;
if (node.arguments.isEmpty) {
- unaryOperator = UnaryOperator.parse(operatorText);
- if (unaryOperator != null) {
- switch (unaryOperator.kind) {
- case UnaryOperatorKind.NOT:
- kind = SendStructureKind.NOT;
- break;
- default:
- kind = SendStructureKind.UNARY;
- break;
- }
- } else {
- return const InvalidUnaryStructure();
- }
+ return internalError(node, "Unexpected unary $operatorText.");
} else {
binaryOperator = BinaryOperator.parse(operatorText);
if (binaryOperator != null) {
switch (binaryOperator.kind) {
case BinaryOperatorKind.EQ:
kind = SendStructureKind.EQ;
- break;
+ return internalError(node, "Unexpected binary $kind.");
karlklose 2015/05/29 11:12:14 Move 'return internalError' after the switch?
Johnni Winther 2015/05/29 12:47:54 We still need to index in compounds.
case BinaryOperatorKind.NOT_EQ:
- if (node.isSuperCall) {
- // `super != foo` is a compile-time error.
- return const InvalidBinaryStructure();
- }
kind = SendStructureKind.NOT_EQ;
- break;
+ return internalError(node, "Unexpected binary $kind.");
case BinaryOperatorKind.INDEX:
if (node.isPrefix) {
kind = SendStructureKind.INDEX_PREFIX;
@@ -304,6 +288,7 @@ abstract class SendResolverMixin {
} else if (node.arguments.tail.isEmpty) {
// a[b]
kind = SendStructureKind.INDEX;
+ return internalError(node, "Unexpected binary $kind.");
} else {
if (kind == SendStructureKind.COMPOUND) {
// a[b] += c
@@ -316,10 +301,11 @@ abstract class SendResolverMixin {
break;
default:
kind = SendStructureKind.BINARY;
- break;
+ return internalError(node, "Unexpected binary $kind.");
}
} else {
- return const InvalidBinaryStructure();
+ return internalError(
+ node, "Unexpected invalid binary $operatorText.");
}
}
}

Powered by Google App Engine
This is Rietveld 408576698