OLD | NEW |
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 160 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 */ | 171 */ |
172 protected abstract AnalysisErrorListener getErrorListener(); | 172 protected abstract AnalysisErrorListener getErrorListener(); |
173 | 173 |
174 /** | 174 /** |
175 * Return the source that contains the given identifier, or the source associa
ted with this scope | 175 * Return the source that contains the given identifier, or the source associa
ted with this scope |
176 * if the source containing the identifier could not be determined. | 176 * if the source containing the identifier could not be determined. |
177 * | 177 * |
178 * @param identifier the identifier whose source is to be returned | 178 * @param identifier the identifier whose source is to be returned |
179 * @return the source that contains the given identifier | 179 * @return the source that contains the given identifier |
180 */ | 180 */ |
181 protected final Source getSource(AstNode node) { | 181 protected Source getSource(AstNode node) { |
182 CompilationUnit unit = node.getAncestor(CompilationUnit.class); | 182 CompilationUnit unit = node.getAncestor(CompilationUnit.class); |
183 if (unit != null) { | 183 if (unit != null) { |
184 CompilationUnitElement unitElement = unit.getElement(); | 184 CompilationUnitElement unitElement = unit.getElement(); |
185 if (unitElement != null) { | 185 if (unitElement != null) { |
186 return unitElement.getSource(); | 186 return unitElement.getSource(); |
187 } | 187 } |
188 } | 188 } |
189 return null; | 189 return null; |
190 } | 190 } |
191 | 191 |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
229 private String getName(Element element) { | 229 private String getName(Element element) { |
230 if (element instanceof MethodElement) { | 230 if (element instanceof MethodElement) { |
231 MethodElement method = (MethodElement) element; | 231 MethodElement method = (MethodElement) element; |
232 if (method.getName().equals("-") && method.getParameters().length == 0) { | 232 if (method.getName().equals("-") && method.getParameters().length == 0) { |
233 return UNARY_MINUS; | 233 return UNARY_MINUS; |
234 } | 234 } |
235 } | 235 } |
236 return element.getName(); | 236 return element.getName(); |
237 } | 237 } |
238 } | 238 } |
OLD | NEW |