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

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, 3 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 1537 matching lines...) Expand 10 before | Expand all | Expand 10 after
1548 targetsUsed.add(field.getter); 1548 targetsUsed.add(field.getter);
1549 targetsUsed.add(field.setter); 1549 targetsUsed.add(field.setter);
1550 } else { 1550 } else {
1551 targetsUsed.add(target); 1551 targetsUsed.add(target);
1552 } 1552 }
1553 } 1553 }
1554 } 1554 }
1555 if (metaTargets != null) metaTargetsUsed.addAll(metaTargets); 1555 if (metaTargets != null) metaTargetsUsed.addAll(metaTargets);
1556 } 1556 }
1557 1557
1558 /// Returns `true` if [element] can be accessed through reflection, that is,
1559 /// is in the set of elements covered by a `MirrorsUsed` annotation.
ngeoffray 2013/08/29 07:45:49 Please also add a comment for isNeededForReflectio
karlklose 2013/08/29 15:33:37 Done.
1560 bool isAccessibleByReflection(Element element) {
1561 if (hasInsufficientMirrorsUsed) return true;
1562 return isNeededForReflection(element);
1563 }
1564
1558 bool isNeededForReflection(Element element) { 1565 bool isNeededForReflection(Element element) {
1559 if (hasInsufficientMirrorsUsed) return isTreeShakingDisabled; 1566 if (hasInsufficientMirrorsUsed) return isTreeShakingDisabled;
1560 /// Record the name of [element] in [symbolsUsed]. Return true for 1567 /// Record the name of [element] in [symbolsUsed]. Return true for
1561 /// convenience. 1568 /// convenience.
1562 bool registerNameOf(Element element) { 1569 bool registerNameOf(Element element) {
1563 symbolsUsed.add(element.name.slowToString()); 1570 symbolsUsed.add(element.name.slowToString());
1564 if (element.isConstructor()) { 1571 if (element.isConstructor()) {
1565 symbolsUsed.add(element.getEnclosingClass().name.slowToString()); 1572 symbolsUsed.add(element.getEnclosingClass().name.slowToString());
1566 } 1573 }
1567 return true; 1574 return true;
(...skipping 74 matching lines...) Expand 10 before | Expand all | Expand 10 after
1642 copy(constant.values); 1649 copy(constant.values);
1643 copy(constant.protoValue); 1650 copy(constant.protoValue);
1644 copy(constant); 1651 copy(constant);
1645 } 1652 }
1646 1653
1647 void visitConstructed(ConstructedConstant constant) { 1654 void visitConstructed(ConstructedConstant constant) {
1648 copy(constant.fields); 1655 copy(constant.fields);
1649 copy(constant); 1656 copy(constant);
1650 } 1657 }
1651 } 1658 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698