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 121 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
132 'specProperty': js.string(namer.nativeSpecProperty), | 132 'specProperty': js.string(namer.nativeSpecProperty), |
133 'trivialNsmHandlers': emitter.buildTrivialNsmHandlers(), | 133 'trivialNsmHandlers': emitter.buildTrivialNsmHandlers(), |
134 'hasRetainedMetadata': backend.mirrorsData.hasRetainedMetadata, | 134 'hasRetainedMetadata': backend.mirrorsData.hasRetainedMetadata, |
135 'types': typesAccess, | 135 'types': typesAccess, |
136 'objectClassName': js.quoteName(namer.runtimeTypeName( | 136 'objectClassName': js.quoteName(namer.runtimeTypeName( |
137 // ignore: UNNECESSARY_CAST | 137 // ignore: UNNECESSARY_CAST |
138 compiler.commonElements.objectClass as Entity)), | 138 compiler.commonElements.objectClass as Entity)), |
139 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo, | 139 'needsStructuredMemberInfo': emitter.needsStructuredMemberInfo, |
140 'usesMangledNames': compiler.commonElements.mirrorsLibrary != null || | 140 'usesMangledNames': compiler.commonElements.mirrorsLibrary != null || |
141 backend.backendUsage.isFunctionApplyUsed, | 141 backend.backendUsage.isFunctionApplyUsed, |
142 'tearOffCode': buildTearOffCode(backend), | 142 'tearOffCode': buildTearOffCode(compiler.options, backend.emitter.emitter, |
| 143 backend.namer, compiler.commonElements), |
143 'nativeInfoHandler': nativeInfoHandler, | 144 'nativeInfoHandler': nativeInfoHandler, |
144 'operatorIsPrefix': js.string(namer.operatorIsPrefix), | 145 'operatorIsPrefix': js.string(namer.operatorIsPrefix), |
145 'deferredActionString': js.string(namer.deferredAction) | 146 'deferredActionString': js.string(namer.deferredAction) |
146 }; | 147 }; |
147 String skeleton = ''' | 148 String skeleton = ''' |
148 function $setupProgramName(programData, typesOffset) { | 149 function $setupProgramName(programData, typesOffset) { |
149 "use strict"; | 150 "use strict"; |
150 if (#needsClassSupport) { | 151 if (#needsClassSupport) { |
151 | 152 |
152 function generateAccessor(fieldDescriptor, accessors, cls) { | 153 function generateAccessor(fieldDescriptor, accessors, cls) { |
(...skipping 690 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
843 (function() { | 844 (function() { |
844 var result = $array[$index]; | 845 var result = $array[$index]; |
845 if ($check) { | 846 if ($check) { |
846 throw new Error( | 847 throw new Error( |
847 name + ": expected value of type \'$type\' at index " + ($index) + | 848 name + ": expected value of type \'$type\' at index " + ($index) + |
848 " but got " + (typeof result)); | 849 " but got " + (typeof result)); |
849 } | 850 } |
850 return result; | 851 return result; |
851 })()'''; | 852 })()'''; |
852 } | 853 } |
OLD | NEW |