@Override public boolean doIsEquals(ThisExpr first, ThisExpr second) { if(!isEqualsUseMerger(first.getClassExpr(),second.getClassExpr())) return false; return true; } }
@Override public ThisExpr doMerge(ThisExpr first, ThisExpr second) { ThisExpr te = new ThisExpr(); te.setClassExpr(mergeSingle(first.getClassExpr(),second.getClassExpr())); return te; }
public SymbolReference<ResolvedTypeDeclaration> solve(ThisExpr node) { // If 'this' is prefixed by a class eg. MyClass.this if (node.getClassExpr().isPresent()) { // Get the class name String className = node.getClassExpr().get().toString(); // Attempt to resolve using a typeSolver SymbolReference<ResolvedReferenceTypeDeclaration> clazz = typeSolver.tryToSolveType(className); if (clazz.isSolved()) { return SymbolReference.solved(clazz.getCorrespondingDeclaration()); } // Attempt to resolve locally in Compilation unit Optional<CompilationUnit> cu = node.findAncestor(CompilationUnit.class); if (cu.isPresent()) { Optional<ClassOrInterfaceDeclaration> classByName = cu.get().getClassByName(className); if (classByName.isPresent()) { return SymbolReference.solved(getTypeDeclaration(classByName.get())); } } } return SymbolReference.solved(getTypeDeclaration(findContainingTypeDeclOrObjectCreationExpr(node))); }
public SymbolReference<ResolvedTypeDeclaration> solve(ThisExpr node){ // If 'this' is prefixed by a class eg. MyClass.this if (node.getClassExpr().isPresent()){ // Get the class name String className = node.getClassExpr().get().toString(); // Attempt to resolve using a typeSolver SymbolReference<ResolvedReferenceTypeDeclaration> clazz = typeSolver.tryToSolveType(className); if (clazz.isSolved()){ return SymbolReference.solved(clazz.getCorrespondingDeclaration()); } // Attempt to resolve locally in Compilation unit Optional<CompilationUnit> cu = node.getAncestorOfType(CompilationUnit.class); if (cu.isPresent()){ Optional<ClassOrInterfaceDeclaration> classByName = cu.get().getClassByName(className); if (classByName.isPresent()){ return SymbolReference.solved(getTypeDeclaration(classByName.get())); } } } return SymbolReference.solved(getTypeDeclaration(findContainingTypeDeclOrObjectCreationExpr(node))); }
public SymbolReference<ResolvedTypeDeclaration> solve(ThisExpr node){ // If 'this' is prefixed by a class eg. MyClass.this if (node.getClassExpr().isPresent()){ // Get the class name String className = node.getClassExpr().get().toString(); // Attempt to resolve using a typeSolver SymbolReference<ResolvedReferenceTypeDeclaration> clazz = typeSolver.tryToSolveType(className); if (clazz.isSolved()){ return SymbolReference.solved(clazz.getCorrespondingDeclaration()); } // Attempt to resolve locally in Compilation unit Optional<CompilationUnit> cu = node.getAncestorOfType(CompilationUnit.class); if (cu.isPresent()){ Optional<ClassOrInterfaceDeclaration> classByName = cu.get().getClassByName(className); if (classByName.isPresent()){ return SymbolReference.solved(getTypeDeclaration(classByName.get())); } } } return SymbolReference.solved(getTypeDeclaration(findContainingTypeDeclOrObjectCreationExpr(node))); }
@Override public ResolvedType visit(ThisExpr node, Boolean solveLambdas) { // If 'this' is prefixed by a class eg. MyClass.this if (node.getClassExpr().isPresent()){ // Get the class name String className = node.getClassExpr().get().toString(); // Attempt to resolve using a typeSolver SymbolReference<ResolvedReferenceTypeDeclaration> clazz = typeSolver.tryToSolveType(className); if (clazz.isSolved()){ return new ReferenceTypeImpl(clazz.getCorrespondingDeclaration(),typeSolver); } // Attempt to resolve locally in Compilation unit Optional<CompilationUnit> cu = node.getAncestorOfType(CompilationUnit.class); if (cu.isPresent()){ Optional<ClassOrInterfaceDeclaration> classByName = cu.get().getClassByName(className); if (classByName.isPresent()){ return new ReferenceTypeImpl(facade.getTypeDeclaration(classByName.get()), typeSolver); } } } return new ReferenceTypeImpl(facade.getTypeDeclaration(facade.findContainingTypeDeclOrObjectCreationExpr(node)), typeSolver); }
@Override public ResolvedType visit(ThisExpr node, Boolean solveLambdas) { // If 'this' is prefixed by a class eg. MyClass.this if (node.getClassExpr().isPresent()) { // Get the class name String className = node.getClassExpr().get().toString(); // Attempt to resolve using a typeSolver SymbolReference<ResolvedReferenceTypeDeclaration> clazz = typeSolver.tryToSolveType(className); if (clazz.isSolved()) { return new ReferenceTypeImpl(clazz.getCorrespondingDeclaration(), typeSolver); } // Attempt to resolve locally in Compilation unit Optional<CompilationUnit> cu = node.findAncestor(CompilationUnit.class); if (cu.isPresent()) { Optional<ClassOrInterfaceDeclaration> classByName = cu.get().getClassByName(className); if (classByName.isPresent()) { return new ReferenceTypeImpl(facade.getTypeDeclaration(classByName.get()), typeSolver); } } } return new ReferenceTypeImpl(facade.getTypeDeclaration(facade.findContainingTypeDeclOrObjectCreationExpr(node)), typeSolver); }
@Override public ResolvedType visit(ThisExpr node, Boolean solveLambdas) { // If 'this' is prefixed by a class eg. MyClass.this if (node.getClassExpr().isPresent()){ // Get the class name String className = node.getClassExpr().get().toString(); // Attempt to resolve using a typeSolver SymbolReference<ResolvedReferenceTypeDeclaration> clazz = typeSolver.tryToSolveType(className); if (clazz.isSolved()){ return new ReferenceTypeImpl(clazz.getCorrespondingDeclaration(),typeSolver); } // Attempt to resolve locally in Compilation unit Optional<CompilationUnit> cu = node.getAncestorOfType(CompilationUnit.class); if (cu.isPresent()){ Optional<ClassOrInterfaceDeclaration> classByName = cu.get().getClassByName(className); if (classByName.isPresent()){ return new ReferenceTypeImpl(facade.getTypeDeclaration(classByName.get()), typeSolver); } } } return new ReferenceTypeImpl(facade.getTypeDeclaration(facade.findContainingTypeDeclOrObjectCreationExpr(node)), typeSolver); }
return NameRole.REFERENCE; if (whenParentIs(ThisExpr.class, name, (p, c) -> p.getClassExpr().isPresent() && p.getClassExpr().get() == c)) { return NameRole.REFERENCE;
ne.getClassExpr().isPresent() && ne.getClassExpr().get() == c2) )) { return true; ne.getClassExpr().isPresent() && ne.getClassExpr().get() == c2)) { return true;