OLD | NEW |
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 // This test is a multi-test with three positive tests. "01" pass on dart2js, | 5 // This test is a multi-test with three positive tests. "01" pass on dart2js, |
6 // "02" pass on the VM, and "none" is the correct behavior. | 6 // "02" pass on the VM, and "none" is the correct behavior. |
7 // The goal is to remove all "01" and "02" lines. | 7 // The goal is to remove all "01" and "02" lines. |
8 | 8 |
9 library test.typedef_test; | 9 library test.typedef_test; |
10 | 10 |
(...skipping 10 matching lines...) Expand all Loading... |
21 typedef String Foo2(int x, num y); | 21 typedef String Foo2(int x, num y); |
22 typedef String Bar2(int x, [num y, num z]); | 22 typedef String Bar2(int x, [num y, num z]); |
23 typedef String Baz2(int x, {num y, num z}); | 23 typedef String Baz2(int x, {num y, num z}); |
24 | 24 |
25 check(t) { | 25 check(t) { |
26 var sb = new StringBuffer(); | 26 var sb = new StringBuffer(); |
27 writeln(o) { | 27 writeln(o) { |
28 sb.write(o); | 28 sb.write(o); |
29 sb.write('\n'); | 29 sb.write('\n'); |
30 } | 30 } |
| 31 |
31 writeln(t); | 32 writeln(t); |
32 t = t.referent; | 33 t = t.referent; |
33 writeln(t); | 34 writeln(t); |
34 writeln(t.returnType); | 35 writeln(t.returnType); |
35 writeln(t.parameters); | 36 writeln(t.parameters); |
36 for (var p in t.parameters) { | 37 for (var p in t.parameters) { |
37 writeln(p.simpleName); | 38 writeln(p.simpleName); |
38 writeln(p.type); | 39 writeln(p.type); |
39 } | 40 } |
40 | 41 |
(...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
96 TypedefMirror on 'Bar' | 97 TypedefMirror on 'Bar' |
97 FunctionTypeMirror on '$type' | 98 FunctionTypeMirror on '$type' |
98 ClassMirror on 'String' | 99 ClassMirror on 'String' |
99 [ParameterMirror on '$x', ParameterMirror on '$y'] | 100 [ParameterMirror on '$x', ParameterMirror on '$y'] |
100 Symbol(\"$x\") | 101 Symbol(\"$x\") |
101 ClassMirror on 'int' | 102 ClassMirror on 'int' |
102 Symbol(\"$y\") | 103 Symbol(\"$y\") |
103 ClassMirror on 'num' | 104 ClassMirror on 'num' |
104 """, | 105 """, |
105 check(reflectType(Bar))); | 106 check(reflectType(Bar))); |
106 type = ft('(dart.core.int, [dart.core.num, dart.core.num])', | 107 type = |
107 'dart.core.String'); | 108 ft('(dart.core.int, [dart.core.num, dart.core.num])', 'dart.core.String'); |
108 Expect.stringEquals( | 109 Expect.stringEquals( |
109 """ | 110 """ |
110 TypedefMirror on 'Bar2' | 111 TypedefMirror on 'Bar2' |
111 FunctionTypeMirror on '$type' | 112 FunctionTypeMirror on '$type' |
112 ClassMirror on 'String' | 113 ClassMirror on 'String' |
113 [ParameterMirror on '$x', ParameterMirror on '$y', ParameterMirror on '$z'] | 114 [ParameterMirror on '$x', ParameterMirror on '$y', ParameterMirror on '$z'] |
114 Symbol(\"$x\") | 115 Symbol(\"$x\") |
115 ClassMirror on 'int' | 116 ClassMirror on 'int' |
116 Symbol(\"$y\") | 117 Symbol(\"$y\") |
117 ClassMirror on 'num' | 118 ClassMirror on 'num' |
118 Symbol(\"$z\") | 119 Symbol(\"$z\") |
119 ClassMirror on 'num' | 120 ClassMirror on 'num' |
120 """, | 121 """, |
121 check(reflectType(Bar2))); | 122 check(reflectType(Bar2))); |
122 type = ft('(dart.core.int, {y: dart.core.num})', 'dart.core.String'); | 123 type = ft('(dart.core.int, {y: dart.core.num})', 'dart.core.String'); |
123 Expect.stringEquals( | 124 Expect.stringEquals( |
124 """ | 125 """ |
125 TypedefMirror on 'Baz' | 126 TypedefMirror on 'Baz' |
126 FunctionTypeMirror on '$type' | 127 FunctionTypeMirror on '$type' |
127 ClassMirror on 'String' | 128 ClassMirror on 'String' |
128 [ParameterMirror on '$x', ParameterMirror on 'y'] | 129 [ParameterMirror on '$x', ParameterMirror on 'y'] |
129 Symbol(\"$x\") | 130 Symbol(\"$x\") |
130 ClassMirror on 'int' | 131 ClassMirror on 'int' |
131 Symbol(\"y\") | 132 Symbol(\"y\") |
132 ClassMirror on 'num' | 133 ClassMirror on 'num' |
133 """, | 134 """, |
134 check(reflectType(Baz))); | 135 check(reflectType(Baz))); |
135 type = ft('(dart.core.int, {y: dart.core.num, z: dart.core.num})', | 136 type = ft('(dart.core.int, {y: dart.core.num, z: dart.core.num})', |
136 'dart.core.String'); | 137 'dart.core.String'); |
137 Expect.stringEquals( | 138 Expect.stringEquals( |
138 """ | 139 """ |
139 TypedefMirror on 'Baz2' | 140 TypedefMirror on 'Baz2' |
140 FunctionTypeMirror on '$type' | 141 FunctionTypeMirror on '$type' |
141 ClassMirror on 'String' | 142 ClassMirror on 'String' |
142 [ParameterMirror on '$x', ParameterMirror on 'y', ParameterMirror on 'z'] | 143 [ParameterMirror on '$x', ParameterMirror on 'y', ParameterMirror on 'z'] |
143 Symbol(\"$x\") | 144 Symbol(\"$x\") |
144 ClassMirror on 'int' | 145 ClassMirror on 'int' |
145 Symbol(\"y\") | 146 Symbol(\"y\") |
146 ClassMirror on 'num' | 147 ClassMirror on 'num' |
147 Symbol(\"z\") | 148 Symbol(\"z\") |
148 ClassMirror on 'num' | 149 ClassMirror on 'num' |
149 """, | 150 """, |
150 check(reflectType(Baz2))); | 151 check(reflectType(Baz2))); |
151 } | 152 } |
OLD | NEW |