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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/js_backend/backend.dart

Issue 23045004: Throw when reflecting on elements not covered by a `MirrorsUsed` annotation. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 7 years, 4 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) 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 part of js_backend; 5 part of js_backend;
6 6
7 class JavaScriptItemCompilationContext extends ItemCompilationContext { 7 class JavaScriptItemCompilationContext extends ItemCompilationContext {
8 final Set<HInstruction> boundsChecked; 8 final Set<HInstruction> boundsChecked;
9 9
10 JavaScriptItemCompilationContext() 10 JavaScriptItemCompilationContext()
(...skipping 1516 matching lines...) Expand 10 before | Expand all | Expand 10 after
1527 targetsUsed.add(field.getter); 1527 targetsUsed.add(field.getter);
1528 targetsUsed.add(field.setter); 1528 targetsUsed.add(field.setter);
1529 } else { 1529 } else {
1530 targetsUsed.add(target); 1530 targetsUsed.add(target);
1531 } 1531 }
1532 } 1532 }
1533 } 1533 }
1534 if (metaTargets != null) metaTargetsUsed.addAll(metaTargets); 1534 if (metaTargets != null) metaTargetsUsed.addAll(metaTargets);
1535 } 1535 }
1536 1536
1537 /// Returns `true` if [element] can be accessed through reflection, that is,
1538 /// is in the set of elements covered by a `MirrorsUsed` annotation.
1539 bool isAccessibleByReflection(Element element) {
ahe 2013/08/26 20:41:15 I'm not sure this method is different from isNeede
1540 if (hasInsufficientMirrorsUsed) return true;
1541 return isNeededForReflection(element);
1542 }
1543
1537 bool isNeededForReflection(Element element) { 1544 bool isNeededForReflection(Element element) {
1538 if (hasInsufficientMirrorsUsed) return isTreeShakingDisabled; 1545 if (hasInsufficientMirrorsUsed) return isTreeShakingDisabled;
1539 /// Record the name of [element] in [symbolsUsed]. Return true for 1546 /// Record the name of [element] in [symbolsUsed]. Return true for
1540 /// convenience. 1547 /// convenience.
1541 bool registerNameOf(Element element) { 1548 bool registerNameOf(Element element) {
1542 symbolsUsed.add(element.name.slowToString()); 1549 symbolsUsed.add(element.name.slowToString());
1543 if (element.isConstructor()) { 1550 if (element.isConstructor()) {
1544 symbolsUsed.add(element.getEnclosingClass().name.slowToString()); 1551 symbolsUsed.add(element.getEnclosingClass().name.slowToString());
1545 } 1552 }
1546 return true; 1553 return true;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1621 copy(constant.values); 1628 copy(constant.values);
1622 copy(constant.protoValue); 1629 copy(constant.protoValue);
1623 copy(constant); 1630 copy(constant);
1624 } 1631 }
1625 1632
1626 void visitConstructed(ConstructedConstant constant) { 1633 void visitConstructed(ConstructedConstant constant) {
1627 copy(constant.fields); 1634 copy(constant.fields);
1628 copy(constant); 1635 copy(constant);
1629 } 1636 }
1630 } 1637 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698