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

Side by Side Diff: dart/tests/language/super_getter_setter_test.dart

Issue 14066019: Change memberName and namedArguments in Invocation to use Symbol. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 import 'dart:mirrors';
6
5 import "package:expect/expect.dart"; 7 import "package:expect/expect.dart";
6 8
7 class A { 9 class A {
8 var missingSetterField; 10 var missingSetterField;
9 var missingGetterField; 11 var missingGetterField;
10 var getterInSuperClassField; 12 var getterInSuperClassField;
11 var setterInSuperClassField; 13 var setterInSuperClassField;
12 var getterSetterField; 14 var getterSetterField;
13 var missingAllField; 15 var missingAllField;
14 var indexField = new List(2); 16 var indexField = new List(2);
15 17
16 set setterInSuperClass(a) { setterInSuperClassField = a; } 18 set setterInSuperClass(a) { setterInSuperClassField = a; }
17 get getterInSuperClass => getterInSuperClassField; 19 get getterInSuperClass => getterInSuperClassField;
18 } 20 }
19 21
20 class B extends A { 22 class B extends A {
21 get missingSetter => missingSetterField; 23 get missingSetter => missingSetterField;
22 get setterInSuperClass => setterInSuperClassField; 24 get setterInSuperClass => setterInSuperClassField;
23 25
24 set missingGetter(a) { missingGetterField = a; } 26 set missingGetter(a) { missingGetterField = a; }
25 set getterInSuperClass(a) { getterInSuperClassField = a; } 27 set getterInSuperClass(a) { getterInSuperClassField = a; }
26 28
27 get getterSetter => getterSetterField; 29 get getterSetter => getterSetterField;
28 set getterSetter(a) { getterSetterField = a; } 30 set getterSetter(a) { getterSetterField = a; }
29 31
30 operator[](index) => indexField[index]; 32 operator[](index) => indexField[index];
31 operator[]=(index, value) { indexField[index] = value; } 33 operator[]=(index, value) { indexField[index] = value; }
32 34
33 noSuchMethod(Invocation im) { 35 noSuchMethod(Invocation im) {
34 if (im.memberName.startsWith('missingSetter')) { 36 String name = MirrorSystem.getName(im.memberName);
37 if (name.startsWith('missingSetter')) {
35 Expect.isTrue(im.isSetter); 38 Expect.isTrue(im.isSetter);
36 missingSetterField = im.positionalArguments[0]; 39 missingSetterField = im.positionalArguments[0];
37 } else if (im.memberName.startsWith('missingGetter')) { 40 } else if (name.startsWith('missingGetter')) {
38 Expect.isTrue(im.isGetter); 41 Expect.isTrue(im.isGetter);
39 return missingGetterField; 42 return missingGetterField;
40 } else if (im.memberName.startsWith('missingAll') && im.isGetter) { 43 } else if (name.startsWith('missingAll') && im.isGetter) {
41 return missingAllField; 44 return missingAllField;
42 } else if (im.memberName.startsWith('missingAll') && im.isSetter) { 45 } else if (name.startsWith('missingAll') && im.isSetter) {
43 missingAllField = im.positionalArguments[0]; 46 missingAllField = im.positionalArguments[0];
44 } else { 47 } else {
45 Expect.fail('Should not reach here'); 48 Expect.fail('Should not reach here');
46 } 49 }
47 } 50 }
48 } 51 }
49 52
50 class C extends B { 53 class C extends B {
51 test() { 54 test() {
52 Expect.equals(42, super.missingSetter = 42); 55 Expect.equals(42, super.missingSetter = 42);
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 Expect.equals(3, super[0] += 1); 99 Expect.equals(3, super[0] += 1);
97 Expect.equals(3, super[0]); 100 Expect.equals(3, super[0]);
98 Expect.equals(3, super[0]++); 101 Expect.equals(3, super[0]++);
99 Expect.equals(4, super[0]); 102 Expect.equals(4, super[0]);
100 } 103 }
101 } 104 }
102 105
103 main() { 106 main() {
104 new C().test(); 107 new C().test();
105 } 108 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698