Class NewExpression
- java.lang.Object
-
- gw.internal.gosu.parser.ParsedElement
-
- gw.internal.gosu.parser.Expression
-
- gw.internal.gosu.parser.expressions.NewExpression
-
- All Implemented Interfaces:
INewExpression
,IExpression
,IHasArguments
,IHasType
,IParsedElement
- Direct Known Subclasses:
AnnotationExpression
,InferredNewExpression
public class NewExpression extends Expression implements INewExpression
The 'new' operator as an expression:new-expression new <type-expression> ( [<argument-list>] ) [ {...} ] new <type-expression> [ <expression> ] new <type-expression> [] { [<array-value-list>] }
- See Also:
IGosuParser
-
-
Field Summary
-
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 NewExpression()
Constructs a BeanMethodCallExpression given an ISymbolTable instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addSizeExpression(Expression sizeExpression)
The size expression for the new array operation.Object
evaluate()
Evaluates this Expression and returns the result.int
getArgPosition()
Expression[]
getArgs()
IType[]
getArgTypes()
IConstructorInfo
getConstructor()
IInitializerExpression
getInitializer()
int[]
getNamedArgOrder()
List<Expression>
getSizeExpressions()
ITypeLiteralExpression
getTypeLiteral()
List<Expression>
getValueExpressions()
boolean
isAnonymousClass()
boolean
isCompileTimeConstant()
void
setAnonymousClass(boolean anonymous)
void
setArgPosition(int iArgPos)
void
setArgs(Expression[] args)
void
setArgTypes(IType... argTypes)
void
setConstructor(IConstructorInfo constructor)
The constructor for the new operation.void
setInitializer(IInitializerExpression initializerExpression)
void
setNamedArgOrder(int[] namedArgOrder)
void
setTypeLiteral(ITypeLiteralExpression typeLiteral)
void
setValueExpressions(List<Expression> valueExpressions)
The value expression for the new array operation.String
toString()
Subclasses should return a String representing the parsed expression.-
Methods inherited from class gw.internal.gosu.parser.Expression
evaluate, getContextType, getReturnType, getType, getTypeImpl, 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, getFunctionName, getGosuClass, getGosuProgram, getImmediateParseIssue, getImmediateParseIssues, getLineNum, getLocation, getModule, getParent, getParseExceptions, getParseIssues, getParseWarnings, getQualifyingEnclosingTypeInfo, getTokens, hasImmediateParseIssue, hasImmediateParseWarning, hasImmediateParseWarnings, hasParseException, hasParseExceptions, hasParseIssue, hasParseIssues, hasParseWarning, hasParseWarnings, initEmptyParseTree, initLocation, isSuppressed, isSuppressed, isSynthetic, makeDoubleValue, makeFloatValue, makeInteger, makeLong, removeParseException, removeParseWarning, removeParseWarningRecursively, setGosuProgram, setLineNum, setLocation, setParent, setSynthetic, shouldClearParseInfo, 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, getFunctionName, getGosuClass, getGosuProgram, getImmediateParseIssue, getImmediateParseIssues, getLineNum, getLocation, getModule, getParent, getParseExceptions, getParseIssues, getParseWarnings, getReturnType, getTokens, hasImmediateParseIssue, hasImmediateParseWarnings, hasParseException, hasParseExceptions, hasParseIssue, hasParseIssues, hasParseWarning, hasParseWarnings, isSuppressed, isSynthetic, setLocation, setParent, visit
-
-
-
-
Method Detail
-
getArgTypes
public IType[] getArgTypes()
- Specified by:
getArgTypes
in interfaceINewExpression
- Returns:
- An array of IType for the arguments of the method call.
-
setArgTypes
public void setArgTypes(IType... argTypes)
- Parameters:
argTypes
- An array of IType for the arguments of the method call.
-
getArgs
public Expression[] getArgs()
- Specified by:
getArgs
in interfaceIHasArguments
- Specified by:
getArgs
in interfaceINewExpression
- Returns:
- An array of expressions for corresponding to the arguments in the expression.
-
setArgs
public void setArgs(Expression[] args)
- Parameters:
args
- An array of expressions for corresponding to the arguments in the expression.
-
getConstructor
public IConstructorInfo getConstructor()
- Specified by:
getConstructor
in interfaceINewExpression
-
getArgPosition
public int getArgPosition()
- Specified by:
getArgPosition
in interfaceIHasArguments
-
setArgPosition
public void setArgPosition(int iArgPos)
-
setConstructor
public void setConstructor(IConstructorInfo constructor)
The constructor for the new operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive.
-
setValueExpressions
public void setValueExpressions(List<Expression> valueExpressions)
The value expression for the new array operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive.
-
getValueExpressions
public List<Expression> getValueExpressions()
- Specified by:
getValueExpressions
in interfaceINewExpression
-
setInitializer
public void setInitializer(IInitializerExpression initializerExpression)
-
getInitializer
public IInitializerExpression getInitializer()
- Specified by:
getInitializer
in interfaceINewExpression
-
addSizeExpression
public void addSizeExpression(Expression sizeExpression)
The size expression for the new array operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive.
-
getSizeExpressions
public List<Expression> getSizeExpressions()
- Specified by:
getSizeExpressions
in interfaceINewExpression
-
isCompileTimeConstant
public boolean isCompileTimeConstant()
- Specified by:
isCompileTimeConstant
in interfaceIParsedElement
- Overrides:
isCompileTimeConstant
in classParsedElement
-
evaluate
public Object evaluate()
Description copied from interface:IExpression
Evaluates this Expression and returns the result.- Specified by:
evaluate
in interfaceIExpression
- Overrides:
evaluate
in classExpression
-
toString
public String toString()
Description copied from class:Expression
Subclasses should return a String representing the parsed expression.- Specified by:
toString
in classExpression
-
isAnonymousClass
public boolean isAnonymousClass()
- Specified by:
isAnonymousClass
in interfaceINewExpression
-
setAnonymousClass
public void setAnonymousClass(boolean anonymous)
-
getTypeLiteral
public ITypeLiteralExpression getTypeLiteral()
- Specified by:
getTypeLiteral
in interfaceINewExpression
-
setTypeLiteral
public void setTypeLiteral(ITypeLiteralExpression typeLiteral)
-
getNamedArgOrder
public int[] getNamedArgOrder()
-
setNamedArgOrder
public void setNamedArgOrder(int[] namedArgOrder)
-
-