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

Side by Side Diff: dart/lib/compiler/implementation/typechecker.dart

Issue 10661029: Ensure interfaces are loaded. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 8 years, 4 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 class TypeCheckerTask extends CompilerTask { 5 class TypeCheckerTask extends CompilerTask {
6 TypeCheckerTask(Compiler compiler) : super(compiler); 6 TypeCheckerTask(Compiler compiler) : super(compiler);
7 String get name() => "Type checker"; 7 String get name() => "Type checker";
8 8
9 static final bool LOG_FAILURES = false; 9 static final bool LOG_FAILURES = false;
10 10
(...skipping 75 matching lines...) Expand 10 before | Expand all | Expand 10 after
86 sb.add('<'); 86 sb.add('<');
87 arguments.printOn(sb, ', '); 87 arguments.printOn(sb, ', ');
88 sb.add('>'); 88 sb.add('>');
89 } 89 }
90 return sb.toString(); 90 return sb.toString();
91 } 91 }
92 } 92 }
93 93
94 class FunctionType implements Type { 94 class FunctionType implements Type {
95 final Element element; 95 final Element element;
96 final Type returnType; 96 Type returnType;
97 final Link<Type> parameterTypes; 97 Link<Type> parameterTypes;
98 98
99 const FunctionType(Type this.returnType, Link<Type> this.parameterTypes, 99 FunctionType(Type this.returnType, Link<Type> this.parameterTypes,
100 Element this.element); 100 Element this.element);
101 101
102 toString() { 102 toString() {
103 StringBuffer sb = new StringBuffer(); 103 StringBuffer sb = new StringBuffer();
104 bool first = true; 104 bool first = true;
105 sb.add('('); 105 sb.add('(');
106 parameterTypes.printOn(sb, ', '); 106 parameterTypes.printOn(sb, ', ');
107 sb.add(') -> ${returnType}'); 107 sb.add(') -> ${returnType}');
108 return sb.toString(); 108 return sb.toString();
109 } 109 }
110 110
111 SourceString get name() => const SourceString('Function'); 111 SourceString get name() => const SourceString('Function');
112 112
113 int computeArity() { 113 int computeArity() {
114 int arity = 0; 114 int arity = 0;
115 parameterTypes.forEach((_) { arity++; }); 115 parameterTypes.forEach((_) { arity++; });
116 return arity; 116 return arity;
117 } 117 }
118
119 void initializeFrom(FunctionType other) {
Lasse Reichstein Nielsen 2012/08/07 09:02:17 Why is this not a constructor? I only see one use
120 assert(returnType === null);
121 assert(parameterTypes === null);
122 returnType = other.returnType;
123 parameterTypes = other.parameterTypes;
124 }
118 } 125 }
119 126
120 class Types { 127 class Types {
121 final VoidType voidType; 128 final VoidType voidType;
122 final InterfaceType dynamicType; 129 final InterfaceType dynamicType;
123 130
124 Types(Element dynamicElement) 131 Types(Element dynamicElement)
125 : this.with(dynamicElement, new LibraryElement(new Script(null, null))); 132 : this.with(dynamicElement, new LibraryElement(new Script(null, null)));
126 133
127 // TODO(karlklose): should we have a class Void? 134 // TODO(karlklose): should we have a class Void?
(...skipping 646 matching lines...) Expand 10 before | Expand all | Expand 10 after
774 } 781 }
775 782
776 visitCatchBlock(CatchBlock node) { 783 visitCatchBlock(CatchBlock node) {
777 return unhandledStatement(); 784 return unhandledStatement();
778 } 785 }
779 786
780 visitTypedef(Typedef node) { 787 visitTypedef(Typedef node) {
781 return unhandledStatement(); 788 return unhandledStatement();
782 } 789 }
783 } 790 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698