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

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

Issue 891673003: dart2js: Refactoring, documentation, and a few bugfixes in Namer class. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Bugfixes and test case repair Created 5 years, 10 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 | Annotate | Revision Log
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 part of js_backend; 5 part of js_backend;
6 6
7 class ConstantEmitter { 7 class ConstantEmitter {
8 ConstantReferenceEmitter _referenceEmitter; 8 ConstantReferenceEmitter _referenceEmitter;
9 ConstantLiteralEmitter _literalEmitter; 9 ConstantLiteralEmitter _literalEmitter;
10 10
(...skipping 338 matching lines...) Expand 10 before | Expand all | Expand 10 after
349 349
350 JavaScriptBackend get backend => compiler.backend; 350 JavaScriptBackend get backend => compiler.backend;
351 351
352 jsAst.PropertyAccess getHelperProperty(Element helper) { 352 jsAst.PropertyAccess getHelperProperty(Element helper) {
353 return backend.emitter.staticFunctionAccess(helper); 353 return backend.emitter.staticFunctionAccess(helper);
354 } 354 }
355 355
356 @override 356 @override
357 jsAst.Expression visitType(TypeConstantValue constant, [_]) { 357 jsAst.Expression visitType(TypeConstantValue constant, [_]) {
358 DartType type = constant.representedType; 358 DartType type = constant.representedType;
359 String name = namer.getRuntimeTypeName(type.element); 359 String name = namer.runtimeTypeName(type.element);
360 jsAst.Expression typeName = new jsAst.LiteralString("'$name'"); 360 jsAst.Expression typeName = new jsAst.LiteralString("'$name'");
361 return new jsAst.Call(getHelperProperty(backend.getCreateRuntimeType()), 361 return new jsAst.Call(getHelperProperty(backend.getCreateRuntimeType()),
362 [typeName]); 362 [typeName]);
363 } 363 }
364 364
365 @override 365 @override
366 jsAst.Expression visitInterceptor(InterceptorConstantValue constant, [_]) { 366 jsAst.Expression visitInterceptor(InterceptorConstantValue constant, [_]) {
367 ClassElement interceptorClass = constant.dispatchedType.element; 367 ClassElement interceptorClass = constant.dispatchedType.element;
368 return backend.emitter.interceptorPrototypeAccess(interceptorClass); 368 return backend.emitter.interceptorPrototypeAccess(interceptorClass);
369 } 369 }
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
413 [value, argumentList]); 413 [value, argumentList]);
414 } 414 }
415 return value; 415 return value;
416 } 416 }
417 417
418 @override 418 @override
419 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { 419 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) {
420 return constantEmitter.reference(constant.referenced); 420 return constantEmitter.reference(constant.referenced);
421 } 421 }
422 } 422 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698