Examples of FunctionNode


Examples of org.hibernate.hql.internal.ast.tree.FunctionNode

  @Override
    protected void beginFunctionTemplate(AST node, AST nameNode) {
    // NOTE for AGGREGATE both nodes are the same; for METHOD the first is the METHOD, the second is the
    //     METHOD_NAME
    FunctionNode functionNode = ( FunctionNode ) node;
    SQLFunction sqlFunction = functionNode.getSQLFunction();
    if ( sqlFunction == null ) {
      // if SQLFunction is null we just write the function out as it appears in the hql statement
      super.beginFunctionTemplate( node, nameNode );
    }
    else {
View Full Code Here

Examples of org.hibernate.hql.internal.ast.tree.FunctionNode

    }
  }

  @Override
    protected void endFunctionTemplate(AST node) {
    FunctionNode functionNode = ( FunctionNode ) node;
    SQLFunction sqlFunction = functionNode.getSQLFunction();
    if ( sqlFunction == null ) {
      super.endFunctionTemplate( node );
    }
    else {
      final Type functionType = functionNode.getFirstArgumentType();
      // this function has a registered SQLFunction -> redirect output and catch the arguments
      FunctionArguments functionArguments = ( FunctionArguments ) writer;
      writer = outputStack.removeFirst();
      out( sqlFunction.render( functionType, functionArguments.getArgs(), sessionFactory ) );
    }
View Full Code Here

Examples of org.mozilla.javascript.FunctionNode

   * @return
   */
  public String getFunctionName() {
    String identifier = null;
    if (isFunction) {
      FunctionNode n = null;
      try {
        n = getAsFunctionNode();
      } catch (final WinkAstException e) {
        e.printStackTrace();
        return null;
      }
      if (n.getFunctionName() != null && n.getFunctionName() != "") {
        identifier = n.getFunctionName();
      }
      if (identifier == null) {
        final StringBuffer sb = new StringBuffer();
        sb.append(Constants.ANONYMOUS_FUNCTION_PREFIX);
        sb.append("-");
        sb.append(new File(n.getSourceName()).getName());
        sb.append("[");
        sb.append(lineStart);
        sb.append(",");
        sb.append(lineEnd);
        sb.append("]");
View Full Code Here

Examples of org.mozilla.javascript.FunctionNode

      final String le = (lineEnd == -1) ? "?" : new Integer(lineEnd).toString();
      sb.append(" [L:").append(ls).append(" - ").append(le).append("]");
    }

    if (isFunction) {
      FunctionNode n = null;
      try {
        n = getAsFunctionNode();
      } catch (final WinkAstException e) {
        e.printStackTrace();
      }
      sb.append(" [").append(Ast.functionTypeName(n.getFunctionType())).append("]");
    }

    return sb.toString();
  }
View Full Code Here

Examples of org.mozilla.javascript.FunctionNode

   *          表达式子节点生存域
   */
  public FunctionLiteral(Node node, ScriptOrFnNode root, Scope scope) {
    super(root.getFunctionNode(node.getIntProp(Node.FUNCTION_PROP, -1))
        .getLineno());
    FunctionNode fnNode = root.getFunctionNode(node.getIntProp(
        Node.FUNCTION_PROP, -1));
    fnScope = new Scope(scope);

    if (fnNode.getFunctionName().length() > 0) {
      name = scope.addIdentifier(fnNode.getFunctionName());
    }

    node = fnNode.getFirstChild().getFirstChild();
    if (node.getType() == Token.EXPR_VOID) {
      Node firstChild = node.getFirstChild();
      if (firstChild.getType() == Token.SETNAME
          && firstChild.getLastChild().getType() == Token.THISFN) {
        node = node.getNext();
      }
    }
    while (node != null) {
      IStatement statement = Utils.createStatement(node, fnNode, fnScope);
      statements.add(statement);
      node = statement.getNext();
    }

    int size = statements.size() - 1;
    if (statements.size() >= 0) {
      IStatement statement = statements.get(size);
      if (statement instanceof ControlStatement
          && ((ControlStatement) statement).getType() == Token.RETURN) {
        statements.remove(size);
      }
    }

    new NodeTransformer().transform(fnNode);
    String[] symbols = fnNode.getParamAndVarNames();
    for (int i = 0; i < symbols.length; i++) {
      String symbol = symbols[i];
      fnScope.registerLocalIdentifier(symbol);
      if (i < fnNode.getParamCount()) {
        Identifier identifier = fnScope.addIdentifier(symbol);
        identifier.inc((fnNode.getParamCount() - i) * 10000000);
        params.add(identifier);
      }
    }
  }
View Full Code Here

Examples of org.mozilla.javascript.ast.FunctionNode

                }
            } else if (this instanceof Scope) {
                if (this instanceof ScriptNode) {
                    ScriptNode sof = (ScriptNode)this;
                    if (this instanceof FunctionNode) {
                        FunctionNode fn = (FunctionNode)this;
                        sb.append(' ');
                        sb.append(fn.getName());
                    }
                    sb.append(" [source name: ");
                    sb.append(sof.getSourceName());
                    sb.append("] [encoded source length: ");
                    sb.append(sof.getEncodedSourceEnd()
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.