Example usage for jdk.nashorn.internal.ir VarNode getInit

List of usage examples for jdk.nashorn.internal.ir VarNode getInit

Introduction

In this page you can find the example usage for jdk.nashorn.internal.ir VarNode getInit.

Prototype

public Expression getInit() 

Source Link

Document

If this is an assignment of the form var x = init; , get the init part.

Usage

From source file:com.bearsoft.org.netbeans.modules.form.JsCodeGenerator.java

private boolean isFormObjectExistsInJs(FunctionNode constructor) {
    if (constructor != null && constructor.getBody() != null) {
        for (Statement st : constructor.getBody().getStatements()) {
            if (st instanceof VarNode) {
                VarNode vn = (VarNode) st;
                if (FORM_OBJECT_NAME.equals(vn.getName().getName())) {
                    if (vn.getInit() instanceof CallNode) {
                        CallNode cn = (CallNode) vn.getInit();
                        return FormModuleCompletionContext.isSystemObjectMethod(cn,
                                FormModuleCompletionContext.LOAD_FORM_METHOD_NAME);
                    }/*  w  w w . j a  v  a2  s .c  o m*/
                }
            }
        }
    }
    return false;
}