| 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 1179 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1190 | 1190 |
| 1191 void visitMember(ClassElement enclosing, Element member) { | 1191 void visitMember(ClassElement enclosing, Element member) { |
| 1192 assert(invariant(classElement, member.isDeclaration)); | 1192 assert(invariant(classElement, member.isDeclaration)); |
| 1193 if (member.isInstanceMember()) { | 1193 if (member.isInstanceMember()) { |
| 1194 addInstanceMember(member, builder); | 1194 addInstanceMember(member, builder); |
| 1195 } | 1195 } |
| 1196 } | 1196 } |
| 1197 | 1197 |
| 1198 classElement.implementation.forEachMember( | 1198 classElement.implementation.forEachMember( |
| 1199 visitMember, | 1199 visitMember, |
| 1200 includeBackendMembers: true, | 1200 includeBackendMembers: true); |
| 1201 includeSuperMembers: false); | |
| 1202 | 1201 |
| 1203 if (identical(classElement, compiler.objectClass) | 1202 if (identical(classElement, compiler.objectClass) |
| 1204 && compiler.enabledNoSuchMethod) { | 1203 && compiler.enabledNoSuchMethod) { |
| 1205 // Emit the noSuchMethod handlers on the Object prototype now, | 1204 // Emit the noSuchMethod handlers on the Object prototype now, |
| 1206 // so that the code in the dynamicFunction helper can find | 1205 // so that the code in the dynamicFunction helper can find |
| 1207 // them. Note that this helper is invoked before analyzing the | 1206 // them. Note that this helper is invoked before analyzing the |
| 1208 // full JS script. | 1207 // full JS script. |
| 1209 if (!nativeEmitter.handleNoSuchMethod) { | 1208 if (!nativeEmitter.handleNoSuchMethod) { |
| 1210 emitNoSuchMethodHandlers(builder.addProperty); | 1209 emitNoSuchMethodHandlers(builder.addProperty); |
| 1211 } | 1210 } |
| (...skipping 130 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1342 // overridden fields. Right now, we rely on the ordering so the | 1341 // overridden fields. Right now, we rely on the ordering so the |
| 1343 // fields pulled in from mixins are replaced with the fields from | 1342 // fields pulled in from mixins are replaced with the fields from |
| 1344 // the class definition. | 1343 // the class definition. |
| 1345 | 1344 |
| 1346 // If a class is not instantiated then we add the field just so we can | 1345 // If a class is not instantiated then we add the field just so we can |
| 1347 // generate the field getter/setter dynamically. Since this is only | 1346 // generate the field getter/setter dynamically. Since this is only |
| 1348 // allowed on fields that are in [classElement] we don't need to visit | 1347 // allowed on fields that are in [classElement] we don't need to visit |
| 1349 // superclasses for non-instantiated classes. | 1348 // superclasses for non-instantiated classes. |
| 1350 classElement.implementation.forEachInstanceField( | 1349 classElement.implementation.forEachInstanceField( |
| 1351 visitField, | 1350 visitField, |
| 1352 includeBackendMembers: true, | 1351 includeSuperAndInjectedMembers: isInstantiated); |
| 1353 includeSuperMembers: isInstantiated); | |
| 1354 } | 1352 } |
| 1355 | 1353 |
| 1356 void generateGetter(Element member, String fieldName, String accessorName, | 1354 void generateGetter(Element member, String fieldName, String accessorName, |
| 1357 ClassBuilder builder) { | 1355 ClassBuilder builder) { |
| 1358 String getterName = namer.getterNameFromAccessorName(accessorName); | 1356 String getterName = namer.getterNameFromAccessorName(accessorName); |
| 1359 String receiver = backend.isInterceptorClass(member.getEnclosingClass()) | 1357 String receiver = backend.isInterceptorClass(member.getEnclosingClass()) |
| 1360 ? 'receiver' : 'this'; | 1358 ? 'receiver' : 'this'; |
| 1361 List<String> args = backend.isInterceptedMethod(member) | 1359 List<String> args = backend.isInterceptedMethod(member) |
| 1362 ? ['receiver'] | 1360 ? ['receiver'] |
| 1363 : []; | 1361 : []; |
| (...skipping 1787 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3151 """; | 3149 """; |
| 3152 const String HOOKS_API_USAGE = """ | 3150 const String HOOKS_API_USAGE = """ |
| 3153 // The code supports the following hooks: | 3151 // The code supports the following hooks: |
| 3154 // dartPrint(message) - if this function is defined it is called | 3152 // dartPrint(message) - if this function is defined it is called |
| 3155 // instead of the Dart [print] method. | 3153 // instead of the Dart [print] method. |
| 3156 // dartMainRunner(main) - if this function is defined, the Dart [main] | 3154 // dartMainRunner(main) - if this function is defined, the Dart [main] |
| 3157 // method will not be invoked directly. | 3155 // method will not be invoked directly. |
| 3158 // Instead, a closure that will invoke [main] is | 3156 // Instead, a closure that will invoke [main] is |
| 3159 // passed to [dartMainRunner]. | 3157 // passed to [dartMainRunner]. |
| 3160 """; | 3158 """; |
| OLD | NEW |