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

Side by Side Diff: frog/leg/typechecker.dart

Issue 9616058: Implement parsing and resolving of type-variables. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fix merge error. Created 8 years, 9 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 11 matching lines...) Expand all
22 } 22 }
23 }); 23 });
24 } 24 }
25 } 25 }
26 26
27 interface Type { 27 interface Type {
28 SourceString get name(); 28 SourceString get name();
29 Element get element(); 29 Element get element();
30 } 30 }
31 31
32 class TypeVariableType {
ahe 2012/03/16 13:37:11 implements Type
karlklose 2012/03/16 14:58:47 Done.
33 final SourceString name;
34 Element element;
35 TypeVariableType(this.name, [this.element]);
ngeoffray 2012/03/15 11:47:40 How about moving these classes in another place? T
karlklose 2012/03/16 14:58:47 I'll do that in another CL.
36 }
37
32 /** 38 /**
33 * A statement type tracks whether a statement returns or may return. 39 * A statement type tracks whether a statement returns or may return.
34 */ 40 */
35 class StatementType implements Type { 41 class StatementType implements Type {
36 final String stringName; 42 final String stringName;
37 Element get element() => null; 43 Element get element() => null;
38 44
39 SourceString get name() => new SourceString(stringName); 45 SourceString get name() => new SourceString(stringName);
40 46
41 const StatementType(this.stringName); 47 const StatementType(this.stringName);
(...skipping 541 matching lines...) Expand 10 before | Expand all | Expand 10 after
583 // TODO(ahe): Why wasn't this resolved by the resolver? 589 // TODO(ahe): Why wasn't this resolved by the resolver?
584 Type type = lookupType(identifier.source, compiler, types); 590 Type type = lookupType(identifier.source, compiler, types);
585 if (type === null) { 591 if (type === null) {
586 // The type name cannot be resolved, but the resolver 592 // The type name cannot be resolved, but the resolver
587 // already gave a warning, so we continue checking. 593 // already gave a warning, so we continue checking.
588 return types.dynamicType; 594 return types.dynamicType;
589 } 595 }
590 return type; 596 return type;
591 } 597 }
592 598
599 visitTypeVariable(TypeVariable node) {
600 return types.dynamicType;
601 }
602
593 Type visitVariableDefinitions(VariableDefinitions node) { 603 Type visitVariableDefinitions(VariableDefinitions node) {
594 Type type = analyzeWithDefault(node.type, types.dynamicType); 604 Type type = analyzeWithDefault(node.type, types.dynamicType);
595 if (type == types.voidType) { 605 if (type == types.voidType) {
596 reportTypeWarning(node.type, MessageKind.VOID_VARIABLE); 606 reportTypeWarning(node.type, MessageKind.VOID_VARIABLE);
597 type = types.dynamicType; 607 type = types.dynamicType;
598 } 608 }
599 for (Link<Node> link = node.definitions.nodes; !link.isEmpty(); 609 for (Link<Node> link = node.definitions.nodes; !link.isEmpty();
600 link = link.tail) { 610 link = link.tail) {
601 Node initialization = link.head; 611 Node initialization = link.head;
602 compiler.ensure(initialization is Identifier 612 compiler.ensure(initialization is Identifier
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 } 705 }
696 706
697 visitCatchBlock(CatchBlock node) { 707 visitCatchBlock(CatchBlock node) {
698 fail(node); 708 fail(node);
699 } 709 }
700 710
701 visitTypedef(Typedef node) { 711 visitTypedef(Typedef node) {
702 fail(node); 712 fail(node);
703 } 713 }
704 } 714 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698