OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 dart2js.js_emitter.full_emitter; | 5 part of dart2js.js_emitter.full_emitter; |
6 | 6 |
7 // TODO(ahe): Share these with js_helper.dart. | 7 // TODO(ahe): Share these with js_helper.dart. |
8 const FUNCTION_INDEX = 0; | 8 const FUNCTION_INDEX = 0; |
9 const NAME_INDEX = 1; | 9 const NAME_INDEX = 1; |
10 const CALL_NAME_INDEX = 2; | 10 const CALL_NAME_INDEX = 2; |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 'allClasses': allClassesAccess, | 125 'allClasses': allClassesAccess, |
126 'debugFastObjects': DEBUG_FAST_OBJECTS, | 126 'debugFastObjects': DEBUG_FAST_OBJECTS, |
127 'isTreeShakingDisabled': backend.mirrorsData.isTreeShakingDisabled, | 127 'isTreeShakingDisabled': backend.mirrorsData.isTreeShakingDisabled, |
128 'precompiled': precompiledAccess, | 128 'precompiled': precompiledAccess, |
129 'finishedClassesAccess': finishedClassesAccess, | 129 'finishedClassesAccess': finishedClassesAccess, |
130 'needsMixinSupport': emitter.needsMixinSupport, | 130 'needsMixinSupport': emitter.needsMixinSupport, |
131 'needsNativeSupport': program.needsNativeSupport, | 131 'needsNativeSupport': program.needsNativeSupport, |
132 'enabledJsInterop': backend.nativeBasicData.isJsInteropUsed, | 132 'enabledJsInterop': backend.nativeBasicData.isJsInteropUsed, |
133 'jsInteropBoostrap': backend.jsInteropAnalysis.buildJsInteropBootstrap(), | 133 'jsInteropBoostrap': backend.jsInteropAnalysis.buildJsInteropBootstrap(), |
134 'isInterceptorClass': | 134 'isInterceptorClass': |
135 namer.operatorIs(compiler.commonElements.jsInterceptorClass), | 135 namer.operatorIs(closedWorld.commonElements.jsInterceptorClass), |
136 'isObject': namer.operatorIs(compiler.commonElements.objectClass), | 136 'isObject': namer.operatorIs(closedWorld.commonElements.objectClass), |
137 'specProperty': js.string(namer.nativeSpecProperty), | 137 'specProperty': js.string(namer.nativeSpecProperty), |
138 'trivialNsmHandlers': emitter.buildTrivialNsmHandlers(), | 138 'trivialNsmHandlers': emitter.buildTrivialNsmHandlers(), |
139 'hasRetainedMetadata': backend.mirrorsData.hasRetainedMetadata, | 139 'hasRetainedMetadata': backend.mirrorsData.hasRetainedMetadata, |
140 'types': typesAccess, | 140 'types': typesAccess, |
141 'objectClassName': js.quoteName(namer.runtimeTypeName( | 141 'objectClassName': js.quoteName(namer.runtimeTypeName( |
142 // ignore: UNNECESSARY_CAST | 142 // ignore: UNNECESSARY_CAST |
143 compiler.commonElements.objectClass as Entity)), | 143 closedWorld.commonElements.objectClass as Entity)), |
144 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo, | 144 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo, |
145 'usesMangledNames': compiler.commonElements.mirrorsLibrary != null || | 145 'usesMangledNames': closedWorld.commonElements.mirrorsLibrary != null || |
146 closedWorld.backendUsage.isFunctionApplyUsed, | 146 closedWorld.backendUsage.isFunctionApplyUsed, |
147 'tearOffCode': buildTearOffCode( | 147 'tearOffCode': buildTearOffCode( |
148 compiler.options, emitter, namer, compiler.commonElements), | 148 compiler.options, emitter, namer, closedWorld.commonElements), |
149 'nativeInfoHandler': nativeInfoHandler, | 149 'nativeInfoHandler': nativeInfoHandler, |
150 'operatorIsPrefix': js.string(namer.operatorIsPrefix), | 150 'operatorIsPrefix': js.string(namer.operatorIsPrefix), |
151 'deferredActionString': js.string(namer.deferredAction) | 151 'deferredActionString': js.string(namer.deferredAction) |
152 }; | 152 }; |
153 String skeleton = ''' | 153 String skeleton = ''' |
154 function $setupProgramName(programData, typesOffset) { | 154 function $setupProgramName(programData, typesOffset) { |
155 "use strict"; | 155 "use strict"; |
156 if (#needsClassSupport) { | 156 if (#needsClassSupport) { |
157 | 157 |
158 function generateAccessor(fieldDescriptor, accessors, cls) { | 158 function generateAccessor(fieldDescriptor, accessors, cls) { |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
849 (function() { | 849 (function() { |
850 var result = $array[$index]; | 850 var result = $array[$index]; |
851 if ($check) { | 851 if ($check) { |
852 throw new Error( | 852 throw new Error( |
853 name + ": expected value of type \'$type\' at index " + ($index) + | 853 name + ": expected value of type \'$type\' at index " + ($index) + |
854 " but got " + (typeof result)); | 854 " but got " + (typeof result)); |
855 } | 855 } |
856 return result; | 856 return result; |
857 })()'''; | 857 })()'''; |
858 } | 858 } |
OLD | NEW |