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 '../common_elements.dart'; | 6 import '../common_elements.dart'; |
7 import '../constants/values.dart'; | 7 import '../constants/values.dart'; |
8 import '../elements/elements.dart'; | 8 import '../elements/elements.dart'; |
| 9 import '../elements/types.dart' show TypeVariableType; |
9 import '../elements/entities.dart'; | 10 import '../elements/entities.dart'; |
10 import '../elements/resolution_types.dart'; | 11 import '../elements/resolution_types.dart'; |
11 import '../io/code_output.dart'; | 12 import '../io/code_output.dart'; |
12 import '../js/js.dart' as jsAst; | 13 import '../js/js.dart' as jsAst; |
13 import '../js/js.dart' show js; | 14 import '../js/js.dart' show js; |
14 import '../js_emitter/code_emitter_task.dart'; | 15 import '../js_emitter/code_emitter_task.dart'; |
15 import '../options.dart'; | 16 import '../options.dart'; |
16 import '../universe/world_builder.dart'; | 17 import '../universe/world_builder.dart'; |
17 import 'constant_system_javascript.dart'; | 18 import 'constant_system_javascript.dart'; |
18 import 'js_backend.dart'; | 19 import 'js_backend.dart'; |
(...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
337 !type.treatAsRaw && | 338 !type.treatAsRaw && |
338 _rtiNeed.classNeedsRti(type.element)) { | 339 _rtiNeed.classNeedsRti(type.element)) { |
339 return new jsAst.Call( | 340 return new jsAst.Call( |
340 getHelperProperty(_commonElements.setRuntimeTypeInfo), | 341 getHelperProperty(_commonElements.setRuntimeTypeInfo), |
341 [value, _reifiedTypeArguments(type)]); | 342 [value, _reifiedTypeArguments(type)]); |
342 } | 343 } |
343 return value; | 344 return value; |
344 } | 345 } |
345 | 346 |
346 jsAst.Expression _reifiedTypeArguments(ResolutionInterfaceType type) { | 347 jsAst.Expression _reifiedTypeArguments(ResolutionInterfaceType type) { |
347 jsAst.Expression unexpected(ResolutionTypeVariableType variable) { | 348 jsAst.Expression unexpected(TypeVariableType _variable) { |
| 349 ResolutionTypeVariableType variable = _variable; |
348 throw new SpannableAssertionFailure( | 350 throw new SpannableAssertionFailure( |
349 NO_LOCATION_SPANNABLE, | 351 NO_LOCATION_SPANNABLE, |
350 "Unexpected type variable '${variable.getStringAsDeclared(null)}'" | 352 "Unexpected type variable '${variable.getStringAsDeclared(null)}'" |
351 " in constant type '${type.getStringAsDeclared(null)}'"); | 353 " in constant type '${type.getStringAsDeclared(null)}'"); |
352 } | 354 } |
353 | 355 |
354 List<jsAst.Expression> arguments = <jsAst.Expression>[]; | 356 List<jsAst.Expression> arguments = <jsAst.Expression>[]; |
355 for (ResolutionDartType argument in type.typeArguments) { | 357 for (ResolutionDartType argument in type.typeArguments) { |
356 arguments.add( | 358 arguments.add( |
357 _rtiEncoder.getTypeRepresentation(_emitter, argument, unexpected)); | 359 _rtiEncoder.getTypeRepresentation(_emitter, argument, unexpected)); |
358 } | 360 } |
359 return new jsAst.ArrayInitializer(arguments); | 361 return new jsAst.ArrayInitializer(arguments); |
360 } | 362 } |
361 | 363 |
362 @override | 364 @override |
363 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { | 365 jsAst.Expression visitDeferred(DeferredConstantValue constant, [_]) { |
364 return constantReferenceGenerator(constant.referenced); | 366 return constantReferenceGenerator(constant.referenced); |
365 } | 367 } |
366 } | 368 } |
OLD | NEW |