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

Side by Side Diff: dart/editor/tools/plugins/com.google.dart.engine/src/com/google/dart/engine/internal/scope/EnclosedScope.java

Issue 59073003: Version 0.8.10.4 (Closed) Base URL: http://dart.googlecode.com/svn/trunk/
Patch Set: Created 7 years, 1 month 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 /* 1 /*
2 * Copyright (c) 2012, the Dart project authors. 2 * Copyright (c) 2012, the Dart project authors.
3 * 3 *
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u se this file except
5 * in compliance with the License. You may obtain a copy of the License at 5 * in compliance with the License. You may obtain a copy of the License at
6 * 6 *
7 * http://www.eclipse.org/legal/epl-v10.html 7 * http://www.eclipse.org/legal/epl-v10.html
8 * 8 *
9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License 9 * Unless required by applicable law or agreed to in writing, software distribut ed under the License
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K IND, either express
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
45 /** 45 /**
46 * Initialize a newly created scope enclosed within another scope. 46 * Initialize a newly created scope enclosed within another scope.
47 * 47 *
48 * @param enclosingScope the scope in which this scope is lexically enclosed 48 * @param enclosingScope the scope in which this scope is lexically enclosed
49 */ 49 */
50 public EnclosedScope(Scope enclosingScope) { 50 public EnclosedScope(Scope enclosingScope) {
51 this.enclosingScope = enclosingScope; 51 this.enclosingScope = enclosingScope;
52 } 52 }
53 53
54 @Override 54 @Override
55 public Scope getEnclosingScope() {
56 return enclosingScope;
57 }
58
59 @Override
55 public AnalysisErrorListener getErrorListener() { 60 public AnalysisErrorListener getErrorListener() {
56 return enclosingScope.getErrorListener(); 61 return enclosingScope.getErrorListener();
57 } 62 }
58 63
59 /** 64 /**
60 * Hides the name of the given element in this scope. If there is already an e lement with the 65 * Hides the name of the given element in this scope. If there is already an e lement with the
61 * given name defined in an outer scope, then it will become unavailable. 66 * given name defined in an outer scope, then it will become unavailable.
62 * 67 *
63 * @param element the element to be hidden in this scope 68 * @param element the element to be hidden in this scope
64 */ 69 */
65 public void hide(Element element) { 70 public void hide(Element element) {
66 if (element != null) { 71 if (element != null) {
67 String name = element.getName(); 72 String name = element.getName();
68 if (name != null && !name.isEmpty()) { 73 if (name != null && !name.isEmpty()) {
69 hiddenNames.add(name); 74 hiddenNames.add(name);
70 } 75 }
71 } 76 }
72 } 77 }
73 78
74 /**
75 * Return the scope in which this scope is lexically enclosed.
76 *
77 * @return the scope in which this scope is lexically enclosed
78 */
79 protected Scope getEnclosingScope() {
80 return enclosingScope;
81 }
82
83 @Override 79 @Override
84 protected Element lookup(Identifier identifier, String name, LibraryElement re ferencingLibrary) { 80 protected Element lookup(Identifier identifier, String name, LibraryElement re ferencingLibrary) {
85 Element element = localLookup(name, referencingLibrary); 81 Element element = localLookup(name, referencingLibrary);
86 if (element != null) { 82 if (element != null) {
87 return element; 83 return element;
88 } 84 }
89 if (hiddenNames.contains(name)) { 85 if (hiddenNames.contains(name)) {
90 getErrorListener().onError( 86 getErrorListener().onError(
91 new AnalysisError( 87 new AnalysisError(
92 getSource(identifier), 88 getSource(identifier),
93 identifier.getOffset(), 89 identifier.getOffset(),
94 identifier.getLength(), 90 identifier.getLength(),
95 CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION)); 91 CompileTimeErrorCode.REFERENCED_BEFORE_DECLARATION));
96 //return null; 92 //return null;
97 } 93 }
98 return enclosingScope.lookup(identifier, name, referencingLibrary); 94 return enclosingScope.lookup(identifier, name, referencingLibrary);
99 } 95 }
100 } 96 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698