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

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

Issue 10917285: Stub implementation of patch invariants for the patch refactoring. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Leftovers from rebase. Created 8 years, 3 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 const bool LOG_FAILURES = false; 9 static const bool LOG_FAILURES = false;
10 10
11 void check(Node tree, TreeElements elements) { 11 void check(Node tree, TreeElements elements) {
12 measure(() { 12 measure(() {
13 Visitor visitor = 13 Visitor visitor =
14 new TypeCheckerVisitor(compiler, elements, compiler.types); 14 new TypeCheckerVisitor(compiler, elements, compiler.types);
15 try { 15 try {
16 tree.accept(visitor); 16 tree.accept(visitor);
17 } on CancelTypeCheckException catch (e) { 17 } on CancelTypeCheckException catch (e) {
18 if (LOG_FAILURES) { 18 if (LOG_FAILURES) {
19 // Do not warn about unimplemented features; log message instead. 19 // Do not warn about unimplemented features; log message instead.
20 compiler.log("'${e.node}': ${e.reason}"); 20 compiler.log("'${e.node}': ${e.reason}");
21 } 21 }
22 } 22 }
23 }); 23 });
24 } 24 }
25 } 25 }
26 26
27 abstract class DartType implements Hashable { 27 abstract class DartType implements Hashable {
28 abstract SourceString get name; 28 abstract SourceString get name;
29 /// Invariant: [element] must be a declaration element.
29 abstract Element get element; 30 abstract Element get element;
30 31
31 /** 32 /**
32 * Returns the unaliased type of this type. 33 * Returns the unaliased type of this type.
33 * 34 *
34 * The unaliased type of a typedef'd type is the unaliased type to which its 35 * The unaliased type of a typedef'd type is the unaliased type to which its
35 * name is bound. The unaliased version of any other type is the type itself. 36 * name is bound. The unaliased version of any other type is the type itself.
36 * 37 *
37 * For example, the unaliased type of [: typedef A Func<A,B>(B b) :] is the 38 * For example, the unaliased type of [: typedef A Func<A,B>(B b) :] is the
38 * function type [: (B) -> A :] and the unaliased type of 39 * function type [: (B) -> A :] and the unaliased type of
(...skipping 107 matching lines...) Expand 10 before | Expand all | Expand 10 after
146 return arguments == other.arguments; 147 return arguments == other.arguments;
147 } 148 }
148 } 149 }
149 150
150 class FunctionType implements DartType { 151 class FunctionType implements DartType {
151 final Element element; 152 final Element element;
152 DartType returnType; 153 DartType returnType;
153 Link<DartType> parameterTypes; 154 Link<DartType> parameterTypes;
154 155
155 FunctionType(DartType this.returnType, Link<DartType> this.parameterTypes, 156 FunctionType(DartType this.returnType, Link<DartType> this.parameterTypes,
156 Element this.element); 157 Element this.element) {
158 assert(element == null || element.isDeclaration);
159 }
157 160
158 DartType unalias(Compiler compiler) => this; 161 DartType unalias(Compiler compiler) => this;
159 162
160 String toString() { 163 String toString() {
161 StringBuffer sb = new StringBuffer(); 164 StringBuffer sb = new StringBuffer();
162 bool first = true; 165 bool first = true;
163 sb.add('('); 166 sb.add('(');
164 parameterTypes.printOn(sb, ', '); 167 parameterTypes.printOn(sb, ', ');
165 sb.add(') -> ${returnType}'); 168 sb.add(') -> ${returnType}');
166 return sb.toString(); 169 return sb.toString();
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
904 } 907 }
905 908
906 visitCatchBlock(CatchBlock node) { 909 visitCatchBlock(CatchBlock node) {
907 return unhandledStatement(); 910 return unhandledStatement();
908 } 911 }
909 912
910 visitTypedef(Typedef node) { 913 visitTypedef(Typedef node) {
911 return unhandledStatement(); 914 return unhandledStatement();
912 } 915 }
913 } 916 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698