| OLD | NEW |
| 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 import 'dart:collection'; | 5 import 'dart:collection'; |
| 6 | 6 |
| 7 import 'package:js_runtime/shared/embedded_names.dart'; | 7 import 'package:js_runtime/shared/embedded_names.dart'; |
| 8 | 8 |
| 9 import '../closure.dart'; | 9 import '../closure.dart'; |
| 10 import '../common.dart'; | 10 import '../common.dart'; |
| (...skipping 3748 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3759 | 3759 |
| 3760 /// In checked mode checks the [type] of [node] to be well-bounded. The method | 3760 /// In checked mode checks the [type] of [node] to be well-bounded. The method |
| 3761 /// returns [:true:] if an error can be statically determined. | 3761 /// returns [:true:] if an error can be statically determined. |
| 3762 bool checkTypeVariableBounds(ast.NewExpression node, InterfaceType type) { | 3762 bool checkTypeVariableBounds(ast.NewExpression node, InterfaceType type) { |
| 3763 if (!compiler.options.enableTypeAssertions) return false; | 3763 if (!compiler.options.enableTypeAssertions) return false; |
| 3764 | 3764 |
| 3765 Map<DartType, Set<DartType>> seenChecksMap = | 3765 Map<DartType, Set<DartType>> seenChecksMap = |
| 3766 new Map<DartType, Set<DartType>>(); | 3766 new Map<DartType, Set<DartType>>(); |
| 3767 bool definitelyFails = false; | 3767 bool definitelyFails = false; |
| 3768 | 3768 |
| 3769 addTypeVariableBoundCheck(GenericType instance, DartType typeArgument, | 3769 void addTypeVariableBoundCheck(GenericType instance, DartType typeArgument, |
| 3770 TypeVariableType typeVariable, DartType bound) { | 3770 TypeVariableType typeVariable, DartType bound) { |
| 3771 if (definitelyFails) return; | 3771 if (definitelyFails) return; |
| 3772 | 3772 |
| 3773 int subtypeRelation = | 3773 int subtypeRelation = |
| 3774 compiler.types.computeSubtypeRelation(typeArgument, bound); | 3774 compiler.types.computeSubtypeRelation(typeArgument, bound); |
| 3775 if (subtypeRelation == Types.IS_SUBTYPE) return; | 3775 if (subtypeRelation == Types.IS_SUBTYPE) return; |
| 3776 | 3776 |
| 3777 String message = "Can't create an instance of malbounded type '$type': " | 3777 String message = "Can't create an instance of malbounded type '$type': " |
| 3778 "'${typeArgument}' is not a subtype of bound '${bound}' for " | 3778 "'${typeArgument}' is not a subtype of bound '${bound}' for " |
| 3779 "type variable '${typeVariable}' of type " | 3779 "type variable '${typeVariable}' of type " |
| (...skipping 3283 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7063 if (unaliased is TypedefType) throw 'unable to unalias $type'; | 7063 if (unaliased is TypedefType) throw 'unable to unalias $type'; |
| 7064 unaliased.accept(this, builder); | 7064 unaliased.accept(this, builder); |
| 7065 } | 7065 } |
| 7066 | 7066 |
| 7067 void visitDynamicType(DynamicType type, SsaBuilder builder) { | 7067 void visitDynamicType(DynamicType type, SsaBuilder builder) { |
| 7068 JavaScriptBackend backend = builder.compiler.backend; | 7068 JavaScriptBackend backend = builder.compiler.backend; |
| 7069 ClassElement cls = backend.helpers.DynamicRuntimeType; | 7069 ClassElement cls = backend.helpers.DynamicRuntimeType; |
| 7070 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld))); | 7070 builder.push(new HDynamicType(type, new TypeMask.exact(cls, closedWorld))); |
| 7071 } | 7071 } |
| 7072 } | 7072 } |
| OLD | NEW |