com.caucho.quercus.program
Class Function

java.lang.Object
  extended by com.caucho.quercus.env.Value
      extended by com.caucho.quercus.env.Callback
          extended by com.caucho.quercus.function.AbstractFunction
              extended by com.caucho.quercus.program.Function
All Implemented Interfaces:
Callable, java.io.Serializable
Direct Known Subclasses:
MethodDeclaration, ObjectMethod, ProFunction

public class Function
extends AbstractFunction

Represents sequence of statements.

See Also:
Serialized Form

Field Summary
protected  Arg[] _args
           
protected  Arg[] _closureUseArgs
           
protected  java.lang.String _comment
           
protected  boolean _hasReturn
           
protected  FunctionInfo _info
           
protected  boolean _isReturnsReference
           
protected  java.lang.String _name
           
protected  Statement _statement
           
 
Fields inherited from class com.caucho.quercus.function.AbstractFunction
_bindingClass, _declaringClassName, _isClosure, _isConstructor, _isFinal, _isStatic, _parseIndex, _visibility
 
Fields inherited from class com.caucho.quercus.env.Value
NULL_VALUE_ARRAY, SCALAR_V
 
Constructor Summary
Function(ExprFactory exprFactory, Location location, java.lang.String name, FunctionInfo info, Arg[] args, Statement[] statements)
           
 
Method Summary
 Value call(Env env, Expr[] args)
           
 Value call(Env env, Value[] args)
          Evaluates the function.
 Value callCopy(Env env, Expr[] args)
           
 Value callCopy(Env env, Value[] args)
          Evaluates the function, returning a copy
 Value callImpl(Env env, Value[] args, boolean isRef, Arg[] useParams, Value[] useArgs)
           
 Value callMethod(Env env, QuercusClass qClass, Value qThis, Value[] args)
          Evaluates the method call.
 Value callMethodRef(Env env, QuercusClass qClass, Value qThis, Value[] args)
          Evaluates the method call, returning a reference.
 Value callRef(Env env, Expr[] args)
           
 Value callRef(Env env, Value[] args)
          Evaluates the function, returning a reference.
 Value[] evalArguments(Env env, Expr fun, Expr[] args)
          Evaluates a function's argument, handling ref vs non-ref
 Value execute(Env env)
           
 Arg[] getArgs()
          Returns the args.
 Arg[] getClosureUseArgs()
          Returns the args.
 java.lang.String getComment()
          Returns the documentation for this function.
 ClassDef getDeclaringClass()
           
 java.lang.String getDeclaringClassName()
           
 FunctionInfo getInfo()
           
 java.lang.String getName()
          Returns the name.
protected  boolean isMethod()
           
 boolean isObjectMethod()
           
 boolean isReturnsReference()
          True for a returns reference.
 void setClosureUseArgs(Arg[] useArgs)
          Returns the args.
 void setComment(java.lang.String comment)
          Sets the documentation for this function.
 java.lang.String toString()
           
 
Methods inherited from class com.caucho.quercus.function.AbstractFunction
call, call, call, call, call, call, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callRef, callRef, callRef, callRef, callRef, callRef, errorPrivateAccess, errorProtectedAccess, getActualFunction, getBindingClass, getBindingClassName, getCallbackName, getCompilationName, getLocation, getType, isAbstract, isBoolean, isCallUsesSymbolTable, isCallUsesVariableArgs, isClosure, isConstructor, isDouble, isFinal, isGlobal, isInternal, isLong, isObject, isPrivate, isProtected, isPublic, isStatic, isString, isValid, setBindingClass, setClosure, setConstructor, setDeclaringClassName, setFinal, setGlobal, setParseIndex, setStatic, setVisibility, toFun
 
Methods inherited from class com.caucho.quercus.env.Callback
callArray, callArray, callArray, toCallable
 
Methods inherited from class com.caucho.quercus.env.Value
abs, add, add, addOne, append, appendTo, appendTo, appendTo, appendTo, bitAnd, bitOr, bitXor, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethod, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, callMethodRef, charValueAt, checkPrivate, checkProtected, clone, cmp, containsKey, copy, copy, copy, copyArrayItem, copyReturn, copySaveFunArg, copyStringBuilder, copyTree, current, div, div, end, eq, eql, eqValue, findFunction, generate, geq, get, getArg, getArray, getArray, getBaseIterator, getCallableName, getCalledClass, getClassName, getCount, getCountRecursive, getDirty, getField, getFieldArg, getFieldArgRef, getFieldArray, getFieldObject, getFieldVar, getHashCode, getIterator, getKeyArray, getKeyIterator, getObject, getObject, getQuercusClass, getRef, getResourceType, getSize, getThisField, getThisFieldArg, getThisFieldArgRef, getThisFieldArray, getThisFieldObject, getThisFieldVar, getValueArray, getValueIterator, getValueType, getVar, gt, hasCurrent, hashCode, increment, initField, isA, isA, isArray, isBinary, isCallable, isDefault, isDoubleConvertible, isEmpty, isFieldInit, isLongConvertible, isNull, isNumberConvertible, isNumeric, isResource, isset, isset, issetField, issetThisField, isUnicode, isVar, jsonEncode, key, keyExists, length, leq, lshift, lt, mod, mul, mul, neg, next, nextIndex, pop, pos, postdecr, postincr, postincr, predecr, preincr, preincr, prev, print, print, printDepth, printJavaChar, printJavaString, printR, printRImpl, put, put, put, putField, putField, putField, putObject, putThisField, putThisField, putVar, remove, reset, rshift, serialize, serialize, set, setCharValueAt, setFieldInit, setJavaObject, shuffle, sub_rev, sub, sub, subOne, toArgRef, toArray, toArrayValue, toAutoArray, toAutoObject, toBigDecimal, toBigInteger, toBinaryValue, toBinaryValue, toBinaryValue, toBinaryValueMarshalCost, toBoolean, toBooleanMarshalCost, toByteArrayMarshalCost, toByteMarshalCost, toChar, toCharArrayMarshalCost, toCharMarshalCost, toDebugString, toDouble, toDoubleMarshalCost, toDoubleValue, toException, toFloatMarshalCost, toInputStream, toInt, toIntegerMarshalCost, toInternString, toJavaBoolean, toJavaByte, toJavaCalendar, toJavaCharacter, toJavaCollection, toJavaDate, toJavaDouble, toJavaFloat, toJavaInteger, toJavaList, toJavaLong, toJavaMap, toJavaObject, toJavaObject, toJavaObjectMarshalCost, toJavaObjectNotNull, toJavaShort, toJavaString, toJavaURL, toKey, toLocalRef, toLocalThis, toLocalValue, toLocalValueReadOnly, toLocalVar, toLocalVarDeclAsRef, toLong, toLongMarshalCost, toLongValue, toObject, toRef, toRefValue, toShortMarshalCost, toString, toStringBuilder, toStringBuilder, toStringBuilder, toStringBuilder, toStringMarshalCost, toStringValue, toStringValue, toStringValueMarshalCost, toUnicode, toUnicodeValue, toUnicodeValue, toUnicodeValueMarshalCost, toValue, toVar, unsetArray, unsetField, unsetThisArray, unsetThisField, valuesToArray, varDump, varDumpImpl, varExport
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, notify, notifyAll, wait, wait, wait
 

Field Detail

_info

protected final FunctionInfo _info

_isReturnsReference

protected final boolean _isReturnsReference

_name

protected final java.lang.String _name

_args

protected final Arg[] _args

_statement

protected final Statement _statement

_hasReturn

protected boolean _hasReturn

_comment

protected java.lang.String _comment

_closureUseArgs

protected Arg[] _closureUseArgs
Constructor Detail

Function

public Function(ExprFactory exprFactory,
                Location location,
                java.lang.String name,
                FunctionInfo info,
                Arg[] args,
                Statement[] statements)
Method Detail

getName

public java.lang.String getName()
Returns the name.

Overrides:
getName in class AbstractFunction

getDeclaringClass

public ClassDef getDeclaringClass()
Overrides:
getDeclaringClass in class AbstractFunction

getInfo

public FunctionInfo getInfo()

isMethod

protected boolean isMethod()

getDeclaringClassName

public java.lang.String getDeclaringClassName()
Overrides:
getDeclaringClassName in class AbstractFunction

getArgs

public Arg[] getArgs()
Returns the args.

Overrides:
getArgs in class AbstractFunction

getClosureUseArgs

public Arg[] getClosureUseArgs()
Returns the args.


setClosureUseArgs

public void setClosureUseArgs(Arg[] useArgs)
Returns the args.


isObjectMethod

public boolean isObjectMethod()

isReturnsReference

public boolean isReturnsReference()
True for a returns reference.

Overrides:
isReturnsReference in class AbstractFunction

setComment

public void setComment(java.lang.String comment)
Sets the documentation for this function.


getComment

public java.lang.String getComment()
Returns the documentation for this function.

Overrides:
getComment in class AbstractFunction

execute

public Value execute(Env env)

evalArguments

public Value[] evalArguments(Env env,
                             Expr fun,
                             Expr[] args)
Evaluates a function's argument, handling ref vs non-ref

Overrides:
evalArguments in class AbstractFunction
args - the user's arguments
Returns:
the user arguments augmented by any defaults

call

public Value call(Env env,
                  Expr[] args)

callCopy

public Value callCopy(Env env,
                      Expr[] args)

callRef

public Value callRef(Env env,
                     Expr[] args)

call

public Value call(Env env,
                  Value[] args)
Description copied from class: AbstractFunction
Evaluates the function.

Specified by:
call in interface Callable
Specified by:
call in class AbstractFunction
Parameters:
env - the calling environment

callCopy

public Value callCopy(Env env,
                      Value[] args)
Description copied from class: AbstractFunction
Evaluates the function, returning a copy

Overrides:
callCopy in class AbstractFunction

callRef

public Value callRef(Env env,
                     Value[] args)
Description copied from class: AbstractFunction
Evaluates the function, returning a reference.

Overrides:
callRef in class AbstractFunction

callImpl

public Value callImpl(Env env,
                      Value[] args,
                      boolean isRef,
                      Arg[] useParams,
                      Value[] useArgs)

callMethod

public Value callMethod(Env env,
                        QuercusClass qClass,
                        Value qThis,
                        Value[] args)
Description copied from class: AbstractFunction
Evaluates the method call.

Overrides:
callMethod in class AbstractFunction

callMethodRef

public Value callMethodRef(Env env,
                           QuercusClass qClass,
                           Value qThis,
                           Value[] args)
Description copied from class: AbstractFunction
Evaluates the method call, returning a reference.

Overrides:
callMethodRef in class AbstractFunction

toString

public java.lang.String toString()
Overrides:
toString in class AbstractFunction