| 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 part of js_backend; | 5 part of js_backend; |
| 6 | 6 |
| 7 /** | 7 /** |
| 8 * A function element that represents a closure call. The signature is copied | 8 * A function element that represents a closure call. The signature is copied |
| 9 * from the given element. | 9 * from the given element. |
| 10 */ | 10 */ |
| (...skipping 1114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1125 element.getLibrary(), | 1125 element.getLibrary(), |
| 1126 signature.requiredParameterCount + i, | 1126 signature.requiredParameterCount + i, |
| 1127 <SourceString>[])); | 1127 <SourceString>[])); |
| 1128 } | 1128 } |
| 1129 return selectors; | 1129 return selectors; |
| 1130 } | 1130 } |
| 1131 | 1131 |
| 1132 bool instanceFieldNeedsGetter(Element member) { | 1132 bool instanceFieldNeedsGetter(Element member) { |
| 1133 assert(member.isField()); | 1133 assert(member.isField()); |
| 1134 if (fieldAccessNeverThrows(member)) return false; | 1134 if (fieldAccessNeverThrows(member)) return false; |
| 1135 return compiler.codegenWorld.hasInvokedGetter(member, compiler); | 1135 return compiler.mirrorsEnabled |
| 1136 || compiler.codegenWorld.hasInvokedGetter(member, compiler); |
| 1136 } | 1137 } |
| 1137 | 1138 |
| 1138 bool instanceFieldNeedsSetter(Element member) { | 1139 bool instanceFieldNeedsSetter(Element member) { |
| 1139 assert(member.isField()); | 1140 assert(member.isField()); |
| 1140 if (fieldAccessNeverThrows(member)) return false; | 1141 if (fieldAccessNeverThrows(member)) return false; |
| 1141 return (!member.modifiers.isFinalOrConst()) | 1142 return (!member.modifiers.isFinalOrConst()) |
| 1142 && compiler.codegenWorld.hasInvokedSetter(member, compiler); | 1143 && (compiler.mirrorsEnabled |
| 1144 || compiler.codegenWorld.hasInvokedSetter(member, compiler)); |
| 1143 } | 1145 } |
| 1144 | 1146 |
| 1145 // We never access a field in a closure (a captured variable) without knowing | 1147 // We never access a field in a closure (a captured variable) without knowing |
| 1146 // that it is there. Therefore we don't need to use a getter (that will throw | 1148 // that it is there. Therefore we don't need to use a getter (that will throw |
| 1147 // if the getter method is missing), but can always access the field directly. | 1149 // if the getter method is missing), but can always access the field directly. |
| 1148 static bool fieldAccessNeverThrows(Element element) { | 1150 static bool fieldAccessNeverThrows(Element element) { |
| 1149 return element is ClosureFieldElement; | 1151 return element is ClosureFieldElement; |
| 1150 } | 1152 } |
| 1151 | 1153 |
| 1152 String compiledFieldName(Element member) { | 1154 String compiledFieldName(Element member) { |
| (...skipping 2230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3383 | 3385 |
| 3384 const String HOOKS_API_USAGE = """ | 3386 const String HOOKS_API_USAGE = """ |
| 3385 // The code supports the following hooks: | 3387 // The code supports the following hooks: |
| 3386 // dartPrint(message) - if this function is defined it is called | 3388 // dartPrint(message) - if this function is defined it is called |
| 3387 // instead of the Dart [print] method. | 3389 // instead of the Dart [print] method. |
| 3388 // dartMainRunner(main) - if this function is defined, the Dart [main] | 3390 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 3389 // method will not be invoked directly. | 3391 // method will not be invoked directly. |
| 3390 // Instead, a closure that will invoke [main] is | 3392 // Instead, a closure that will invoke [main] is |
| 3391 // passed to [dartMainRunner]. | 3393 // passed to [dartMainRunner]. |
| 3392 """; | 3394 """; |
| OLD | NEW |