Example usage for org.eclipse.jdt.core.dom ThisExpression setSourceRange

List of usage examples for org.eclipse.jdt.core.dom ThisExpression setSourceRange

Introduction

In this page you can find the example usage for org.eclipse.jdt.core.dom ThisExpression setSourceRange.

Prototype

public final void setSourceRange(int startPosition, int length) 

Source Link

Document

Sets the source range of the original source file where the source fragment corresponding to this node was found.

Usage

From source file:org.eclipse.jdt.core.dom.ASTConverter.java

License:Open Source License

public ThisExpression convert(org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference reference) {
    final ThisExpression thisExpression = new ThisExpression(this.ast);
    thisExpression.setSourceRange(reference.sourceStart, reference.sourceEnd - reference.sourceStart + 1);
    thisExpression.setQualifier(convert(reference.qualification));
    if (this.resolveBindings) {
        recordNodes(thisExpression, reference);
        recordPendingThisExpressionScopeResolution(thisExpression);
    }//from   www . j  av  a 2s  .c om
    return thisExpression;
}

From source file:org.eclipse.jdt.core.dom.ASTConverter.java

License:Open Source License

public Expression convert(org.eclipse.jdt.internal.compiler.ast.ThisReference reference) {
    if (reference.isImplicitThis()) {
        // There is no source associated with an implicit this
        return null;
    } else if (reference instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) {
        return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedSuperReference) reference);
    } else if (reference instanceof org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference) {
        return convert((org.eclipse.jdt.internal.compiler.ast.QualifiedThisReference) reference);
    } else {//  ww  w  . j av a  2s. c  o  m
        ThisExpression thisExpression = new ThisExpression(this.ast);
        thisExpression.setSourceRange(reference.sourceStart, reference.sourceEnd - reference.sourceStart + 1);
        if (this.resolveBindings) {
            recordNodes(thisExpression, reference);
            recordPendingThisExpressionScopeResolution(thisExpression);
        }
        return thisExpression;
    }
}