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.new_js_emitter.emitter; | 5 library dart2js.new_js_emitter.emitter; |
6 | 6 |
7 import 'package:_internal/compiler/js_lib/shared/embedded_names.dart' show | 7 import 'package:_internal/compiler/js_lib/shared/embedded_names.dart' show |
8 JsBuiltin, | 8 JsBuiltin, |
9 METADATA, | 9 METADATA, |
10 TYPES; | 10 TYPES; |
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
133 | 133 |
134 @override | 134 @override |
135 js.Template templateForBuiltin(JsBuiltin builtin) { | 135 js.Template templateForBuiltin(JsBuiltin builtin) { |
136 String typeNameProperty = ModelEmitter.typeNameProperty; | 136 String typeNameProperty = ModelEmitter.typeNameProperty; |
137 | 137 |
138 switch (builtin) { | 138 switch (builtin) { |
139 case JsBuiltin.dartObjectConstructor: | 139 case JsBuiltin.dartObjectConstructor: |
140 return js.js.expressionTemplateYielding( | 140 return js.js.expressionTemplateYielding( |
141 typeAccess(_compiler.objectClass)); | 141 typeAccess(_compiler.objectClass)); |
142 | 142 |
143 case JsBuiltin.classNameFromIsCheckProperty: | 143 case JsBuiltin.isCheckPropertyToJsConstructorName: |
144 int isPrefixLength = namer.operatorIsPrefix.length; | 144 int isPrefixLength = namer.operatorIsPrefix.length; |
145 return js.js.expressionTemplateFor('#.substring($isPrefixLength)'); | 145 return js.js.expressionTemplateFor('#.substring($isPrefixLength)'); |
146 | 146 |
147 case JsBuiltin.isFunctionType: | 147 case JsBuiltin.isFunctionType: |
148 return _backend.rti.representationGenerator.templateForIsFunctionType; | 148 return _backend.rti.representationGenerator.templateForIsFunctionType; |
149 | 149 |
150 case JsBuiltin.typeName: | 150 case JsBuiltin.rawRtiToJsConstructorName: |
151 return js.js.expressionTemplateFor("#.$typeNameProperty"); | 151 return js.js.expressionTemplateFor("#.$typeNameProperty"); |
152 | 152 |
153 case JsBuiltin.rawRuntimeType: | 153 case JsBuiltin.rawRuntimeType: |
154 return js.js.expressionTemplateFor("#.constructor"); | 154 return js.js.expressionTemplateFor("#.constructor"); |
155 | 155 |
156 case JsBuiltin.createFunctionType: | 156 case JsBuiltin.createFunctionTypeRti: |
157 return _backend.rti.representationGenerator | 157 return _backend.rti.representationGenerator |
158 .templateForCreateFunctionType; | 158 .templateForCreateFunctionType; |
159 | 159 |
160 case JsBuiltin.isSubtype: | 160 case JsBuiltin.isSubtype: |
161 // TODO(floitsch): move this closer to where is-check properties are | 161 // TODO(floitsch): move this closer to where is-check properties are |
162 // built. | 162 // built. |
163 String isPrefix = namer.operatorIsPrefix; | 163 String isPrefix = namer.operatorIsPrefix; |
164 return js.js.expressionTemplateFor("('$isPrefix' + #) in #.prototype"); | 164 return js.js.expressionTemplateFor("('$isPrefix' + #) in #.prototype"); |
165 | 165 |
166 case JsBuiltin.isFunctionTypeRti: | 166 case JsBuiltin.isFunctionTypeRti: |
(...skipping 24 matching lines...) Expand all Loading... |
191 _compiler.internalError(NO_LOCATION_SPANNABLE, | 191 _compiler.internalError(NO_LOCATION_SPANNABLE, |
192 "Unhandled Builtin: $builtin"); | 192 "Unhandled Builtin: $builtin"); |
193 return null; | 193 return null; |
194 } | 194 } |
195 } | 195 } |
196 | 196 |
197 @override | 197 @override |
198 void invalidateCaches() { | 198 void invalidateCaches() { |
199 } | 199 } |
200 } | 200 } |
OLD | NEW |