| 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 cdacd2c0781fc48a0776af853d350a5d64c64216..7dadd03ff5b84892553c8880cd87edb05a054969 100644
|
| --- a/tests/compiler/dart2js/semantic_visitor_test.dart
|
| +++ b/tests/compiler/dart2js/semantic_visitor_test.dart
|
| @@ -2251,6 +2251,824 @@ const Map<String, List<Test>> SEND_TESTS = const {
|
| ],
|
| };
|
|
|
| +const Map<String, List<Test>> DECL_TESTS = const {
|
| + 'Function declarations': const [
|
| + const Test(
|
| + '''
|
| + m(a, b) {}
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '(a,b)',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#b)',
|
| + index: 1),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m(a, [b]) {}
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '(a,[b])',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,
|
| + element: 'parameter(m#b)',
|
| + index: 1),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m(a, [b = null]) {}
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '(a,[b=null])',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,
|
| + element: 'parameter(m#b)',
|
| + constant: 'null',
|
| + index: 1),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m(a, [b = 42]) {}
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '(a,[b=42])',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,
|
| + element: 'parameter(m#b)',
|
| + constant: 42,
|
| + index: 1),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m(a, {b}) {}
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '(a,{b})',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,
|
| + element: 'parameter(m#b)'),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m(a, {b: null}) {}
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '(a,{b: null})',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,
|
| + element: 'parameter(m#b)',
|
| + constant: 'null'),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m(a, {b:42}) {}
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '(a,{b: 42})',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,
|
| + element: 'parameter(m#b)',
|
| + constant: 42),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + get m => null;
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_DECL,
|
| + element: 'getter(m)',
|
| + body: '=>null;'),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + set m(a) {}
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_DECL,
|
| + element: 'setter(m)',
|
| + parameters: '(a)',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + static m(a, b) {}
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_STATIC_FUNCTION_DECL,
|
| + element: 'function(C#m)',
|
| + parameters: '(a,b)',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#b)',
|
| + index: 1),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + static get m => null;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_STATIC_GETTER_DECL,
|
| + element: 'getter(C#m)',
|
| + body: '=>null;'),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + static set m(a) {}
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_STATIC_SETTER_DECL,
|
| + element: 'setter(C#m)',
|
| + parameters: '(a)',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + m(a, b) {}
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_INSTANCE_METHOD_DECL,
|
| + element: 'function(C#m)',
|
| + parameters: '(a,b)',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#b)',
|
| + index: 1),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + get m => null;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_INSTANCE_GETTER_DECL,
|
| + element: 'getter(C#m)',
|
| + body: '=>null;'),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + set m(a) {}
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_INSTANCE_SETTER_DECL,
|
| + element: 'setter(C#m)',
|
| + parameters: '(a)',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + abstract class C {
|
| + m(a, b);
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_ABSTRACT_METHOD_DECL,
|
| + element: 'function(C#m)',
|
| + parameters: '(a,b)'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#b)',
|
| + index: 1),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + abstract class C {
|
| + get m;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_ABSTRACT_GETTER_DECL,
|
| + element: 'getter(C#m)'),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + abstract class C {
|
| + set m(a);
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_ABSTRACT_SETTER_DECL,
|
| + element: 'setter(C#m)',
|
| + parameters: '(a)'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m(a, b) {}
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '(a,b)',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(m#b)',
|
| + index: 1),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m() {
|
| + local(a, b) {}
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '()',
|
| + body: '{local(a,b){}}'),
|
| + const Visit(VisitKind.VISIT_LOCAL_FUNCTION_DECL,
|
| + element: 'function(m#local)',
|
| + parameters: '(a,b)',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(local#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(local#b)',
|
| + index: 1),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m() => (a, b) {};
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '()',
|
| + body: '=>(a,b){};'),
|
| + const Visit(VisitKind.VISIT_CLOSURE_DECL,
|
| + element: 'function(m#)',
|
| + parameters: '(a,b)',
|
| + body: '{}'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#b)',
|
| + index: 1),
|
| + ]),
|
| + ],
|
| + 'Constructor declarations': const [
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + C(a, b);
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,
|
| + element: 'generative_constructor(C#)',
|
| + parameters: '(a,b)',
|
| + body: ';'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#b)',
|
| + index: 1),
|
| + ],
|
| + method: ''),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + var b;
|
| + C(a, this.b);
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,
|
| + element: 'generative_constructor(C#)',
|
| + parameters: '(a,this.b)',
|
| + body: ';'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_INITIALIZING_FORMAL_DECL,
|
| + element: 'initializing_formal(#b)',
|
| + index: 1),
|
| + ],
|
| + method: ''),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + var b;
|
| + C(a, [this.b = 42]);
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,
|
| + element: 'generative_constructor(C#)',
|
| + parameters: '(a,[this.b=42])',
|
| + body: ';'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL,
|
| + element: 'initializing_formal(#b)',
|
| + constant: 42,
|
| + index: 1),
|
| + ],
|
| + method: ''),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + var b;
|
| + C(a, {this.b: 42});
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,
|
| + element: 'generative_constructor(C#)',
|
| + parameters: '(a,{this.b: 42})',
|
| + body: ';'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_NAMED_INITIALIZING_FORMAL_DECL,
|
| + element: 'initializing_formal(#b)',
|
| + constant: 42),
|
| + ],
|
| + method: ''),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + C(a, b) : super();
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,
|
| + element: 'generative_constructor(C#)',
|
| + parameters: '(a,b)',
|
| + body: ';'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#b)',
|
| + index: 1),
|
| + const Visit(VisitKind.VISIT_SUPER_CONSTRUCTOR_INVOKE,
|
| + element: 'generative_constructor(Object#)',
|
| + type: 'Object',
|
| + arguments: '()',
|
| + selector: 'Selector(call, super, arity=0)'),
|
| + ],
|
| + method: ''),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + var field;
|
| + C(a, b) : this.field = a;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,
|
| + element: 'generative_constructor(C#)',
|
| + parameters: '(a,b)',
|
| + body: ';'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#b)',
|
| + index: 1),
|
| + const Visit(VisitKind.VISIT_FIELD_INITIALIZER,
|
| + element: 'field(C#field)',
|
| + rhs: 'a'),
|
| + ],
|
| + method: ''),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + C(a, b) : this._(a, b);
|
| + C._(a, b);
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_DECL,
|
| + element: 'generative_constructor(C#)',
|
| + parameters: '(a,b)',
|
| + initializers: ':this._(a,b)'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#b)',
|
| + index: 1),
|
| + const Visit(VisitKind.VISIT_THIS_CONSTRUCTOR_INVOKE,
|
| + element: 'generative_constructor(C#_)',
|
| + arguments: '(a,b)',
|
| + selector: 'Selector(call, _, arity=2)'),
|
| + ],
|
| + method: ''),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + factory C(a, b) => null;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_DECL,
|
| + element: 'function(C#)',
|
| + parameters: '(a,b)',
|
| + body: '=>null;'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#b)',
|
| + index: 1),
|
| + ],
|
| + method: ''),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + factory C(a, b) = C._;
|
| + C._(a, b);
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,
|
| + element: 'function(C#)',
|
| + parameters: '(a,b)',
|
| + target: 'generative_constructor(C#_)',
|
| + type: 'C'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#b)',
|
| + index: 1),
|
| + ],
|
| + method: ''),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + factory C(a, b) = D;
|
| + }
|
| + class D<T> {
|
| + D(a, b);
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,
|
| + element: 'function(C#)',
|
| + parameters: '(a,b)',
|
| + target: 'generative_constructor(D#)',
|
| + type: 'D'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#b)',
|
| + index: 1),
|
| + ],
|
| + method: ''),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + factory C(a, b) = D<int>;
|
| + }
|
| + class D<T> {
|
| + D(a, b);
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,
|
| + element: 'function(C#)',
|
| + parameters: '(a,b)',
|
| + target: 'generative_constructor(D#)',
|
| + type: 'D<int>'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#b)',
|
| + index: 1),
|
| + ],
|
| + method: ''),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + factory C(a, b) = D<int>;
|
| + }
|
| + class D<T> {
|
| + factory D(a, b) = E<D<T>>;
|
| + }
|
| + class E<S> {
|
| + E(a, b);
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,
|
| + element: 'function(C#)',
|
| + parameters: '(a,b)',
|
| + target: 'function(D#)',
|
| + type: 'D<int>'),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#a)',
|
| + index: 0),
|
| + const Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: 'parameter(#b)',
|
| + index: 1),
|
| + ],
|
| + method: ''),
|
| + ],
|
| + "Field declarations": const [
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + var m;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,
|
| + element: 'field(C#m)'),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + var m, n;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,
|
| + element: 'field(C#m)'),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + var m = 42;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,
|
| + element: 'field(C#m)',
|
| + rhs: 42),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m() {
|
| + var local;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '()',
|
| + body: '{var local;}'),
|
| + const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,
|
| + element: 'variable(m#local)'),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m() {
|
| + var local = 42;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '()',
|
| + body: '{var local=42;}'),
|
| + const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,
|
| + element: 'variable(m#local)',
|
| + rhs: 42),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m() {
|
| + const local = 42;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '()',
|
| + body: '{const local=42;}'),
|
| + const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,
|
| + element: 'variable(m#local)',
|
| + constant: 42),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m() {
|
| + var local1, local2;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '()',
|
| + body: '{var local1,local2;}'),
|
| + const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,
|
| + element: 'variable(m#local1)'),
|
| + const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,
|
| + element: 'variable(m#local2)'),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m() {
|
| + var local1 = 42, local2 = true;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '()',
|
| + body: '{var local1=42,local2=true;}'),
|
| + const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,
|
| + element: 'variable(m#local1)',
|
| + rhs: 42),
|
| + const Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,
|
| + element: 'variable(m#local2)',
|
| + rhs: true),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + m() {
|
| + const local1 = 42, local2 = true;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: 'function(m)',
|
| + parameters: '()',
|
| + body: '{const local1=42,local2=true;}'),
|
| + const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,
|
| + element: 'variable(m#local1)',
|
| + constant: 42),
|
| + const Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,
|
| + element: 'variable(m#local2)',
|
| + constant: true),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + static var m;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,
|
| + element: 'field(C#m)'),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + static var m, n;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,
|
| + element: 'field(C#m)'),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + static var k, l, m, n;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,
|
| + element: 'field(C#m)'),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + static var m = 42;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,
|
| + element: 'field(C#m)',
|
| + rhs: 42),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + static var m = 42, n = true;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_STATIC_FIELD_DECL,
|
| + element: 'field(C#m)',
|
| + rhs: 42),
|
| + ]),
|
| + const Test.clazz(
|
| + '''
|
| + class C {
|
| + static const m = 42;
|
| + }
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_STATIC_CONSTANT_DECL,
|
| + element: 'field(C#m)',
|
| + constant: 42),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + var m;
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,
|
| + element: 'field(m)'),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + var m, n;
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,
|
| + element: 'field(m)'),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + var m = 42;
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,
|
| + element: 'field(m)',
|
| + rhs: 42),
|
| + ]),
|
| + const Test(
|
| + '''
|
| + const m = 42;
|
| + ''',
|
| + const [
|
| + const Visit(VisitKind.VISIT_TOP_LEVEL_CONSTANT_DECL,
|
| + element: 'field(m)',
|
| + constant: 42),
|
| + ]),
|
| + ],
|
| +};
|
| +
|
| main(List<String> arguments) {
|
| asyncTest(() => Future.forEach([
|
| () {
|
| @@ -2259,6 +3077,12 @@ main(List<String> arguments) {
|
| SEND_TESTS,
|
| (elements) => new SemanticSendTestVisitor(elements));
|
| },
|
| + () {
|
| + return test(
|
| + arguments,
|
| + DECL_TESTS,
|
| + (elements) => new SemanticDeclTestVisitor(elements));
|
| + },
|
| ], (f) => f()));
|
| }
|
|
|
| @@ -2301,7 +3125,7 @@ Future test(List<String> arguments,
|
| if (expectedVisits is! List) {
|
| expectedVisits = [expectedVisits];
|
| }
|
| - AstElement element;
|
| + Element element;
|
| String cls = test.cls;
|
| String method = test.method;
|
| if (cls == null) {
|
| @@ -2313,22 +3137,35 @@ Future test(List<String> arguments,
|
| "${library.compilationUnit.script.text}");
|
| element = classElement.localLookup(method);
|
| }
|
| - Expect.isNotNull(element, "Element '$method' not found in:\n"
|
| - "${library.compilationUnit.script.text}");
|
| - ResolvedAst resolvedAst = element.resolvedAst;
|
| - SemanticTestVisitor visitor = createVisitor(resolvedAst.elements);
|
| - try {
|
| - compiler.withCurrentElement(resolvedAst.element, () {
|
| - //print(resolvedAst.node.toDebugString());
|
| - resolvedAst.node.accept(visitor);
|
| - });
|
| - } catch (e, s) {
|
| - Expect.fail("$e:\n$s\nIn test:\n"
|
| - "${library.compilationUnit.script.text}");
|
| +
|
| + void testAstElement(AstElement astElement) {
|
| + Expect.isNotNull(astElement, "Element '$method' not found in:\n"
|
| + "${library.compilationUnit.script.text}");
|
| + ResolvedAst resolvedAst = astElement.resolvedAst;
|
| + SemanticTestVisitor visitor = createVisitor(resolvedAst.elements);
|
| + try {
|
| + compiler.withCurrentElement(resolvedAst.element, () {
|
| + //print(resolvedAst.node.toDebugString());
|
| + resolvedAst.node.accept(visitor);
|
| + });
|
| + } catch (e, s) {
|
| + Expect.fail("$e:\n$s\nIn test:\n"
|
| + "${library.compilationUnit.script.text}");
|
| + }
|
| + Expect.listEquals(expectedVisits, visitor.visits,
|
| + "In test:\n"
|
| + "${library.compilationUnit.script.text}");
|
| + }
|
| + if (element.isAbstractField) {
|
| + AbstractFieldElement abstractFieldElement = element;
|
| + if (abstractFieldElement.getter != null) {
|
| + testAstElement(abstractFieldElement.getter);
|
| + } else if (abstractFieldElement.setter != null) {
|
| + testAstElement(abstractFieldElement.setter);
|
| + }
|
| + } else {
|
| + testAstElement(element);
|
| }
|
| - Expect.listEquals(expectedVisits, visitor.visits,
|
| - "In test:\n"
|
| - "${library.compilationUnit.script.text}");
|
| });
|
| });
|
| }
|
| @@ -4426,6 +5263,484 @@ class SemanticSendTestVisitor extends SemanticTestVisitor {
|
| }
|
| }
|
|
|
| +class SemanticDeclTestVisitor extends SemanticTestVisitor {
|
| +
|
| + SemanticDeclTestVisitor(TreeElements elements) : super(elements);
|
| +
|
| + @override
|
| + errorUnresolvedSuperConstructorInvoke(
|
| + Send node,
|
| + Element element,
|
| + NodeList arguments,
|
| + Selector selector,
|
| + arg) {
|
| + // TODO: implement errorUnresolvedSuperConstructorInvoke
|
| + }
|
| +
|
| + @override
|
| + errorUnresolvedThisConstructorInvoke(
|
| + Send node,
|
| + Element element,
|
| + NodeList arguments,
|
| + Selector selector,
|
| + arg) {
|
| + // TODO: implement errorUnresolvedThisConstructorInvoke
|
| + }
|
| +
|
| + @override
|
| + visitAbstractMethodDecl(
|
| + FunctionExpression node,
|
| + MethodElement method,
|
| + NodeList parameters,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_ABSTRACT_METHOD_DECL,
|
| + element: method, parameters: parameters));
|
| + applyParameters(parameters, arg);
|
| + }
|
| +
|
| + @override
|
| + visitClosureDecl(
|
| + FunctionExpression node,
|
| + LocalFunctionElement function,
|
| + NodeList parameters,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_CLOSURE_DECL,
|
| + element: function, parameters: parameters, body: body));
|
| + applyParameters(parameters, arg);
|
| + apply(body, arg);
|
| + }
|
| +
|
| + @override
|
| + visitFactoryConstructorDecl(
|
| + FunctionExpression node,
|
| + ConstructorElement constructor,
|
| + NodeList parameters,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_FACTORY_CONSTRUCTOR_DECL,
|
| + element: constructor, parameters: parameters, body: body));
|
| + applyParameters(parameters, arg);
|
| + apply(body, arg);
|
| + }
|
| +
|
| + @override
|
| + visitFieldInitializer(
|
| + SendSet node,
|
| + FieldElement field,
|
| + Node initializer,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_FIELD_INITIALIZER,
|
| + element: field, rhs: initializer));
|
| + apply(initializer, arg);
|
| + }
|
| +
|
| + @override
|
| + visitGenerativeConstructorDecl(
|
| + FunctionExpression node,
|
| + ConstructorElement constructor,
|
| + NodeList parameters,
|
| + NodeList initializers,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_GENERATIVE_CONSTRUCTOR_DECL,
|
| + element: constructor, parameters: parameters, body: body));
|
| + applyParameters(parameters, arg);
|
| + applyInitializers(initializers, arg);
|
| + apply(body, arg);
|
| + }
|
| +
|
| + @override
|
| + visitInstanceMethodDecl(
|
| + FunctionExpression node,
|
| + MethodElement method,
|
| + NodeList parameters,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_INSTANCE_METHOD_DECL,
|
| + element: method, parameters: parameters, body: body));
|
| + applyParameters(parameters, arg);
|
| + apply(body, arg);
|
| + }
|
| +
|
| + @override
|
| + visitLocalFunctionDecl(
|
| + FunctionExpression node,
|
| + LocalFunctionElement function,
|
| + NodeList parameters,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_LOCAL_FUNCTION_DECL,
|
| + element: function, parameters: parameters, body: body));
|
| + applyParameters(parameters, arg);
|
| + apply(body, arg);
|
| + }
|
| +
|
| + @override
|
| + visitRedirectingFactoryConstructorDecl(
|
| + FunctionExpression node,
|
| + ConstructorElement constructor,
|
| + NodeList parameters,
|
| + InterfaceType redirectionType,
|
| + ConstructorElement redirectionTarget,
|
| + arg) {
|
| + visits.add(new Visit(
|
| + VisitKind.VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,
|
| + element: constructor,
|
| + parameters: parameters,
|
| + target: redirectionTarget,
|
| + type: redirectionType));
|
| + applyParameters(parameters, arg);
|
| + }
|
| +
|
| + @override
|
| + visitRedirectingGenerativeConstructorDecl(
|
| + FunctionExpression node,
|
| + ConstructorElement constructor,
|
| + NodeList parameters,
|
| + NodeList initializers,
|
| + arg) {
|
| + visits.add(new Visit(
|
| + VisitKind.VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_DECL,
|
| + element: constructor,
|
| + parameters: parameters,
|
| + initializers: initializers));
|
| + applyParameters(parameters, arg);
|
| + applyInitializers(initializers, arg);
|
| + }
|
| +
|
| + @override
|
| + visitStaticFunctionDecl(
|
| + FunctionExpression node,
|
| + MethodElement function,
|
| + NodeList parameters,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_STATIC_FUNCTION_DECL,
|
| + element: function, parameters: parameters, body: body));
|
| + applyParameters(parameters, arg);
|
| + apply(body, arg);
|
| + }
|
| +
|
| + @override
|
| + visitSuperConstructorInvoke(
|
| + Send node,
|
| + ConstructorElement superConstructor,
|
| + InterfaceType type,
|
| + NodeList arguments,
|
| + Selector selector,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_SUPER_CONSTRUCTOR_INVOKE,
|
| + element: superConstructor, type: type,
|
| + arguments: arguments, selector: selector));
|
| + apply(arguments, arg);
|
| + }
|
| +
|
| + @override
|
| + visitThisConstructorInvoke(
|
| + Send node,
|
| + ConstructorElement thisConstructor,
|
| + NodeList arguments,
|
| + Selector selector,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_THIS_CONSTRUCTOR_INVOKE,
|
| + element: thisConstructor, arguments: arguments, selector: selector));
|
| + apply(arguments, arg);
|
| + }
|
| +
|
| + @override
|
| + visitTopLevelFunctionDecl(
|
| + FunctionExpression node,
|
| + MethodElement function,
|
| + NodeList parameters,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FUNCTION_DECL,
|
| + element: function, parameters: parameters, body: body));
|
| + applyParameters(parameters, arg);
|
| + apply(body, arg);
|
| + }
|
| +
|
| + @override
|
| + errorUnresolvedFieldInitializer(
|
| + SendSet node,
|
| + Element element,
|
| + Node initializer,
|
| + arg) {
|
| + // TODO: implement errorUnresolvedFieldInitializer
|
| + }
|
| +
|
| + @override
|
| + visitOptionalParameterDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + ParameterElement parameter,
|
| + ConstantExpression defaultValue,
|
| + int index,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_OPTIONAL_PARAMETER_DECL,
|
| + element: parameter,
|
| + constant: defaultValue != null ? defaultValue.getText() : null,
|
| + index: index));
|
| + }
|
| +
|
| + @override
|
| + visitParameterDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + ParameterElement parameter,
|
| + int index,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_REQUIRED_PARAMETER_DECL,
|
| + element: parameter, index: index));
|
| + }
|
| +
|
| + @override
|
| + visitInitializingFormalDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + InitializingFormalElement initializingFormal,
|
| + int index,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_REQUIRED_INITIALIZING_FORMAL_DECL,
|
| + element: initializingFormal, index: index));
|
| + }
|
| +
|
| + @override
|
| + visitLocalVariableDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + LocalVariableElement variable,
|
| + Node initializer,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_LOCAL_VARIABLE_DECL,
|
| + element: variable, rhs: initializer));
|
| + if (initializer != null) {
|
| + apply(initializer, arg);
|
| + }
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitLocalConstantDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + LocalVariableElement variable,
|
| + ConstantExpression constant,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_LOCAL_CONSTANT_DECL,
|
| + element: variable, constant: constant.getText()));
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitNamedInitializingFormalDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + InitializingFormalElement initializingFormal,
|
| + ConstantExpression defaultValue,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_NAMED_INITIALIZING_FORMAL_DECL,
|
| + element: initializingFormal,
|
| + constant: defaultValue != null ? defaultValue.getText() : null));
|
| + }
|
| +
|
| + @override
|
| + visitNamedParameterDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + ParameterElement parameter,
|
| + ConstantExpression defaultValue,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_NAMED_PARAMETER_DECL,
|
| + element: parameter,
|
| + constant: defaultValue != null ? defaultValue.getText() : null));
|
| + }
|
| +
|
| + @override
|
| + visitOptionalInitializingFormalDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + InitializingFormalElement initializingFormal,
|
| + ConstantExpression defaultValue,
|
| + int index,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL,
|
| + element: initializingFormal,
|
| + constant: defaultValue != null ? defaultValue.getText() : null,
|
| + index: index));
|
| + }
|
| +
|
| + @override
|
| + visitInstanceFieldDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + FieldElement field,
|
| + Node initializer,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_INSTANCE_FIELD_DECL,
|
| + element: field, rhs: initializer));
|
| + if (initializer != null) {
|
| + apply(initializer, arg);
|
| + }
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitStaticConstantDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + FieldElement field,
|
| + ConstantExpression constant,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_STATIC_CONSTANT_DECL,
|
| + element: field, constant: constant.getText()));
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitStaticFieldDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + FieldElement field,
|
| + Node initializer,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_STATIC_FIELD_DECL,
|
| + element: field, rhs: initializer));
|
| + if (initializer != null) {
|
| + apply(initializer, arg);
|
| + }
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitTopLevelConstantDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + FieldElement field,
|
| + ConstantExpression constant,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_CONSTANT_DECL,
|
| + element: field, constant: constant.getText()));
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitTopLevelFieldDecl(
|
| + VariableDefinitions node,
|
| + Node definition,
|
| + FieldElement field,
|
| + Node initializer,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_FIELD_DECL,
|
| + element: field, rhs: initializer));
|
| + if (initializer != null) {
|
| + apply(initializer, arg);
|
| + }
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitAbstractGetterDecl(
|
| + FunctionExpression node,
|
| + MethodElement getter,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_ABSTRACT_GETTER_DECL,
|
| + element: getter));
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitAbstractSetterDecl(
|
| + FunctionExpression node,
|
| + MethodElement setter,
|
| + NodeList parameters,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_ABSTRACT_SETTER_DECL,
|
| + element: setter, parameters: parameters));
|
| + applyParameters(parameters, arg);
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitInstanceGetterDecl(
|
| + FunctionExpression node,
|
| + MethodElement getter,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_INSTANCE_GETTER_DECL,
|
| + element: getter, body: body));
|
| + apply(body, arg);
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitInstanceSetterDecl(
|
| + FunctionExpression node,
|
| + MethodElement setter,
|
| + NodeList parameters,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_INSTANCE_SETTER_DECL,
|
| + element: setter, parameters: parameters, body: body));
|
| + applyParameters(parameters, arg);
|
| + apply(body, arg);
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitTopLevelGetterDecl(
|
| + FunctionExpression node,
|
| + MethodElement getter,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_GETTER_DECL,
|
| + element: getter, body: body));
|
| + apply(body, arg);
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitTopLevelSetterDecl(
|
| + FunctionExpression node,
|
| + MethodElement setter,
|
| + NodeList parameters,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_TOP_LEVEL_SETTER_DECL,
|
| + element: setter, parameters: parameters, body: body));
|
| + applyParameters(parameters, arg);
|
| + apply(body, arg);
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitStaticGetterDecl(
|
| + FunctionExpression node,
|
| + MethodElement getter,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_STATIC_GETTER_DECL,
|
| + element: getter, body: body));
|
| + apply(body, arg);
|
| + return null;
|
| + }
|
| +
|
| + @override
|
| + visitStaticSetterDecl(
|
| + FunctionExpression node,
|
| + MethodElement setter,
|
| + NodeList parameters,
|
| + Node body,
|
| + arg) {
|
| + visits.add(new Visit(VisitKind.VISIT_STATIC_SETTER_DECL,
|
| + element: setter, parameters: parameters, body: body));
|
| + applyParameters(parameters, arg);
|
| + apply(body, arg);
|
| + return null;
|
| + }
|
| +}
|
| +
|
| enum VisitKind {
|
| VISIT_PARAMETER_GET,
|
| VISIT_PARAMETER_SET,
|
| @@ -4440,9 +5755,13 @@ enum VisitKind {
|
| VISIT_LOCAL_VARIABLE_COMPOUND,
|
| VISIT_LOCAL_VARIABLE_PREFIX,
|
| VISIT_LOCAL_VARIABLE_POSTFIX,
|
| + VISIT_LOCAL_VARIABLE_DECL,
|
| + VISIT_LOCAL_CONSTANT_DECL,
|
|
|
| VISIT_LOCAL_FUNCTION_GET,
|
| VISIT_LOCAL_FUNCTION_INVOKE,
|
| + VISIT_LOCAL_FUNCTION_DECL,
|
| + VISIT_CLOSURE_DECL,
|
|
|
| VISIT_STATIC_FIELD_GET,
|
| VISIT_STATIC_FIELD_SET,
|
| @@ -4450,6 +5769,8 @@ enum VisitKind {
|
| VISIT_STATIC_FIELD_COMPOUND,
|
| VISIT_STATIC_FIELD_PREFIX,
|
| VISIT_STATIC_FIELD_POSTFIX,
|
| + VISIT_STATIC_FIELD_DECL,
|
| + VISIT_STATIC_CONSTANT_DECL,
|
|
|
| VISIT_STATIC_GETTER_GET,
|
| VISIT_STATIC_SETTER_SET,
|
| @@ -4458,9 +5779,12 @@ enum VisitKind {
|
| VISIT_STATIC_METHOD_SETTER_COMPOUND,
|
| VISIT_STATIC_GETTER_SETTER_PREFIX,
|
| VISIT_STATIC_GETTER_SETTER_POSTFIX,
|
| + VISIT_STATIC_GETTER_DECL,
|
| + VISIT_STATIC_SETTER_DECL,
|
|
|
| VISIT_STATIC_FUNCTION_GET,
|
| VISIT_STATIC_FUNCTION_INVOKE,
|
| + VISIT_STATIC_FUNCTION_DECL,
|
|
|
| VISIT_TOP_LEVEL_FIELD_GET,
|
| VISIT_TOP_LEVEL_FIELD_SET,
|
| @@ -4468,6 +5792,8 @@ enum VisitKind {
|
| VISIT_TOP_LEVEL_FIELD_COMPOUND,
|
| VISIT_TOP_LEVEL_FIELD_PREFIX,
|
| VISIT_TOP_LEVEL_FIELD_POSTFIX,
|
| + VISIT_TOP_LEVEL_FIELD_DECL,
|
| + VISIT_TOP_LEVEL_CONSTANT_DECL,
|
|
|
| VISIT_TOP_LEVEL_GETTER_GET,
|
| VISIT_TOP_LEVEL_SETTER_SET,
|
| @@ -4475,9 +5801,12 @@ enum VisitKind {
|
| VISIT_TOP_LEVEL_GETTER_SETTER_COMPOUND,
|
| VISIT_TOP_LEVEL_GETTER_SETTER_PREFIX,
|
| VISIT_TOP_LEVEL_GETTER_SETTER_POSTFIX,
|
| + VISIT_TOP_LEVEL_GETTER_DECL,
|
| + VISIT_TOP_LEVEL_SETTER_DECL,
|
|
|
| VISIT_TOP_LEVEL_FUNCTION_GET,
|
| VISIT_TOP_LEVEL_FUNCTION_INVOKE,
|
| + VISIT_TOP_LEVEL_FUNCTION_DECL,
|
|
|
| VISIT_DYNAMIC_PROPERTY_GET,
|
| VISIT_DYNAMIC_PROPERTY_SET,
|
| @@ -4589,10 +5918,34 @@ enum VisitKind {
|
| VISIT_FACTORY_CONSTRUCTOR_INVOKE,
|
| VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,
|
|
|
| + VISIT_SUPER_CONSTRUCTOR_INVOKE,
|
| + VISIT_THIS_CONSTRUCTOR_INVOKE,
|
| + VISIT_FIELD_INITIALIZER,
|
| +
|
| ERROR_UNRESOLVED_CLASS_CONSTRUCTOR_INVOKE,
|
| ERROR_UNRESOLVED_CONSTRUCTOR_INVOKE,
|
| ERROR_ABSTRACT_CLASS_CONSTRUCTOR_INVOKE,
|
| ERROR_UNRESOLVED_REDIRECTING_FACTORY_CONSTRUCTOR_INVOKE,
|
|
|
| + VISIT_INSTANCE_GETTER_DECL,
|
| + VISIT_INSTANCE_SETTER_DECL,
|
| + VISIT_INSTANCE_METHOD_DECL,
|
| + VISIT_ABSTRACT_GETTER_DECL,
|
| + VISIT_ABSTRACT_SETTER_DECL,
|
| + VISIT_ABSTRACT_METHOD_DECL,
|
| + VISIT_INSTANCE_FIELD_DECL,
|
| +
|
| + VISIT_GENERATIVE_CONSTRUCTOR_DECL,
|
| + VISIT_REDIRECTING_GENERATIVE_CONSTRUCTOR_DECL,
|
| + VISIT_FACTORY_CONSTRUCTOR_DECL,
|
| + VISIT_REDIRECTING_FACTORY_CONSTRUCTOR_DECL,
|
| +
|
| + VISIT_REQUIRED_PARAMETER_DECL,
|
| + VISIT_OPTIONAL_PARAMETER_DECL,
|
| + VISIT_NAMED_PARAMETER_DECL,
|
| + VISIT_REQUIRED_INITIALIZING_FORMAL_DECL,
|
| + VISIT_OPTIONAL_INITIALIZING_FORMAL_DECL,
|
| + VISIT_NAMED_INITIALIZING_FORMAL_DECL,
|
| +
|
| // TODO(johnniwinther): Add tests for error cases.
|
| }
|
|
|