Class BlockExpression
- java.lang.Object
-
- gw.internal.gosu.parser.ParsedElement
-
- gw.internal.gosu.parser.Expression
-
- gw.internal.gosu.parser.expressions.BlockExpression
-
- All Implemented Interfaces:
IBlockExpression,IExpression,IHasType,IParsedElement
public final class BlockExpression extends Expression implements IBlockExpression
A block expression, representing an anonymous function/closure- See Also:
IGosuParser
-
-
Field Summary
Fields Modifier and Type Field Description private java.util.List<ISymbol>_argsprivate IParsedElement_blockBodyprivate IBlockClassInternal_blockClassprivate IType_blockReturnTypeprivate java.util.Map<java.lang.String,ICapturedSymbol>_capturedSymbolsprivate StandardScope_scope-
Fields inherited from class gw.internal.gosu.parser.Expression
_type
-
Fields inherited from class gw.internal.gosu.parser.ParsedElement
_tokens, UNDEF_FILE, UNDEF_FUNCTION, UNDEF_MODULE
-
Fields inherited from interface gw.lang.parser.IExpression
EMPTY_ARRAY
-
-
Constructor Summary
Constructors Constructor Description BlockExpression()Constructs an block expression.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidaddCapturedSymbol(ICapturedSymbol sym)java.lang.Objectevaluate()Evaluates this Expression and returns the result.java.util.List<ISymbol>getArgs()IBlockClassgetBlockGosuClass()ITypegetBlockReturnType()IParsedElementgetBody()ICapturedSymbolgetCapturedSymbol(java.lang.String strName)java.util.Map<java.lang.String,ICapturedSymbol>getCapturedSymbols()java.lang.StringgetFunctionName()IGosuClassgetGosuClass()IScopegetScope()The scope of the block, available only at compile timeIFunctionTypegetType()Returns this Expression's IType.IFunctionTypegetTypeImpl()booleanisWithinScope(ISymbol sym, ISymbolTable symbolTable)voidsetArgs(java.util.List<ISymbol> args)voidsetBlockGosuClass(IBlockClassInternal blockClass)voidsetBlockReturnType(IType blockReturnType)voidsetBody(IParsedElement blockBody)voidsetScope(StandardScope blockScope)The scope of the block, available only at compile timebooleanshouldClearParseInfo()java.lang.StringtoString()Subclasses should return a String representing the parsed expression.voidupdateGosuClass()-
Methods inherited from class gw.internal.gosu.parser.Expression
evaluate, getContextType, getReturnType, isNullSafe, isUnchecked, setType
-
Methods inherited from class gw.internal.gosu.parser.ParsedElement
addExceptionsFrom, addParseException, addParseException, addParseException, addParseExceptions, addParseIssues, addParseWarning, addParseWarning, addParseWarnings, addToken, adjustColumn, adjustLineNum, assignTokens, clearParseExceptions, clearParseTreeInformation, clearParseWarnings, compactParseTree, findAncestorParsedElementByType, findDeclaringStatement, findLineNumberOfDeclaration, findRootParsedElement, getAnnotations, getColumn, getContainedParsedElementsByType, getContainedParsedElementsByTypes, getContainedParsedElementsByTypesWithIgnoreSet, getEnclosingFeatureInfo, getGosuProgram, getImmediateParseIssue, getImmediateParseIssues, getLineNum, getLocation, getModule, getParent, getParseExceptions, getParseIssues, getParseWarnings, getQualifyingEnclosingTypeInfo, getTokens, hasImmediateParseIssue, hasImmediateParseWarning, hasImmediateParseWarnings, hasParseException, hasParseExceptions, hasParseIssue, hasParseIssues, hasParseWarning, hasParseWarnings, initEmptyParseTree, initLocation, isCompileTimeConstant, isSuppressed, isSuppressed, isSynthetic, makeDoubleValue, makeFloatValue, makeInteger, makeLong, removeParseException, removeParseWarning, removeParseWarningRecursively, setGosuProgram, setLineNum, setLocation, setParent, setSynthetic, visit
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface gw.lang.parser.IExpression
evaluate, getContextType, isNullSafe, isUnchecked
-
Methods inherited from interface gw.lang.parser.IParsedElement
addExceptionsFrom, addParseException, addParseException, addParseWarning, addParseWarning, clearParseExceptions, clearParseTreeInformation, clearParseWarnings, findAncestorParsedElementByType, findDeclaringStatement, findRootParsedElement, getColumn, getContainedParsedElementsByType, getContainedParsedElementsByTypes, getContainedParsedElementsByTypesWithIgnoreSet, getGosuProgram, getImmediateParseIssue, getImmediateParseIssues, getLineNum, getLocation, getModule, getParent, getParseExceptions, getParseIssues, getParseWarnings, getReturnType, getTokens, hasImmediateParseIssue, hasImmediateParseWarnings, hasParseException, hasParseExceptions, hasParseIssue, hasParseIssues, hasParseWarning, hasParseWarnings, isCompileTimeConstant, isSuppressed, isSynthetic, setLocation, setParent, visit
-
-
-
-
Field Detail
-
_args
private java.util.List<ISymbol> _args
-
_blockBody
private IParsedElement _blockBody
-
_capturedSymbols
private java.util.Map<java.lang.String,ICapturedSymbol> _capturedSymbols
-
_scope
private StandardScope _scope
-
_blockReturnType
private IType _blockReturnType
-
_blockClass
private IBlockClassInternal _blockClass
-
-
Method Detail
-
evaluate
public java.lang.Object evaluate()
Description copied from interface:IExpressionEvaluates this Expression and returns the result.- Specified by:
evaluatein interfaceIExpression- Overrides:
evaluatein classExpression
-
toString
public java.lang.String toString()
Description copied from class:ExpressionSubclasses should return a String representing the parsed expression.- Specified by:
toStringin classExpression
-
setArgs
public void setArgs(java.util.List<ISymbol> args)
-
setBody
public void setBody(IParsedElement blockBody)
-
getType
public IFunctionType getType()
Description copied from class:ExpressionReturns this Expression's IType.- Specified by:
getTypein interfaceIHasType- Overrides:
getTypein classExpression
-
getTypeImpl
public IFunctionType getTypeImpl()
- Overrides:
getTypeImplin classExpression
-
getBlockReturnType
public IType getBlockReturnType()
-
setBlockReturnType
public void setBlockReturnType(IType blockReturnType)
-
getBody
public IParsedElement getBody()
- Specified by:
getBodyin interfaceIBlockExpression
-
getArgs
public java.util.List<ISymbol> getArgs()
- Specified by:
getArgsin interfaceIBlockExpression
-
getCapturedSymbol
public ICapturedSymbol getCapturedSymbol(java.lang.String strName)
- Specified by:
getCapturedSymbolin interfaceIBlockExpression
-
addCapturedSymbol
public void addCapturedSymbol(ICapturedSymbol sym)
-
isWithinScope
public boolean isWithinScope(ISymbol sym, ISymbolTable symbolTable)
- Specified by:
isWithinScopein interfaceIBlockExpression
-
getFunctionName
public java.lang.String getFunctionName()
- Specified by:
getFunctionNamein interfaceIParsedElement- Overrides:
getFunctionNamein classParsedElement
-
setScope
public void setScope(StandardScope blockScope)
The scope of the block, available only at compile time
-
getScope
public IScope getScope()
The scope of the block, available only at compile time- Specified by:
getScopein interfaceIBlockExpression
-
shouldClearParseInfo
public boolean shouldClearParseInfo()
- Overrides:
shouldClearParseInfoin classParsedElement
-
setBlockGosuClass
public void setBlockGosuClass(IBlockClassInternal blockClass)
-
getBlockGosuClass
public IBlockClass getBlockGosuClass()
- Specified by:
getBlockGosuClassin interfaceIBlockExpression
-
getGosuClass
public IGosuClass getGosuClass()
- Specified by:
getGosuClassin interfaceIParsedElement- Overrides:
getGosuClassin classParsedElement
-
getCapturedSymbols
public java.util.Map<java.lang.String,ICapturedSymbol> getCapturedSymbols()
-
updateGosuClass
public void updateGosuClass()
-
-