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

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

Issue 10232011: Implement simple dynamic type check. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Minor edits. Created 8 years, 7 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 #library('elements'); 5 #library('elements');
6 6
7 #import('../tree/tree.dart'); 7 #import('../tree/tree.dart');
8 #import('../scanner/scannerlib.dart'); 8 #import('../scanner/scannerlib.dart');
9 #import('../leg.dart'); // TODO(karlklose): we only need type. 9 #import('../leg.dart'); // TODO(karlklose): we only need type.
10 #import('../util/util.dart'); 10 #import('../util/util.dart');
(...skipping 670 matching lines...) Expand 10 before | Expand all | Expand 10 after
681 } 681 }
682 682
683 class ClassElement extends ContainerElement { 683 class ClassElement extends ContainerElement {
684 Type type; 684 Type type;
685 Type supertype; 685 Type supertype;
686 Type defaultClass; 686 Type defaultClass;
687 Link<Element> members = const EmptyLink<Element>(); 687 Link<Element> members = const EmptyLink<Element>();
688 Map<SourceString, Element> localMembers; 688 Map<SourceString, Element> localMembers;
689 Map<SourceString, Element> constructors; 689 Map<SourceString, Element> constructors;
690 Link<Type> interfaces = const EmptyLink<Type>(); 690 Link<Type> interfaces = const EmptyLink<Type>();
691 Map<SourceString, TypeVariableElement> typeParameters; 691 LinkedHashMap<SourceString, TypeVariableElement> typeParameters;
692 bool isResolved = false; 692 bool isResolved = false;
693 bool isBeingResolved = false; 693 bool isBeingResolved = false;
694 // backendMembers are members that have been added by the backend to simplify 694 // backendMembers are members that have been added by the backend to simplify
695 // compilation. They don't have any user-side counter-part. 695 // compilation. They don't have any user-side counter-part.
696 Link<Element> backendMembers = const EmptyLink<Element>(); 696 Link<Element> backendMembers = const EmptyLink<Element>();
697 697
698 Link<Type> allSupertypes; 698 Link<Type> allSupertypes;
699 699
700 ClassElement(SourceString name, CompilationUnitElement enclosing) 700 ClassElement(SourceString name, CompilationUnitElement enclosing)
701 : localMembers = new Map<SourceString, Element>(), 701 : localMembers = new Map<SourceString, Element>(),
702 constructors = new Map<SourceString, Element>(), 702 constructors = new Map<SourceString, Element>(),
703 typeParameters = new Map<SourceString, TypeVariableElement>(), 703 typeParameters = new LinkedHashMap<SourceString, TypeVariableElement>(),
704 super(name, ElementKind.CLASS, enclosing); 704 super(name, ElementKind.CLASS, enclosing);
705 705
706 void addMember(Element element, DiagnosticListener listener) { 706 void addMember(Element element, DiagnosticListener listener) {
707 members = members.prepend(element); 707 members = members.prepend(element);
708 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR || 708 if (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR ||
709 element.modifiers.isFactory()) { 709 element.modifiers.isFactory()) {
710 constructors[element.name] = element; 710 constructors[element.name] = element;
711 } else if (element.kind == ElementKind.GETTER 711 } else if (element.kind == ElementKind.GETTER
712 || element.kind == ElementKind.SETTER) { 712 || element.kind == ElementKind.SETTER) {
713 addGetterOrSetter(element, localMembers[element.name], listener); 713 addGetterOrSetter(element, localMembers[element.name], listener);
(...skipping 332 matching lines...) Expand 10 before | Expand all | Expand 10 after
1046 final Node node; 1046 final Node node;
1047 Type bound; 1047 Type bound;
1048 Type type; 1048 Type type;
1049 TypeVariableElement(name, Element enclosing, this.node, this.type, 1049 TypeVariableElement(name, Element enclosing, this.node, this.type,
1050 [this.bound]) 1050 [this.bound])
1051 : super(name, ElementKind.TYPE_VARIABLE, enclosing); 1051 : super(name, ElementKind.TYPE_VARIABLE, enclosing);
1052 Type computeType(compiler) => type; 1052 Type computeType(compiler) => type;
1053 Node parseNode(compiler) => node; 1053 Node parseNode(compiler) => node;
1054 toString() => "${enclosingElement.toString()}.${name.slowToString()}"; 1054 toString() => "${enclosingElement.toString()}.${name.slowToString()}";
1055 } 1055 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698