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

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

Issue 9347045: Start supporting default classes. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | dart/frog/leg/resolver.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 473 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 null, null, null, null); 484 null, null, null, null);
485 return cachedNode; 485 return cachedNode;
486 } 486 }
487 487
488 Token position() => null; 488 Token position() => null;
489 } 489 }
490 490
491 class ClassElement extends ContainerElement { 491 class ClassElement extends ContainerElement {
492 Type type; 492 Type type;
493 Type supertype; 493 Type supertype;
494 Type defaultClass;
494 Link<Element> members = const EmptyLink<Element>(); 495 Link<Element> members = const EmptyLink<Element>();
495 Map<SourceString, Element> localMembers; 496 Map<SourceString, Element> localMembers;
496 Map<SourceString, Element> constructors; 497 Map<SourceString, Element> constructors;
497 Link<Type> interfaces = const EmptyLink<Type>(); 498 Link<Type> interfaces = const EmptyLink<Type>();
498 bool isResolved = false; 499 bool isResolved = false;
499 // backendMembers are members that have been added by the backend to simplify 500 // backendMembers are members that have been added by the backend to simplify
500 // compilation. They don't have any user-side counter-part. 501 // compilation. They don't have any user-side counter-part.
501 Link<Element> backendMembers = const EmptyLink<Element>(); 502 Link<Element> backendMembers = const EmptyLink<Element>();
502 SynthesizedConstructorElement synthesizedConstructor; 503 SynthesizedConstructorElement synthesizedConstructor;
503 504
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
605 606
606 /** 607 /**
607 * Returns the super class, if any. 608 * Returns the super class, if any.
608 * 609 *
609 * The returned element may not be resolved yet. 610 * The returned element may not be resolved yet.
610 */ 611 */
611 ClassElement get superclass() { 612 ClassElement get superclass() {
612 assert(isResolved); 613 assert(isResolved);
613 return supertype === null ? null : supertype.element; 614 return supertype === null ? null : supertype.element;
614 } 615 }
616
617 bool isInterface() => false;
615 } 618 }
616 619
617 class Elements { 620 class Elements {
618 static bool isLocal(Element element) { 621 static bool isLocal(Element element) {
619 return ((element !== null) 622 return ((element !== null)
620 && !element.isInstanceMember() 623 && !element.isInstanceMember()
621 && !isStaticOrTopLevelField(element) 624 && !isStaticOrTopLevelField(element)
622 && !isStaticOrTopLevelFunction(element) 625 && !isStaticOrTopLevelFunction(element)
623 && (element.kind === ElementKind.VARIABLE || 626 && (element.kind === ElementKind.VARIABLE ||
624 element.kind === ElementKind.PARAMETER || 627 element.kind === ElementKind.PARAMETER ||
(...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after
719 bool isContinueTarget = false; 722 bool isContinueTarget = false;
720 723
721 StatementElement(this.origin, Element enclosingElement) 724 StatementElement(this.origin, Element enclosingElement)
722 : super(const SourceString(""), ElementKind.STATEMENT, enclosingElement); 725 : super(const SourceString(""), ElementKind.STATEMENT, enclosingElement);
723 StatementElement.label(String name, this.origin, Element enclosingElement) 726 StatementElement.label(String name, this.origin, Element enclosingElement)
724 : super(new SourceString(name), ElementKind.STATEMENT, enclosingElement); 727 : super(new SourceString(name), ElementKind.STATEMENT, enclosingElement);
725 bool get isTarget() => isBreakTarget || isContinueTarget; 728 bool get isTarget() => isBreakTarget || isContinueTarget;
726 729
727 Node parseNode(DiagnosticListener l) => origin; 730 Node parseNode(DiagnosticListener l) => origin;
728 } 731 }
OLDNEW
« no previous file with comments | « no previous file | dart/frog/leg/resolver.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698