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 1071 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1082 superCtor = element.supertype.element.unnamedConstructor; | 1082 superCtor = element.supertype.element.unnamedConstructor; |
1083 if (superCtor == null) { | 1083 if (superCtor == null) { |
1084 // This will only happen if the code has errors: | 1084 // This will only happen if the code has errors: |
1085 // we're trying to generate an implicit constructor for a type where | 1085 // we're trying to generate an implicit constructor for a type where |
1086 // we don't have a default constructor in the supertype. | 1086 // we don't have a default constructor in the supertype. |
1087 assert(options.forceCompile); | 1087 assert(options.forceCompile); |
1088 return null; | 1088 return null; |
1089 } | 1089 } |
1090 } | 1090 } |
1091 | 1091 |
| 1092 if (superCtor == null) { |
| 1093 print('Error generating: ${element.displayName}'); |
| 1094 } |
1092 if (superCtor.name == '' && !_shouldCallUnnamedSuperCtor(element)) { | 1095 if (superCtor.name == '' && !_shouldCallUnnamedSuperCtor(element)) { |
1093 return null; | 1096 return null; |
1094 } | 1097 } |
1095 | 1098 |
1096 var name = _constructorName(superCtor); | 1099 var name = _constructorName(superCtor); |
1097 var args = node != null ? _visit(node.argumentList) : []; | 1100 var args = node != null ? _visit(node.argumentList) : []; |
1098 return js.statement('super.#(#);', [name, args])..sourceInformation = node; | 1101 return js.statement('super.#(#);', [name, args])..sourceInformation = node; |
1099 } | 1102 } |
1100 | 1103 |
1101 bool _shouldCallUnnamedSuperCtor(ClassElement e) { | 1104 bool _shouldCallUnnamedSuperCtor(ClassElement e) { |
(...skipping 2419 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
3521 | 3524 |
3522 /// A special kind of element created by the compiler, signifying a temporary | 3525 /// A special kind of element created by the compiler, signifying a temporary |
3523 /// variable. These objects use instance equality, and should be shared | 3526 /// variable. These objects use instance equality, and should be shared |
3524 /// everywhere in the tree where they are treated as the same variable. | 3527 /// everywhere in the tree where they are treated as the same variable. |
3525 class TemporaryVariableElement extends LocalVariableElementImpl { | 3528 class TemporaryVariableElement extends LocalVariableElementImpl { |
3526 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); | 3529 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); |
3527 | 3530 |
3528 int get hashCode => identityHashCode(this); | 3531 int get hashCode => identityHashCode(this); |
3529 bool operator ==(Object other) => identical(this, other); | 3532 bool operator ==(Object other) => identical(this, other); |
3530 } | 3533 } |
OLD | NEW |