Examples of FunctionExpression


Examples of com.foundationdb.sql.optimizer.plan.FunctionExpression

                return collate(left, cond.getOperation(), right, collator);
            else
                return compare(left, cond, right);
        }
        else if (node instanceof FunctionExpression) {
            FunctionExpression funcNode = (FunctionExpression)node;
            return assembleFunction(funcNode, funcNode.getFunction(),
                    funcNode.getOperands(),
                    columnContext, subqueryAssembler);
        }
        else if (node instanceof IfElseExpression) {
            IfElseExpression ifElse = (IfElseExpression)node;
            return assembleFunction(ifElse, "if",
View Full Code Here

Examples of com.github.sommeri.less4j.core.ast.FunctionExpression

  }

  private Expression buildFromEscapedScript(HiddenTokenAwareTree token, HiddenTokenAwareTree first) {
    String text = first.getText();
    text = text.substring(2, text.length() - 1);
    return new FunctionExpression(token, "~`", new EmbeddedScript(token, text));
  }
View Full Code Here

Examples of com.google.dart.engine.ast.FunctionExpression

    return null;
  }

  @Override
  public Void visitFunctionDeclaration(FunctionDeclaration node) {
    FunctionExpression expression = node.getFunctionExpression();
    if (expression != null) {
      ElementHolder holder = new ElementHolder();
      boolean wasInFunction = inFunction;
      inFunction = true;
      try {
        visitChildren(holder, expression);
      } finally {
        inFunction = wasInFunction;
      }

      FunctionBody body = expression.getBody();
      Token property = node.getPropertyKeyword();
      if (property == null) {
        SimpleIdentifier functionName = node.getName();
        FunctionElementImpl element = new FunctionElementImpl(functionName);
        element.setFunctions(holder.getFunctions());
        element.setLabels(holder.getLabels());
        element.setLocalVariables(holder.getLocalVariables());
        element.setParameters(holder.getParameters());
        if (body.isAsynchronous()) {
          element.setAsynchronous(true);
        }
        if (body.isGenerator()) {
          element.setGenerator(true);
        }

        if (inFunction) {
          Block enclosingBlock = node.getAncestor(Block.class);
          if (enclosingBlock != null) {
            int functionEnd = node.getOffset() + node.getLength();
            int blockEnd = enclosingBlock.getOffset() + enclosingBlock.getLength();
            element.setVisibleRange(functionEnd, blockEnd - functionEnd - 1);
          }
        }

        currentHolder.addFunction(element);
        expression.setElement(element);
        functionName.setStaticElement(element);
      } else {
        SimpleIdentifier propertyNameNode = node.getName();
        if (propertyNameNode == null) {
          // TODO(brianwilkerson) Report this internal error.
          return null;
        }
        String propertyName = propertyNameNode.getName();
        TopLevelVariableElementImpl variable = (TopLevelVariableElementImpl) currentHolder.getTopLevelVariable(propertyName);
        if (variable == null) {
          variable = new TopLevelVariableElementImpl(node.getName().getName(), -1);
          variable.setFinal(true);
          variable.setSynthetic(true);

          currentHolder.addTopLevelVariable(variable);
        }
        if (matches(property, Keyword.GET)) {
          PropertyAccessorElementImpl getter = new PropertyAccessorElementImpl(propertyNameNode);
          getter.setFunctions(holder.getFunctions());
          getter.setLabels(holder.getLabels());
          getter.setLocalVariables(holder.getLocalVariables());
          if (body.isAsynchronous()) {
            getter.setAsynchronous(true);
          }
          if (body.isGenerator()) {
            getter.setGenerator(true);
          }

          getter.setVariable(variable);
          getter.setGetter(true);
          getter.setStatic(true);
          variable.setGetter(getter);

          currentHolder.addAccessor(getter);
          expression.setElement(getter);
          propertyNameNode.setStaticElement(getter);
        } else {
          PropertyAccessorElementImpl setter = new PropertyAccessorElementImpl(propertyNameNode);
          setter.setFunctions(holder.getFunctions());
          setter.setLabels(holder.getLabels());
          setter.setLocalVariables(holder.getLocalVariables());
          setter.setParameters(holder.getParameters());
          if (body.isAsynchronous()) {
            setter.setAsynchronous(true);
          }
          if (body.isGenerator()) {
            setter.setGenerator(true);
          }

          setter.setVariable(variable);
          setter.setSetter(true);
          setter.setStatic(true);
          variable.setSetter(setter);
          variable.setFinal(false);

          currentHolder.addAccessor(setter);
          expression.setElement(setter);
          propertyNameNode.setStaticElement(setter);
        }
      }
      holder.validate();
    }
View Full Code Here

Examples of com.google.dart.engine.ast.FunctionExpression

      enclosingFunction = node.getElement();
      TypeName returnType = node.getReturnType();
      if (node.isSetter() || node.isGetter()) {
        checkForMismatchedAccessorTypes(node, methodName);
        if (node.isSetter()) {
          FunctionExpression functionExpression = node.getFunctionExpression();
          if (functionExpression != null) {
            checkForWrongNumberOfParametersForSetter(identifier, functionExpression.getParameters());
          }
          checkForNonVoidReturnTypeForSetter(returnType);
        }
      }
      if (node.isSetter()) {
View Full Code Here

Examples of com.google.dart.engine.ast.FunctionExpression

      Type mayByFunctionType) {
    // prepare closure
    if (!(mayBeClosure instanceof FunctionExpression)) {
      return;
    }
    FunctionExpression closure = (FunctionExpression) mayBeClosure;
    // prepare expected closure type
    if (!(mayByFunctionType instanceof FunctionType)) {
      return;
    }
    FunctionType expectedClosureType = (FunctionType) mayByFunctionType;

    // If the expectedClosureType is not more specific than the static type, return.
    Type staticClosureType = closure.getElement() != null ? closure.getElement().getType() : null;
    if (staticClosureType != null && !expectedClosureType.isMoreSpecificThan(staticClosureType)) {
      return;
    }

    // set propagated type for the closure
    closure.setPropagatedType(expectedClosureType);
    // set inferred types for parameters
    NodeList<FormalParameter> parameters = closure.getParameters().getParameters();
    ParameterElement[] expectedParameters = expectedClosureType.getParameters();
    for (int i = 0; i < parameters.size() && i < expectedParameters.length; i++) {
      FormalParameter parameter = parameters.get(i);
      ParameterElement element = parameter.getElement();
      Type currentType = getBestType(element);
View Full Code Here

Examples of com.google.dart.engine.ast.FunctionExpression

  @Override
  public Void visitFunctionExpressionInvocation(FunctionExpressionInvocation node) {
    // TODO(brianwilkerson) Can we ever resolve the function being invoked?
    Expression expression = node.getFunction();
    if (expression instanceof FunctionExpression) {
      FunctionExpression functionExpression = (FunctionExpression) expression;
      ExecutableElement functionElement = functionExpression.getElement();
      ArgumentList argumentList = node.getArgumentList();
      ParameterElement[] parameters = resolveArgumentsToFunction(
          false,
          argumentList,
          functionElement);
View Full Code Here

Examples of com.google.dart.engine.ast.FunctionExpression

    return null;
  }

  @Override
  public Void visitFunctionDeclaration(FunctionDeclaration node) {
    FunctionExpression function = node.getFunctionExpression();
    ExecutableElementImpl functionElement = (ExecutableElementImpl) node.getElement();
    functionElement.setReturnType(computeStaticReturnTypeOfFunctionDeclaration(node));
    recordPropagatedTypeOfFunction(functionElement, function.getBody());
    recordStaticType(function, functionElement.getType());
    return null;
  }
View Full Code Here

Examples of com.google.dart.engine.ast.FunctionExpression

          NodeList<Expression> arguments = node.getArgumentList().getArguments();
          if (arguments.size() == 1) {
            // TODO(brianwilkerson) Handle the case where both arguments are provided.
            Expression closureArg = arguments.get(0);
            if (closureArg instanceof FunctionExpression) {
              FunctionExpression closureExpr = (FunctionExpression) closureArg;
              Type returnType = computePropagatedReturnType(closureExpr.getElement());
              if (returnType != null) {
                // prepare the type of the returned Future
                InterfaceTypeImpl newFutureType;
                if (isAsyncFutureType(returnType)) {
                  newFutureType = (InterfaceTypeImpl) returnType;
View Full Code Here

Examples of com.meidusa.amoeba.parser.expression.FunctionExpression

            // 注:evaluate 返回常量的值。
            namedParams.put(column, expr.evaluate(null));

        } else if (expr instanceof FunctionExpression) {

            FunctionExpression funcExpr = (FunctionExpression) expr;

            List<Expression> list = funcExpr.getArgList();

            for (Expression exp : list) {
                parseExpr(exp, null);
            }
        }
View Full Code Here

Examples of org.apache.phoenix.expression.function.FunctionExpression

     * @param node a function expression node
     * @param children the child expression arguments to the function expression node.
     */
    public Expression visitLeave(FunctionParseNode node, List<Expression> children) throws SQLException {
        children = node.validate(children, context);
        FunctionExpression func = node.create(children, context);
        if (node.isConstant()) {
            ImmutableBytesWritable ptr = context.getTempPtr();
            Object value = null;
            PDataType type = func.getDataType();
            if (func.evaluate(null, ptr)) {
                value = type.toObject(ptr);
            }
            return LiteralExpression.newConstant(value, type);
        }
        BuiltInFunctionInfo info = node.getInfo();
        for (int i = 0; i < info.getRequiredArgCount(); i++) {
            // Optimization to catch cases where a required argument is null resulting in the function
            // returning null. We have to wait until after we create the function expression so that
            // we can get the proper type to use.
            if (node.evalToNullIfParamIsNull(context, i)) {
                Expression child = children.get(i);
                if (child instanceof LiteralExpression
                        && ((LiteralExpression)child).getValue() == null) {
                    return LiteralExpression.newConstant(null, func.getDataType());
                }
            }
        }
        Expression expression = addFunction(func);
        expression = wrapGroupByExpression(expression);
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.