| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 code_generator_dependencies; | 5 library code_generator_dependencies; |
| 6 | 6 |
| 7 import '../js_backend.dart'; | 7 import '../js_backend.dart'; |
| 8 import '../../dart2jslib.dart'; | 8 import '../../dart2jslib.dart'; |
| 9 import '../../js_emitter/js_emitter.dart'; | 9 import '../../js_emitter/js_emitter.dart'; |
| 10 import '../../js/js.dart' as js; | 10 import '../../js/js.dart' as js; |
| 11 import '../../constants/values.dart'; | 11 import '../../constants/values.dart'; |
| 12 import '../../elements/elements.dart'; | 12 import '../../elements/elements.dart'; |
| 13 import '../../constants/expressions.dart'; |
| 13 | 14 |
| 14 /// Encapsulates the dependencies of the function-compiler to the compiler, | 15 /// Encapsulates the dependencies of the function-compiler to the compiler, |
| 15 /// backend and emitter. | 16 /// backend and emitter. |
| 16 // TODO(sigurdm): Should be refactored when we have a better feeling for the | 17 // TODO(sigurdm): Should be refactored when we have a better feeling for the |
| 17 // interface. | 18 // interface. |
| 18 class Glue { | 19 class Glue { |
| 19 final Compiler _compiler; | 20 final Compiler _compiler; |
| 20 | 21 |
| 21 JavaScriptBackend get _backend => _compiler.backend; | 22 JavaScriptBackend get _backend => _compiler.backend; |
| 22 | 23 |
| 23 CodeEmitterTask get _emitter => _backend.emitter; | 24 CodeEmitterTask get _emitter => _backend.emitter; |
| 24 Namer get _namer => _backend.namer; | 25 Namer get _namer => _backend.namer; |
| 25 | 26 |
| 26 Glue(this._compiler); | 27 Glue(this._compiler); |
| 27 | 28 |
| 28 js.Expression constantReference(ConstantValue value) { | 29 js.Expression constantReference(ConstantValue value) { |
| 29 return _emitter.constantReference(value); | 30 return _emitter.constantReference(value); |
| 30 } | 31 } |
| 31 | 32 |
| 32 reportInternalError(String message) { | 33 reportInternalError(String message) { |
| 33 _compiler.internalError(_compiler.currentElement, message); | 34 _compiler.internalError(_compiler.currentElement, message); |
| 34 } | 35 } |
| 35 | 36 |
| 37 ConstantExpression getConstantForVariable(VariableElement variable) { |
| 38 return _backend.constants.getConstantForVariable(variable); |
| 39 } |
| 40 |
| 36 js.Expression elementAccess(Element element) { | 41 js.Expression elementAccess(Element element) { |
| 37 return _namer.elementAccess(element); | 42 return _namer.elementAccess(element); |
| 38 } | 43 } |
| 39 | 44 |
| 40 String safeVariableName(String name) { | 45 String safeVariableName(String name) { |
| 41 return _namer.safeVariableName(name); | 46 return _namer.safeVariableName(name); |
| 42 } | 47 } |
| 43 ClassElement get listClass => _compiler.listClass; | 48 ClassElement get listClass => _compiler.listClass; |
| 44 | 49 |
| 50 FunctionElement get identicalFunction => _compiler.identicalFunction; |
| 51 |
| 45 } | 52 } |
| OLD | NEW |