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

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

Issue 10873033: Support non-const instance field initializers. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: 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 interface TreeElements { 5 interface TreeElements {
6 Element operator[](Node node); 6 Element operator[](Node node);
7 Selector getSelector(Send send); 7 Selector getSelector(Send send);
8 Type getType(TypeAnnotation annotation); 8 Type getType(TypeAnnotation annotation);
9 } 9 }
10 10
(...skipping 912 matching lines...) Expand 10 before | Expand all | Expand 10 after
923 bool inInstanceContext; 923 bool inInstanceContext;
924 Scope scope; 924 Scope scope;
925 ClassElement currentClass; 925 ClassElement currentClass;
926 bool typeRequired = false; 926 bool typeRequired = false;
927 StatementScope statementScope; 927 StatementScope statementScope;
928 int allowedCategory = ElementCategory.VARIABLE | ElementCategory.FUNCTION; 928 int allowedCategory = ElementCategory.VARIABLE | ElementCategory.FUNCTION;
929 929
930 ResolverVisitor(Compiler compiler, Element element) 930 ResolverVisitor(Compiler compiler, Element element)
931 : this.mapping = new TreeElementMapping(), 931 : this.mapping = new TreeElementMapping(),
932 this.enclosingElement = element, 932 this.enclosingElement = element,
933 inInstanceContext = element.isInstanceMember() 933 // When the element is a field, we are actually resolving its
934 // initial value, which should not have access to instance
935 // fields.
936 inInstanceContext = (element.isInstanceMember() && !element.isField())
934 || element.isGenerativeConstructor(), 937 || element.isGenerativeConstructor(),
935 this.currentClass = element.isMember() ? 938 this.currentClass = element.isMember() ?
936 element.getEnclosingClass() : 939 element.getEnclosingClass() :
937 null, 940 null,
938 this.statementScope = new StatementScope(), 941 this.statementScope = new StatementScope(),
939 typeResolver = new TypeResolver(compiler), 942 typeResolver = new TypeResolver(compiler),
940 scope = element.buildEnclosingScope(), 943 scope = element.buildEnclosingScope(),
941 super(compiler) { 944 super(compiler) {
942 } 945 }
943 946
(...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after
2579 TopScope(LibraryElement library) : super(null, library); 2582 TopScope(LibraryElement library) : super(null, library);
2580 Element lookup(SourceString name) { 2583 Element lookup(SourceString name) {
2581 return library.find(name); 2584 return library.find(name);
2582 } 2585 }
2583 2586
2584 Element add(Element newElement) { 2587 Element add(Element newElement) {
2585 throw "Cannot add an element in the top scope"; 2588 throw "Cannot add an element in the top scope";
2586 } 2589 }
2587 String toString() => '$element'; 2590 String toString() => '$element';
2588 } 2591 }
OLDNEW
« no previous file with comments | « lib/compiler/implementation/elements/elements.dart ('k') | lib/compiler/implementation/ssa/builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698