Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(59)

Side by Side Diff: pkg/compiler/lib/src/js_emitter/startup_emitter/emitter.dart

Issue 2653203002: Use entities in CommonElements interface. (Closed)
Patch Set: Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.startup_emitter; 5 library dart2js.js_emitter.startup_emitter;
6 6
7 import 'package:js_runtime/shared/embedded_names.dart' 7 import 'package:js_runtime/shared/embedded_names.dart'
8 show JsBuiltin, METADATA, STATIC_FUNCTION_NAME_TO_CLOSURE, TYPES; 8 show JsBuiltin, METADATA, STATIC_FUNCTION_NAME_TO_CLOSURE, TYPES;
9 9
10 import '../../common.dart'; 10 import '../../common.dart';
(...skipping 128 matching lines...) Expand 10 before | Expand all | Expand 10 after
139 js.Expression typeAccess(Element element) { 139 js.Expression typeAccess(Element element) {
140 return _globalPropertyAccess(element); 140 return _globalPropertyAccess(element);
141 } 141 }
142 142
143 @override 143 @override
144 js.Template templateForBuiltin(JsBuiltin builtin) { 144 js.Template templateForBuiltin(JsBuiltin builtin) {
145 String typeNameProperty = ModelEmitter.typeNameProperty; 145 String typeNameProperty = ModelEmitter.typeNameProperty;
146 146
147 switch (builtin) { 147 switch (builtin) {
148 case JsBuiltin.dartObjectConstructor: 148 case JsBuiltin.dartObjectConstructor:
149 return js.js.expressionTemplateYielding( 149 ClassElement objectClass = _compiler.commonElements.objectClass;
150 typeAccess(_compiler.commonElements.objectClass)); 150 return js.js.expressionTemplateYielding(typeAccess(objectClass));
151 151
152 case JsBuiltin.isCheckPropertyToJsConstructorName: 152 case JsBuiltin.isCheckPropertyToJsConstructorName:
153 int isPrefixLength = namer.operatorIsPrefix.length; 153 int isPrefixLength = namer.operatorIsPrefix.length;
154 return js.js.expressionTemplateFor('#.substring($isPrefixLength)'); 154 return js.js.expressionTemplateFor('#.substring($isPrefixLength)');
155 155
156 case JsBuiltin.isFunctionType: 156 case JsBuiltin.isFunctionType:
157 return _backend.rtiEncoder.templateForIsFunctionType; 157 return _backend.rtiEncoder.templateForIsFunctionType;
158 158
159 case JsBuiltin.rawRtiToJsConstructorName: 159 case JsBuiltin.rawRtiToJsConstructorName:
160 return js.js.expressionTemplateFor("#.$typeNameProperty"); 160 return js.js.expressionTemplateFor("#.$typeNameProperty");
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
198 @override 198 @override
199 int generatedSize(OutputUnit unit) { 199 int generatedSize(OutputUnit unit) {
200 Fragment key = _emitter.outputBuffers.keys 200 Fragment key = _emitter.outputBuffers.keys
201 .firstWhere((Fragment fragment) => fragment.outputUnit == unit); 201 .firstWhere((Fragment fragment) => fragment.outputUnit == unit);
202 return _emitter.outputBuffers[key].length; 202 return _emitter.outputBuffers[key].length;
203 } 203 }
204 204
205 @override 205 @override
206 void invalidateCaches() {} 206 void invalidateCaches() {}
207 } 207 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698