Chromium Code Reviews| Index: lib/compiler/implementation/typechecker.dart |
| diff --git a/lib/compiler/implementation/typechecker.dart b/lib/compiler/implementation/typechecker.dart |
| index 85e9cf39e6d5b6e9f7ec5918cb6d7b74364198b4..e23beb04d89782ea1d945bf9c66b7734780a07b7 100644 |
| --- a/lib/compiler/implementation/typechecker.dart |
| +++ b/lib/compiler/implementation/typechecker.dart |
| @@ -26,6 +26,15 @@ class TypeCheckerTask extends CompilerTask { |
| abstract class DartType implements Hashable { |
| abstract SourceString get name; |
| + /** |
| + * Returns the [Element] which declared this type. |
| + * |
| + * This can be [ClassElement] for classes, [TypedefElement] for typedefs, |
| + * [TypeVariableElement] for type variables and [FunctionElement] for |
| + * function types. |
| + * |
| + * Invariant: [element] must be a declaration element. |
| + */ |
| abstract Element get element; |
| /** |
| @@ -154,7 +163,9 @@ class FunctionType implements DartType { |
| Link<DartType> parameterTypes; |
| FunctionType(DartType this.returnType, Link<DartType> this.parameterTypes, |
| - Element this.element); |
| + Element this.element) { |
| + assert(element == null || invariant(element, element.isDeclaration)); |
|
ahe
2012/09/20 11:12:07
===
Johnni Winther
2012/09/21 09:18:25
Done.
|
| + } |
| DartType unalias(Compiler compiler) => this; |