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 ClosureConversionTask, ClosureFieldElement; | 10 import '../../closure.dart' show ClosureConversionTask, ClosureFieldElement; |
(...skipping 765 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
776 cls: cls, | 776 cls: cls, |
777 visitStatics: true, | 777 visitStatics: true, |
778 isHolderInterceptedClass: isInterceptedClass); | 778 isHolderInterceptedClass: isInterceptedClass); |
779 | 779 |
780 TypeTestProperties typeTests = runtimeTypeGenerator.generateIsTests(cls, | 780 TypeTestProperties typeTests = runtimeTypeGenerator.generateIsTests(cls, |
781 storeFunctionTypeInMetadata: _storeFunctionTypesInMetadata); | 781 storeFunctionTypeInMetadata: _storeFunctionTypesInMetadata); |
782 | 782 |
783 List<StubMethod> checkedSetters = <StubMethod>[]; | 783 List<StubMethod> checkedSetters = <StubMethod>[]; |
784 List<StubMethod> isChecks = <StubMethod>[]; | 784 List<StubMethod> isChecks = <StubMethod>[]; |
785 if (_nativeData.isJsInteropClass(cls)) { | 785 if (_nativeData.isJsInteropClass(cls)) { |
786 typeTests.properties.forEach((js.Name name, js.Node code) { | 786 typeTests.forEachProperty(_sorter, (js.Name name, js.Node code) { |
787 _classes[_commonElements.jsInterceptorClass] | 787 _classes[_commonElements.jsInterceptorClass] |
788 .isChecks | 788 .isChecks |
789 .add(_buildStubMethod(name, code)); | 789 .add(_buildStubMethod(name, code)); |
790 }); | 790 }); |
791 } else { | 791 } else { |
792 for (Field field in instanceFields) { | 792 for (Field field in instanceFields) { |
793 if (field.needsCheckedSetter) { | 793 if (field.needsCheckedSetter) { |
794 assert(!field.needsUncheckedSetter); | 794 assert(!field.needsUncheckedSetter); |
795 FieldElement element = field.element; | 795 FieldElement element = field.element; |
796 js.Expression code = _generatedCode[element]; | 796 js.Expression code = _generatedCode[element]; |
797 assert(code != null); | 797 assert(code != null); |
798 js.Name name = _namer.deriveSetterName(field.accessorName); | 798 js.Name name = _namer.deriveSetterName(field.accessorName); |
799 checkedSetters.add(_buildStubMethod(name, code, element: element)); | 799 checkedSetters.add(_buildStubMethod(name, code, element: element)); |
800 } | 800 } |
801 } | 801 } |
802 | 802 |
803 typeTests.properties.forEach((js.Name name, js.Node code) { | 803 typeTests.forEachProperty(_sorter, (js.Name name, js.Node code) { |
804 isChecks.add(_buildStubMethod(name, code)); | 804 isChecks.add(_buildStubMethod(name, code)); |
805 }); | 805 }); |
806 } | 806 } |
807 | 807 |
808 js.Name name = _namer.className(cls); | 808 js.Name name = _namer.className(cls); |
809 String holderName = _namer.globalObjectForClass(cls); | 809 String holderName = _namer.globalObjectForClass(cls); |
810 // TODO(floitsch): we shouldn't update the registry in the middle of | 810 // TODO(floitsch): we shouldn't update the registry in the middle of |
811 // building a class. | 811 // building a class. |
812 Holder holder = _registry.registerHolder(holderName); | 812 Holder holder = _registry.registerHolder(holderName); |
813 bool isInstantiated = !_nativeData.isJsInteropClass(cls) && | 813 bool isInstantiated = !_nativeData.isJsInteropClass(cls) && |
(...skipping 379 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1193 Constant constant = new Constant(name, holder, constantValue); | 1193 Constant constant = new Constant(name, holder, constantValue); |
1194 _constants[constantValue] = constant; | 1194 _constants[constantValue] = constant; |
1195 } | 1195 } |
1196 } | 1196 } |
1197 | 1197 |
1198 Holder _registerStaticStateHolder() { | 1198 Holder _registerStaticStateHolder() { |
1199 return _registry.registerHolder(_namer.staticStateHolder, | 1199 return _registry.registerHolder(_namer.staticStateHolder, |
1200 isStaticStateHolder: true); | 1200 isStaticStateHolder: true); |
1201 } | 1201 } |
1202 } | 1202 } |
OLD | NEW |