Index: frog/leg/typechecker.dart |
diff --git a/frog/leg/typechecker.dart b/frog/leg/typechecker.dart |
index db4df503ea0f19cd4eb389d2dac58664ff90be25..bd5d8ae2e8355c63d4df76448036196a5e3bff7b 100644 |
--- a/frog/leg/typechecker.dart |
+++ b/frog/leg/typechecker.dart |
@@ -48,12 +48,36 @@ class StatementType implements Type { |
String toString() => stringName; |
} |
-class SimpleType implements Type { |
+class TypeVariable { |
ahe
2012/02/29 12:49:15
What is the purpose of this class?
karlklose
2012/03/30 11:56:40
Removed.
|
final SourceString name; |
- final Element element; |
+ final Type value; |
ahe
2012/02/29 12:49:15
What is this?
karlklose
2012/03/30 11:56:40
Removed the class.
|
+ const TypeVariable(this.name, [this.value]); |
+} |
ngeoffray
2012/02/24 13:36:15
You can remove the code above.
karlklose
2012/03/30 11:56:40
Done.
|
- const SimpleType(SourceString this.name, Element this.element); |
+class InterfaceType implements Type { |
+ final SourceString name; |
+ final ClassElement element; |
+ final Link<Type> arguments; |
+ const InterfaceType(SourceString this.name, ClassElement this.element, |
+ [Link<Type> arguments = const EmptyLink<Type>()]) |
ahe
2012/02/29 12:49:15
Why not this.arguments?
karlklose
2012/03/30 11:56:40
Done.
|
+ : this.arguments = arguments; |
ngeoffray
2012/02/24 13:36:15
Add new line.
ngeoffray
2012/02/24 13:36:15
Do you think it'd be more robust to write:
this.ar
karlklose
2012/03/30 11:56:40
Done.
|
+ toString() { |
+ StringBuffer sb = new StringBuffer(); |
+ sb.add(name); |
+ bool first = true; |
+ for (Link link = arguments; !link.isEmpty(); link = link.tail) { |
ahe
2012/02/29 12:49:15
Could you use:
if (!arguments.isEmpty()) {
sb.ad
karlklose
2012/03/30 11:56:40
Done.
|
+ sb.add(first ? '<' : ', '); |
+ sb.add(link.head); |
+ if (link.tail.isEmpty()) sb.add('>'); |
+ first = false; |
+ } |
+ return sb.toString(); |
+ } |
+} |
+// TODO(karlklose): merge into InterfaceType as a named constructor. |
ahe
2012/02/29 12:49:15
+1
|
+class SimpleType extends InterfaceType { |
+ const SimpleType(SourceString name, Element element) : super(name, element); |
String toString() => name.toString(); |
} |