Example usage for jdk.nashorn.internal.ir AccessNode getProperty

List of usage examples for jdk.nashorn.internal.ir AccessNode getProperty

Introduction

In this page you can find the example usage for jdk.nashorn.internal.ir AccessNode getProperty.

Prototype

public String getProperty() 

Source Link

Document

Get the property name

Usage

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

private int findHandlerPosition(String componentName, String handlerName, PlatypusFormDataObject dataObject) {
    FunctionNode constructor = dataObject.getConstructor();
    if (constructor != null && constructor.getBody() != null) {
        for (Statement st : constructor.getBody().getStatements()) {
            if (st instanceof ExpressionStatement
                    && ((ExpressionStatement) st).getExpression() instanceof BinaryNode) {
                BinaryNode a = (BinaryNode) ((ExpressionStatement) st).getExpression();
                if (a.isAssignment() && a.getAssignmentDest() instanceof AccessNode) {
                    AccessNode pg = (AccessNode) a.getAssignmentDest();
                    if (handlerName.equals(pg.getProperty())) {
                        if (pg.getBase() instanceof AccessNode) {
                            AccessNode componentPg = (AccessNode) pg.getBase();
                            if (componentName.equals(componentPg.getProperty())
                                    && componentPg.getBase() instanceof IdentNode
                                    && FORM_OBJECT_NAME.equals(((IdentNode) componentPg.getBase()).getName())) {
                                if (a.getAssignmentSource() instanceof FunctionNode) {
                                    FunctionNode handlerFn = (FunctionNode) a.getAssignmentSource();
                                    return handlerFn.getStart();
                                }//  w ww.ja  va2 s . c o m
                            }
                        }
                    }
                }
            }
        }
    }
    return NOT_FOUND;
}

From source file:com.eas.script.PropertiesAnnotationsMiner.java

@Override
public boolean enterBinaryNode(BinaryNode binaryNode) {
    if (scopeLevel == TOP_CONSTRUCTORS_SCOPE_LEVEL && binaryNode.isAssignment()
            && !binaryNode.isSelfModifying()) {
        if (binaryNode.getAssignmentDest() instanceof AccessNode) {
            AccessNode left = (AccessNode) binaryNode.getAssignmentDest();
            if (left.getBase() instanceof IdentNode
                    && thisAliases.contains(((IdentNode) left.getBase()).getName())) {
                long ft = left.getBase().getToken();
                if (prevComments.containsKey(ft)) {
                    long prevComment = prevComments.get(ft);
                    commentedProperty(left.getProperty(), source.getString(prevComment));
                }//from ww w .ja v a 2 s  . c  om
                property(left.getProperty(), binaryNode.getAssignmentSource());
            }
        }
    }
    return super.enterBinaryNode(binaryNode);
}