OLD | NEW |
---|---|
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library dart2js.js_emitter.program_builder; | 5 library dart2js.js_emitter.program_builder; |
6 | 6 |
7 import 'js_emitter.dart' show computeMixinClass; | 7 import 'js_emitter.dart' show computeMixinClass; |
8 import 'model.dart'; | 8 import 'model.dart'; |
9 | 9 |
10 import '../common.dart'; | 10 import '../common.dart'; |
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
346 if (element == _compiler.objectClass) { | 346 if (element == _compiler.objectClass) { |
347 Map<String, Selector> selectors = | 347 Map<String, Selector> selectors = |
348 classStubGenerator.computeSelectorsForNsmHandlers(); | 348 classStubGenerator.computeSelectorsForNsmHandlers(); |
349 selectors.forEach((String name, Selector selector) { | 349 selectors.forEach((String name, Selector selector) { |
350 noSuchMethodStubs | 350 noSuchMethodStubs |
351 .add(classStubGenerator.generateStubForNoSuchMethod(name, | 351 .add(classStubGenerator.generateStubForNoSuchMethod(name, |
352 selector)); | 352 selector)); |
353 }); | 353 }); |
354 } | 354 } |
355 | 355 |
356 if (element == backend.closureClass) { | |
357 // We add a special getter here to allow for tearing off a closure from | |
358 // itself. | |
359 String name = namer.getterNameFromAccessorName( | |
360 namer.getMappedInstanceName(Compiler.CALL_OPERATOR_NAME)); | |
361 js.Fun function = js.js('function() { return this; }'); | |
362 callStubs.add(_buildStubMethod(name, function)); | |
363 } | |
356 ClassElement implementation = element.implementation; | 364 ClassElement implementation = element.implementation; |
floitsch
2015/02/13 12:38:28
New line before.
zarah
2015/02/13 12:52:18
Done.
| |
357 | 365 |
358 // MixinApplications run through the members of their mixin. Here, we are | 366 // MixinApplications run through the members of their mixin. Here, we are |
359 // only interested in direct members. | 367 // only interested in direct members. |
360 if (!onlyForRti && !element.isMixinApplication) { | 368 if (!onlyForRti && !element.isMixinApplication) { |
361 implementation.forEachMember(visitMember, includeBackendMembers: true); | 369 implementation.forEachMember(visitMember, includeBackendMembers: true); |
362 } | 370 } |
363 | 371 |
364 List<Field> instanceFields = | 372 List<Field> instanceFields = |
365 onlyForRti ? const <Field>[] : _buildFields(element, false); | 373 onlyForRti ? const <Field>[] : _buildFields(element, false); |
366 List<Field> staticFieldsForReflection = | 374 List<Field> staticFieldsForReflection = |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
658 _registry.registerConstant(outputUnit, constantValue); | 666 _registry.registerConstant(outputUnit, constantValue); |
659 assert(!_constants.containsKey(constantValue)); | 667 assert(!_constants.containsKey(constantValue)); |
660 String name = namer.constantName(constantValue); | 668 String name = namer.constantName(constantValue); |
661 String constantObject = namer.globalObjectForConstant(constantValue); | 669 String constantObject = namer.globalObjectForConstant(constantValue); |
662 Holder holder = _registry.registerHolder(constantObject); | 670 Holder holder = _registry.registerHolder(constantObject); |
663 Constant constant = new Constant(name, holder, constantValue); | 671 Constant constant = new Constant(name, holder, constantValue); |
664 _constants[constantValue] = constant; | 672 _constants[constantValue] = constant; |
665 } | 673 } |
666 } | 674 } |
667 } | 675 } |
OLD | NEW |