| OLD | NEW |
| 1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 library dart2js.js_emitter.metadata_collector; | 5 library dart2js.js_emitter.metadata_collector; |
| 6 | 6 |
| 7 import 'package:js_ast/src/precedence.dart' as js_precedence; | 7 import 'package:js_ast/src/precedence.dart' as js_precedence; |
| 8 | 8 |
| 9 import '../common.dart'; | 9 import '../common.dart'; |
| 10 import '../constants/values.dart'; | 10 import '../constants/values.dart'; |
| 11 import '../elements/resolution_types.dart' | |
| 12 show ResolutionDartType, ResolutionTypedefType; | |
| 13 import '../deferred_load.dart' show DeferredLoadTask, OutputUnit; | 11 import '../deferred_load.dart' show DeferredLoadTask, OutputUnit; |
| 14 import '../elements/elements.dart' | 12 import '../elements/elements.dart' |
| 15 show | 13 show |
| 16 ClassElement, | 14 ClassElement, |
| 17 ConstructorElement, | 15 ConstructorElement, |
| 18 Element, | 16 Element, |
| 19 FieldElement, | 17 FieldElement, |
| 20 FunctionSignature, | 18 FunctionSignature, |
| 21 LibraryElement, | 19 LibraryElement, |
| 22 MemberElement, | 20 MemberElement, |
| 23 MethodElement, | 21 MethodElement, |
| 24 MetadataAnnotation, | 22 MetadataAnnotation, |
| 25 ParameterElement; | 23 ParameterElement; |
| 26 import '../elements/entities.dart'; | 24 import '../elements/entities.dart'; |
| 25 import '../elements/resolution_types.dart' |
| 26 show ResolutionDartType, ResolutionTypedefType; |
| 27 import '../elements/types.dart'; |
| 27 import '../js/js.dart' as jsAst; | 28 import '../js/js.dart' as jsAst; |
| 28 import '../js/js.dart' show js; | 29 import '../js/js.dart' show js; |
| 29 import '../js_backend/constant_handler_javascript.dart'; | 30 import '../js_backend/constant_handler_javascript.dart'; |
| 30 import '../js_backend/mirrors_data.dart'; | 31 import '../js_backend/mirrors_data.dart'; |
| 31 import '../js_backend/runtime_types.dart' show RuntimeTypesEncoder; | 32 import '../js_backend/runtime_types.dart' show RuntimeTypesEncoder; |
| 32 import '../js_backend/type_variable_handler.dart' | 33 import '../js_backend/type_variable_handler.dart' |
| 33 show TypeVariableCodegenAnalysis; | 34 show TypeVariableCodegenAnalysis; |
| 34 import '../options.dart'; | 35 import '../options.dart'; |
| 35 | 36 |
| 36 import 'code_emitter_task.dart' show Emitter; | 37 import 'code_emitter_task.dart' show Emitter; |
| (...skipping 283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 320 | 321 |
| 321 jsAst.Expression reifyMetadata(MetadataAnnotation annotation) { | 322 jsAst.Expression reifyMetadata(MetadataAnnotation annotation) { |
| 322 ConstantValue constant = _constants.getConstantValueForMetadata(annotation); | 323 ConstantValue constant = _constants.getConstantValueForMetadata(annotation); |
| 323 if (constant == null) { | 324 if (constant == null) { |
| 324 reporter.internalError(annotation, 'Annotation value is null.'); | 325 reporter.internalError(annotation, 'Annotation value is null.'); |
| 325 return null; | 326 return null; |
| 326 } | 327 } |
| 327 return _addGlobalMetadata(_emitter.constantReference(constant)); | 328 return _addGlobalMetadata(_emitter.constantReference(constant)); |
| 328 } | 329 } |
| 329 | 330 |
| 330 jsAst.Expression reifyType(ResolutionDartType type, | 331 jsAst.Expression reifyType(DartType type, {ignoreTypeVariables: false}) { |
| 331 {ignoreTypeVariables: false}) { | |
| 332 return reifyTypeForOutputUnit(type, _deferredLoadTask.mainOutputUnit, | 332 return reifyTypeForOutputUnit(type, _deferredLoadTask.mainOutputUnit, |
| 333 ignoreTypeVariables: ignoreTypeVariables); | 333 ignoreTypeVariables: ignoreTypeVariables); |
| 334 } | 334 } |
| 335 | 335 |
| 336 jsAst.Expression reifyTypeForOutputUnit( | 336 jsAst.Expression reifyTypeForOutputUnit( |
| 337 ResolutionDartType type, OutputUnit outputUnit, | 337 ResolutionDartType type, OutputUnit outputUnit, |
| 338 {ignoreTypeVariables: false}) { | 338 {ignoreTypeVariables: false}) { |
| 339 return addTypeInOutputUnit(type, outputUnit, | 339 return addTypeInOutputUnit(type, outputUnit, |
| 340 ignoreTypeVariables: ignoreTypeVariables); | 340 ignoreTypeVariables: ignoreTypeVariables); |
| 341 } | 341 } |
| (...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 if (token is _ForwardingMetadataEntry && !token.isBound) { | 471 if (token is _ForwardingMetadataEntry && !token.isBound) { |
| 472 _foundUnboundToken = true; | 472 _foundUnboundToken = true; |
| 473 } | 473 } |
| 474 } | 474 } |
| 475 | 475 |
| 476 bool findUnboundPlaceholders(jsAst.Node node) { | 476 bool findUnboundPlaceholders(jsAst.Node node) { |
| 477 node.accept(this); | 477 node.accept(this); |
| 478 return _foundUnboundToken; | 478 return _foundUnboundToken; |
| 479 } | 479 } |
| 480 } | 480 } |
| OLD | NEW |