If required, rewrite the statement containing the call expression.
@see ExpressionDecomposer#canExposeExpression
332576
void maybePrepareCall(Reference ref) {
    CallSiteType callSiteType = classifyCallSite(ref);
    callSiteType.prepare(this, ref);
  }
586566
public static MethodCallExpression buildPutMapExpression(final Expression objectExpression, final String keyName, final Expression valueExpression) {
        return applyDefaultMethodTarget(new MethodCallExpression(objectExpression, "put", new ArgumentListExpression(new ConstantExpression(keyName), valueExpression)), Map.class);
    }
202733
public Statement invokeVoid(MethodRef method, Expression... args) {
    return method.invokeVoid(ImmutableList.<Expression>builder().add(this).add(args).build());
  }
296467
private static void setSourcePosition(Expression toSet, Expression origNode) {
        toSet.setSourcePosition(origNode);
        if (toSet instanceof PropertyExpression) {
            ((PropertyExpression) toSet).getProperty().setSourcePosition(origNode);
        }
    }
888831
void moveExpression(Node expression) {
    // TODO(johnlenz): This is not currently used by the function inliner,
    // as moving the call out of the expression before the actual function call
    // causes additional variables to be introduced.  As the variable
    // inliner is improved, this might be a viable option.

    String resultName = getResultValueName();
    Node injectionPoint = findInjectionPoint(expression);
    checkNotNull(injectionPoint);
    Node injectionPointParent = injectionPoint.getParent();
    checkNotNull(injectionPointParent);
    checkState(NodeUtil.isStatementBlock(injectionPointParent));

    // Replace the expression with a reference to the new name.
    Node expressionParent = expression.getParent();
    expressionParent.replaceChild(
        expression, withType(IR.name(resultName), expression.getJSType()));

    // Re-add the expression at the appropriate place.
    Node newExpressionRoot = NodeUtil.newVarNode(resultName, expression);
    newExpressionRoot.getFirstChild().setJSType(expression.getJSType());
    injectionPointParent.addChildBefore(newExpressionRoot, injectionPoint);

    compiler.reportChangeToEnclosingScope(injectionPointParent);
  }
1041175
final public static function methodCall(Expression $value, Expression $name, array $arguments = [])
    {
        return new MethodCallExpression(
                $value,
                $name,
                $arguments);
    }
1158432
public void pushEnclosingMethodCall(Expression call) {
        if (call instanceof MethodCallExpression || call instanceof StaticMethodCallExpression) {
            enclosingMethodCalls.addFirst(call);
        } else {
            throw new IllegalArgumentException("Expression must be a method call or a static method call");
        }
    }
594171
@Override
    protected InfixExpression createCorrectOddnessCheck(ASTRewrite rewrite, Expression numberExpression) {
        Assert.isNotNull(rewrite);
        Assert.isNotNull(numberExpression);

        final AST ast = rewrite.getAST();
        InfixExpression correctOddnessCheck = ast.newInfixExpression();
        InfixExpression remainderExp = ast.newInfixExpression();

        correctOddnessCheck.setLeftOperand(remainderExp);
        correctOddnessCheck.setOperator(NOT_EQUALS);
        correctOddnessCheck.setRightOperand(ast.newNumberLiteral("0"));

        remainderExp.setLeftOperand((Expression) rewrite.createMoveTarget(numberExpression));
        remainderExp.setOperator(REMAINDER);
        remainderExp.setRightOperand(ast.newNumberLiteral("2"));

        return correctOddnessCheck;
    }
1135942
public void visitMethodCallExpression(MethodCallExpression call) {
        boolean shouldContinueWalking = true;

        if (isBuildInvocation(call)) {
            shouldContinueWalking = handleTargetMethodCallExpression(call);
        }

        if (shouldContinueWalking) {
            // continue normal tree walking
            call.getObjectExpression().visit(this);
            call.getMethod().visit(this);
            call.getArguments().visit(this);
        }
    }
499821
private ExpressionStatementTree parseExpressionStatement() {
    SourcePosition start = getTreeStartLocation();
    ParseTree expression = parseExpression();
    eatPossibleImplicitSemiColon();
    return new ExpressionStatementTree(getTreeLocation(start), expression);
  }
1372350
final public ExecExpressionBuilder<T> exec() {
    final int sourceLineNumber = builder.getSourceLineNumber();
    return new ExecExpressionBuilder<T>(new ExpressionHandler<T>() {
      public T handleExpression(Expression e) {
        return statementHandler().handleStatement(new ExpressionStatement(sourceLineNumber, e));
      }
    });
  }
1053938
@Nonnull
  public CSSDeclaration setExpression (@Nonnull final CSSExpression aExpression)
  {
    m_aExpression = ValueEnforcer.notNull (aExpression, "Expression");
    return this;
  }
191198
public static MethodCallExpression applyDefaultMethodTarget(final MethodCallExpression methodCallExpression, final Class<?> targetClass) {
        return applyDefaultMethodTarget(methodCallExpression, ClassHelper.make(targetClass).getPlainNodeReference());
    }
708666
public static function createRecursiveExpression( core_kernel_rules_Expression $exp1,  core_kernel_rules_Expression $exp2,  core_kernel_classes_Resource $operator)
    {
        $returnValue = null;

        
        if ($exp1 == null || $exp2 == null  || $operator == null) {
        	var_dump($exp1,$exp2,$operator);
        	throw new common_Exception('paramaters could not be null');
        }

        $expressionClass = new core_kernel_classes_Class(RulesRdf::CLASS_URI_EXPRESSION,__METHOD__);
        $label = 'Expression : ' . $exp1->getLabel() . ' ' . $operator->getLabel() . ' ' . $exp2->getLabel();
        $comment = 'Expression : ' . $exp1->getUri() . ' ' . $operator->getUri() . ' ' . $exp2->getUri();
        $expressionInst = core_kernel_classes_ResourceFactory::create($expressionClass,$label,$comment);
      	$terminalExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_TERMINAL_EXPRESSION,__METHOD__);
        $logicalOperatorProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_HASLOGICALOPERATOR,__METHOD__);
		$firstExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_FIRST_EXPRESSION,__METHOD__);
		$secondExpressionProperty = new core_kernel_classes_Property(RulesRdf::PROPERTY_SECOND_EXPRESSION,__METHOD__);
		$returnValue = new core_kernel_rules_Expression($expressionInst->getUri());
		$returnValue->debug = __METHOD__;
		$returnValue->setPropertyValue($terminalExpressionProperty,RulesRdf::INSTANCE_EMPTY_TERM_URI);
		$returnValue->setPropertyValue($firstExpressionProperty,$exp1->getUri());
		$returnValue->setPropertyValue($secondExpressionProperty,$exp2->getUri());
		$returnValue->setPropertyValue($logicalOperatorProperty,$operator->getUri()); 
		

        return $returnValue;
    }
748439
private function processOptionals(array &$expression, Call $call, CompilationContext $context)
    {
        $flags = null;
        $offset = null;

        $offsetParamOffset = 4;
        if (isset($expression['parameters'][4]) && 'int' === $expression['parameters'][4]['parameter']['type']) {
            $offset = $expression['parameters'][4]['parameter']['value'].' ';
            unset($expression['parameters'][4]);
        }

        if (isset($expression['parameters'][3]) && 'int' === $expression['parameters'][3]['parameter']['type']) {
            $flags = $expression['parameters'][3]['parameter']['value'].' ';
            $offsetParamOffset = 3;
            unset($expression['parameters'][3]);
        }

        try {
            $resolvedParams = $call->getReadOnlyResolvedParams($expression['parameters'], $context, $expression);

            if (null === $offset && isset($resolvedParams[$offsetParamOffset])) {
                $context->headersManager->add('kernel/operators');
                $offset = 'zephir_get_intval('.$resolvedParams[$offsetParamOffset].') ';
            }

            if (null === $flags && isset($resolvedParams[3])) {
                $context->headersManager->add('kernel/operators');
                $flags = 'zephir_get_intval('.$resolvedParams[3].') ';
            }
        } catch (Exception $e) {
            throw new CompilerException($e->getMessage(), $expression, $e->getCode(), $e);
        }

        if (null === $flags) {
            $flags = '0 ';
        }

        if (null === $offset) {
            $offset = '0 ';
        }

        return [$flags, $offset];
    }
624974
private Expression toExpression(Part part, ExpressionList<?> root) {
        return new ExpressionBuilder(part, root).build();
    }
668654
function executeExpression(expressionToExecute, callback) {
    var receivedData = "";
    var hadDataSinceTimeout = false;

    function getProcessInfo(expressionToExecute, callback) {
      var prevReader = Espruino.Core.Serial.startListening(function (readData) {
        var bufView = new Uint8Array(readData);
        for(var i = 0; i < bufView.length; i++) {
          receivedData += String.fromCharCode(bufView[i]);
        }
        // check if we got what we wanted
        var startProcess = receivedData.indexOf("< <<");
        var endProcess = receivedData.indexOf(">> >", startProcess);
        if(startProcess >= 0 && endProcess > 0){
          // All good - get the data!
          var result = receivedData.substring(startProcess + 4,endProcess);
          console.log("Got "+JSON.stringify(receivedData));
          // strip out the text we found
          receivedData = receivedData.substr(0,startProcess) + receivedData.substr(endProcess+4);
          // Now stop time timeout
          if (timeout) clearInterval(timeout);
          timeout = "cancelled";
          // Do the next stuff
          nextStep(result);
        } else if (startProcess >= 0) {
          // we got some data - so keep waiting...
          hadDataSinceTimeout = true;
        }
      });

      // when we're done...
      var nextStep = function(result) {
        // start the previous reader listing again
        Espruino.Core.Serial.startListening(prevReader);
        // forward the original text to the previous reader
        if(prevReader) prevReader(receivedData);
        // run the callback
        callback(result);
      };

      var timeout = undefined;
      // Don't Ctrl-C, as we've already got ourselves a prompt with Espruino.Core.Utils.getEspruinoPrompt
      Espruino.Core.Serial.write('\x10print("<","<<",JSON.stringify('+expressionToExecute+'),">>",">")\n',
                                 undefined, function() {
        // now it's sent, wait for data
        var maxTimeout = 10; // seconds - how long we wait if we're getting data
        var minTimeout = 2; // seconds - how long we wait if we're not getting data
        var pollInterval = 500; // milliseconds
        var timeoutSeconds = 0;
        if (timeout != "cancelled")
          timeout = setInterval(function onTimeout(){
          timeoutSeconds += pollInterval/1000;
          // if we're still getting data, keep waiting for up to 10 secs
          if (hadDataSinceTimeout && timeoutSeconds<maxTimeout) {
            hadDataSinceTimeout = false;
          } else if (timeoutSeconds > minTimeout) {
            // No data yet...
            // OR we keep getting data for > maxTimeout seconds
            clearInterval(timeout);
            console.warn("No result found for "+JSON.stringify(expressionToExecute)+" - just got "+JSON.stringify(receivedData));
            nextStep(undefined);
          }
        }, pollInterval);
      });
    }

    if(Espruino.Core.Serial.isConnected()){
      Espruino.Core.Utils.getEspruinoPrompt(function() {
        getProcessInfo(expressionToExecute, callback);
      });
    } else {
      console.error("executeExpression called when not connected!");
      callback(undefined);
    }
  }