Example usage for org.eclipse.jdt.internal.compiler.ast ASTNode toString

List of usage examples for org.eclipse.jdt.internal.compiler.ast ASTNode toString

Introduction

In this page you can find the example usage for org.eclipse.jdt.internal.compiler.ast ASTNode toString.

Prototype

@Override
    public String toString() 

Source Link

Usage

From source file:ch.uzh.ifi.seal.changedistiller.ast.java.JavaMethodBodyConverter.java

License:Apache License

private String getASTString(ASTNode node) {
    if (node instanceof CompilationUnitDeclaration) {
        return "";
    }/*from  w ww . ja v  a2  s .co  m*/
    String result = node.toString();
    // method and type declaration strings contain their javadoc
    // get rid of the javadoc
    if (node instanceof MethodDeclaration || node instanceof TypeDeclaration) {
        MethodDeclaration method = (MethodDeclaration) node;
        if (method.javadoc != null) {
            return result.replace(method.javadoc.toString(), "");
        }
    }
    return result;
}

From source file:com.google.gwt.dev.jjs.impl.GwtAstBuilder.java

License:Apache License

InternalCompilerException translateException(ASTNode node, Throwable e) {
    if (e instanceof VirtualMachineError) {
        // Always rethrow VM errors (an attempt to wrap may fail).
        throw (VirtualMachineError) e;
    }/* w w  w . j  a v  a 2 s .  c o m*/
    InternalCompilerException ice;
    if (e instanceof InternalCompilerException) {
        ice = (InternalCompilerException) e;
    } else {
        ice = new InternalCompilerException("Error constructing Java AST", e);
    }
    if (node != null) {
        ice.addNode(node.getClass().getName(), node.toString(), makeSourceInfo(node));
    }
    return ice;
}

From source file:org.eclipse.recommenders.rcp.utils.CompilerBindingsToMethodNameTest.java

License:Open Source License

private static MethodBinding getBinding(ASTNode node) {
    if (node instanceof MessageSend) {
        return ((MessageSend) node).binding;
    } else if (node instanceof AllocationExpression) {
        return ((AllocationExpression) node).binding;
    } else {/*from w w  w . j a  v  a 2 s .co  m*/
        throw new IllegalArgumentException(node.toString());
    }
}

From source file:org.eclipse.recommenders.rcp.utils.CompilerBindingsToTypeNameTest.java

License:Open Source License

private static TypeBinding getBinding(ASTNode node) {
    if (node instanceof SingleTypeReference) {
        return ((SingleTypeReference) node).resolvedType;
    } else {/*from   w w  w.j  a v a 2 s.c o  m*/
        throw new IllegalArgumentException(node.toString());
    }
}