| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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("../../../pkg/dartdoc/lib/mirrors.dart"); | 5 #import("../../../pkg/dartdoc/lib/mirrors.dart"); |
| 6 #import("../../../pkg/dartdoc/lib/mirrors_util.dart"); | 6 #import("../../../pkg/dartdoc/lib/mirrors_util.dart"); |
| 7 | 7 |
| 8 #import('dart:io'); | 8 #import('dart:io'); |
| 9 | 9 |
| 10 int count(Iterable iterable) { | 10 int count(Iterable iterable) { |
| (...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 349 //////////////////////////////////////////////////////////////////////////// | 349 //////////////////////////////////////////////////////////////////////////// |
| 350 // static method1(e) {} | 350 // static method1(e) {} |
| 351 //////////////////////////////////////////////////////////////////////////// | 351 //////////////////////////////////////////////////////////////////////////// |
| 352 var method1 = bazClassMembers["method1"]; | 352 var method1 = bazClassMembers["method1"]; |
| 353 Expect.isNotNull(method1, "method1 not found"); | 353 Expect.isNotNull(method1, "method1 not found"); |
| 354 Expect.stringEquals('method1', method1.simpleName, | 354 Expect.stringEquals('method1', method1.simpleName, |
| 355 "Unexpected method simpleName"); | 355 "Unexpected method simpleName"); |
| 356 Expect.stringEquals('mirrors_helper.Baz.method1', method1.qualifiedName, | 356 Expect.stringEquals('mirrors_helper.Baz.method1', method1.qualifiedName, |
| 357 "Unexpected method qualifiedName"); | 357 "Unexpected method qualifiedName"); |
| 358 Expect.equals(method1.owner, bazClass); | 358 Expect.equals(method1.owner, bazClass); |
| 359 Expect.isFalse(method1.isTopLevel, "Method is top level"); | 359 Expect.isFalse(method1.isTopLevel); |
| 360 Expect.isFalse(method1.isConstructor, "Method is constructor"); | 360 Expect.isFalse(method1.isConstructor); |
| 361 Expect.isFalse(method1.isField, "Method is field"); | 361 Expect.isFalse(method1.isField); |
| 362 Expect.isTrue(method1.isMethod, "Method is not method"); | 362 Expect.isTrue(method1.isMethod); |
| 363 Expect.isFalse(method1.isPrivate, "Method is private"); | 363 Expect.isFalse(method1.isPrivate); |
| 364 Expect.isTrue(method1.isStatic, "Method is not static"); | 364 Expect.isTrue(method1.isStatic); |
| 365 Expect.isTrue(method1 is MethodMirror, "Method is not MethodMirror"); | 365 Expect.isTrue(method1 is MethodMirror); |
| 366 Expect.isFalse(method1.isConst, "Method is const"); | 366 Expect.isTrue(method1.isRegularMethod); |
| 367 Expect.isFalse(method1.isFactory, "Method is factory"); | 367 Expect.isFalse(method1.isConstConstructor); |
| 368 Expect.isNull(method1.constructorName, | 368 Expect.isFalse(method1.isGenerativeConstructor); |
| 369 "Method constructorName is non-null"); | 369 Expect.isFalse(method1.isRedirectingConstructor); |
| 370 Expect.isFalse(method1.isGetter, "Method is getter"); | 370 Expect.isFalse(method1.isFactoryConstructor); |
| 371 Expect.isFalse(method1.isSetter, "Method is setter"); | 371 Expect.isNull(method1.constructorName); |
| 372 Expect.isFalse(method1.isOperator, "Method is operator"); | 372 Expect.isFalse(method1.isGetter); |
| 373 Expect.isNull(method1.operatorName, | 373 Expect.isFalse(method1.isSetter); |
| 374 "Method operatorName is non-null"); | 374 Expect.isFalse(method1.isOperator); |
| 375 Expect.isNull(method1.operatorName); |
| 375 | 376 |
| 376 var dynamicType = method1.returnType; | 377 var dynamicType = method1.returnType; |
| 377 Expect.isNotNull(dynamicType, "Return type was null"); | 378 Expect.isNotNull(dynamicType, "Return type was null"); |
| 378 Expect.isFalse(dynamicType.isObject, "Dynamic is Object"); | 379 Expect.isFalse(dynamicType.isObject, "Dynamic is Object"); |
| 379 Expect.isTrue(dynamicType.isDynamic, "Dynamic is not Dynamic"); | 380 Expect.isTrue(dynamicType.isDynamic, "Dynamic is not Dynamic"); |
| 380 Expect.isFalse(dynamicType.isVoid, "Dynamic is void"); | 381 Expect.isFalse(dynamicType.isVoid, "Dynamic is void"); |
| 381 Expect.isFalse(dynamicType.isTypeVariable, "Dynamic is a type variable"); | 382 Expect.isFalse(dynamicType.isTypeVariable, "Dynamic is a type variable"); |
| 382 Expect.isFalse(dynamicType.isTypedef, "Dynamic is a typedef"); | 383 Expect.isFalse(dynamicType.isTypedef, "Dynamic is a typedef"); |
| 383 Expect.isFalse(dynamicType.isFunction, "Dynamic is a function"); | 384 Expect.isFalse(dynamicType.isFunction, "Dynamic is a function"); |
| 384 | 385 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 402 //////////////////////////////////////////////////////////////////////////// | 403 //////////////////////////////////////////////////////////////////////////// |
| 403 // static void method2(E e, [F f = null]) {} | 404 // static void method2(E e, [F f = null]) {} |
| 404 //////////////////////////////////////////////////////////////////////////// | 405 //////////////////////////////////////////////////////////////////////////// |
| 405 var method2 = bazClassMembers["method2"]; | 406 var method2 = bazClassMembers["method2"]; |
| 406 Expect.isNotNull(method2, "method2 not found"); | 407 Expect.isNotNull(method2, "method2 not found"); |
| 407 Expect.stringEquals('method2', method2.simpleName, | 408 Expect.stringEquals('method2', method2.simpleName, |
| 408 "Unexpected method simpleName"); | 409 "Unexpected method simpleName"); |
| 409 Expect.stringEquals('mirrors_helper.Baz.method2', method2.qualifiedName, | 410 Expect.stringEquals('mirrors_helper.Baz.method2', method2.qualifiedName, |
| 410 "Unexpected method qualifiedName"); | 411 "Unexpected method qualifiedName"); |
| 411 Expect.equals(method2.owner, bazClass); | 412 Expect.equals(method2.owner, bazClass); |
| 412 Expect.isFalse(method2.isTopLevel, "Method is top level"); | 413 Expect.isFalse(method2.isTopLevel); |
| 413 Expect.isFalse(method2.isConstructor, "Method is constructor"); | 414 Expect.isFalse(method2.isConstructor); |
| 414 Expect.isFalse(method2.isField, "Method is field"); | 415 Expect.isFalse(method2.isField); |
| 415 Expect.isTrue(method2.isMethod, "Method is not method"); | 416 Expect.isTrue(method2.isMethod); |
| 416 Expect.isFalse(method2.isPrivate, "Method is private"); | 417 Expect.isFalse(method2.isPrivate); |
| 417 Expect.isFalse(method2.isStatic, "Method is static"); | 418 Expect.isFalse(method2.isStatic); |
| 418 Expect.isTrue(method2 is MethodMirror, "Method is not MethodMirror"); | 419 Expect.isTrue(method2 is MethodMirror); |
| 419 Expect.isFalse(method2.isConst, "Method is const"); | 420 Expect.isTrue(method2.isRegularMethod); |
| 420 Expect.isFalse(method2.isFactory, "Method is factory"); | 421 Expect.isFalse(method2.isConstConstructor); |
| 421 Expect.isNull(method2.constructorName, | 422 Expect.isFalse(method2.isGenerativeConstructor); |
| 422 "Method constructorName is non-null"); | 423 Expect.isFalse(method2.isRedirectingConstructor); |
| 423 Expect.isFalse(method2.isGetter, "Method is getter"); | 424 Expect.isFalse(method2.isFactoryConstructor); |
| 424 Expect.isFalse(method2.isSetter, "Method is setter"); | 425 Expect.isNull(method2.constructorName); |
| 425 Expect.isFalse(method2.isOperator, "Method is operator"); | 426 Expect.isFalse(method2.isGetter); |
| 426 Expect.isNull(method2.operatorName, | 427 Expect.isFalse(method2.isSetter); |
| 427 "Method operatorName is non-null"); | 428 Expect.isFalse(method2.isOperator); |
| 429 Expect.isNull(method2.operatorName); |
| 428 | 430 |
| 429 var voidType = method2.returnType; | 431 var voidType = method2.returnType; |
| 430 Expect.isNotNull(voidType, "Return type was null"); | 432 Expect.isNotNull(voidType, "Return type was null"); |
| 431 Expect.isFalse(voidType.isObject, "void is Object"); | 433 Expect.isFalse(voidType.isObject, "void is Object"); |
| 432 Expect.isFalse(voidType.isDynamic, "void is Dynamic"); | 434 Expect.isFalse(voidType.isDynamic, "void is Dynamic"); |
| 433 Expect.isTrue(voidType.isVoid, "void is not void"); | 435 Expect.isTrue(voidType.isVoid, "void is not void"); |
| 434 Expect.isFalse(voidType.isTypeVariable, "void is a type variable"); | 436 Expect.isFalse(voidType.isTypeVariable, "void is a type variable"); |
| 435 Expect.isFalse(voidType.isTypedef, "void is a typedef"); | 437 Expect.isFalse(voidType.isTypedef, "void is a typedef"); |
| 436 Expect.isFalse(voidType.isFunction, "void is a function"); | 438 Expect.isFalse(voidType.isFunction, "void is a function"); |
| 437 | 439 |
| (...skipping 30 matching lines...) Expand all Loading... |
| 468 //////////////////////////////////////////////////////////////////////////// | 470 //////////////////////////////////////////////////////////////////////////// |
| 469 // Baz<E,F> method3(E func1(F f), Func<E,F> func2) => null; | 471 // Baz<E,F> method3(E func1(F f), Func<E,F> func2) => null; |
| 470 //////////////////////////////////////////////////////////////////////////// | 472 //////////////////////////////////////////////////////////////////////////// |
| 471 var method3 = bazClassMembers["method3"]; | 473 var method3 = bazClassMembers["method3"]; |
| 472 Expect.isNotNull(method3, "method3 not found"); | 474 Expect.isNotNull(method3, "method3 not found"); |
| 473 Expect.stringEquals('method3', method3.simpleName, | 475 Expect.stringEquals('method3', method3.simpleName, |
| 474 "Unexpected method simpleName"); | 476 "Unexpected method simpleName"); |
| 475 Expect.stringEquals('mirrors_helper.Baz.method3', method3.qualifiedName, | 477 Expect.stringEquals('mirrors_helper.Baz.method3', method3.qualifiedName, |
| 476 "Unexpected method qualifiedName"); | 478 "Unexpected method qualifiedName"); |
| 477 Expect.equals(method3.owner, bazClass); | 479 Expect.equals(method3.owner, bazClass); |
| 478 Expect.isFalse(method3.isTopLevel, "Method is top level"); | 480 Expect.isFalse(method3.isTopLevel); |
| 479 Expect.isFalse(method3.isConstructor, "Method is constructor"); | 481 Expect.isFalse(method3.isConstructor); |
| 480 Expect.isFalse(method3.isField, "Method is field"); | 482 Expect.isFalse(method3.isField); |
| 481 Expect.isTrue(method3.isMethod, "Method is not method"); | 483 Expect.isTrue(method3.isMethod); |
| 482 Expect.isFalse(method3.isPrivate, "Method is private"); | 484 Expect.isFalse(method3.isPrivate); |
| 483 Expect.isFalse(method3.isStatic, "Method is static"); | 485 Expect.isFalse(method3.isStatic); |
| 484 Expect.isTrue(method3 is MethodMirror, "Method is not MethodMirror"); | 486 Expect.isTrue(method3 is MethodMirror); |
| 485 Expect.isFalse(method3.isConst, "Method is const"); | 487 Expect.isTrue(method3.isRegularMethod); |
| 486 Expect.isFalse(method3.isFactory, "Method is factory"); | 488 Expect.isFalse(method3.isConstConstructor); |
| 487 Expect.isNull(method3.constructorName, | 489 Expect.isFalse(method3.isGenerativeConstructor); |
| 488 "Method constructorName is non-null"); | 490 Expect.isFalse(method3.isRedirectingConstructor); |
| 489 Expect.isFalse(method3.isGetter, "Method is getter"); | 491 Expect.isFalse(method3.isFactoryConstructor); |
| 490 Expect.isFalse(method3.isSetter, "Method is setter"); | 492 Expect.isNull(method3.constructorName); |
| 491 Expect.isFalse(method3.isOperator, "Method is operator"); | 493 Expect.isFalse(method3.isGetter); |
| 492 Expect.isNull(method3.operatorName, | 494 Expect.isFalse(method3.isSetter); |
| 493 "Method operatorName is non-null"); | 495 Expect.isFalse(method3.isOperator); |
| 496 Expect.isNull(method3.operatorName); |
| 494 | 497 |
| 495 var method3ReturnType = method3.returnType; | 498 var method3ReturnType = method3.returnType; |
| 496 Expect.isNotNull(method3ReturnType, "Return type is null"); | 499 Expect.isNotNull(method3ReturnType, "Return type is null"); |
| 497 Expect.isTrue(method3ReturnType is ClassMirror, | 500 Expect.isTrue(method3ReturnType is ClassMirror, |
| 498 "Return type is not interface"); | 501 "Return type is not interface"); |
| 499 Expect.equals(bazClass, method3ReturnType.originalDeclaration); | 502 Expect.equals(bazClass, method3ReturnType.originalDeclaration); |
| 500 // TODO(johnniwinther): Test type arguments of [method3ReturnType]. | 503 // TODO(johnniwinther): Test type arguments of [method3ReturnType]. |
| 501 | 504 |
| 502 var method3Parameters = method3.parameters; | 505 var method3Parameters = method3.parameters; |
| 503 Expect.isNotNull(method3Parameters, "Method parameters is null"); | 506 Expect.isNotNull(method3Parameters, "Method parameters is null"); |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 593 //////////////////////////////////////////////////////////////////////////// | 596 //////////////////////////////////////////////////////////////////////////// |
| 594 var operator_eq = bazClassMembers['==']; | 597 var operator_eq = bazClassMembers['==']; |
| 595 Expect.isNotNull(operator_eq, "operator == not found"); | 598 Expect.isNotNull(operator_eq, "operator == not found"); |
| 596 Expect.stringEquals('==', operator_eq.simpleName, | 599 Expect.stringEquals('==', operator_eq.simpleName, |
| 597 "Unexpected method simpleName"); | 600 "Unexpected method simpleName"); |
| 598 Expect.stringEquals('operator ==', operator_eq.displayName); | 601 Expect.stringEquals('operator ==', operator_eq.displayName); |
| 599 Expect.stringEquals('mirrors_helper.Baz.==', | 602 Expect.stringEquals('mirrors_helper.Baz.==', |
| 600 operator_eq.qualifiedName, | 603 operator_eq.qualifiedName, |
| 601 "Unexpected method qualifiedName"); | 604 "Unexpected method qualifiedName"); |
| 602 Expect.equals(operator_eq.owner, bazClass); | 605 Expect.equals(operator_eq.owner, bazClass); |
| 603 Expect.isFalse(operator_eq.isTopLevel, "Method is top level"); | 606 Expect.isFalse(operator_eq.isTopLevel); |
| 604 Expect.isFalse(operator_eq.isConstructor, "Method is constructor"); | 607 Expect.isFalse(operator_eq.isConstructor); |
| 605 Expect.isFalse(operator_eq.isField, "Method is field"); | 608 Expect.isFalse(operator_eq.isField); |
| 606 Expect.isTrue(operator_eq.isMethod, "Method is not method"); | 609 Expect.isTrue(operator_eq.isMethod); |
| 607 Expect.isFalse(operator_eq.isPrivate, "Method is private"); | 610 Expect.isFalse(operator_eq.isPrivate); |
| 608 Expect.isFalse(operator_eq.isStatic, "Method is static"); | 611 Expect.isFalse(operator_eq.isStatic); |
| 609 Expect.isTrue(operator_eq is MethodMirror, "Method is not MethodMirror"); | 612 Expect.isTrue(operator_eq is MethodMirror); |
| 610 Expect.isFalse(operator_eq.isConst, "Method is const"); | 613 Expect.isTrue(operator_eq.isRegularMethod); |
| 611 Expect.isFalse(operator_eq.isFactory, "Method is factory"); | 614 Expect.isFalse(operator_eq.isConstConstructor); |
| 612 Expect.isNull(operator_eq.constructorName, | 615 Expect.isFalse(operator_eq.isGenerativeConstructor); |
| 613 "Method constructorName is non-null"); | 616 Expect.isFalse(operator_eq.isRedirectingConstructor); |
| 614 Expect.isFalse(operator_eq.isGetter, "Method is getter"); | 617 Expect.isFalse(operator_eq.isFactoryConstructor); |
| 615 Expect.isFalse(operator_eq.isSetter, "Method is setter"); | 618 Expect.isNull(operator_eq.constructorName); |
| 616 Expect.isTrue(operator_eq.isOperator, "Method is not operator"); | 619 Expect.isFalse(operator_eq.isGetter); |
| 617 Expect.stringEquals('==', operator_eq.operatorName, | 620 Expect.isFalse(operator_eq.isSetter); |
| 618 "Unexpected operatorName"); | 621 Expect.isTrue(operator_eq.isOperator); |
| 622 Expect.stringEquals('==', operator_eq.operatorName); |
| 619 | 623 |
| 620 //////////////////////////////////////////////////////////////////////////// | 624 //////////////////////////////////////////////////////////////////////////// |
| 621 // int operator -() => 0; | 625 // int operator -() => 0; |
| 622 //////////////////////////////////////////////////////////////////////////// | 626 //////////////////////////////////////////////////////////////////////////// |
| 623 var operator_negate = bazClassMembers[Mirror.UNARY_MINUS]; | 627 var operator_negate = bazClassMembers[Mirror.UNARY_MINUS]; |
| 624 Expect.isNotNull(operator_negate, "operator < not found"); | 628 Expect.isNotNull(operator_negate, "operator < not found"); |
| 625 Expect.stringEquals(Mirror.UNARY_MINUS, operator_negate.simpleName, | 629 Expect.stringEquals(Mirror.UNARY_MINUS, operator_negate.simpleName, |
| 626 "Unexpected method simpleName"); | 630 "Unexpected method simpleName"); |
| 627 Expect.stringEquals('operator -', operator_negate.displayName); | 631 Expect.stringEquals('operator -', operator_negate.displayName); |
| 628 Expect.stringEquals('mirrors_helper.Baz.${Mirror.UNARY_MINUS}', | 632 Expect.stringEquals('mirrors_helper.Baz.${Mirror.UNARY_MINUS}', |
| 629 operator_negate.qualifiedName, | 633 operator_negate.qualifiedName, |
| 630 "Unexpected method qualifiedName"); | 634 "Unexpected method qualifiedName"); |
| 631 Expect.equals(operator_negate.owner, bazClass); | 635 Expect.equals(operator_negate.owner, bazClass); |
| 632 Expect.isFalse(operator_negate.isTopLevel, "Method is top level"); | 636 Expect.isFalse(operator_negate.isTopLevel); |
| 633 Expect.isFalse(operator_negate.isConstructor, "Method is constructor"); | 637 Expect.isFalse(operator_negate.isConstructor); |
| 634 Expect.isFalse(operator_negate.isField, "Method is field"); | 638 Expect.isFalse(operator_negate.isField); |
| 635 Expect.isTrue(operator_negate.isMethod, "Method is not method"); | 639 Expect.isTrue(operator_negate.isMethod); |
| 636 Expect.isFalse(operator_negate.isPrivate, "Method is private"); | 640 Expect.isFalse(operator_negate.isPrivate); |
| 637 Expect.isFalse(operator_negate.isStatic, "Method is static"); | 641 Expect.isFalse(operator_negate.isStatic); |
| 638 Expect.isTrue(operator_negate is MethodMirror, | 642 Expect.isTrue(operator_negate is MethodMirror); |
| 639 "Method is not MethodMirror"); | 643 Expect.isTrue(operator_negate.isRegularMethod); |
| 640 Expect.isFalse(operator_negate.isConst, "Method is const"); | 644 Expect.isFalse(operator_negate.isConstConstructor); |
| 641 Expect.isFalse(operator_negate.isFactory, "Method is factory"); | 645 Expect.isFalse(operator_negate.isGenerativeConstructor); |
| 642 Expect.isNull(operator_negate.constructorName, | 646 Expect.isFalse(operator_negate.isRedirectingConstructor); |
| 643 "Method constructorName is non-null"); | 647 Expect.isFalse(operator_negate.isFactoryConstructor); |
| 644 Expect.isFalse(operator_negate.isGetter, "Method is getter"); | 648 Expect.isNull(operator_negate.constructorName); |
| 645 Expect.isFalse(operator_negate.isSetter, "Method is setter"); | 649 Expect.isFalse(operator_negate.isGetter); |
| 646 Expect.isTrue(operator_negate.isOperator, "Method is not operator"); | 650 Expect.isFalse(operator_negate.isSetter); |
| 647 Expect.stringEquals('-', operator_negate.operatorName, | 651 Expect.isTrue(operator_negate.isOperator); |
| 648 "Unexpected operatorName"); | 652 Expect.stringEquals('-', operator_negate.operatorName); |
| 649 | 653 |
| 650 | 654 |
| 651 var bazClassConstructors = bazClass.constructors; | 655 var bazClassConstructors = bazClass.constructors; |
| 652 Expect.isNotNull(bazClassConstructors, "Constructors map is null"); | 656 Expect.isNotNull(bazClassConstructors, "Constructors map is null"); |
| 653 Expect.equals(3, bazClassConstructors.length, | 657 Expect.equals(3, bazClassConstructors.length, |
| 654 "Unexpected number of constructors"); | 658 "Unexpected number of constructors"); |
| 655 | 659 |
| 660 //////////////////////////////////////////////////////////////////////////// |
| 661 // Baz(); |
| 662 //////////////////////////////////////////////////////////////////////////// |
| 656 var bazClassNonameConstructor = bazClassConstructors['Baz']; | 663 var bazClassNonameConstructor = bazClassConstructors['Baz']; |
| 657 Expect.isNotNull(bazClassNonameConstructor); | 664 Expect.isNotNull(bazClassNonameConstructor); |
| 658 Expect.isTrue(bazClassNonameConstructor is MethodMirror); | 665 Expect.isTrue(bazClassNonameConstructor is MethodMirror); |
| 659 Expect.isTrue(bazClassNonameConstructor.isConstructor); | 666 Expect.isTrue(bazClassNonameConstructor.isConstructor); |
| 660 Expect.isFalse(bazClassNonameConstructor.isFactory); | 667 Expect.isFalse(bazClassNonameConstructor.isRegularMethod); |
| 668 Expect.isFalse(bazClassNonameConstructor.isConstConstructor); |
| 669 Expect.isTrue(bazClassNonameConstructor.isGenerativeConstructor); |
| 670 Expect.isFalse(bazClassNonameConstructor.isRedirectingConstructor); |
| 671 Expect.isFalse(bazClassNonameConstructor.isFactoryConstructor); |
| 661 Expect.stringEquals('Baz', bazClassNonameConstructor.simpleName); | 672 Expect.stringEquals('Baz', bazClassNonameConstructor.simpleName); |
| 662 Expect.stringEquals('Baz', bazClassNonameConstructor.displayName); | 673 Expect.stringEquals('Baz', bazClassNonameConstructor.displayName); |
| 663 Expect.stringEquals('mirrors_helper.Baz.Baz', | 674 Expect.stringEquals('mirrors_helper.Baz.Baz', |
| 664 bazClassNonameConstructor.qualifiedName); | 675 bazClassNonameConstructor.qualifiedName); |
| 665 Expect.stringEquals('', bazClassNonameConstructor.constructorName); | 676 Expect.stringEquals('', bazClassNonameConstructor.constructorName); |
| 666 | 677 |
| 678 //////////////////////////////////////////////////////////////////////////// |
| 679 // const Baz.named(); |
| 680 //////////////////////////////////////////////////////////////////////////// |
| 667 var bazClassNamedConstructor = bazClassConstructors['Baz.named']; | 681 var bazClassNamedConstructor = bazClassConstructors['Baz.named']; |
| 668 Expect.isNotNull(bazClassNamedConstructor); | 682 Expect.isNotNull(bazClassNamedConstructor); |
| 669 Expect.isTrue(bazClassNamedConstructor is MethodMirror); | 683 Expect.isTrue(bazClassNamedConstructor is MethodMirror); |
| 670 Expect.isTrue(bazClassNamedConstructor.isConstructor); | 684 Expect.isTrue(bazClassNamedConstructor.isConstructor); |
| 671 Expect.isFalse(bazClassNamedConstructor.isFactory); | 685 Expect.isFalse(bazClassNamedConstructor.isRegularMethod); |
| 686 Expect.isTrue(bazClassNamedConstructor.isConstConstructor); |
| 687 Expect.isFalse(bazClassNamedConstructor.isGenerativeConstructor); |
| 688 Expect.isFalse(bazClassNamedConstructor.isRedirectingConstructor); |
| 689 Expect.isFalse(bazClassNamedConstructor.isFactoryConstructor); |
| 672 Expect.stringEquals('Baz.named', bazClassNamedConstructor.simpleName); | 690 Expect.stringEquals('Baz.named', bazClassNamedConstructor.simpleName); |
| 673 Expect.stringEquals('Baz.named', bazClassNamedConstructor.displayName); | 691 Expect.stringEquals('Baz.named', bazClassNamedConstructor.displayName); |
| 674 Expect.stringEquals('mirrors_helper.Baz.Baz.named', | 692 Expect.stringEquals('mirrors_helper.Baz.Baz.named', |
| 675 bazClassNamedConstructor.qualifiedName); | 693 bazClassNamedConstructor.qualifiedName); |
| 676 Expect.stringEquals('named', bazClassNamedConstructor.constructorName); | 694 Expect.stringEquals('named', bazClassNamedConstructor.constructorName); |
| 677 | 695 |
| 696 //////////////////////////////////////////////////////////////////////////// |
| 697 // factory Baz.factory() => new Baz<E,F>(); |
| 698 //////////////////////////////////////////////////////////////////////////// |
| 678 var bazClassFactoryConstructor = bazClassConstructors['Baz.factory']; | 699 var bazClassFactoryConstructor = bazClassConstructors['Baz.factory']; |
| 679 Expect.isNotNull(bazClassFactoryConstructor); | 700 Expect.isNotNull(bazClassFactoryConstructor); |
| 680 Expect.isTrue(bazClassFactoryConstructor is MethodMirror); | 701 Expect.isTrue(bazClassFactoryConstructor is MethodMirror); |
| 681 Expect.isTrue(bazClassFactoryConstructor.isConstructor); | 702 Expect.isTrue(bazClassFactoryConstructor.isConstructor); |
| 682 Expect.isTrue(bazClassFactoryConstructor.isFactory); | 703 Expect.isFalse(bazClassFactoryConstructor.isRegularMethod); |
| 704 Expect.isFalse(bazClassFactoryConstructor.isConstConstructor); |
| 705 Expect.isFalse(bazClassFactoryConstructor.isGenerativeConstructor); |
| 706 Expect.isFalse(bazClassFactoryConstructor.isRedirectingConstructor); |
| 707 Expect.isTrue(bazClassFactoryConstructor.isFactoryConstructor); |
| 683 Expect.stringEquals('Baz.factory', bazClassFactoryConstructor.simpleName); | 708 Expect.stringEquals('Baz.factory', bazClassFactoryConstructor.simpleName); |
| 684 Expect.stringEquals('Baz.factory', bazClassFactoryConstructor.displayName); | 709 Expect.stringEquals('Baz.factory', bazClassFactoryConstructor.displayName); |
| 685 Expect.stringEquals('mirrors_helper.Baz.Baz.factory', | 710 Expect.stringEquals('mirrors_helper.Baz.Baz.factory', |
| 686 bazClassFactoryConstructor.qualifiedName); | 711 bazClassFactoryConstructor.qualifiedName); |
| 687 Expect.stringEquals('factory', bazClassFactoryConstructor.constructorName); | 712 Expect.stringEquals('factory', bazClassFactoryConstructor.constructorName); |
| 688 | 713 |
| 689 // TODO(johnniwinther): Add more tests of constructors. | 714 // TODO(johnniwinther): Add more tests of constructors. |
| 690 // TODO(johnniwinther): Add a test for unnamed factory methods. | 715 // TODO(johnniwinther): Add a test for unnamed factory methods. |
| 691 } | 716 } |
| 692 | 717 |
| (...skipping 16 matching lines...) Expand all Loading... |
| 709 var privateField = privateClass.members['_privateField']; | 734 var privateField = privateClass.members['_privateField']; |
| 710 Expect.isNotNull(privateField); | 735 Expect.isNotNull(privateField); |
| 711 Expect.isTrue(privateField is VariableMirror); | 736 Expect.isTrue(privateField is VariableMirror); |
| 712 Expect.isTrue(privateField.isPrivate); | 737 Expect.isTrue(privateField.isPrivate); |
| 713 | 738 |
| 714 var privateGetter = privateClass.members['_privateGetter']; | 739 var privateGetter = privateClass.members['_privateGetter']; |
| 715 Expect.isNotNull(privateGetter); | 740 Expect.isNotNull(privateGetter); |
| 716 Expect.isTrue(privateGetter is MethodMirror); | 741 Expect.isTrue(privateGetter is MethodMirror); |
| 717 Expect.isTrue(privateGetter.isGetter); | 742 Expect.isTrue(privateGetter.isGetter); |
| 718 Expect.isTrue(privateGetter.isPrivate); | 743 Expect.isTrue(privateGetter.isPrivate); |
| 744 Expect.isFalse(privateGetter.isRegularMethod); |
| 719 | 745 |
| 720 var privateSetter = privateClass.members['_privateSetter=']; | 746 var privateSetter = privateClass.members['_privateSetter=']; |
| 721 Expect.isNotNull(privateSetter); | 747 Expect.isNotNull(privateSetter); |
| 722 Expect.isTrue(privateSetter is MethodMirror); | 748 Expect.isTrue(privateSetter is MethodMirror); |
| 723 Expect.isTrue(privateSetter.isSetter); | 749 Expect.isTrue(privateSetter.isSetter); |
| 724 Expect.isTrue(privateSetter.isPrivate); | 750 Expect.isTrue(privateSetter.isPrivate); |
| 751 Expect.isFalse(privateSetter.isRegularMethod); |
| 725 | 752 |
| 726 var privateMethod = privateClass.members['_privateMethod']; | 753 var privateMethod = privateClass.members['_privateMethod']; |
| 727 Expect.isNotNull(privateMethod); | 754 Expect.isNotNull(privateMethod); |
| 728 Expect.isTrue(privateMethod is MethodMirror); | 755 Expect.isTrue(privateMethod is MethodMirror); |
| 729 Expect.isTrue(privateMethod.isPrivate); | 756 Expect.isTrue(privateMethod.isPrivate); |
| 757 Expect.isTrue(privateMethod.isRegularMethod); |
| 730 | 758 |
| 731 var privateConstructor = | 759 var privateConstructor = |
| 732 privateClass.members['_PrivateClass._privateConstructor']; | 760 privateClass.members['_PrivateClass._privateConstructor']; |
| 733 Expect.isNotNull(privateConstructor); | 761 Expect.isNotNull(privateConstructor); |
| 734 Expect.isTrue(privateConstructor is MethodMirror); | 762 Expect.isTrue(privateConstructor is MethodMirror); |
| 735 Expect.isTrue(privateConstructor.isConstructor); | 763 Expect.isTrue(privateConstructor.isConstructor); |
| 736 Expect.isTrue(privateConstructor.isPrivate); | 764 Expect.isTrue(privateConstructor.isPrivate); |
| 765 Expect.isFalse(privateConstructor.isConstConstructor); |
| 766 Expect.isFalse(privateConstructor.isRedirectingConstructor); |
| 767 Expect.isTrue(privateConstructor.isGenerativeConstructor); |
| 768 Expect.isFalse(privateConstructor.isFactoryConstructor); |
| 737 | 769 |
| 738 var privateFactoryConstructor = | 770 var privateFactoryConstructor = |
| 739 privateClass.members['_PrivateClass._privateFactoryConstructor']; | 771 privateClass.members['_PrivateClass._privateFactoryConstructor']; |
| 740 Expect.isNotNull(privateFactoryConstructor); | 772 Expect.isNotNull(privateFactoryConstructor); |
| 741 Expect.isTrue(privateFactoryConstructor is MethodMirror); | 773 Expect.isTrue(privateFactoryConstructor is MethodMirror); |
| 742 Expect.isTrue(privateFactoryConstructor.isFactory); | 774 Expect.isTrue(privateFactoryConstructor.isConstructor); |
| 743 Expect.isTrue(privateFactoryConstructor.isPrivate); | 775 Expect.isTrue(privateFactoryConstructor.isPrivate); |
| 776 Expect.isFalse(privateFactoryConstructor.isConstConstructor); |
| 777 Expect.isFalse(privateFactoryConstructor.isRedirectingConstructor); |
| 778 Expect.isFalse(privateFactoryConstructor.isGenerativeConstructor); |
| 779 Expect.isTrue(privateFactoryConstructor.isFactoryConstructor); |
| 744 } | 780 } |
| OLD | NEW |