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

Side by Side Diff: pkg/compiler/lib/src/js_backend/constant_emitter.dart

Issue 2603263002: Prefix resolution_types with Resolution. (Closed)
Patch Set: Rebased 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) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 import '../common.dart'; 5 import '../common.dart';
6 import '../compiler.dart' show Compiler; 6 import '../compiler.dart' show Compiler;
7 import '../constants/values.dart'; 7 import '../constants/values.dart';
8 import '../elements/resolution_types.dart'; 8 import '../elements/resolution_types.dart';
9 import '../elements/elements.dart'; 9 import '../elements/elements.dart';
10 import '../io/code_output.dart'; 10 import '../io/code_output.dart';
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after
262 } 262 }
263 263
264 JavaScriptBackend get backend => compiler.backend; 264 JavaScriptBackend get backend => compiler.backend;
265 265
266 jsAst.PropertyAccess getHelperProperty(Element helper) { 266 jsAst.PropertyAccess getHelperProperty(Element helper) {
267 return backend.emitter.staticFunctionAccess(helper); 267 return backend.emitter.staticFunctionAccess(helper);
268 } 268 }
269 269
270 @override 270 @override
271 jsAst.Expression visitType(TypeConstantValue constant, [_]) { 271 jsAst.Expression visitType(TypeConstantValue constant, [_]) {
272 DartType type = constant.representedType; 272 ResolutionDartType type = constant.representedType;
273 jsAst.Name typeName = namer.runtimeTypeName(type.element); 273 jsAst.Name typeName = namer.runtimeTypeName(type.element);
274 return new jsAst.Call(getHelperProperty(backend.helpers.createRuntimeType), 274 return new jsAst.Call(getHelperProperty(backend.helpers.createRuntimeType),
275 [js.quoteName(typeName)]); 275 [js.quoteName(typeName)]);
276 } 276 }
277 277
278 @override 278 @override
279 jsAst.Expression visitInterceptor(InterceptorConstantValue constant, [_]) { 279 jsAst.Expression visitInterceptor(InterceptorConstantValue constant, [_]) {
280 ClassElement interceptorClass = constant.dispatchedType.element; 280 ClassElement interceptorClass = constant.dispatchedType.element;
281 return backend.emitter.interceptorPrototypeAccess(interceptorClass); 281 return backend.emitter.interceptorPrototypeAccess(interceptorClass);
282 } 282 }
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
316 } 316 }
317 jsAst.New instantiation = new jsAst.New(constructor, fields); 317 jsAst.New instantiation = new jsAst.New(constructor, fields);
318 return instantiation; 318 return instantiation;
319 } 319 }
320 320
321 String stripComments(String rawJavaScript) { 321 String stripComments(String rawJavaScript) {
322 return rawJavaScript.replaceAll(COMMENT_RE, ''); 322 return rawJavaScript.replaceAll(COMMENT_RE, '');
323 } 323 }
324 324
325 jsAst.Expression maybeAddTypeArguments( 325 jsAst.Expression maybeAddTypeArguments(
326 InterfaceType type, jsAst.Expression value) { 326 ResolutionInterfaceType type, jsAst.Expression value) {
327 if (type is InterfaceType && 327 if (type is ResolutionInterfaceType &&
328 !type.treatAsRaw && 328 !type.treatAsRaw &&
329 backend.classNeedsRti(type.element)) { 329 backend.classNeedsRti(type.element)) {
330 return new jsAst.Call( 330 return new jsAst.Call(
331 getHelperProperty(backend.helpers.setRuntimeTypeInfo), 331 getHelperProperty(backend.helpers.setRuntimeTypeInfo),
332 [value, _reifiedTypeArguments(type)]); 332 [value, _reifiedTypeArguments(type)]);
333 } 333 }
334 return value; 334 return value;
335 } 335 }
336 336
337 jsAst.Expression _reifiedTypeArguments(InterfaceType type) { 337 jsAst.Expression _reifiedTypeArguments(ResolutionInterfaceType type) {
338 jsAst.Expression unexpected(TypeVariableType variable) { 338 jsAst.Expression unexpected(ResolutionTypeVariableType variable) {
339 reporter.internalError( 339 reporter.internalError(
340 NO_LOCATION_SPANNABLE, 340 NO_LOCATION_SPANNABLE,
341 "Unexpected type variable '${variable.getStringAsDeclared(null)}'" 341 "Unexpected type variable '${variable.getStringAsDeclared(null)}'"
342 " in constant type '${type.getStringAsDeclared(null)}'"); 342 " in constant type '${type.getStringAsDeclared(null)}'");
343 return null; 343 return null;
344 } 344 }
345 345
346 List<jsAst.Expression> arguments = <jsAst.Expression>[]; 346 List<jsAst.Expression> arguments = <jsAst.Expression>[];
347 RuntimeTypesEncoder rtiEncoder = backend.rtiEncoder; 347 RuntimeTypesEncoder rtiEncoder = backend.rtiEncoder;
348 for (DartType argument in type.typeArguments) { 348 for (ResolutionDartType argument in type.typeArguments) {
349 arguments.add(rtiEncoder.getTypeRepresentation(argument, unexpected)); 349 arguments.add(rtiEncoder.getTypeRepresentation(argument, unexpected));
350 } 350 }
351 return new jsAst.ArrayInitializer(arguments); 351 return new jsAst.ArrayInitializer(arguments);
352 } 352 }
353 353
354 @override 354 @override
355 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { 355 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) {
356 return constantReferenceGenerator(constant.referenced); 356 return constantReferenceGenerator(constant.referenced);
357 } 357 }
358 } 358 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698