Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(163)

Unified Diff: frog/leg/typechecker.dart

Issue 9431029: Implement interface types. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Remove debug function. Created 8 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« frog/leg/resolver.dart ('K') | « frog/leg/resolver.dart ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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();
}
« frog/leg/resolver.dart ('K') | « frog/leg/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698