OLD | NEW |
1 // Copyright (c) 2017, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2017, 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 library dart2js.resolution_strategy; | 5 library dart2js.resolution_strategy; |
6 | 6 |
7 import 'package:front_end/src/fasta/scanner.dart' show Token; | 7 import 'package:front_end/src/fasta/scanner.dart' show Token; |
8 | 8 |
9 import '../common.dart'; | 9 import '../common.dart'; |
10 import '../common_elements.dart'; | 10 import '../common_elements.dart'; |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
135 } | 135 } |
136 | 136 |
137 WorkItemBuilder createResolutionWorkItemBuilder( | 137 WorkItemBuilder createResolutionWorkItemBuilder( |
138 NativeBasicData nativeBasicData, | 138 NativeBasicData nativeBasicData, |
139 NativeDataBuilder nativeDataBuilder, | 139 NativeDataBuilder nativeDataBuilder, |
140 ImpactTransformer impactTransformer) { | 140 ImpactTransformer impactTransformer) { |
141 return new ResolutionWorkItemBuilder(_compiler.resolution); | 141 return new ResolutionWorkItemBuilder(_compiler.resolution); |
142 } | 142 } |
143 | 143 |
144 FunctionEntity computeMain( | 144 FunctionEntity computeMain( |
145 LibraryElement mainApp, WorldImpactBuilder impactBuilder) { | 145 covariant LibraryElement mainApp, WorldImpactBuilder impactBuilder) { |
146 _elementEnvironment._mainLibrary = mainApp; | 146 _elementEnvironment._mainLibrary = mainApp; |
147 if (mainApp == null) return null; | 147 if (mainApp == null) return null; |
148 MethodElement mainFunction; | 148 MethodElement mainFunction; |
149 Element main = mainApp.findExported(Identifiers.main); | 149 Element main = mainApp.findExported(Identifiers.main); |
150 ErroneousElement errorElement = null; | 150 ErroneousElement errorElement = null; |
151 if (main == null) { | 151 if (main == null) { |
152 if (_compiler.options.analyzeOnly) { | 152 if (_compiler.options.analyzeOnly) { |
153 if (!_compiler.analyzeAll) { | 153 if (!_compiler.analyzeAll) { |
154 errorElement = new ErroneousElementX(MessageKind.CONSIDER_ANALYZE_ALL, | 154 errorElement = new ErroneousElementX(MessageKind.CONSIDER_ANALYZE_ALL, |
155 {'main': Identifiers.main}, Identifiers.main, mainApp); | 155 {'main': Identifiers.main}, Identifiers.main, mainApp); |
(...skipping 231 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 @override | 387 @override |
388 LibraryEntity get mainLibrary => _mainLibrary; | 388 LibraryEntity get mainLibrary => _mainLibrary; |
389 | 389 |
390 @override | 390 @override |
391 FunctionEntity get mainFunction => _mainFunction; | 391 FunctionEntity get mainFunction => _mainFunction; |
392 | 392 |
393 @override | 393 @override |
394 Iterable<LibraryEntity> get libraries => _compiler.libraryLoader.libraries; | 394 Iterable<LibraryEntity> get libraries => _compiler.libraryLoader.libraries; |
395 | 395 |
396 @override | 396 @override |
397 String getLibraryName(LibraryElement library) => library.libraryName; | 397 String getLibraryName(covariant LibraryElement library) => |
| 398 library.libraryName; |
398 | 399 |
399 @override | 400 @override |
400 ResolutionInterfaceType getThisType(ClassElement cls) { | 401 ResolutionInterfaceType getThisType(covariant ClassElement cls) { |
401 cls.ensureResolved(_resolution); | 402 cls.ensureResolved(_resolution); |
402 return cls.thisType; | 403 return cls.thisType; |
403 } | 404 } |
404 | 405 |
405 @override | 406 @override |
406 ResolutionInterfaceType getRawType(ClassElement cls) { | 407 ResolutionInterfaceType getRawType(covariant ClassElement cls) { |
407 cls.ensureResolved(_resolution); | 408 cls.ensureResolved(_resolution); |
408 return cls.rawType; | 409 return cls.rawType; |
409 } | 410 } |
410 | 411 |
411 @override | 412 @override |
412 bool isGenericClass(ClassEntity cls) { | 413 bool isGenericClass(ClassEntity cls) { |
413 return getThisType(cls).typeArguments.isNotEmpty; | 414 return getThisType(cls).typeArguments.isNotEmpty; |
414 } | 415 } |
415 | 416 |
416 @override | 417 @override |
417 bool isMixinApplication(ClassElement cls) { | 418 bool isMixinApplication(covariant ClassElement cls) { |
418 return cls.isMixinApplication; | 419 return cls.isMixinApplication; |
419 } | 420 } |
420 | 421 |
421 @override | 422 @override |
422 bool isUnnamedMixinApplication(ClassElement cls) { | 423 bool isUnnamedMixinApplication(covariant ClassElement cls) { |
423 return cls.isUnnamedMixinApplication; | 424 return cls.isUnnamedMixinApplication; |
424 } | 425 } |
425 | 426 |
426 @override | 427 @override |
427 ClassEntity getEffectiveMixinClass(ClassElement cls) { | 428 ClassEntity getEffectiveMixinClass(covariant ClassElement cls) { |
428 if (!cls.isMixinApplication) return null; | 429 if (!cls.isMixinApplication) return null; |
429 do { | 430 do { |
430 MixinApplicationElement mixinApplication = cls; | 431 MixinApplicationElement mixinApplication = cls; |
431 cls = mixinApplication.mixin; | 432 cls = mixinApplication.mixin; |
432 } while (cls.isMixinApplication); | 433 } while (cls.isMixinApplication); |
433 return cls; | 434 return cls; |
434 } | 435 } |
435 | 436 |
436 @override | 437 @override |
437 ResolutionDartType getTypeVariableBound(TypeVariableElement typeVariable) { | 438 ResolutionDartType getTypeVariableBound( |
| 439 covariant TypeVariableElement typeVariable) { |
438 return typeVariable.bound; | 440 return typeVariable.bound; |
439 } | 441 } |
440 | 442 |
441 @override | 443 @override |
442 ResolutionInterfaceType createInterfaceType( | 444 ResolutionInterfaceType createInterfaceType(covariant ClassElement cls, |
443 ClassElement cls, List<ResolutionDartType> typeArguments) { | 445 covariant List<ResolutionDartType> typeArguments) { |
444 cls.ensureResolved(_resolution); | 446 cls.ensureResolved(_resolution); |
445 return cls.thisType.createInstantiation(typeArguments); | 447 return cls.thisType.createInstantiation(typeArguments); |
446 } | 448 } |
447 | 449 |
448 @override | 450 @override |
449 MemberElement lookupClassMember(ClassElement cls, String name, | 451 MemberElement lookupClassMember(covariant ClassElement cls, String name, |
450 {bool setter: false, bool required: false}) { | 452 {bool setter: false, bool required: false}) { |
451 cls.ensureResolved(_resolution); | 453 cls.ensureResolved(_resolution); |
452 Element member = cls.implementation.lookupLocalMember(name); | 454 Element member = cls.implementation.lookupLocalMember(name); |
453 if (member != null && member.isAbstractField) { | 455 if (member != null && member.isAbstractField) { |
454 AbstractFieldElement abstractField = member; | 456 AbstractFieldElement abstractField = member; |
455 if (setter) { | 457 if (setter) { |
456 member = abstractField.setter; | 458 member = abstractField.setter; |
457 } else { | 459 } else { |
458 member = abstractField.getter; | 460 member = abstractField.getter; |
459 } | 461 } |
460 if (member == null && required) { | 462 if (member == null && required) { |
461 throw new SpannableAssertionFailure( | 463 throw new SpannableAssertionFailure( |
462 cls, | 464 cls, |
463 "The class '${cls.name}' does not contain required " | 465 "The class '${cls.name}' does not contain required " |
464 "${setter ? 'setter' : 'getter'}: '$name'."); | 466 "${setter ? 'setter' : 'getter'}: '$name'."); |
465 } | 467 } |
466 } | 468 } |
467 if (member == null && required) { | 469 if (member == null && required) { |
468 throw new SpannableAssertionFailure( | 470 throw new SpannableAssertionFailure( |
469 cls, | 471 cls, |
470 "The class '${cls.name}' does not " | 472 "The class '${cls.name}' does not " |
471 "contain required member: '$name'."); | 473 "contain required member: '$name'."); |
472 } | 474 } |
473 return member?.declaration; | 475 return member?.declaration; |
474 } | 476 } |
475 | 477 |
476 @override | 478 @override |
477 ConstructorElement lookupConstructor(ClassElement cls, String name, | 479 ConstructorElement lookupConstructor(covariant ClassElement cls, String name, |
478 {bool required: false}) { | 480 {bool required: false}) { |
479 cls.ensureResolved(_resolution); | 481 cls.ensureResolved(_resolution); |
480 ConstructorElement constructor = cls.implementation.lookupConstructor(name); | 482 ConstructorElement constructor = cls.implementation.lookupConstructor(name); |
481 // TODO(johnniwinther): Skip redirecting factories. | 483 // TODO(johnniwinther): Skip redirecting factories. |
482 if (constructor == null && required) { | 484 if (constructor == null && required) { |
483 throw new SpannableAssertionFailure( | 485 throw new SpannableAssertionFailure( |
484 cls, | 486 cls, |
485 "The class '${cls.name}' does not contain " | 487 "The class '${cls.name}' does not contain " |
486 "required constructor: '$name'."); | 488 "required constructor: '$name'."); |
487 } | 489 } |
488 return constructor?.declaration; | 490 return constructor?.declaration; |
489 } | 491 } |
490 | 492 |
491 @override | 493 @override |
492 void forEachClassMember( | 494 void forEachClassMember(covariant ClassElement cls, |
493 ClassElement cls, void f(ClassElement declarer, MemberElement member)) { | 495 void f(ClassElement declarer, MemberElement member)) { |
494 cls.ensureResolved(_resolution); | 496 cls.ensureResolved(_resolution); |
495 cls.forEachMember((ClassElement declarer, _member) { | 497 cls.forEachMember((ClassElement declarer, _member) { |
496 MemberElement member = _member; | 498 MemberElement member = _member; |
497 if (member.isSynthesized) return; | 499 if (member.isSynthesized) return; |
498 if (member.isMalformed) return; | 500 if (member.isMalformed) return; |
499 if (member.isConstructor) return; | 501 if (member.isConstructor) return; |
500 f(declarer, member); | 502 f(declarer, member); |
501 }, includeSuperAndInjectedMembers: true); | 503 }, includeSuperAndInjectedMembers: true); |
502 } | 504 } |
503 | 505 |
504 @override | 506 @override |
505 void forEachConstructor( | 507 void forEachConstructor( |
506 ClassElement cls, void f(ConstructorEntity constructor)) { | 508 covariant ClassElement cls, void f(ConstructorEntity constructor)) { |
507 cls.ensureResolved(_resolution); | 509 cls.ensureResolved(_resolution); |
508 for (ConstructorElement constructor in cls.implementation.constructors) { | 510 for (ConstructorElement constructor in cls.implementation.constructors) { |
509 _resolution.ensureResolved(constructor.declaration); | 511 _resolution.ensureResolved(constructor.declaration); |
510 if (constructor.isRedirectingFactory) continue; | 512 if (constructor.isRedirectingFactory) continue; |
511 f(constructor); | 513 f(constructor); |
512 } | 514 } |
513 } | 515 } |
514 | 516 |
515 @override | 517 @override |
516 ClassEntity getSuperClass(ClassElement cls, | 518 ClassEntity getSuperClass(covariant ClassElement cls, |
517 {bool skipUnnamedMixinApplications: false}) { | 519 {bool skipUnnamedMixinApplications: false}) { |
518 cls.ensureResolved(_resolution); | 520 cls.ensureResolved(_resolution); |
519 ClassElement superclass = cls.superclass; | 521 ClassElement superclass = cls.superclass; |
520 if (skipUnnamedMixinApplications) { | 522 if (skipUnnamedMixinApplications) { |
521 while (superclass != null && superclass.isUnnamedMixinApplication) { | 523 while (superclass != null && superclass.isUnnamedMixinApplication) { |
522 superclass = superclass.superclass; | 524 superclass = superclass.superclass; |
523 } | 525 } |
524 } | 526 } |
525 return superclass; | 527 return superclass; |
526 } | 528 } |
527 | 529 |
528 @override | 530 @override |
529 void forEachSupertype( | 531 void forEachSupertype( |
530 ClassElement cls, void f(ResolutionInterfaceType supertype)) { | 532 covariant ClassElement cls, void f(ResolutionInterfaceType supertype)) { |
531 cls.allSupertypes | 533 cls.allSupertypes.forEach((InterfaceType supertype) => f(supertype)); |
532 .forEach((ResolutionInterfaceType supertype) => f(supertype)); | |
533 } | 534 } |
534 | 535 |
535 @override | 536 @override |
536 void forEachMixin(ClassElement cls, void f(ClassElement mixin)) { | 537 void forEachMixin(covariant ClassElement cls, void f(ClassElement mixin)) { |
537 for (; cls != null; cls = cls.superclass) { | 538 for (; cls != null; cls = cls.superclass) { |
538 if (cls.isMixinApplication) { | 539 if (cls.isMixinApplication) { |
539 MixinApplicationElement mixinApplication = cls; | 540 MixinApplicationElement mixinApplication = cls; |
540 f(mixinApplication.mixin); | 541 f(mixinApplication.mixin); |
541 } | 542 } |
542 } | 543 } |
543 } | 544 } |
544 | 545 |
545 @override | 546 @override |
546 MemberElement lookupLibraryMember(LibraryElement library, String name, | 547 MemberElement lookupLibraryMember( |
| 548 covariant LibraryElement library, String name, |
547 {bool setter: false, bool required: false}) { | 549 {bool setter: false, bool required: false}) { |
548 Element member = library.implementation.findLocal(name); | 550 Element member = library.implementation.findLocal(name); |
549 if (member != null && member.isAbstractField) { | 551 if (member != null && member.isAbstractField) { |
550 AbstractFieldElement abstractField = member; | 552 AbstractFieldElement abstractField = member; |
551 if (setter) { | 553 if (setter) { |
552 member = abstractField.setter; | 554 member = abstractField.setter; |
553 } else { | 555 } else { |
554 member = abstractField.getter; | 556 member = abstractField.getter; |
555 } | 557 } |
556 if (member == null && required) { | 558 if (member == null && required) { |
557 throw new SpannableAssertionFailure( | 559 throw new SpannableAssertionFailure( |
558 library, | 560 library, |
559 "The library '${library.canonicalUri}' does not contain required " | 561 "The library '${library.canonicalUri}' does not contain required " |
560 "${setter ? 'setter' : 'getter'}: '$name'."); | 562 "${setter ? 'setter' : 'getter'}: '$name'."); |
561 } | 563 } |
562 } | 564 } |
563 if (member == null && required) { | 565 if (member == null && required) { |
564 throw new SpannableAssertionFailure( | 566 throw new SpannableAssertionFailure( |
565 member, | 567 member, |
566 "The library '${library.libraryName}' does not " | 568 "The library '${library.libraryName}' does not " |
567 "contain required member: '$name'."); | 569 "contain required member: '$name'."); |
568 } | 570 } |
569 return member?.declaration; | 571 return member?.declaration; |
570 } | 572 } |
571 | 573 |
572 @override | 574 @override |
573 void forEachLibraryMember( | 575 void forEachLibraryMember( |
574 LibraryElement library, void f(MemberEntity member)) { | 576 covariant LibraryElement library, void f(MemberEntity member)) { |
575 library.implementation.forEachLocalMember((Element element) { | 577 library.implementation.forEachLocalMember((Element element) { |
576 if (!element.isClass && !element.isTypedef) { | 578 if (!element.isClass && !element.isTypedef) { |
577 MemberElement member = element; | 579 MemberElement member = element; |
578 f(member); | 580 f(member); |
579 } | 581 } |
580 }); | 582 }); |
581 } | 583 } |
582 | 584 |
583 @override | 585 @override |
584 ClassElement lookupClass(LibraryElement library, String name, | 586 ClassElement lookupClass(covariant LibraryElement library, String name, |
585 {bool required: false}) { | 587 {bool required: false}) { |
586 ClassElement cls = library.implementation.findLocal(name); | 588 ClassElement cls = library.implementation.findLocal(name); |
587 if (cls == null && required) { | 589 if (cls == null && required) { |
588 throw new SpannableAssertionFailure( | 590 throw new SpannableAssertionFailure( |
589 library, | 591 library, |
590 "The library '${library.libraryName}' does not " | 592 "The library '${library.libraryName}' does not " |
591 "contain required class: '$name'."); | 593 "contain required class: '$name'."); |
592 } | 594 } |
593 return cls?.declaration; | 595 return cls?.declaration; |
594 } | 596 } |
595 | 597 |
596 @override | 598 @override |
597 void forEachClass(LibraryElement library, void f(ClassElement cls)) { | 599 void forEachClass(covariant LibraryElement library, void f(ClassEntity cls)) { |
598 library.implementation.forEachLocalMember((member) { | 600 library.implementation.forEachLocalMember((dynamic member) { |
599 if (member.isClass) { | 601 if (member.isClass) { |
600 f(member); | 602 ClassElement cls = member; |
| 603 f(cls); |
601 } | 604 } |
602 }); | 605 }); |
603 } | 606 } |
604 | 607 |
605 @override | 608 @override |
606 LibraryElement lookupLibrary(Uri uri, {bool required: false}) { | 609 LibraryElement lookupLibrary(Uri uri, {bool required: false}) { |
607 LibraryElement library = _libraryProvider.lookupLibrary(uri); | 610 LibraryElement library = _libraryProvider.lookupLibrary(uri); |
608 // If the script of the library is synthesized, the library does not exist | 611 // If the script of the library is synthesized, the library does not exist |
609 // and we do not try to load the helpers. | 612 // and we do not try to load the helpers. |
610 // | 613 // |
611 // This could for example happen if dart:async is disabled, then loading it | 614 // This could for example happen if dart:async is disabled, then loading it |
612 // should not try to find the given element. | 615 // should not try to find the given element. |
613 if (library != null && library.isSynthesized) { | 616 if (library != null && library.isSynthesized) { |
614 return null; | 617 return null; |
615 } | 618 } |
616 if (library == null && required) { | 619 if (library == null && required) { |
617 throw new SpannableAssertionFailure( | 620 throw new SpannableAssertionFailure( |
618 NO_LOCATION_SPANNABLE, "The library '${uri}' was not found."); | 621 NO_LOCATION_SPANNABLE, "The library '${uri}' was not found."); |
619 } | 622 } |
620 return library; | 623 return library; |
621 } | 624 } |
622 | 625 |
623 @override | 626 @override |
624 bool isDeferredLoadLibraryGetter(MemberElement member) { | 627 bool isDeferredLoadLibraryGetter(covariant MemberElement member) { |
625 return member.isDeferredLoaderGetter; | 628 return member.isDeferredLoaderGetter; |
626 } | 629 } |
627 | 630 |
628 @override | 631 @override |
629 ResolutionFunctionType getFunctionType(MethodElement method) { | 632 ResolutionFunctionType getFunctionType(covariant MethodElement method) { |
630 if (method is ConstructorBodyElement) { | 633 if (method is ConstructorBodyElement) { |
631 return method.constructor.type; | 634 return method.constructor.type; |
632 } | 635 } |
633 method.computeType(_resolution); | 636 method.computeType(_resolution); |
634 return method.type; | 637 return method.type; |
635 } | 638 } |
636 | 639 |
637 @override | 640 @override |
638 ResolutionFunctionType getLocalFunctionType(LocalFunctionElement function) { | 641 ResolutionFunctionType getLocalFunctionType( |
| 642 covariant LocalFunctionElement function) { |
639 return function.type; | 643 return function.type; |
640 } | 644 } |
641 | 645 |
642 @override | 646 @override |
643 ResolutionDartType getUnaliasedType(ResolutionDartType type) { | 647 ResolutionDartType getUnaliasedType(covariant ResolutionDartType type) { |
644 type.computeUnaliased(_resolution); | 648 type.computeUnaliased(_resolution); |
645 return type.unaliased; | 649 return type.unaliased; |
646 } | 650 } |
647 | 651 |
648 @override | 652 @override |
649 Iterable<ConstantValue> getMemberMetadata(MemberElement element) { | 653 Iterable<ConstantValue> getMemberMetadata(covariant MemberElement element) { |
650 List<ConstantValue> values = <ConstantValue>[]; | 654 List<ConstantValue> values = <ConstantValue>[]; |
651 _compiler.reporter.withCurrentElement(element, () { | 655 _compiler.reporter.withCurrentElement(element, () { |
652 for (MetadataAnnotation metadata in element.implementation.metadata) { | 656 for (MetadataAnnotation metadata in element.implementation.metadata) { |
653 metadata.ensureResolved(_compiler.resolution); | 657 metadata.ensureResolved(_compiler.resolution); |
654 assert(metadata.constant != null, | 658 assert(metadata.constant != null, |
655 failedAt(metadata, "Unevaluated metadata constant.")); | 659 failedAt(metadata, "Unevaluated metadata constant.")); |
656 ConstantValue value = | 660 ConstantValue value = |
657 _compiler.constants.getConstantValue(metadata.constant); | 661 _compiler.constants.getConstantValue(metadata.constant); |
658 values.add(value); | 662 values.add(value); |
659 } | 663 } |
(...skipping 10 matching lines...) Expand all Loading... |
670 /// annotations correspond to the correct element. | 674 /// annotations correspond to the correct element. |
671 class _ElementAnnotationProcessor implements AnnotationProcessor { | 675 class _ElementAnnotationProcessor implements AnnotationProcessor { |
672 Compiler _compiler; | 676 Compiler _compiler; |
673 | 677 |
674 _ElementAnnotationProcessor(this._compiler); | 678 _ElementAnnotationProcessor(this._compiler); |
675 | 679 |
676 CommonElements get _commonElements => _compiler.resolution.commonElements; | 680 CommonElements get _commonElements => _compiler.resolution.commonElements; |
677 | 681 |
678 /// Check whether [cls] has a `@Native(...)` annotation, and if so, set its | 682 /// Check whether [cls] has a `@Native(...)` annotation, and if so, set its |
679 /// native name from the annotation. | 683 /// native name from the annotation. |
680 void extractNativeAnnotations( | 684 void extractNativeAnnotations(covariant LibraryElement library, |
681 LibraryElement library, NativeBasicDataBuilder nativeBasicDataBuilder) { | 685 NativeBasicDataBuilder nativeBasicDataBuilder) { |
682 library.forEachLocalMember((Element element) { | 686 library.forEachLocalMember((Element element) { |
683 if (element.isClass) { | 687 if (element.isClass) { |
684 EagerAnnotationHandler.checkAnnotation(_compiler, element, | 688 EagerAnnotationHandler.checkAnnotation(_compiler, element, |
685 new NativeAnnotationHandler(nativeBasicDataBuilder)); | 689 new NativeAnnotationHandler(nativeBasicDataBuilder)); |
686 } | 690 } |
687 }); | 691 }); |
688 } | 692 } |
689 | 693 |
690 void extractJsInteropAnnotations( | 694 void extractJsInteropAnnotations(covariant LibraryElement library, |
691 LibraryElement library, NativeBasicDataBuilder nativeBasicDataBuilder) { | 695 NativeBasicDataBuilder nativeBasicDataBuilder) { |
692 bool checkJsInteropAnnotation(Element element) { | 696 bool checkJsInteropAnnotation(Element element) { |
693 return EagerAnnotationHandler.checkAnnotation( | 697 return EagerAnnotationHandler.checkAnnotation( |
694 _compiler, element, const JsInteropAnnotationHandler()); | 698 _compiler, element, const JsInteropAnnotationHandler()); |
695 } | 699 } |
696 | 700 |
697 if (checkJsInteropAnnotation(library)) { | 701 if (checkJsInteropAnnotation(library)) { |
698 nativeBasicDataBuilder.markAsJsInteropLibrary(library); | 702 nativeBasicDataBuilder.markAsJsInteropLibrary(library); |
699 } | 703 } |
700 library.forEachLocalMember((Element element) { | 704 library.forEachLocalMember((Element element) { |
701 if (element.isClass) { | 705 if (element.isClass) { |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 }); | 847 }); |
844 } else { | 848 } else { |
845 checkFunctionParameters(fn); | 849 checkFunctionParameters(fn); |
846 } | 850 } |
847 } | 851 } |
848 }); | 852 }); |
849 }); | 853 }); |
850 } | 854 } |
851 | 855 |
852 _compiler.libraryLoader.libraries | 856 _compiler.libraryLoader.libraries |
853 .forEach(processJsInteropAnnotationsInLibrary); | 857 .forEach((LibraryEntity l) => processJsInteropAnnotationsInLibrary(l)); |
854 } | 858 } |
855 } | 859 } |
856 | 860 |
857 /// Builder that creates work item necessary for the resolution of a | 861 /// Builder that creates work item necessary for the resolution of a |
858 /// [MemberElement]. | 862 /// [MemberElement]. |
859 class ResolutionWorkItemBuilder extends WorkItemBuilder { | 863 class ResolutionWorkItemBuilder extends WorkItemBuilder { |
860 final Resolution _resolution; | 864 final Resolution _resolution; |
861 | 865 |
862 ResolutionWorkItemBuilder(this._resolution); | 866 ResolutionWorkItemBuilder(this._resolution); |
863 | 867 |
864 @override | 868 @override |
865 WorkItem createWorkItem(MemberElement element) { | 869 WorkItem createWorkItem(MemberElement element) { |
866 assert(element.isDeclaration, failedAt(element)); | 870 assert(element.isDeclaration, failedAt(element)); |
867 if (element.isMalformed) return null; | 871 if (element.isMalformed) return null; |
868 | 872 |
869 assert(element is AnalyzableElement, | 873 assert(element is AnalyzableElement, |
870 failedAt(element, 'Element $element is not analyzable.')); | 874 failedAt(element, 'Element $element is not analyzable.')); |
871 return _resolution.createWorkItem(element); | 875 return _resolution.createWorkItem(element); |
872 } | 876 } |
873 } | 877 } |
OLD | NEW |