OLD | NEW |
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 369 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
380 | 380 |
381 JavaScriptBackend get backend => compiler.backend; | 381 JavaScriptBackend get backend => compiler.backend; |
382 | 382 |
383 jsAst.PropertyAccess getHelperProperty(Element helper) { | 383 jsAst.PropertyAccess getHelperProperty(Element helper) { |
384 return backend.emitter.staticFunctionAccess(helper); | 384 return backend.emitter.staticFunctionAccess(helper); |
385 } | 385 } |
386 | 386 |
387 @override | 387 @override |
388 jsAst.Expression visitType(TypeConstantValue constant, [_]) { | 388 jsAst.Expression visitType(TypeConstantValue constant, [_]) { |
389 DartType type = constant.representedType; | 389 DartType type = constant.representedType; |
390 String name = namer.getRuntimeTypeName(type.element); | 390 String name = namer.runtimeTypeName(type.element); |
391 jsAst.Expression typeName = new jsAst.LiteralString("'$name'"); | 391 jsAst.Expression typeName = new jsAst.LiteralString("'$name'"); |
392 return new jsAst.Call(getHelperProperty(backend.getCreateRuntimeType()), | 392 return new jsAst.Call(getHelperProperty(backend.getCreateRuntimeType()), |
393 [typeName]); | 393 [typeName]); |
394 } | 394 } |
395 | 395 |
396 @override | 396 @override |
397 jsAst.Expression visitInterceptor(InterceptorConstantValue constant, [_]) { | 397 jsAst.Expression visitInterceptor(InterceptorConstantValue constant, [_]) { |
398 ClassElement interceptorClass = constant.dispatchedType.element; | 398 ClassElement interceptorClass = constant.dispatchedType.element; |
399 return backend.emitter.interceptorPrototypeAccess(interceptorClass); | 399 return backend.emitter.interceptorPrototypeAccess(interceptorClass); |
400 } | 400 } |
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 [value, argumentList]); | 444 [value, argumentList]); |
445 } | 445 } |
446 return value; | 446 return value; |
447 } | 447 } |
448 | 448 |
449 @override | 449 @override |
450 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { | 450 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { |
451 return constantEmitter.reference(constant.referenced); | 451 return constantEmitter.reference(constant.referenced); |
452 } | 452 } |
453 } | 453 } |
OLD | NEW |