gnu.expr

Class ApplyExp

public class ApplyExp extends Expression

This class is used to represent "combination" or "application". A function and arguments are evaluated, and then the function applied.
Field Summary
static intINLINE_IF_CONSTANT
ApplyExpnextCall
The next ApplyExp in ((ReferenceExp)func).binding.firstCall list.
protected Typetype
Cache for getType().
static intTAILCALL
Constructor Summary
ApplyExp(Expression f, Expression[] a)
ApplyExp(Procedure p, Expression[] a)
ApplyExp(Method m, Expression[] a)
Method Summary
voidapply(CallContext ctx)
voidcompile(Compilation comp, Target target)
static voidcompile(ApplyExp exp, Compilation comp, Target target)
static voidcompileToArray(Expression[] args, Compilation comp)
ExpressiongetArg(int i)
intgetArgCount()
Expression[]getArgs()
ExpressiongetFunction()
ObjectgetFunctionValue()
If getFunction() is constant, return its value; otherwise null.
TypegetType()
TypegetTypeRaw()
ExpressioninlineIfConstant(Procedure proc, ExpWalker walker)
ExpressioninlineIfConstant(Procedure proc, SourceMessages messages)
Inline this ApplyExp if parameters are constant.
booleanisTailCall()
protected booleanmustCompile()
voidprint(OutPort out)
voidsetArg(int i, Expression arg)
voidsetArgs(Expression[] args)
voidsetFunction(Expression func)
voidsetTailCall(boolean tailCall)
voidsetType(Type type)
StringtoString()
protected Expressionwalk(ExpWalker walker)
protected voidwalkChildren(ExpWalker walker)

Field Detail

INLINE_IF_CONSTANT

public static final int INLINE_IF_CONSTANT

nextCall

public ApplyExp nextCall
The next ApplyExp in ((ReferenceExp)func).binding.firstCall list.

type

protected Type type
Cache for getType().

TAILCALL

public static final int TAILCALL

Constructor Detail

ApplyExp

public ApplyExp(Expression f, Expression[] a)

ApplyExp

public ApplyExp(Procedure p, Expression[] a)

ApplyExp

public ApplyExp(Method m, Expression[] a)

Method Detail

apply

public void apply(CallContext ctx)

compile

public void compile(Compilation comp, Target target)

compile

public static void compile(ApplyExp exp, Compilation comp, Target target)

compileToArray

public static void compileToArray(Expression[] args, Compilation comp)

getArg

public Expression getArg(int i)

getArgCount

public final int getArgCount()

getArgs

public final Expression[] getArgs()

getFunction

public final Expression getFunction()

getFunctionValue

public final Object getFunctionValue()
If getFunction() is constant, return its value; otherwise null.

getType

public final Type getType()

getTypeRaw

public final Type getTypeRaw()

inlineIfConstant

public final Expression inlineIfConstant(Procedure proc, ExpWalker walker)

inlineIfConstant

public final Expression inlineIfConstant(Procedure proc, SourceMessages messages)
Inline this ApplyExp if parameters are constant.

Parameters: proc the procedure bound to this.func.

Returns: the constant result (as a QuoteExp) if inlining was possible; otherwise this ApplyExp. If applying proc throws an exception, print a warning on walker.messages.

isTailCall

public final boolean isTailCall()

mustCompile

protected boolean mustCompile()

print

public void print(OutPort out)

setArg

public void setArg(int i, Expression arg)

setArgs

public void setArgs(Expression[] args)

setFunction

public void setFunction(Expression func)

setTailCall

public final void setTailCall(boolean tailCall)

setType

public final void setType(Type type)

toString

public String toString()

walk

protected Expression walk(ExpWalker walker)

walkChildren

protected void walkChildren(ExpWalker walker)