OLD | NEW |
1 // Copyright (c) 2013, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2013, 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 simple_types_inferrer; | 5 library simple_types_inferrer; |
6 | 6 |
7 import 'dart:collection' show Queue, LinkedHashSet; | 7 import 'dart:collection' show Queue, LinkedHashSet; |
8 | 8 |
9 import '../closure.dart' show ClosureClassMap, ClosureScope; | 9 import '../closure.dart' show ClosureClassMap, ClosureScope; |
10 import '../dart_types.dart' | 10 import '../dart_types.dart' |
(...skipping 753 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
764 | 764 |
765 | 765 |
766 /** | 766 /** |
767 * Returns the type of [element]. Returns [:dynamic:] if | 767 * Returns the type of [element]. Returns [:dynamic:] if |
768 * [element] has not been analyzed yet. | 768 * [element] has not been analyzed yet. |
769 */ | 769 */ |
770 TypeMask typeOfElement(Element element) { | 770 TypeMask typeOfElement(Element element) { |
771 element = element.implementation; | 771 element = element.implementation; |
772 if (isNativeElement(element) && element.isField()) { | 772 if (isNativeElement(element) && element.isField()) { |
773 var type = typeOf.putIfAbsent(element, () { | 773 var type = typeOf.putIfAbsent(element, () { |
774 InterfaceType type = element.computeType(compiler).asRaw(); | 774 InterfaceType rawType = element.computeType(compiler).asRaw(); |
775 return type.isDynamic ? dynamicType : new TypeMask.subtype(type); | 775 return rawType.isDynamic ? dynamicType : new TypeMask.subtype(rawType); |
776 }); | 776 }); |
777 assert(type != null); | 777 assert(type != null); |
778 return type; | 778 return type; |
779 } | 779 } |
780 TypeMask type = typeOf[element]; | 780 TypeMask type = typeOf[element]; |
781 if (type == null) { | 781 if (type == null) { |
782 if ((compiler.trustTypeAnnotations | 782 if ((compiler.trustTypeAnnotations |
783 && (element.isField() | 783 && (element.isField() |
784 || element.isParameter() | 784 || element.isParameter() |
785 || element.isVariable())) | 785 || element.isVariable())) |
(...skipping 1831 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2617 } else { | 2617 } else { |
2618 result.merge(locals, discardIfAborts: false); | 2618 result.merge(locals, discardIfAborts: false); |
2619 } | 2619 } |
2620 } | 2620 } |
2621 locals = result; | 2621 locals = result; |
2622 } | 2622 } |
2623 clearBreaksAndContinues(elements[node]); | 2623 clearBreaksAndContinues(elements[node]); |
2624 return inferrer.dynamicType; | 2624 return inferrer.dynamicType; |
2625 } | 2625 } |
2626 } | 2626 } |
OLD | NEW |