| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 part of native; | 5 part of native; |
| 6 | 6 |
| 7 /// This class is a temporary work-around until we get a more powerful DartType. | 7 /// This class is a temporary work-around until we get a more powerful DartType. |
| 8 class SpecialType { | 8 class SpecialType { |
| 9 final String name; | 9 final String name; |
| 10 const SpecialType._(this.name); | 10 const SpecialType._(this.name); |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 811 } | 811 } |
| 812 | 812 |
| 813 if (!compiler.trustJSInteropTypeAnnotations || | 813 if (!compiler.trustJSInteropTypeAnnotations || |
| 814 type.isDynamic || type.isObject) { | 814 type.isDynamic || type.isObject) { |
| 815 // By saying that only JS-interop types can be created, we prevent | 815 // By saying that only JS-interop types can be created, we prevent |
| 816 // pulling in every other native type (e.g. all of dart:html) when a | 816 // pulling in every other native type (e.g. all of dart:html) when a |
| 817 // JS interop API returns dynamic or when we don't trust the type | 817 // JS interop API returns dynamic or when we don't trust the type |
| 818 // annotations. This means that to some degree we still use the return | 818 // annotations. This means that to some degree we still use the return |
| 819 // type to decide whether to include native types, even if we don't | 819 // type to decide whether to include native types, even if we don't |
| 820 // trust the type annotation. | 820 // trust the type annotation. |
| 821 typesInstantiated.add( | 821 ClassElement cls = backend.helpers.jsJavaScriptObjectClass; |
| 822 backend.helpers.jsJavaScriptObjectClass.thisType); | 822 cls.ensureResolved(resolution); |
| 823 typesInstantiated.add(cls.thisType); |
| 823 } else { | 824 } else { |
| 824 // Otherwise, when the declared type is a Dart type, we do not | 825 // Otherwise, when the declared type is a Dart type, we do not |
| 825 // register an allocation because we assume it cannot be instantiated | 826 // register an allocation because we assume it cannot be instantiated |
| 826 // from within the JS-interop code. It must have escaped from another | 827 // from within the JS-interop code. It must have escaped from another |
| 827 // API. | 828 // API. |
| 828 } | 829 } |
| 829 } | 830 } |
| 830 } | 831 } |
| 831 } | 832 } |
| 832 | 833 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 861 MessageKind.GENERIC, | 862 MessageKind.GENERIC, |
| 862 {'text': "Type '$typeString' not found."}); | 863 {'text': "Type '$typeString' not found."}); |
| 863 return const DynamicType(); | 864 return const DynamicType(); |
| 864 } | 865 } |
| 865 | 866 |
| 866 static _errorNode(locationNodeOrElement, Parsing parsing) { | 867 static _errorNode(locationNodeOrElement, Parsing parsing) { |
| 867 if (locationNodeOrElement is Node) return locationNodeOrElement; | 868 if (locationNodeOrElement is Node) return locationNodeOrElement; |
| 868 return locationNodeOrElement.parseNode(parsing); | 869 return locationNodeOrElement.parseNode(parsing); |
| 869 } | 870 } |
| 870 } | 871 } |
| OLD | NEW |