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

Side by Side Diff: pkg/analyzer/test/generated/element_test.dart

Issue 294903015: New analyzer snapshot. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 7 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 code was auto-generated, is not intended to be edited, and is subject to 5 // This code was auto-generated, is not intended to be edited, and is subject to
6 // significant change. Please see the README file for more information. 6 // significant change. Please see the README file for more information.
7 7
8 library engine.element_test; 8 library engine.element_test;
9 9
10 import 'package:analyzer/src/generated/java_core.dart'; 10 import 'package:analyzer/src/generated/java_core.dart';
(...skipping 234 matching lines...) Expand 10 before | Expand all | Expand 10 after
245 245
246 void test_hasStaticMember_true_setter() { 246 void test_hasStaticMember_true_setter() {
247 ClassElementImpl classA = ElementFactory.classElement2("A", []); 247 ClassElementImpl classA = ElementFactory.classElement2("A", []);
248 PropertyAccessorElementImpl setter = ElementFactory.setterElement("foo", fal se, null); 248 PropertyAccessorElementImpl setter = ElementFactory.setterElement("foo", fal se, null);
249 classA.accessors = <PropertyAccessorElement> [setter]; 249 classA.accessors = <PropertyAccessorElement> [setter];
250 // "foo" is static 250 // "foo" is static
251 setter.static = true; 251 setter.static = true;
252 JUnitTestCase.assertTrue(classA.hasStaticMember); 252 JUnitTestCase.assertTrue(classA.hasStaticMember);
253 } 253 }
254 254
255 void test_lookUpConcreteMethod_declared() {
256 // class A {
257 // m() {}
258 // }
259 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
260 ClassElementImpl classA = ElementFactory.classElement2("A", []);
261 String methodName = "m";
262 MethodElement method = ElementFactory.methodElement(methodName, null, []);
263 classA.methods = <MethodElement> [method];
264 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
265 JUnitTestCase.assertSame(method, classA.lookUpConcreteMethod(methodName, lib rary));
266 }
267
268 void test_lookUpConcreteMethod_declaredAbstract() {
269 // class A {
270 // m();
271 // }
272 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
273 ClassElementImpl classA = ElementFactory.classElement2("A", []);
274 String methodName = "m";
275 MethodElementImpl method = ElementFactory.methodElement(methodName, null, [] );
276 method.abstract = true;
277 classA.methods = <MethodElement> [method];
278 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
279 JUnitTestCase.assertNull(classA.lookUpConcreteMethod(methodName, library));
280 }
281
282 void test_lookUpConcreteMethod_declaredAbstractAndInherited() {
283 // class A {
284 // m() {}
285 // }
286 // class B extends A {
287 // m();
288 // }
289 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
290 ClassElementImpl classA = ElementFactory.classElement2("A", []);
291 String methodName = "m";
292 MethodElement inheritedMethod = ElementFactory.methodElement(methodName, nul l, []);
293 classA.methods = <MethodElement> [inheritedMethod];
294 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
295 MethodElementImpl method = ElementFactory.methodElement(methodName, null, [] );
296 method.abstract = true;
297 classB.methods = <MethodElement> [method];
298 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
299 JUnitTestCase.assertSame(inheritedMethod, classB.lookUpConcreteMethod(method Name, library));
300 }
301
302 void test_lookUpConcreteMethod_declaredAndInherited() {
303 // class A {
304 // m() {}
305 // }
306 // class B extends A {
307 // m() {}
308 // }
309 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
310 ClassElementImpl classA = ElementFactory.classElement2("A", []);
311 String methodName = "m";
312 MethodElement inheritedMethod = ElementFactory.methodElement(methodName, nul l, []);
313 classA.methods = <MethodElement> [inheritedMethod];
314 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
315 MethodElement method = ElementFactory.methodElement(methodName, null, []);
316 classB.methods = <MethodElement> [method];
317 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
318 JUnitTestCase.assertSame(method, classB.lookUpConcreteMethod(methodName, lib rary));
319 }
320
321 void test_lookUpConcreteMethod_declaredAndInheritedAbstract() {
322 // abstract class A {
323 // m();
324 // }
325 // class B extends A {
326 // m() {}
327 // }
328 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
329 ClassElementImpl classA = ElementFactory.classElement2("A", []);
330 classA.abstract = true;
331 String methodName = "m";
332 MethodElementImpl inheritedMethod = ElementFactory.methodElement(methodName, null, []);
333 inheritedMethod.abstract = true;
334 classA.methods = <MethodElement> [inheritedMethod];
335 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
336 MethodElement method = ElementFactory.methodElement(methodName, null, []);
337 classB.methods = <MethodElement> [method];
338 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
339 JUnitTestCase.assertSame(method, classB.lookUpConcreteMethod(methodName, lib rary));
340 }
341
342 void test_lookUpConcreteMethod_inherited() {
343 // class A {
344 // m() {}
345 // }
346 // class B extends A {
347 // }
348 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
349 ClassElementImpl classA = ElementFactory.classElement2("A", []);
350 String methodName = "m";
351 MethodElement inheritedMethod = ElementFactory.methodElement(methodName, nul l, []);
352 classA.methods = <MethodElement> [inheritedMethod];
353 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
354 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
355 JUnitTestCase.assertSame(inheritedMethod, classB.lookUpConcreteMethod(method Name, library));
356 }
357
358 void test_lookUpConcreteMethod_undeclared() {
359 // class A {
360 // }
361 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
362 ClassElementImpl classA = ElementFactory.classElement2("A", []);
363 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
364 JUnitTestCase.assertNull(classA.lookUpConcreteMethod("m", library));
365 }
366
255 void test_lookUpGetter_declared() { 367 void test_lookUpGetter_declared() {
368 // class A {
369 // get g {}
370 // }
256 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 371 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
257 ClassElementImpl classA = ElementFactory.classElement2("A", []); 372 ClassElementImpl classA = ElementFactory.classElement2("A", []);
258 String getterName = "g"; 373 String getterName = "g";
259 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null); 374 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null);
260 classA.accessors = <PropertyAccessorElement> [getter]; 375 classA.accessors = <PropertyAccessorElement> [getter];
261 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA]; 376 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
262 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library)); 377 JUnitTestCase.assertSame(getter, classA.lookUpGetter(getterName, library));
263 } 378 }
264 379
265 void test_lookUpGetter_inherited() { 380 void test_lookUpGetter_inherited() {
381 // class A {
382 // get g {}
383 // }
384 // class B extends A {
385 // }
266 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 386 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
267 ClassElementImpl classA = ElementFactory.classElement2("A", []); 387 ClassElementImpl classA = ElementFactory.classElement2("A", []);
268 String getterName = "g"; 388 String getterName = "g";
269 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null); 389 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null);
270 classA.accessors = <PropertyAccessorElement> [getter]; 390 classA.accessors = <PropertyAccessorElement> [getter];
271 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 391 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
272 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB]; 392 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
273 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library)); 393 JUnitTestCase.assertSame(getter, classB.lookUpGetter(getterName, library));
274 } 394 }
275 395
276 void test_lookUpGetter_undeclared() { 396 void test_lookUpGetter_undeclared() {
397 // class A {
398 // }
277 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 399 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
278 ClassElementImpl classA = ElementFactory.classElement2("A", []); 400 ClassElementImpl classA = ElementFactory.classElement2("A", []);
279 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA]; 401 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
280 JUnitTestCase.assertNull(classA.lookUpGetter("g", library)); 402 JUnitTestCase.assertNull(classA.lookUpGetter("g", library));
281 } 403 }
282 404
283 void test_lookUpGetter_undeclared_recursive() { 405 void test_lookUpGetter_undeclared_recursive() {
406 // class A extends B {
407 // }
408 // class B extends A {
409 // }
284 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 410 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
285 ClassElementImpl classA = ElementFactory.classElement2("A", []); 411 ClassElementImpl classA = ElementFactory.classElement2("A", []);
286 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 412 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
287 classA.supertype = classB.type; 413 classA.supertype = classB.type;
288 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB]; 414 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
289 JUnitTestCase.assertNull(classA.lookUpGetter("g", library)); 415 JUnitTestCase.assertNull(classA.lookUpGetter("g", library));
290 } 416 }
291 417
418 void test_lookUpInheritedConcreteGetter_declared() {
419 // class A {
420 // get g {}
421 // }
422 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
423 ClassElementImpl classA = ElementFactory.classElement2("A", []);
424 String getterName = "g";
425 PropertyAccessorElement getter = ElementFactory.getterElement(getterName, fa lse, null);
426 classA.accessors = <PropertyAccessorElement> [getter];
427 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
428 JUnitTestCase.assertNull(classA.lookUpInheritedConcreteGetter(getterName, li brary));
429 }
430
431 void test_lookUpInheritedConcreteGetter_inherited() {
432 // class A {
433 // get g {}
434 // }
435 // class B extends A {
436 // }
437 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
438 ClassElementImpl classA = ElementFactory.classElement2("A", []);
439 String getterName = "g";
440 PropertyAccessorElement inheritedGetter = ElementFactory.getterElement(gette rName, false, null);
441 classA.accessors = <PropertyAccessorElement> [inheritedGetter];
442 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
443 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
444 JUnitTestCase.assertSame(inheritedGetter, classB.lookUpInheritedConcreteGett er(getterName, library));
445 }
446
447 void test_lookUpInheritedConcreteGetter_undeclared() {
448 // class A {
449 // }
450 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
451 ClassElementImpl classA = ElementFactory.classElement2("A", []);
452 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
453 JUnitTestCase.assertNull(classA.lookUpInheritedConcreteGetter("g", library)) ;
454 }
455
456 void test_lookUpInheritedConcreteGetter_undeclared_recursive() {
457 // class A extends B {
458 // }
459 // class B extends A {
460 // }
461 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
462 ClassElementImpl classA = ElementFactory.classElement2("A", []);
463 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
464 classA.supertype = classB.type;
465 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
466 JUnitTestCase.assertNull(classA.lookUpInheritedConcreteGetter("g", library)) ;
467 }
468
469 void test_lookUpInheritedConcreteMethod_declared() {
470 // class A {
471 // m() {}
472 // }
473 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
474 ClassElementImpl classA = ElementFactory.classElement2("A", []);
475 String methodName = "m";
476 MethodElement method = ElementFactory.methodElement(methodName, null, []);
477 classA.methods = <MethodElement> [method];
478 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
479 JUnitTestCase.assertNull(classA.lookUpInheritedConcreteMethod(methodName, li brary));
480 }
481
482 void test_lookUpInheritedConcreteMethod_declaredAbstractAndInherited() {
483 // class A {
484 // m() {}
485 // }
486 // class B extends A {
487 // m();
488 // }
489 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
490 ClassElementImpl classA = ElementFactory.classElement2("A", []);
491 String methodName = "m";
492 MethodElement inheritedMethod = ElementFactory.methodElement(methodName, nul l, []);
493 classA.methods = <MethodElement> [inheritedMethod];
494 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
495 MethodElementImpl method = ElementFactory.methodElement(methodName, null, [] );
496 method.abstract = true;
497 classB.methods = <MethodElement> [method];
498 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
499 JUnitTestCase.assertSame(inheritedMethod, classB.lookUpInheritedConcreteMeth od(methodName, library));
500 }
501
502 void test_lookUpInheritedConcreteMethod_declaredAndInherited() {
503 // class A {
504 // m() {}
505 // }
506 // class B extends A {
507 // m() {}
508 // }
509 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
510 ClassElementImpl classA = ElementFactory.classElement2("A", []);
511 String methodName = "m";
512 MethodElement inheritedMethod = ElementFactory.methodElement(methodName, nul l, []);
513 classA.methods = <MethodElement> [inheritedMethod];
514 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
515 MethodElement method = ElementFactory.methodElement(methodName, null, []);
516 classB.methods = <MethodElement> [method];
517 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
518 JUnitTestCase.assertSame(inheritedMethod, classB.lookUpInheritedConcreteMeth od(methodName, library));
519 }
520
521 void test_lookUpInheritedConcreteMethod_declaredAndInheritedAbstract() {
522 // abstract class A {
523 // m();
524 // }
525 // class B extends A {
526 // m() {}
527 // }
528 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
529 ClassElementImpl classA = ElementFactory.classElement2("A", []);
530 classA.abstract = true;
531 String methodName = "m";
532 MethodElementImpl inheritedMethod = ElementFactory.methodElement(methodName, null, []);
533 inheritedMethod.abstract = true;
534 classA.methods = <MethodElement> [inheritedMethod];
535 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
536 MethodElement method = ElementFactory.methodElement(methodName, null, []);
537 classB.methods = <MethodElement> [method];
538 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
539 JUnitTestCase.assertNull(classB.lookUpInheritedConcreteMethod(methodName, li brary));
540 }
541
542 void test_lookUpInheritedConcreteMethod_declaredAndInheritedWithAbstractBetwee n() {
543 // class A {
544 // m() {}
545 // }
546 // class B extends A {
547 // m();
548 // }
549 // class C extends B {
550 // m() {}
551 // }
552 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
553 ClassElementImpl classA = ElementFactory.classElement2("A", []);
554 String methodName = "m";
555 MethodElement inheritedMethod = ElementFactory.methodElement(methodName, nul l, []);
556 classA.methods = <MethodElement> [inheritedMethod];
557 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
558 MethodElementImpl abstractMethod = ElementFactory.methodElement(methodName, null, []);
559 abstractMethod.abstract = true;
560 classB.methods = <MethodElement> [abstractMethod];
561 ClassElementImpl classC = ElementFactory.classElement("C", classB.type, []);
562 MethodElementImpl method = ElementFactory.methodElement(methodName, null, [] );
563 classC.methods = <MethodElement> [method];
564 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB, classC];
565 JUnitTestCase.assertSame(inheritedMethod, classC.lookUpInheritedConcreteMeth od(methodName, library));
566 }
567
568 void test_lookUpInheritedConcreteMethod_inherited() {
569 // class A {
570 // m() {}
571 // }
572 // class B extends A {
573 // }
574 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
575 ClassElementImpl classA = ElementFactory.classElement2("A", []);
576 String methodName = "m";
577 MethodElement inheritedMethod = ElementFactory.methodElement(methodName, nul l, []);
578 classA.methods = <MethodElement> [inheritedMethod];
579 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
580 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
581 JUnitTestCase.assertSame(inheritedMethod, classB.lookUpInheritedConcreteMeth od(methodName, library));
582 }
583
584 void test_lookUpInheritedConcreteMethod_undeclared() {
585 // class A {
586 // }
587 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
588 ClassElementImpl classA = ElementFactory.classElement2("A", []);
589 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
590 JUnitTestCase.assertNull(classA.lookUpInheritedConcreteMethod("m", library)) ;
591 }
592
593 void test_lookUpInheritedConcreteSetter_declared() {
594 // class A {
595 // set g(x) {}
596 // }
597 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
598 ClassElementImpl classA = ElementFactory.classElement2("A", []);
599 String setterName = "s";
600 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null);
601 classA.accessors = <PropertyAccessorElement> [setter];
602 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
603 JUnitTestCase.assertNull(classA.lookUpInheritedConcreteSetter(setterName, li brary));
604 }
605
606 void test_lookUpInheritedConcreteSetter_inherited() {
607 // class A {
608 // set g(x) {}
609 // }
610 // class B extends A {
611 // }
612 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
613 ClassElementImpl classA = ElementFactory.classElement2("A", []);
614 String setterName = "s";
615 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null);
616 classA.accessors = <PropertyAccessorElement> [setter];
617 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
618 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
619 JUnitTestCase.assertSame(setter, classB.lookUpInheritedConcreteSetter(setter Name, library));
620 }
621
622 void test_lookUpInheritedConcreteSetter_undeclared() {
623 // class A {
624 // }
625 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
626 ClassElementImpl classA = ElementFactory.classElement2("A", []);
627 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
628 JUnitTestCase.assertNull(classA.lookUpInheritedConcreteSetter("s", library)) ;
629 }
630
631 void test_lookUpInheritedConcreteSetter_undeclared_recursive() {
632 // class A extends B {
633 // }
634 // class B extends A {
635 // }
636 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
637 ClassElementImpl classA = ElementFactory.classElement2("A", []);
638 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
639 classA.supertype = classB.type;
640 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
641 JUnitTestCase.assertNull(classA.lookUpInheritedConcreteSetter("s", library)) ;
642 }
643
292 void test_lookUpInheritedMethod_declared() { 644 void test_lookUpInheritedMethod_declared() {
293 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 645 // class A {
294 ClassElementImpl classA = ElementFactory.classElement2("A", []); 646 // m() {}
295 String methodName = "m"; 647 // }
648 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
649 ClassElementImpl classA = ElementFactory.classElement2("A", []);
650 String methodName = "m";
296 MethodElement method = ElementFactory.methodElement(methodName, null, []); 651 MethodElement method = ElementFactory.methodElement(methodName, null, []);
297 classA.methods = <MethodElement> [method]; 652 classA.methods = <MethodElement> [method];
298 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA]; 653 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
299 JUnitTestCase.assertNull(classA.lookUpInheritedMethod(methodName, library)); 654 JUnitTestCase.assertNull(classA.lookUpInheritedMethod(methodName, library));
300 } 655 }
301 656
302 void test_lookUpInheritedMethod_declaredAndInherited() { 657 void test_lookUpInheritedMethod_declaredAndInherited() {
658 // class A {
659 // m() {}
660 // }
661 // class B extends A {
662 // m() {}
663 // }
303 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 664 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
304 ClassElementImpl classA = ElementFactory.classElement2("A", []); 665 ClassElementImpl classA = ElementFactory.classElement2("A", []);
305 String methodName = "m"; 666 String methodName = "m";
306 MethodElement inheritedMethod = ElementFactory.methodElement(methodName, nul l, []); 667 MethodElement inheritedMethod = ElementFactory.methodElement(methodName, nul l, []);
307 classA.methods = <MethodElement> [inheritedMethod]; 668 classA.methods = <MethodElement> [inheritedMethod];
308 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 669 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
309 MethodElement method = ElementFactory.methodElement(methodName, null, []); 670 MethodElement method = ElementFactory.methodElement(methodName, null, []);
310 classB.methods = <MethodElement> [method]; 671 classB.methods = <MethodElement> [method];
311 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB]; 672 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
312 JUnitTestCase.assertSame(inheritedMethod, classB.lookUpInheritedMethod(metho dName, library)); 673 JUnitTestCase.assertSame(inheritedMethod, classB.lookUpInheritedMethod(metho dName, library));
313 } 674 }
314 675
315 void test_lookUpInheritedMethod_inherited() { 676 void test_lookUpInheritedMethod_inherited() {
677 // class A {
678 // m() {}
679 // }
680 // class B extends A {
681 // }
316 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 682 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
317 ClassElementImpl classA = ElementFactory.classElement2("A", []); 683 ClassElementImpl classA = ElementFactory.classElement2("A", []);
318 String methodName = "m"; 684 String methodName = "m";
319 MethodElement inheritedMethod = ElementFactory.methodElement(methodName, nul l, []); 685 MethodElement inheritedMethod = ElementFactory.methodElement(methodName, nul l, []);
320 classA.methods = <MethodElement> [inheritedMethod]; 686 classA.methods = <MethodElement> [inheritedMethod];
321 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 687 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
322 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB]; 688 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
323 JUnitTestCase.assertSame(inheritedMethod, classB.lookUpInheritedMethod(metho dName, library)); 689 JUnitTestCase.assertSame(inheritedMethod, classB.lookUpInheritedMethod(metho dName, library));
324 } 690 }
325 691
326 void test_lookUpInheritedMethod_undeclared() { 692 void test_lookUpInheritedMethod_undeclared() {
693 // class A {
694 // }
327 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 695 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
328 ClassElementImpl classA = ElementFactory.classElement2("A", []); 696 ClassElementImpl classA = ElementFactory.classElement2("A", []);
329 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA]; 697 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
330 JUnitTestCase.assertNull(classA.lookUpInheritedMethod("m", library)); 698 JUnitTestCase.assertNull(classA.lookUpInheritedMethod("m", library));
331 } 699 }
332 700
333 void test_lookUpMethod_declared() { 701 void test_lookUpMethod_declared() {
334 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 702 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
335 ClassElementImpl classA = ElementFactory.classElement2("A", []); 703 ClassElementImpl classA = ElementFactory.classElement2("A", []);
336 String methodName = "m"; 704 String methodName = "m";
(...skipping 24 matching lines...) Expand all
361 void test_lookUpMethod_undeclared_recursive() { 729 void test_lookUpMethod_undeclared_recursive() {
362 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 730 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
363 ClassElementImpl classA = ElementFactory.classElement2("A", []); 731 ClassElementImpl classA = ElementFactory.classElement2("A", []);
364 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 732 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
365 classA.supertype = classB.type; 733 classA.supertype = classB.type;
366 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB]; 734 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
367 JUnitTestCase.assertNull(classA.lookUpMethod("m", library)); 735 JUnitTestCase.assertNull(classA.lookUpMethod("m", library));
368 } 736 }
369 737
370 void test_lookUpSetter_declared() { 738 void test_lookUpSetter_declared() {
739 // class A {
740 // set g(x) {}
741 // }
371 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 742 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
372 ClassElementImpl classA = ElementFactory.classElement2("A", []); 743 ClassElementImpl classA = ElementFactory.classElement2("A", []);
373 String setterName = "s"; 744 String setterName = "s";
374 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null); 745 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null);
375 classA.accessors = <PropertyAccessorElement> [setter]; 746 classA.accessors = <PropertyAccessorElement> [setter];
376 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA]; 747 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
377 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library)); 748 JUnitTestCase.assertSame(setter, classA.lookUpSetter(setterName, library));
378 } 749 }
379 750
380 void test_lookUpSetter_inherited() { 751 void test_lookUpSetter_inherited() {
752 // class A {
753 // set g(x) {}
754 // }
755 // class B extends A {
756 // }
381 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 757 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
382 ClassElementImpl classA = ElementFactory.classElement2("A", []); 758 ClassElementImpl classA = ElementFactory.classElement2("A", []);
383 String setterName = "s"; 759 String setterName = "s";
384 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null); 760 PropertyAccessorElement setter = ElementFactory.setterElement(setterName, fa lse, null);
385 classA.accessors = <PropertyAccessorElement> [setter]; 761 classA.accessors = <PropertyAccessorElement> [setter];
386 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 762 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
387 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB]; 763 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
388 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library)); 764 JUnitTestCase.assertSame(setter, classB.lookUpSetter(setterName, library));
389 } 765 }
390 766
391 void test_lookUpSetter_undeclared() { 767 void test_lookUpSetter_undeclared() {
768 // class A {
769 // }
392 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 770 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
393 ClassElementImpl classA = ElementFactory.classElement2("A", []); 771 ClassElementImpl classA = ElementFactory.classElement2("A", []);
394 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA]; 772 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA];
395 JUnitTestCase.assertNull(classA.lookUpSetter("s", library)); 773 JUnitTestCase.assertNull(classA.lookUpSetter("s", library));
396 } 774 }
397 775
398 void test_lookUpSetter_undeclared_recursive() { 776 void test_lookUpSetter_undeclared_recursive() {
777 // class A extends B {
778 // }
779 // class B extends A {
780 // }
399 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib"); 781 LibraryElementImpl library = ElementFactory.library(createAnalysisContext(), "lib");
400 ClassElementImpl classA = ElementFactory.classElement2("A", []); 782 ClassElementImpl classA = ElementFactory.classElement2("A", []);
401 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []); 783 ClassElementImpl classB = ElementFactory.classElement("B", classA.type, []);
402 classA.supertype = classB.type; 784 classA.supertype = classB.type;
403 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB]; 785 (library.definingCompilationUnit as CompilationUnitElementImpl).types = <Cla ssElement> [classA, classB];
404 JUnitTestCase.assertNull(classA.lookUpSetter("s", library)); 786 JUnitTestCase.assertNull(classA.lookUpSetter("s", library));
405 } 787 }
406 788
407 static dartSuite() { 789 static dartSuite() {
408 _ut.group('ClassElementImplTest', () { 790 _ut.group('ClassElementImplTest', () {
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after
471 runJUnitTest(__test, __test.test_hasStaticMember_true_getter); 853 runJUnitTest(__test, __test.test_hasStaticMember_true_getter);
472 }); 854 });
473 _ut.test('test_hasStaticMember_true_method', () { 855 _ut.test('test_hasStaticMember_true_method', () {
474 final __test = new ClassElementImplTest(); 856 final __test = new ClassElementImplTest();
475 runJUnitTest(__test, __test.test_hasStaticMember_true_method); 857 runJUnitTest(__test, __test.test_hasStaticMember_true_method);
476 }); 858 });
477 _ut.test('test_hasStaticMember_true_setter', () { 859 _ut.test('test_hasStaticMember_true_setter', () {
478 final __test = new ClassElementImplTest(); 860 final __test = new ClassElementImplTest();
479 runJUnitTest(__test, __test.test_hasStaticMember_true_setter); 861 runJUnitTest(__test, __test.test_hasStaticMember_true_setter);
480 }); 862 });
863 _ut.test('test_lookUpConcreteMethod_declared', () {
864 final __test = new ClassElementImplTest();
865 runJUnitTest(__test, __test.test_lookUpConcreteMethod_declared);
866 });
867 _ut.test('test_lookUpConcreteMethod_declaredAbstract', () {
868 final __test = new ClassElementImplTest();
869 runJUnitTest(__test, __test.test_lookUpConcreteMethod_declaredAbstract);
870 });
871 _ut.test('test_lookUpConcreteMethod_declaredAbstractAndInherited', () {
872 final __test = new ClassElementImplTest();
873 runJUnitTest(__test, __test.test_lookUpConcreteMethod_declaredAbstractAn dInherited);
874 });
875 _ut.test('test_lookUpConcreteMethod_declaredAndInherited', () {
876 final __test = new ClassElementImplTest();
877 runJUnitTest(__test, __test.test_lookUpConcreteMethod_declaredAndInherit ed);
878 });
879 _ut.test('test_lookUpConcreteMethod_declaredAndInheritedAbstract', () {
880 final __test = new ClassElementImplTest();
881 runJUnitTest(__test, __test.test_lookUpConcreteMethod_declaredAndInherit edAbstract);
882 });
883 _ut.test('test_lookUpConcreteMethod_inherited', () {
884 final __test = new ClassElementImplTest();
885 runJUnitTest(__test, __test.test_lookUpConcreteMethod_inherited);
886 });
887 _ut.test('test_lookUpConcreteMethod_undeclared', () {
888 final __test = new ClassElementImplTest();
889 runJUnitTest(__test, __test.test_lookUpConcreteMethod_undeclared);
890 });
481 _ut.test('test_lookUpGetter_declared', () { 891 _ut.test('test_lookUpGetter_declared', () {
482 final __test = new ClassElementImplTest(); 892 final __test = new ClassElementImplTest();
483 runJUnitTest(__test, __test.test_lookUpGetter_declared); 893 runJUnitTest(__test, __test.test_lookUpGetter_declared);
484 }); 894 });
485 _ut.test('test_lookUpGetter_inherited', () { 895 _ut.test('test_lookUpGetter_inherited', () {
486 final __test = new ClassElementImplTest(); 896 final __test = new ClassElementImplTest();
487 runJUnitTest(__test, __test.test_lookUpGetter_inherited); 897 runJUnitTest(__test, __test.test_lookUpGetter_inherited);
488 }); 898 });
489 _ut.test('test_lookUpGetter_undeclared', () { 899 _ut.test('test_lookUpGetter_undeclared', () {
490 final __test = new ClassElementImplTest(); 900 final __test = new ClassElementImplTest();
491 runJUnitTest(__test, __test.test_lookUpGetter_undeclared); 901 runJUnitTest(__test, __test.test_lookUpGetter_undeclared);
492 }); 902 });
493 _ut.test('test_lookUpGetter_undeclared_recursive', () { 903 _ut.test('test_lookUpGetter_undeclared_recursive', () {
494 final __test = new ClassElementImplTest(); 904 final __test = new ClassElementImplTest();
495 runJUnitTest(__test, __test.test_lookUpGetter_undeclared_recursive); 905 runJUnitTest(__test, __test.test_lookUpGetter_undeclared_recursive);
496 }); 906 });
907 _ut.test('test_lookUpInheritedConcreteGetter_declared', () {
908 final __test = new ClassElementImplTest();
909 runJUnitTest(__test, __test.test_lookUpInheritedConcreteGetter_declared) ;
910 });
911 _ut.test('test_lookUpInheritedConcreteGetter_inherited', () {
912 final __test = new ClassElementImplTest();
913 runJUnitTest(__test, __test.test_lookUpInheritedConcreteGetter_inherited );
914 });
915 _ut.test('test_lookUpInheritedConcreteGetter_undeclared', () {
916 final __test = new ClassElementImplTest();
917 runJUnitTest(__test, __test.test_lookUpInheritedConcreteGetter_undeclare d);
918 });
919 _ut.test('test_lookUpInheritedConcreteGetter_undeclared_recursive', () {
920 final __test = new ClassElementImplTest();
921 runJUnitTest(__test, __test.test_lookUpInheritedConcreteGetter_undeclare d_recursive);
922 });
923 _ut.test('test_lookUpInheritedConcreteMethod_declared', () {
924 final __test = new ClassElementImplTest();
925 runJUnitTest(__test, __test.test_lookUpInheritedConcreteMethod_declared) ;
926 });
927 _ut.test('test_lookUpInheritedConcreteMethod_declaredAbstractAndInherited' , () {
928 final __test = new ClassElementImplTest();
929 runJUnitTest(__test, __test.test_lookUpInheritedConcreteMethod_declaredA bstractAndInherited);
930 });
931 _ut.test('test_lookUpInheritedConcreteMethod_declaredAndInherited', () {
932 final __test = new ClassElementImplTest();
933 runJUnitTest(__test, __test.test_lookUpInheritedConcreteMethod_declaredA ndInherited);
934 });
935 _ut.test('test_lookUpInheritedConcreteMethod_declaredAndInheritedAbstract' , () {
936 final __test = new ClassElementImplTest();
937 runJUnitTest(__test, __test.test_lookUpInheritedConcreteMethod_declaredA ndInheritedAbstract);
938 });
939 _ut.test('test_lookUpInheritedConcreteMethod_declaredAndInheritedWithAbstr actBetween', () {
940 final __test = new ClassElementImplTest();
941 runJUnitTest(__test, __test.test_lookUpInheritedConcreteMethod_declaredA ndInheritedWithAbstractBetween);
942 });
943 _ut.test('test_lookUpInheritedConcreteMethod_inherited', () {
944 final __test = new ClassElementImplTest();
945 runJUnitTest(__test, __test.test_lookUpInheritedConcreteMethod_inherited );
946 });
947 _ut.test('test_lookUpInheritedConcreteMethod_undeclared', () {
948 final __test = new ClassElementImplTest();
949 runJUnitTest(__test, __test.test_lookUpInheritedConcreteMethod_undeclare d);
950 });
951 _ut.test('test_lookUpInheritedConcreteSetter_declared', () {
952 final __test = new ClassElementImplTest();
953 runJUnitTest(__test, __test.test_lookUpInheritedConcreteSetter_declared) ;
954 });
955 _ut.test('test_lookUpInheritedConcreteSetter_inherited', () {
956 final __test = new ClassElementImplTest();
957 runJUnitTest(__test, __test.test_lookUpInheritedConcreteSetter_inherited );
958 });
959 _ut.test('test_lookUpInheritedConcreteSetter_undeclared', () {
960 final __test = new ClassElementImplTest();
961 runJUnitTest(__test, __test.test_lookUpInheritedConcreteSetter_undeclare d);
962 });
963 _ut.test('test_lookUpInheritedConcreteSetter_undeclared_recursive', () {
964 final __test = new ClassElementImplTest();
965 runJUnitTest(__test, __test.test_lookUpInheritedConcreteSetter_undeclare d_recursive);
966 });
497 _ut.test('test_lookUpInheritedMethod_declared', () { 967 _ut.test('test_lookUpInheritedMethod_declared', () {
498 final __test = new ClassElementImplTest(); 968 final __test = new ClassElementImplTest();
499 runJUnitTest(__test, __test.test_lookUpInheritedMethod_declared); 969 runJUnitTest(__test, __test.test_lookUpInheritedMethod_declared);
500 }); 970 });
501 _ut.test('test_lookUpInheritedMethod_declaredAndInherited', () { 971 _ut.test('test_lookUpInheritedMethod_declaredAndInherited', () {
502 final __test = new ClassElementImplTest(); 972 final __test = new ClassElementImplTest();
503 runJUnitTest(__test, __test.test_lookUpInheritedMethod_declaredAndInheri ted); 973 runJUnitTest(__test, __test.test_lookUpInheritedMethod_declaredAndInheri ted);
504 }); 974 });
505 _ut.test('test_lookUpInheritedMethod_inherited', () { 975 _ut.test('test_lookUpInheritedMethod_inherited', () {
506 final __test = new ClassElementImplTest(); 976 final __test = new ClassElementImplTest();
(...skipping 3783 matching lines...) Expand 10 before | Expand all | Expand 10 after
4290 InterfaceTypeImplTest.dartSuite(); 4760 InterfaceTypeImplTest.dartSuite();
4291 TypeParameterTypeImplTest.dartSuite(); 4761 TypeParameterTypeImplTest.dartSuite();
4292 VoidTypeImplTest.dartSuite(); 4762 VoidTypeImplTest.dartSuite();
4293 ClassElementImplTest.dartSuite(); 4763 ClassElementImplTest.dartSuite();
4294 ElementLocationImplTest.dartSuite(); 4764 ElementLocationImplTest.dartSuite();
4295 ElementImplTest.dartSuite(); 4765 ElementImplTest.dartSuite();
4296 HtmlElementImplTest.dartSuite(); 4766 HtmlElementImplTest.dartSuite();
4297 LibraryElementImplTest.dartSuite(); 4767 LibraryElementImplTest.dartSuite();
4298 MultiplyDefinedElementImplTest.dartSuite(); 4768 MultiplyDefinedElementImplTest.dartSuite();
4299 } 4769 }
OLDNEW
« no previous file with comments | « pkg/analyzer/test/generated/ast_test.dart ('k') | pkg/analyzer/test/generated/resolver_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698