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

Side by Side Diff: tests/compiler/dart2js/semantic_visitor_test_send_data.dart

Issue 1182563003: Handle most qualified sends. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Handle qualified access of ambiguous static members. Created 5 years, 6 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
« no previous file with comments | « tests/compiler/dart2js/semantic_visitor_test.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 part of dart2js.semantics_visitor_test; 5 part of dart2js.semantics_visitor_test;
6 6
7 const Map<String, List<Test>> SEND_TESTS = const { 7 const Map<String, List<Test>> SEND_TESTS = const {
8 'Parameters': const [ 8 'Parameters': const [
9 // Parameters 9 // Parameters
10 const Test('m(o) => o;', 10 const Test('m(o) => o;',
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 ''' 102 '''
103 class C { 103 class C {
104 static var o; 104 static var o;
105 } 105 }
106 ''', 106 ''',
107 'm() => p.C.o;', 107 'm() => p.C.o;',
108 const Visit(VisitKind.VISIT_STATIC_FIELD_GET, 108 const Visit(VisitKind.VISIT_STATIC_FIELD_GET,
109 element: 'field(C#o)')), 109 element: 'field(C#o)')),
110 const Test( 110 const Test(
111 ''' 111 '''
112 class C {
113 var o;
114 }
115 m() => C.o;
116 ''',
117 const Visit(VisitKind.VISIT_UNRESOLVED_GET,
118 name: 'o')),
119 const Test(
120 '''
121 class C {
122 C.o();
123 }
124 m() => C.o;
125 ''',
126 const Visit(VisitKind.VISIT_UNRESOLVED_GET,
127 name: 'o')),
128 const Test(
129 '''
130 class C {}
131 m() => C.this;
132 ''',
133 null),
134 const Test(
135 '''
112 class C { static var o; } 136 class C { static var o; }
113 m() { C.o = 42; } 137 m() { C.o = 42; }
114 ''', 138 ''',
115 const Visit(VisitKind.VISIT_STATIC_FIELD_SET, 139 const Visit(VisitKind.VISIT_STATIC_FIELD_SET,
116 element: 'field(C#o)', 140 element: 'field(C#o)',
117 rhs: '42')), 141 rhs: '42')),
118 const Test.clazz( 142 const Test.clazz(
119 ''' 143 '''
120 class C { 144 class C {
121 static var o; 145 static var o;
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after
176 const Test.prefix( 200 const Test.prefix(
177 ''' 201 '''
178 class C { 202 class C {
179 static var o; 203 static var o;
180 } 204 }
181 ''', 205 ''',
182 'm() { p.C.o(null, 42); }', 206 'm() { p.C.o(null, 42); }',
183 const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE, 207 const Visit(VisitKind.VISIT_STATIC_FIELD_INVOKE,
184 element: 'field(C#o)', 208 element: 'field(C#o)',
185 arguments: '(null,42)')), 209 arguments: '(null,42)')),
210 const Test(
211 '''
212 class C {}
213 m() => C.this(null, 42);
214 ''',
215 const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE,
216 name: 'this', arguments: '(null,42)')),
186 // TODO(johnniwinther): Expect [VISIT_FINAL_STATIC_FIELD_SET] instead. 217 // TODO(johnniwinther): Expect [VISIT_FINAL_STATIC_FIELD_SET] instead.
187 const Test( 218 const Test(
188 ''' 219 '''
189 class C { static final o = 0; } 220 class C { static final o = 0; }
190 m() { C.o = 42; } 221 m() { C.o = 42; }
191 ''', 222 ''',
192 const Visit(VisitKind.VISIT_UNRESOLVED_SET, 223 const Visit(VisitKind.VISIT_UNRESOLVED_SET,
193 name: 'o', 224 name: 'o',
194 rhs: '42')), 225 rhs: '42')),
195 const Test.clazz( 226 const Test.clazz(
(...skipping 135 matching lines...) Expand 10 before | Expand all | Expand 10 after
331 const Test.prefix( 362 const Test.prefix(
332 ''' 363 '''
333 class C { 364 class C {
334 static get o => 42; 365 static get o => 42;
335 } 366 }
336 ''', 367 ''',
337 'm() { p.C.o = 42; }', 368 'm() { p.C.o = 42; }',
338 const Visit(VisitKind.VISIT_UNRESOLVED_SET, 369 const Visit(VisitKind.VISIT_UNRESOLVED_SET,
339 name: 'o', 370 name: 'o',
340 rhs: '42')), 371 rhs: '42')),
341 // TODO(johnniwinther): Expected [VISIT_STATIC_SETTER_GET] instead.
342 const Test( 372 const Test(
343 ''' 373 '''
344 class C { 374 class C {
345 static set o(_) {} 375 static set o(_) {}
346 } 376 }
347 m() => C.o; 377 m() => C.o;
348 ''', 378 ''',
349 const Visit(VisitKind.VISIT_UNRESOLVED_GET, 379 const Visit(VisitKind.VISIT_STATIC_SETTER_GET,
350 name: 'o')), 380 element: 'setter(C#o)')),
351 const Test.clazz( 381 const Test.clazz(
352 ''' 382 '''
353 class C { 383 class C {
354 static set o(_) {} 384 static set o(_) {}
355 m() => o; 385 m() => o;
356 } 386 }
357 ''', 387 ''',
358 const Visit(VisitKind.VISIT_STATIC_SETTER_GET, 388 const Visit(VisitKind.VISIT_STATIC_SETTER_GET,
359 element: 'setter(C#o)')), 389 element: 'setter(C#o)')),
360 390
361 const Test.clazz( 391 const Test.clazz(
362 ''' 392 '''
363 class C { 393 class C {
364 static set o(_) {} 394 static set o(_) {}
365 m() => C.o; 395 m() => C.o;
366 } 396 }
367 ''', 397 ''',
368 const Visit(VisitKind.VISIT_UNRESOLVED_GET, 398 const Visit(VisitKind.VISIT_STATIC_SETTER_GET,
369 name: 'o')), 399 element: 'setter(C#o)')),
370 const Test.prefix( 400 const Test.prefix(
371 ''' 401 '''
372 class C { 402 class C {
373 static set o(_) {} 403 static set o(_) {}
374 } 404 }
375 ''', 405 ''',
376 'm() => p.C.o;', 406 'm() => p.C.o;',
377 const Visit(VisitKind.VISIT_UNRESOLVED_GET, 407 const Visit(VisitKind.VISIT_STATIC_SETTER_GET,
378 name: 'o')), 408 element: 'setter(C#o)')),
379 const Test( 409 const Test(
380 ''' 410 '''
381 class C { static set o(_) {} } 411 class C { static set o(_) {} }
382 m() { C.o = 42; } 412 m() { C.o = 42; }
383 ''', 413 ''',
384 const Visit(VisitKind.VISIT_STATIC_SETTER_SET, 414 const Visit(VisitKind.VISIT_STATIC_SETTER_SET,
385 element: 'setter(C#o)', 415 element: 'setter(C#o)',
386 rhs: '42')), 416 rhs: '42')),
387 const Test.clazz( 417 const Test.clazz(
388 ''' 418 '''
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 const Test.prefix( 475 const Test.prefix(
446 ''' 476 '''
447 class C { 477 class C {
448 static get o => null; 478 static get o => null;
449 } 479 }
450 ''', 480 ''',
451 'm() { p.C.o(null, 42); }', 481 'm() { p.C.o(null, 42); }',
452 const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE, 482 const Visit(VisitKind.VISIT_STATIC_GETTER_INVOKE,
453 element: 'getter(C#o)', 483 element: 'getter(C#o)',
454 arguments: '(null,42)')), 484 arguments: '(null,42)')),
455 // TODO(johnniwinther): Expect [VISIT_STATIC_SETTER_INVOKE] instead.
456 const Test( 485 const Test(
457 ''' 486 '''
458 class C { static set o(_) {} } 487 class C { static set o(_) {} }
459 m() => C.o(null, 42); 488 m() => C.o(null, 42);
460 ''', 489 ''',
461 const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE, 490 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE,
462 name: 'o', 491 element: 'setter(C#o)',
463 arguments: '(null,42)')), 492 arguments: '(null,42)')),
464 const Test.clazz( 493 const Test.clazz(
465 ''' 494 '''
466 class C { 495 class C {
467 static set o(_) {} 496 static set o(_) {}
468 m() { o(null, 42); } 497 m() { o(null, 42); }
469 } 498 }
470 ''', 499 ''',
471 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE, 500 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE,
472 element: 'setter(C#o)', 501 element: 'setter(C#o)',
473 arguments: '(null,42)')), 502 arguments: '(null,42)')),
474 const Test.clazz( 503 const Test.clazz(
475 ''' 504 '''
476 class C { 505 class C {
477 static set o(_) {} 506 static set o(_) {}
478 m() { C.o(null, 42); } 507 m() { C.o(null, 42); }
479 } 508 }
480 ''', 509 ''',
481 const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE, 510 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE,
482 name: 'o', 511 element: 'setter(C#o)',
483 arguments: '(null,42)')), 512 arguments: '(null,42)')),
484 const Test.prefix( 513 const Test.prefix(
485 ''' 514 '''
486 class C { 515 class C {
487 static set o(_) {} 516 static set o(_) {}
488 } 517 }
489 ''', 518 ''',
490 'm() { p.C.o(null, 42); }', 519 'm() { p.C.o(null, 42); }',
491 const Visit(VisitKind.VISIT_UNRESOLVED_INVOKE, 520 const Visit(VisitKind.VISIT_STATIC_SETTER_INVOKE,
492 name: 'o', 521 element: 'setter(C#o)',
493 arguments: '(null,42)')), 522 arguments: '(null,42)')),
494 ], 523 ],
495 'Static functions': const [ 524 'Static functions': const [
496 // Static functions 525 // Static functions
497 const Test( 526 const Test(
498 ''' 527 '''
499 class C { static o(a, b) {} } 528 class C { static o(a, b) {} }
500 m() => C.o; 529 m() => C.o;
501 ''', 530 ''',
502 const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET, 531 const Visit(VisitKind.VISIT_STATIC_FUNCTION_GET,
(...skipping 733 matching lines...) Expand 10 before | Expand all | Expand 10 after
1236 ''' 1265 '''
1237 class C {} 1266 class C {}
1238 m() => C--; 1267 m() => C--;
1239 ''', 1268 ''',
1240 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_POSTFIX, 1269 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_POSTFIX,
1241 constant: 'C', 1270 constant: 'C',
1242 operator: '--')), 1271 operator: '--')),
1243 const Test( 1272 const Test(
1244 ''' 1273 '''
1245 class C {} 1274 class C {}
1246 m() => C; 1275 m() => (C).hashCode;
1247 ''', 1276 ''',
1248 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET, 1277 const [
1249 constant: 'C')), 1278 const Visit(VisitKind.VISIT_DYNAMIC_PROPERTY_GET,
1279 receiver: '(C)', name: 'hashCode'),
1280 const Visit(VisitKind.VISIT_CLASS_TYPE_LITERAL_GET,
1281 constant: 'C'),
1282 ]),
1250 ], 1283 ],
1251 'Typedef type literals': const [ 1284 'Typedef type literals': const [
1252 // Typedef type literals 1285 // Typedef type literals
1253 const Test( 1286 const Test(
1254 ''' 1287 '''
1255 typedef F(); 1288 typedef F();
1256 m() => F; 1289 m() => F;
1257 ''', 1290 ''',
1258 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_GET, 1291 const Visit(VisitKind.VISIT_TYPEDEF_TYPE_LITERAL_GET,
1259 constant: 'F')), 1292 constant: 'F')),
(...skipping 2152 matching lines...) Expand 10 before | Expand all | Expand 10 after
3412 const Visit( 3445 const Visit(
3413 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_GET, 3446 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_GET,
3414 receiver: 'a', 3447 receiver: 'a',
3415 name: 'b'), 3448 name: 'b'),
3416 const Visit( 3449 const Visit(
3417 VisitKind.VISIT_PARAMETER_GET, 3450 VisitKind.VISIT_PARAMETER_GET,
3418 element: 'parameter(m#a)'), 3451 element: 'parameter(m#a)'),
3419 ]), 3452 ]),
3420 const Test( 3453 const Test(
3421 ''' 3454 '''
3455 class C {
3456 static var b;
3457 }
3458 m(a) => C?.b;
3459 ''',
3460 const [
3461 const Visit(
3462 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_GET,
3463 receiver: 'C',
3464 name: 'b'),
3465 const Visit(
3466 VisitKind.VISIT_CLASS_TYPE_LITERAL_GET,
3467 constant: 'C'),
3468 ]),
3469 const Test(
3470 '''
3422 m(a) => a?.b = 42; 3471 m(a) => a?.b = 42;
3423 ''', 3472 ''',
3424 const [ 3473 const [
3425 const Visit( 3474 const Visit(
3426 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_SET, 3475 VisitKind.VISIT_IF_NOT_NULL_DYNAMIC_PROPERTY_SET,
3427 receiver: 'a', 3476 receiver: 'a',
3428 name: 'b', 3477 name: 'b',
3429 rhs: '42'), 3478 rhs: '42'),
3430 const Visit( 3479 const Visit(
3431 VisitKind.VISIT_PARAMETER_GET, 3480 VisitKind.VISIT_PARAMETER_GET,
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
3509 ''' 3558 '''
3510 m(a) => a ??= 42; 3559 m(a) => a ??= 42;
3511 ''', 3560 ''',
3512 const Visit( 3561 const Visit(
3513 VisitKind.VISIT_PARAMETER_COMPOUND, 3562 VisitKind.VISIT_PARAMETER_COMPOUND,
3514 element: 'parameter(m#a)', 3563 element: 'parameter(m#a)',
3515 operator: '??=', 3564 operator: '??=',
3516 rhs: '42')), 3565 rhs: '42')),
3517 ], 3566 ],
3518 }; 3567 };
OLDNEW
« no previous file with comments | « tests/compiler/dart2js/semantic_visitor_test.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698