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

Unified Diff: tests/compiler/dart2js/semantic_visitor_test.dart

Issue 1004683002: Refactor IrBuilder to use SemanticVisitor. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Handle local/static constants and index prefix/postfix. Created 5 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
« no previous file with comments | « tests/compiler/dart2js/backend_dart/sexpr_test.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tests/compiler/dart2js/semantic_visitor_test.dart
diff --git a/tests/compiler/dart2js/semantic_visitor_test.dart b/tests/compiler/dart2js/semantic_visitor_test.dart
index a9c457e91ddd0a0c1793f75fc962cdf8e1f561fa..fea44dc43decc27f89d6e10bcdd77679029f3cd2 100644
--- a/tests/compiler/dart2js/semantic_visitor_test.dart
+++ b/tests/compiler/dart2js/semantic_visitor_test.dart
@@ -1040,12 +1040,6 @@ const List<Test> TESTS = const [
''',
const Visit(VisitKind.VISIT_BINARY,
left: '2', operator: '^', right: '3')),
- const Test(
- '''
- m() => 2[3];
- ''',
- const Visit(VisitKind.VISIT_INDEX,
- receiver: '2', index: '3')),
const Test.clazz(
'''
class B {
@@ -1059,6 +1053,25 @@ const List<Test> TESTS = const [
element: 'function(B#+)',
operator: '+',
right: '42')),
+ // Index
+ const Test(
+ '''
+ m() => 2[3];
+ ''',
+ const Visit(VisitKind.VISIT_INDEX,
+ receiver: '2', index: '3')),
+ const Test(
+ '''
+ m() => --2[3];
+ ''',
+ const Visit(VisitKind.VISIT_INDEX_PREFIX,
+ receiver: '2', index: '3', operator: '--')),
+ const Test(
+ '''
+ m() => 2[3]++;
+ ''',
+ const Visit(VisitKind.VISIT_INDEX_POSTFIX,
+ receiver: '2', index: '3', operator: '++')),
const Test.clazz(
'''
class B {
@@ -1071,6 +1084,36 @@ const List<Test> TESTS = const [
const Visit(VisitKind.VISIT_SUPER_INDEX,
element: 'function(B#[])',
index: '42')),
+ const Test.clazz(
+ '''
+ class B {
+ operator [](_) => null;
+ operator []=(a, b) {}
+ }
+ class C extends B {
+ m() => ++super[42];
+ }
+ ''',
+ const Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX,
+ getter: 'function(B#[])',
+ setter: 'function(B#[]=)',
+ index: '42',
+ operator: '++')),
+ const Test.clazz(
+ '''
+ class B {
+ operator [](_) => null;
+ operator []=(a, b) {}
+ }
+ class C extends B {
+ m() => super[42]--;
+ }
+ ''',
+ const Visit(VisitKind.VISIT_SUPER_INDEX_POSTFIX,
+ getter: 'function(B#[])',
+ setter: 'function(B#[]=)',
+ index: '42',
+ operator: '--')),
// Equals
const Test(
@@ -3889,6 +3932,89 @@ class SemanticTestVisitor extends SemanticVisitor with SemanticSendVisitor {
arg) {
// TODO: implement errorUnresolvedSuperUnary
}
+
+ @override
+ errorUnresolvedSuperIndex(
+ Send node,
+ Element element,
+ Node index,
+ arg) {
+ // TODO: implement errorUnresolvedSuperIndex
+ }
+
+ @override
+ errorUnresolvedSuperIndexPostfix(
+ Send node,
+ Element function,
+ Node index,
+ IncDecOperator operator,
+ arg) {
+ // TODO: implement errorUnresolvedSuperIndexPostfix
+ }
+
+ @override
+ errorUnresolvedSuperIndexPrefix(
+ Send node,
+ Element function,
+ Node index,
+ IncDecOperator operator,
+ arg) {
+ // TODO: implement errorUnresolvedSuperIndexPrefix
+ }
+
+ @override
+ visitIndexPostfix(
+ Send node,
+ Node receiver,
+ Node index,
+ IncDecOperator operator,
+ arg) {
+ visits.add(new Visit(VisitKind.VISIT_INDEX_POSTFIX,
+ receiver: receiver, index: index, operator: operator));
+ apply(receiver, arg);
+ apply(index, arg);
+ }
+
+ @override
+ visitIndexPrefix(
+ Send node,
+ Node receiver,
+ Node index,
+ IncDecOperator operator,
+ arg) {
+ visits.add(new Visit(VisitKind.VISIT_INDEX_PREFIX,
+ receiver: receiver, index: index, operator: operator));
+ apply(receiver, arg);
+ apply(index, arg);
+ }
+
+ @override
+ visitSuperIndexPostfix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
+ arg) {
+ visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX_POSTFIX,
+ getter: indexFunction, setter: indexSetFunction,
+ index: index, operator: operator));
+ apply(index, arg);
+ }
+
+ @override
+ visitSuperIndexPrefix(
+ Send node,
+ FunctionElement indexFunction,
+ FunctionElement indexSetFunction,
+ Node index,
+ IncDecOperator operator,
+ arg) {
+ visits.add(new Visit(VisitKind.VISIT_SUPER_INDEX_PREFIX,
+ getter: indexFunction, setter: indexSetFunction,
+ index: index, operator: operator));
+ apply(index, arg);
+ }
}
enum VisitKind {
@@ -3988,11 +4114,15 @@ enum VisitKind {
VISIT_INDEX,
VISIT_EQUALS,
VISIT_NOT_EQUALS,
+ VISIT_INDEX_PREFIX,
+ VISIT_INDEX_POSTFIX,
VISIT_SUPER_BINARY,
VISIT_SUPER_INDEX,
VISIT_SUPER_EQUALS,
VISIT_SUPER_NOT_EQUALS,
+ VISIT_SUPER_INDEX_PREFIX,
+ VISIT_SUPER_INDEX_POSTFIX,
VISIT_UNARY,
VISIT_SUPER_UNARY,
« no previous file with comments | « tests/compiler/dart2js/backend_dart/sexpr_test.dart ('k') | tests/language/language_dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698