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

Unified Diff: pkg/front_end/lib/src/fasta/operator.dart

Issue 2782843002: Complain about bad operator parameters. (Closed)
Patch Set: Created 3 years, 9 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/operator.dart
diff --git a/pkg/front_end/lib/src/fasta/operator.dart b/pkg/front_end/lib/src/fasta/operator.dart
index 322f1243577b6f868aca83a1ca5bde5b1056f32f..3731d4359cdbabfdb527b4f852b222e03a1ed031 100644
--- a/pkg/front_end/lib/src/fasta/operator.dart
+++ b/pkg/front_end/lib/src/fasta/operator.dart
@@ -99,3 +99,49 @@ String operatorToString(Operator operator) {
}
return null;
}
+
+int operatorRequiredArgumentCount(Operator operator) {
+ switch (operator) {
+ case Operator.add:
karlklose 2017/03/29 10:12:01 Consider combining the cases for operators with th
ahe 2017/03/29 10:55:00 Done.
+ return 1;
+ case Operator.bitwiseAnd:
+ return 1;
+ case Operator.bitwiseNot:
+ return 0;
+ case Operator.bitwiseOr:
+ return 1;
+ case Operator.bitwiseXor:
+ return 1;
+ case Operator.divide:
+ return 1;
+ case Operator.equals:
+ return 1;
+ case Operator.greaterThan:
+ return 1;
+ case Operator.greaterThanEquals:
+ return 1;
+ case Operator.indexGet:
+ return 1;
+ case Operator.indexSet:
+ return 2;
+ case Operator.leftShift:
+ return 1;
+ case Operator.lessThan:
+ return 1;
+ case Operator.lessThanEquals:
+ return 1;
+ case Operator.modulo:
+ return 1;
+ case Operator.multiply:
+ return 1;
+ case Operator.rightShift:
+ return 1;
+ case Operator.subtract:
+ return 1;
+ case Operator.truncatingDivide:
+ return 1;
+ case Operator.unaryMinus:
+ return 0;
+ }
+ return -1;
karlklose 2017/03/29 10:12:01 Should this be an internal error?
ahe 2017/03/29 10:55:00 If feel its sufficient with the warnings you get f
+}

Powered by Google App Engine
This is Rietveld 408576698