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

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

Issue 9027002: Support factory methods. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: '' Created 9 years 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) 2011, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2011, 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 TreeElements { 5 class TreeElements {
6 Map<Node, Element> map; 6 Map<Node, Element> map;
7 TreeElements() : map = new LinkedHashMap<Node, Element>(); 7 TreeElements() : map = new LinkedHashMap<Node, Element>();
8 operator []=(Node node, Element element) => map[node] = element; 8 operator []=(Node node, Element element) => map[node] = element;
9 operator [](Node node) => map[node]; 9 operator [](Node node) => map[node];
10 } 10 }
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 final Compiler compiler; 112 final Compiler compiler;
113 final TreeElements mapping; 113 final TreeElements mapping;
114 final Element enclosingElement; 114 final Element enclosingElement;
115 bool inInstanceContext; 115 bool inInstanceContext;
116 Scope context; 116 Scope context;
117 117
118 ResolverVisitor(Compiler compiler, Element element) 118 ResolverVisitor(Compiler compiler, Element element)
119 : this.compiler = compiler, 119 : this.compiler = compiler,
120 this.mapping = new TreeElements(), 120 this.mapping = new TreeElements(),
121 this.enclosingElement = element, 121 this.enclosingElement = element,
122 inInstanceContext = 122 inInstanceContext = element.isInstanceMember()
123 element.isInstanceMember() || element.kind == ElementKind.CONSTRUCTOR, 123 || element.kind == ElementKind.GENERATIVE_CONSTRUCTOR,
kasperl 2011/12/22 11:34:42 element.isGenerativeConstructor would be somewhat
ngeoffray 2011/12/22 13:07:02 Done.
124 this.context = element.isMember() 124 this.context = element.isMember()
125 ? new ClassScope(element.enclosingElement, compiler.universe) 125 ? new ClassScope(element.enclosingElement, compiler.universe)
126 : new TopScope(compiler.universe); 126 : new TopScope(compiler.universe);
127 127
128 ResolverVisitor.from(ResolverVisitor other) 128 ResolverVisitor.from(ResolverVisitor other)
129 : compiler = other.compiler, 129 : compiler = other.compiler,
130 mapping = other.mapping, 130 mapping = other.mapping,
131 enclosingElement = other.enclosingElement, 131 enclosingElement = other.enclosingElement,
132 inInstanceContext = other.inInstanceContext, 132 inInstanceContext = other.inInstanceContext,
133 context = other.context; 133 context = other.context;
(...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after
688 class TopScope extends Scope { 688 class TopScope extends Scope {
689 Universe universe; 689 Universe universe;
690 690
691 TopScope(Universe this.universe) : super(null, null); 691 TopScope(Universe this.universe) : super(null, null);
692 Element lookup(SourceString name) => universe.find(name); 692 Element lookup(SourceString name) => universe.find(name);
693 693
694 Element add(Element element) { 694 Element add(Element element) {
695 throw "Cannot add an element in the top scope"; 695 throw "Cannot add an element in the top scope";
696 } 696 }
697 } 697 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698