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; | 7 import 'dart:collection' show HashSet, HashMap; |
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 788 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
799 | 799 |
800 @override | 800 @override |
801 JS.Statement visitRedirectingConstructorInvocation( | 801 JS.Statement visitRedirectingConstructorInvocation( |
802 RedirectingConstructorInvocation node) { | 802 RedirectingConstructorInvocation node) { |
803 var name = _constructorName(node.staticElement); | 803 var name = _constructorName(node.staticElement); |
804 return js.statement('this.#(#);', [name, _visit(node.argumentList)]); | 804 return js.statement('this.#(#);', [name, _visit(node.argumentList)]); |
805 } | 805 } |
806 | 806 |
807 JS.Statement _superConstructorCall(ClassElement element, | 807 JS.Statement _superConstructorCall(ClassElement element, |
808 [SuperConstructorInvocation node]) { | 808 [SuperConstructorInvocation node]) { |
809 | |
810 ConstructorElement superCtor; | 809 ConstructorElement superCtor; |
811 if (node != null) { | 810 if (node != null) { |
812 superCtor = node.staticElement; | 811 superCtor = node.staticElement; |
813 } else { | 812 } else { |
814 // Get the supertype's unnamed constructor. | 813 // Get the supertype's unnamed constructor. |
815 superCtor = element.supertype.element.unnamedConstructor; | 814 superCtor = element.supertype.element.unnamedConstructor; |
816 if (superCtor == null) { | 815 if (superCtor == null) { |
817 // This will only happen if the code has errors: | 816 // This will only happen if the code has errors: |
818 // we're trying to generate an implicit constructor for a type where | 817 // we're trying to generate an implicit constructor for a type where |
819 // we don't have a default constructor in the supertype. | 818 // we don't have a default constructor in the supertype. |
(...skipping 1827 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2647 | 2646 |
2648 /// A special kind of element created by the compiler, signifying a temporary | 2647 /// A special kind of element created by the compiler, signifying a temporary |
2649 /// variable. These objects use instance equality, and should be shared | 2648 /// variable. These objects use instance equality, and should be shared |
2650 /// everywhere in the tree where they are treated as the same variable. | 2649 /// everywhere in the tree where they are treated as the same variable. |
2651 class TemporaryVariableElement extends LocalVariableElementImpl { | 2650 class TemporaryVariableElement extends LocalVariableElementImpl { |
2652 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); | 2651 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); |
2653 | 2652 |
2654 int get hashCode => identityHashCode(this); | 2653 int get hashCode => identityHashCode(this); |
2655 bool operator ==(Object other) => identical(this, other); | 2654 bool operator ==(Object other) => identical(this, other); |
2656 } | 2655 } |
OLD | NEW |