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 10 matching lines...) Expand all Loading... |
21 InterceptorStubGenerator, | 21 InterceptorStubGenerator, |
22 MainCallStubGenerator, | 22 MainCallStubGenerator, |
23 ParameterStubGenerator, | 23 ParameterStubGenerator, |
24 RuntimeTypeGenerator, | 24 RuntimeTypeGenerator, |
25 TypeTestProperties; | 25 TypeTestProperties; |
26 | 26 |
27 import '../elements/elements.dart' show ParameterElement, MethodElement; | 27 import '../elements/elements.dart' show ParameterElement, MethodElement; |
28 | 28 |
29 import '../universe/universe.dart' show Universe; | 29 import '../universe/universe.dart' show Universe; |
30 import '../deferred_load.dart' show DeferredLoadTask, OutputUnit; | 30 import '../deferred_load.dart' show DeferredLoadTask, OutputUnit; |
31 import '../constants/expressions.dart' show ConstantExpression, ConstantValue; | |
32 | 31 |
33 part 'registry.dart'; | 32 part 'registry.dart'; |
34 | 33 |
35 class ProgramBuilder { | 34 class ProgramBuilder { |
36 final Compiler _compiler; | 35 final Compiler _compiler; |
37 final Namer namer; | 36 final Namer namer; |
38 final CodeEmitterTask _task; | 37 final CodeEmitterTask _task; |
39 | 38 |
40 final Registry _registry; | 39 final Registry _registry; |
41 | 40 |
(...skipping 445 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 | 486 |
488 // TODO(kasperl): Figure out under which conditions code is null. | 487 // TODO(kasperl): Figure out under which conditions code is null. |
489 if (code == null) return null; | 488 if (code == null) return null; |
490 | 489 |
491 bool canTearOff = false; | 490 bool canTearOff = false; |
492 String tearOffName; | 491 String tearOffName; |
493 bool isClosure = false; | 492 bool isClosure = false; |
494 bool isNotApplyTarget = !element.isFunction || element.isAccessor; | 493 bool isNotApplyTarget = !element.isFunction || element.isAccessor; |
495 | 494 |
496 bool canBeReflected = _methodCanBeReflected(element); | 495 bool canBeReflected = _methodCanBeReflected(element); |
497 bool needsStubs = _methodNeedsStubs(element); | |
498 bool canBeApplied = _methodCanBeApplied(element); | 496 bool canBeApplied = _methodCanBeApplied(element); |
499 | 497 |
500 String aliasName = backend.isAliasedSuperMember(element) | 498 String aliasName = backend.isAliasedSuperMember(element) |
501 ? namer.aliasedSuperMemberPropertyName(element) | 499 ? namer.aliasedSuperMemberPropertyName(element) |
502 : null; | 500 : null; |
503 | 501 |
504 if (isNotApplyTarget) { | 502 if (isNotApplyTarget) { |
505 canTearOff = false; | 503 canTearOff = false; |
506 } else { | 504 } else { |
507 if (element.enclosingClass.isClosure) { | 505 if (element.enclosingClass.isClosure) { |
(...skipping 247 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
755 _registry.registerConstant(outputUnit, constantValue); | 753 _registry.registerConstant(outputUnit, constantValue); |
756 assert(!_constants.containsKey(constantValue)); | 754 assert(!_constants.containsKey(constantValue)); |
757 String name = namer.constantName(constantValue); | 755 String name = namer.constantName(constantValue); |
758 String constantObject = namer.globalObjectForConstant(constantValue); | 756 String constantObject = namer.globalObjectForConstant(constantValue); |
759 Holder holder = _registry.registerHolder(constantObject); | 757 Holder holder = _registry.registerHolder(constantObject); |
760 Constant constant = new Constant(name, holder, constantValue); | 758 Constant constant = new Constant(name, holder, constantValue); |
761 _constants[constantValue] = constant; | 759 _constants[constantValue] = constant; |
762 } | 760 } |
763 } | 761 } |
764 } | 762 } |
OLD | NEW |