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 975 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
986 } | 986 } |
987 | 987 |
988 bool _typeIsLoaded(DartType type) { | 988 bool _typeIsLoaded(DartType type) { |
989 if (type is FunctionType && (type.name == '' || type.name == null)) { | 989 if (type is FunctionType && (type.name == '' || type.name == null)) { |
990 return (_typeIsLoaded(type.returnType) && | 990 return (_typeIsLoaded(type.returnType) && |
991 type.optionalParameterTypes.every(_typeIsLoaded) && | 991 type.optionalParameterTypes.every(_typeIsLoaded) && |
992 type.namedParameterTypes.values.every(_typeIsLoaded) && | 992 type.namedParameterTypes.values.every(_typeIsLoaded) && |
993 type.normalParameterTypes.every(_typeIsLoaded)); | 993 type.normalParameterTypes.every(_typeIsLoaded)); |
994 } | 994 } |
995 if (type.isDynamic || type.isVoid || type.isBottom) return true; | 995 if (type.isDynamic || type.isVoid || type.isBottom) return true; |
| 996 if (type is ParameterizedType && !type.typeArguments.every(_typeIsLoaded)) { |
| 997 return false; |
| 998 } |
996 return _loader.isLoaded(type.element); | 999 return _loader.isLoaded(type.element); |
997 } | 1000 } |
998 | 1001 |
999 JS.Expression _emitFunctionTagged(JS.Expression clos, DartType type, | 1002 JS.Expression _emitFunctionTagged(JS.Expression clos, DartType type, |
1000 {topLevel: false}) { | 1003 {topLevel: false}) { |
1001 var name = type.name; | 1004 var name = type.name; |
1002 var lazy = topLevel && !_typeIsLoaded(type); | 1005 var lazy = topLevel && !_typeIsLoaded(type); |
1003 | 1006 |
1004 if (type is FunctionType && (name == '' || name == null)) { | 1007 if (type is FunctionType && (name == '' || name == null)) { |
1005 if (type.returnType.isDynamic && | 1008 if (type.returnType.isDynamic && |
(...skipping 1560 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2566 | 2569 |
2567 /// A special kind of element created by the compiler, signifying a temporary | 2570 /// A special kind of element created by the compiler, signifying a temporary |
2568 /// variable. These objects use instance equality, and should be shared | 2571 /// variable. These objects use instance equality, and should be shared |
2569 /// everywhere in the tree where they are treated as the same variable. | 2572 /// everywhere in the tree where they are treated as the same variable. |
2570 class TemporaryVariableElement extends LocalVariableElementImpl { | 2573 class TemporaryVariableElement extends LocalVariableElementImpl { |
2571 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); | 2574 TemporaryVariableElement.forNode(Identifier name) : super.forNode(name); |
2572 | 2575 |
2573 int get hashCode => identityHashCode(this); | 2576 int get hashCode => identityHashCode(this); |
2574 bool operator ==(Object other) => identical(this, other); | 2577 bool operator ==(Object other) => identical(this, other); |
2575 } | 2578 } |
OLD | NEW |