Lines 20-25
Link Here
|
20 |
import org.eclipse.cdt.core.dom.ast.IASTNameOwner; |
20 |
import org.eclipse.cdt.core.dom.ast.IASTNameOwner; |
21 |
import org.eclipse.cdt.core.dom.ast.IASTNode; |
21 |
import org.eclipse.cdt.core.dom.ast.IASTNode; |
22 |
import org.eclipse.cdt.core.dom.ast.IBinding; |
22 |
import org.eclipse.cdt.core.dom.ast.IBinding; |
|
|
23 |
import org.eclipse.cdt.core.dom.ast.IField; |
23 |
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName; |
24 |
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTConversionName; |
24 |
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName; |
25 |
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTOperatorName; |
25 |
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName; |
26 |
import org.eclipse.cdt.core.dom.ast.cpp.ICPPASTQualifiedName; |
Lines 301-341
Link Here
|
301 |
public IBinding[] resolvePrefix(IASTName n) { |
302 |
public IBinding[] resolvePrefix(IASTName n) { |
302 |
IBinding binding = names[names.length - 2].resolveBinding(); |
303 |
IBinding binding = names[names.length - 2].resolveBinding(); |
303 |
if (binding instanceof ICPPClassType) { |
304 |
if (binding instanceof ICPPClassType) { |
304 |
ICPPClassType classType = (ICPPClassType) binding; |
305 |
return resolveClassScopePrefix((ICPPClassType) binding, |
305 |
List bindings = new ArrayList(); |
306 |
n.toCharArray()); |
306 |
char[] name = n.toCharArray(); |
307 |
} else if (binding instanceof ICPPNamespace) { |
307 |
|
308 |
return resolveNamespaceScopePrefix((ICPPNamespace) binding, |
308 |
try { |
309 |
n.toCharArray()); |
309 |
ICPPMethod[] methods = classType.getDeclaredMethods(); |
310 |
} |
310 |
for (int i = 0; i < methods.length; i++) { |
311 |
|
311 |
char[] potential = methods[i].getNameCharArray(); |
312 |
return null; |
|
|
313 |
} |
314 |
|
315 |
private IBinding[] resolveClassScopePrefix(ICPPClassType classType, char[] name) { |
316 |
List bindings = new ArrayList(); |
317 |
|
318 |
try { |
319 |
IField[] fields = classType.getFields(); |
320 |
for (int i = 0; i < fields.length; i++) { |
321 |
if (fields[i].isStatic()) { |
322 |
char[] potential = fields[i].getNameCharArray(); |
312 |
if (CharArrayUtils.equals(potential, 0, name.length, name, false)) { |
323 |
if (CharArrayUtils.equals(potential, 0, name.length, name, false)) { |
313 |
bindings.add(methods[i]); |
324 |
bindings.add(fields[i]); |
314 |
} |
325 |
} |
315 |
} |
326 |
} |
316 |
} catch (DOMException e) { |
|
|
317 |
} |
327 |
} |
318 |
|
328 |
} catch (DOMException e) { |
319 |
return (IBinding[]) bindings.toArray(new IBinding[bindings.size()]); |
329 |
} |
320 |
} else if (binding instanceof ICPPNamespace) { |
330 |
|
321 |
ICPPNamespace namespace = (ICPPNamespace) binding; |
331 |
try { |
322 |
List bindings = new ArrayList(); |
332 |
ICPPMethod[] methods = classType.getDeclaredMethods(); |
323 |
char[] name = n.toCharArray(); |
333 |
for (int i = 0; i < methods.length; i++) { |
324 |
|
334 |
char[] potential = methods[i].getNameCharArray(); |
325 |
try { |
335 |
if (CharArrayUtils.equals(potential, 0, name.length, name, false)) { |
326 |
IBinding[] members = namespace.getMemberBindings(); |
336 |
bindings.add(methods[i]); |
327 |
for (int i = 0 ; i < members.length; i++) { |
|
|
328 |
char[] potential = members[i].getNameCharArray(); |
329 |
if (CharArrayUtils.equals(potential, 0, name.length, name, false)) { |
330 |
bindings.add(members[i]); |
331 |
} |
332 |
} |
337 |
} |
333 |
} catch (DOMException e) { |
|
|
334 |
} |
338 |
} |
335 |
|
339 |
} catch (DOMException e) { |
336 |
return (IBinding[]) bindings.toArray(new IBinding[bindings.size()]); |
|
|
337 |
} |
340 |
} |
338 |
|
341 |
|
339 |
return null; |
342 |
try { |
|
|
343 |
ICPPClassType[] nested = classType.getNestedClasses(); |
344 |
for (int i = 0; i < nested.length; i++) { |
345 |
char[] potential = nested[i].getNameCharArray(); |
346 |
if (CharArrayUtils.equals(potential, 0, name.length, name, false)) { |
347 |
bindings.add(nested[i]); |
348 |
} |
349 |
} |
350 |
} catch (DOMException e) { |
351 |
} |
352 |
|
353 |
return (IBinding[]) bindings.toArray(new IBinding[bindings.size()]); |
354 |
} |
355 |
|
356 |
private IBinding[] resolveNamespaceScopePrefix(ICPPNamespace namespace, char[] name) { |
357 |
List bindings = new ArrayList(); |
358 |
|
359 |
try { |
360 |
IBinding[] members = namespace.getMemberBindings(); |
361 |
for (int i = 0 ; i < members.length; i++) { |
362 |
char[] potential = members[i].getNameCharArray(); |
363 |
if (CharArrayUtils.equals(potential, 0, name.length, name, false)) { |
364 |
bindings.add(members[i]); |
365 |
} |
366 |
} |
367 |
} catch (DOMException e) { |
368 |
} |
369 |
|
370 |
return (IBinding[]) bindings.toArray(new IBinding[bindings.size()]); |
340 |
} |
371 |
} |
341 |
} |
372 |
} |