All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.sourceforge.pmd.lang.ecmascript.ast.ASTAstRoot Maven / Gradle / Ivy

There is a newer version: 7.7.0
Show newest version
/*
 * BSD-style license; for more info see http://pmd.sourceforge.net/license.html
 */

package net.sourceforge.pmd.lang.ecmascript.ast;

import org.mozilla.javascript.ast.AstRoot;

import net.sourceforge.pmd.lang.ast.AstInfo;
import net.sourceforge.pmd.lang.ast.RootNode;

public final class ASTAstRoot extends AbstractEcmascriptNode implements RootNode {

    private AstInfo astInfo;

    public ASTAstRoot(AstRoot astRoot) {
        super(astRoot);
    }

    @Override
    public AstInfo getAstInfo() {
        return astInfo;
    }

    @Override
    protected  R acceptJsVisitor(EcmascriptVisitor visitor, P data) {
        return visitor.visit(this, data);
    }

    public int getNumComments() {
        return node.getComments() != null ? node.getComments().size() : 0;
    }


    public ASTComment getComment(int index) {
        return (ASTComment) getChild(getNumChildren() - 1 - getNumComments() + index);
    }

    void setAstInfo(AstInfo astInfo) {
        this.astInfo = astInfo;
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy