| 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 'dart:io'; | 7 import 'dart:io'; |
| 8 import 'dart:convert' show JSON; | 8 import 'dart:convert' show JSON; |
| 9 | 9 |
| 10 import '../../closure.dart' show ClosureTask, ClosureFieldElement; | 10 import '../../closure.dart' show ClosureTask, ClosureFieldElement; |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 | 736 |
| 737 if (isClosureBaseClass) { | 737 if (isClosureBaseClass) { |
| 738 // We add a special getter to allow for tearing off a closure from itself. | 738 // We add a special getter to allow for tearing off a closure from itself. |
| 739 js.Name name = _namer.getterForMember(Names.call); | 739 js.Name name = _namer.getterForMember(Names.call); |
| 740 js.Fun function = js.js('function() { return this; }'); | 740 js.Fun function = js.js('function() { return this; }'); |
| 741 callStubs.add(_buildStubMethod(name, function)); | 741 callStubs.add(_buildStubMethod(name, function)); |
| 742 } | 742 } |
| 743 | 743 |
| 744 // MixinApplications run through the members of their mixin. Here, we are | 744 // MixinApplications run through the members of their mixin. Here, we are |
| 745 // only interested in direct members. | 745 // only interested in direct members. |
| 746 if (!onlyForRti && !_elementEnvironment.isMixinApplication(cls)) { | 746 if (!onlyForRti && !_elementEnvironment.isUnnamedMixinApplication(cls)) { |
| 747 _elementEnvironment.forEachClassMember(cls, visitMember); | 747 _elementEnvironment.forEachClassMember(cls, visitMember); |
| 748 if (cls is ClassElement) { | 748 if (cls is ClassElement) { |
| 749 // TODO(johnniwinther): Support constructor bodies for entities. | 749 // TODO(johnniwinther): Support constructor bodies for entities. |
| 750 cls.forEachConstructorBody((ConstructorBodyElement constructorBody) => | 750 cls.forEachConstructorBody((ConstructorBodyElement constructorBody) => |
| 751 visitMember(cls, constructorBody)); | 751 visitMember(cls, constructorBody)); |
| 752 } | 752 } |
| 753 } | 753 } |
| 754 bool isInterceptedClass = _interceptorData.isInterceptedClass(cls); | 754 bool isInterceptedClass = _interceptorData.isInterceptedClass(cls); |
| 755 List<Field> instanceFields = onlyForRti | 755 List<Field> instanceFields = onlyForRti |
| 756 ? const <Field>[] | 756 ? const <Field>[] |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 795 | 795 |
| 796 js.Name name = _namer.className(cls); | 796 js.Name name = _namer.className(cls); |
| 797 String holderName = _namer.globalObjectForClass(cls); | 797 String holderName = _namer.globalObjectForClass(cls); |
| 798 // TODO(floitsch): we shouldn't update the registry in the middle of | 798 // TODO(floitsch): we shouldn't update the registry in the middle of |
| 799 // building a class. | 799 // building a class. |
| 800 Holder holder = _registry.registerHolder(holderName); | 800 Holder holder = _registry.registerHolder(holderName); |
| 801 bool isInstantiated = !_nativeData.isJsInteropClass(cls) && | 801 bool isInstantiated = !_nativeData.isJsInteropClass(cls) && |
| 802 _worldBuilder.directlyInstantiatedClasses.contains(cls); | 802 _worldBuilder.directlyInstantiatedClasses.contains(cls); |
| 803 | 803 |
| 804 Class result; | 804 Class result; |
| 805 if (_elementEnvironment.isMixinApplication(cls) && !onlyForRti) { | 805 if (_elementEnvironment.isUnnamedMixinApplication(cls) && !onlyForRti) { |
| 806 assert(!_nativeData.isNativeClass(cls)); | 806 assert(!_nativeData.isNativeClass(cls)); |
| 807 assert(methods.isEmpty); | 807 assert(methods.isEmpty); |
| 808 assert(!isClosureBaseClass); | 808 assert(!isClosureBaseClass); |
| 809 | 809 |
| 810 result = new MixinApplication( | 810 result = new MixinApplication( |
| 811 cls, | 811 cls, |
| 812 name, | 812 name, |
| 813 holder, | 813 holder, |
| 814 instanceFields, | 814 instanceFields, |
| 815 staticFieldsForReflection, | 815 staticFieldsForReflection, |
| (...skipping 364 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1180 Constant constant = new Constant(name, holder, constantValue); | 1180 Constant constant = new Constant(name, holder, constantValue); |
| 1181 _constants[constantValue] = constant; | 1181 _constants[constantValue] = constant; |
| 1182 } | 1182 } |
| 1183 } | 1183 } |
| 1184 | 1184 |
| 1185 Holder _registerStaticStateHolder() { | 1185 Holder _registerStaticStateHolder() { |
| 1186 return _registry.registerHolder(_namer.staticStateHolder, | 1186 return _registry.registerHolder(_namer.staticStateHolder, |
| 1187 isStaticStateHolder: true); | 1187 isStaticStateHolder: true); |
| 1188 } | 1188 } |
| 1189 } | 1189 } |
| OLD | NEW |