List of usage examples for org.eclipse.jdt.core.dom CastExpression getExpression
public Expression getExpression()
From source file:at.bestsolution.fxide.jdt.corext.dom.ASTFlattener.java
License:Open Source License
@Override public boolean visit(CastExpression node) { this.fBuffer.append("(");//$NON-NLS-1$ node.getType().accept(this); this.fBuffer.append(")");//$NON-NLS-1$ node.getExpression().accept(this); return false; }
From source file:boa.datagen.util.Java7Visitor.java
License:Apache License
@Override public boolean visit(CastExpression node) { boa.types.Ast.Expression.Builder b = boa.types.Ast.Expression.newBuilder(); // b.setPosition(pos.build()); b.setKind(boa.types.Ast.Expression.ExpressionKind.CAST); boa.types.Ast.Type.Builder tb = boa.types.Ast.Type.newBuilder(); tb.setName(getIndex(typeName(node.getType()))); tb.setKind(boa.types.Ast.TypeKind.OTHER); b.setNewType(tb.build());/*w w w . j a v a 2 s .co m*/ node.getExpression().accept(this); b.addExpressions(expressions.pop()); expressions.push(b.build()); return false; }
From source file:ca.mcgill.cs.swevo.ppa.PPAASTUtil.java
License:Open Source License
public static boolean isIndicationOfField(Name node) { boolean isField = false; ASTNode parent = node.getParent();/*from w ww . j a v a2 s. c om*/ // The thing here is that if the parent is a qualified name, go one // level up. // If the parent is still a qualified name, then, it means we were in // the middle, so this is // not necessarily a field. if (parent instanceof QualifiedName) { QualifiedName qName = (QualifiedName) parent; if (qName.getName().equals(node)) { node = (Name) parent; parent = parent.getParent(); } } if (parent instanceof ArrayAccess) { isField = true; // } else if (parent instanceof ArrayCreation) { // isField = true; } else if (parent instanceof ArrayInitializer) { isField = true; } else if (parent instanceof Assignment) { isField = true; } else if (parent instanceof CastExpression) { CastExpression cExpression = (CastExpression) parent; isField = cExpression.getExpression().equals(node); } else if (parent instanceof ConditionalExpression) { isField = true; } else if (parent instanceof InfixExpression) { isField = true; } else if (parent instanceof WhileStatement) { isField = true; } else if (parent instanceof DoStatement) { isField = true; } else if (parent instanceof ForStatement) { ForStatement forStatement = (ForStatement) parent; isField = forStatement.getExpression().equals(node); } else if (parent instanceof PrefixExpression) { isField = true; } else if (parent instanceof PostfixExpression) { isField = true; } else if (parent instanceof ReturnStatement) { isField = true; } else if (parent instanceof InstanceofExpression) { InstanceofExpression ioe = (InstanceofExpression) parent; isField = ioe.getLeftOperand().equals(node); } else if (parent instanceof FieldAccess) { isField = true; } else if (parent instanceof SuperFieldAccess) { isField = true; } else if (parent instanceof MethodInvocation) { MethodInvocation mi = (MethodInvocation) parent; for (Object object : mi.arguments()) { if (node == object) { isField = true; break; } } } else if (parent instanceof ClassInstanceCreation) { ClassInstanceCreation cic = (ClassInstanceCreation) parent; for (Object object : cic.arguments()) { if (node == object) { isField = true; break; } } } else if (parent instanceof VariableDeclarationFragment) { isField = true; } return isField; }
From source file:changetypes.ASTVisitorAtomicChange.java
License:Open Source License
public boolean visit(CastExpression node) { if (this.mtbStack.isEmpty()) { return true; }//from www .j a v a 2 s.c om Expression expression = node.getExpression(); ITypeBinding type = node.getType().resolveBinding(); IMethodBinding mtb = (IMethodBinding) this.mtbStack.peek(); String exprStr = expression.toString(); String typeStr = getQualifiedName(type); String methodStr = getQualifiedName(mtb); exprStr = edit_str(exprStr); this.facts.add(Fact.makeCastFact(exprStr, typeStr, methodStr)); return true; }
From source file:coloredide.utils.CopiedNaiveASTFlattener.java
License:Open Source License
public boolean visit(CastExpression node) { this.buffer.append("(");//$NON-NLS-1$ node.getType().accept(this); this.buffer.append(")");//$NON-NLS-1$ node.getExpression().accept(this); return false; }
From source file:com.bsiag.eclipse.jdt.java.formatter.SpacePreparator.java
License:Open Source License
@Override public boolean visit(CastExpression node) { handleToken(node, TokenNameLPAREN, false, this.options.insert_space_after_opening_paren_in_cast); handleTokenBefore(node.getExpression(), TokenNameRPAREN, this.options.insert_space_before_closing_paren_in_cast, this.options.insert_space_after_closing_paren_in_cast); return true;/* w ww . j a v a 2s . c o m*/ }
From source file:com.google.dart.java2dart.SyntaxTranslator.java
License:Open Source License
@Override public boolean visit(org.eclipse.jdt.core.dom.CastExpression node) { Expression expression = translate(node.getExpression()); TypeName typeName = translate(node.getType()); AsExpression asExpression = asExpression(expression, typeName); return done(parenthesizedExpression(asExpression)); }
From source file:com.google.devtools.j2cpp.gen.CppStatementGenerator.java
License:Open Source License
@Override public boolean visit(CastExpression node) { buffer.append("("); buffer.append(NameTable.javaRefToCpp(node.getType())); buffer.append(") "); node.getExpression().accept(this); return false; }
From source file:com.google.devtools.j2objc.ast.DebugASTPrinter.java
License:Apache License
@Override public boolean visit(CastExpression node) { sb.print('('); node.getType().accept(this); sb.print(')'); node.getExpression().accept(this); return false; }
From source file:com.google.googlejavaformat.java.JavaInputAstVisitor.java
License:Apache License
/** Visitor method for {@link CastExpression}s. */ @Override/* www .j av a 2 s.c o m*/ public boolean visit(CastExpression node) { sync(node); builder.open(plusFour); token("("); node.getType().accept(this); token(")"); builder.breakOp(" "); node.getExpression().accept(this); builder.close(); return false; }