OLD | NEW |
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2015, 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 dev_compiler.src.codegen.js_codegen; | 5 library dev_compiler.src.codegen.js_codegen; |
6 | 6 |
7 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; | 7 import 'dart:collection' show HashSet, HashMap, SplayTreeSet; |
8 | 8 |
9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 9 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; | 10 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; |
(...skipping 1758 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1769 } | 1769 } |
1770 if (jsArgs != null) { | 1770 if (jsArgs != null) { |
1771 var genericName = _emitTopLevelName(element, suffix: '\$'); | 1771 var genericName = _emitTopLevelName(element, suffix: '\$'); |
1772 return js.call('#(#)', [genericName, jsArgs]); | 1772 return js.call('#(#)', [genericName, jsArgs]); |
1773 } | 1773 } |
1774 } | 1774 } |
1775 | 1775 |
1776 return _emitTopLevelName(element); | 1776 return _emitTopLevelName(element); |
1777 } | 1777 } |
1778 | 1778 |
1779 JS.Expression _emitTopLevelName(Element e, {String suffix : ''}) { | 1779 JS.Expression _emitTopLevelName(Element e, {String suffix: ''}) { |
1780 var libName = _libraryName(e.library); | 1780 var libName = _libraryName(e.library); |
1781 var nameExpr = _propertyName((_getJSExportName(e) ?? e.name) + suffix); | 1781 var nameExpr = _propertyName((_getJSExportName(e) ?? e.name) + suffix); |
1782 | 1782 |
1783 // Always qualify: | 1783 // Always qualify: |
1784 // * mutable top-level fields | 1784 // * mutable top-level fields |
1785 // * elements from other libraries | 1785 // * elements from other libraries |
1786 bool mutableTopLevel = e is TopLevelVariableElement && | 1786 bool mutableTopLevel = e is TopLevelVariableElement && |
1787 !e.isConst && | 1787 !e.isConst && |
1788 !_isFinalJSDecl(e.computeNode()); | 1788 !_isFinalJSDecl(e.computeNode()); |
1789 bool fromAnotherLibrary = e.library != currentLibrary; | 1789 bool fromAnotherLibrary = e.library != currentLibrary; |
(...skipping 1844 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3634 | 3634 |
3635 /// A special kind of element created by the compiler, signifying a temporary | 3635 /// A special kind of element created by the compiler, signifying a temporary |
3636 /// variable. These objects use instance equality, and should be shared | 3636 /// variable. These objects use instance equality, and should be shared |
3637 /// everywhere in the tree where they are treated as the same variable. | 3637 /// everywhere in the tree where they are treated as the same variable. |
3638 class TemporaryVariableElement extends LocalVariableElementImpl { | 3638 class TemporaryVariableElement extends LocalVariableElementImpl { |
3639 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); | 3639 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); |
3640 | 3640 |
3641 int get hashCode => identityHashCode(this); | 3641 int get hashCode => identityHashCode(this); |
3642 bool operator ==(Object other) => identical(this, other); | 3642 bool operator ==(Object other) => identical(this, other); |
3643 } | 3643 } |
OLD | NEW |