Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 inInstanceContext = (element.isInstanceMember() && !element.isField()) |
|
karlklose
2012/08/24 11:46:22
Please add a comment explaining why 'fields are no
ngeoffray
2012/08/24 13:01:41
Done.
| |
| 934 || element.isGenerativeConstructor(), | 934 || element.isGenerativeConstructor(), |
| 935 this.currentClass = element.isMember() ? | 935 this.currentClass = element.isMember() ? |
| 936 element.getEnclosingClass() : | 936 element.getEnclosingClass() : |
| 937 null, | 937 null, |
| 938 this.statementScope = new StatementScope(), | 938 this.statementScope = new StatementScope(), |
| 939 typeResolver = new TypeResolver(compiler), | 939 typeResolver = new TypeResolver(compiler), |
| 940 scope = element.buildEnclosingScope(), | 940 scope = element.buildEnclosingScope(), |
| 941 super(compiler) { | 941 super(compiler) { |
| 942 } | 942 } |
| 943 | 943 |
| (...skipping 1635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 2579 TopScope(LibraryElement library) : super(null, library); | 2579 TopScope(LibraryElement library) : super(null, library); |
| 2580 Element lookup(SourceString name) { | 2580 Element lookup(SourceString name) { |
| 2581 return library.find(name); | 2581 return library.find(name); |
| 2582 } | 2582 } |
| 2583 | 2583 |
| 2584 Element add(Element newElement) { | 2584 Element add(Element newElement) { |
| 2585 throw "Cannot add an element in the top scope"; | 2585 throw "Cannot add an element in the top scope"; |
| 2586 } | 2586 } |
| 2587 String toString() => '$element'; | 2587 String toString() => '$element'; |
| 2588 } | 2588 } |
| OLD | NEW |