| 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 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 253 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 264 JavaScriptBackend get backend => compiler.backend; | 264 JavaScriptBackend get backend => compiler.backend; |
| 265 | 265 |
| 266 jsAst.PropertyAccess getHelperProperty(MethodElement helper) { | 266 jsAst.PropertyAccess getHelperProperty(MethodElement 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 ResolutionDartType 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( |
| 275 getHelperProperty(backend.commonElements.createRuntimeType), |
| 275 [js.quoteName(typeName)]); | 276 [js.quoteName(typeName)]); |
| 276 } | 277 } |
| 277 | 278 |
| 278 @override | 279 @override |
| 279 jsAst.Expression visitInterceptor(InterceptorConstantValue constant, [_]) { | 280 jsAst.Expression visitInterceptor(InterceptorConstantValue constant, [_]) { |
| 280 ClassElement interceptorClass = constant.cls; | 281 ClassElement interceptorClass = constant.cls; |
| 281 return backend.emitter.interceptorPrototypeAccess(interceptorClass); | 282 return backend.emitter.interceptorPrototypeAccess(interceptorClass); |
| 282 } | 283 } |
| 283 | 284 |
| 284 @override | 285 @override |
| (...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 321 String stripComments(String rawJavaScript) { | 322 String stripComments(String rawJavaScript) { |
| 322 return rawJavaScript.replaceAll(COMMENT_RE, ''); | 323 return rawJavaScript.replaceAll(COMMENT_RE, ''); |
| 323 } | 324 } |
| 324 | 325 |
| 325 jsAst.Expression maybeAddTypeArguments( | 326 jsAst.Expression maybeAddTypeArguments( |
| 326 ResolutionInterfaceType type, jsAst.Expression value) { | 327 ResolutionInterfaceType type, jsAst.Expression value) { |
| 327 if (type is ResolutionInterfaceType && | 328 if (type is ResolutionInterfaceType && |
| 328 !type.treatAsRaw && | 329 !type.treatAsRaw && |
| 329 backend.rtiNeed.classNeedsRti(type.element)) { | 330 backend.rtiNeed.classNeedsRti(type.element)) { |
| 330 return new jsAst.Call( | 331 return new jsAst.Call( |
| 331 getHelperProperty(backend.helpers.setRuntimeTypeInfo), | 332 getHelperProperty(backend.commonElements.setRuntimeTypeInfo), |
| 332 [value, _reifiedTypeArguments(type)]); | 333 [value, _reifiedTypeArguments(type)]); |
| 333 } | 334 } |
| 334 return value; | 335 return value; |
| 335 } | 336 } |
| 336 | 337 |
| 337 jsAst.Expression _reifiedTypeArguments(ResolutionInterfaceType type) { | 338 jsAst.Expression _reifiedTypeArguments(ResolutionInterfaceType type) { |
| 338 jsAst.Expression unexpected(ResolutionTypeVariableType variable) { | 339 jsAst.Expression unexpected(ResolutionTypeVariableType variable) { |
| 339 reporter.internalError( | 340 reporter.internalError( |
| 340 NO_LOCATION_SPANNABLE, | 341 NO_LOCATION_SPANNABLE, |
| 341 "Unexpected type variable '${variable.getStringAsDeclared(null)}'" | 342 "Unexpected type variable '${variable.getStringAsDeclared(null)}'" |
| 342 " in constant type '${type.getStringAsDeclared(null)}'"); | 343 " in constant type '${type.getStringAsDeclared(null)}'"); |
| 343 return null; | 344 return null; |
| 344 } | 345 } |
| 345 | 346 |
| 346 List<jsAst.Expression> arguments = <jsAst.Expression>[]; | 347 List<jsAst.Expression> arguments = <jsAst.Expression>[]; |
| 347 RuntimeTypesEncoder rtiEncoder = backend.rtiEncoder; | 348 RuntimeTypesEncoder rtiEncoder = backend.rtiEncoder; |
| 348 for (ResolutionDartType argument in type.typeArguments) { | 349 for (ResolutionDartType argument in type.typeArguments) { |
| 349 arguments.add(rtiEncoder.getTypeRepresentation(argument, unexpected)); | 350 arguments.add(rtiEncoder.getTypeRepresentation(argument, unexpected)); |
| 350 } | 351 } |
| 351 return new jsAst.ArrayInitializer(arguments); | 352 return new jsAst.ArrayInitializer(arguments); |
| 352 } | 353 } |
| 353 | 354 |
| 354 @override | 355 @override |
| 355 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { | 356 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { |
| 356 return constantReferenceGenerator(constant.referenced); | 357 return constantReferenceGenerator(constant.referenced); |
| 357 } | 358 } |
| 358 } | 359 } |
| OLD | NEW |