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 import '../closure.dart'; | 5 import '../closure.dart'; |
6 import '../common.dart'; | 6 import '../common.dart'; |
7 import '../common_elements.dart'; | 7 import '../common_elements.dart'; |
8 import '../compiler.dart'; | 8 import '../compiler.dart'; |
9 import '../constants/values.dart'; | 9 import '../constants/values.dart'; |
10 import '../elements/elements.dart'; | 10 import '../elements/elements.dart'; |
(...skipping 525 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
536 * reflection locally when looking at the member: We lack the information by | 536 * reflection locally when looking at the member: We lack the information by |
537 * which classes a member is inherited. Called after resolution is complete. | 537 * which classes a member is inherited. Called after resolution is complete. |
538 * | 538 * |
539 * We filter out private libraries here, as their elements should not | 539 * We filter out private libraries here, as their elements should not |
540 * be visible by reflection unless some other interfaces makes them | 540 * be visible by reflection unless some other interfaces makes them |
541 * accessible. | 541 * accessible. |
542 */ | 542 */ |
543 void computeMembersNeededForReflection( | 543 void computeMembersNeededForReflection( |
544 ResolutionWorldBuilder worldBuilder, ClosedWorld closedWorld) { | 544 ResolutionWorldBuilder worldBuilder, ClosedWorld closedWorld) { |
545 if (_membersNeededForReflection != null) return; | 545 if (_membersNeededForReflection != null) return; |
546 if (closedWorld.commonElements.mirrorsLibrary == null) { | 546 if (!closedWorld.backendUsage.isMirrorsUsed) { |
547 createImmutableSets(); | 547 createImmutableSets(); |
548 return; | 548 return; |
549 } | 549 } |
550 _classesNeededForReflection = new Set<ClassElement>(); | 550 _classesNeededForReflection = new Set<ClassElement>(); |
551 _typedefsNeededForReflection = new Set<TypedefElement>(); | 551 _typedefsNeededForReflection = new Set<TypedefElement>(); |
552 _membersNeededForReflection = new Set<MemberElement>(); | 552 _membersNeededForReflection = new Set<MemberElement>(); |
553 _closuresNeededForReflection = new Set<LocalFunctionElement>(); | 553 _closuresNeededForReflection = new Set<LocalFunctionElement>(); |
554 | 554 |
555 // Compute a mapping from class to the closures it contains, so we | 555 // Compute a mapping from class to the closures it contains, so we |
556 // can include the correct ones when including the class. | 556 // can include the correct ones when including the class. |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
704 } | 704 } |
705 | 705 |
706 /// Called when `const Symbol(name)` is seen. | 706 /// Called when `const Symbol(name)` is seen. |
707 void registerConstSymbol(String name) { | 707 void registerConstSymbol(String name) { |
708 symbolsUsed.add(name); | 708 symbolsUsed.add(name); |
709 if (name.endsWith('=')) { | 709 if (name.endsWith('=')) { |
710 symbolsUsed.add(name.substring(0, name.length - 1)); | 710 symbolsUsed.add(name.substring(0, name.length - 1)); |
711 } | 711 } |
712 } | 712 } |
713 } | 713 } |
OLD | NEW |