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
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:
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate booleanprivate Expression[]private IType[]private IConstructorInfoprivate intprivate IInitializerExpressionprivate int[]private List<Expression>private ITypeLiteralExpressionprivate List<Expression>Fields inherited from class gw.internal.gosu.parser.Expression
_typeFields inherited from class gw.internal.gosu.parser.ParsedElement
_tokens, UNDEF_FILE, UNDEF_FUNCTION, UNDEF_MODULEFields inherited from interface gw.lang.parser.IExpression
EMPTY_ARRAY -
Constructor Summary
ConstructorsConstructorDescriptionConstructs a BeanMethodCallExpression given an ISymbolTable instance. -
Method Summary
Modifier and TypeMethodDescriptionvoidaddSizeExpression(Expression sizeExpression) The size expression for the new array operation.evaluate()Evaluates this Expression and returns the result.intgetArgs()IType[]private Class<?>getArrayClass(IType type) private Class<?>private Class<?>getComponentClass(IType type) int[]booleanbooleanvoidsetAnonymousClass(boolean anonymous) voidsetArgPosition(int iArgPos) voidsetArgs(Expression[] args) voidsetArgTypes(IType... argTypes) voidsetConstructor(IConstructorInfo constructor) The constructor for the new operation.voidsetInitializer(IInitializerExpression initializerExpression) voidsetNamedArgOrder(int[] namedArgOrder) voidsetTypeLiteral(ITypeLiteralExpression typeLiteral) voidsetValueExpressions(List<Expression> valueExpressions) The value expression for the new array operation.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, setTypeMethods 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, visitMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitMethods inherited from interface gw.lang.parser.IExpression
evaluate, getContextType, isNullSafe, isUncheckedMethods 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
-
Field Details
-
_argTypes
-
_args
-
_constructor
-
_valueExpressions
-
_sizeExpressions
-
_iArgPos
private int _iArgPos -
_typeLiteral
-
_initExpr
-
_anonymous
private boolean _anonymous -
_namedArgOrder
private int[] _namedArgOrder
-
-
Constructor Details
-
NewExpression
public NewExpression()Constructs a BeanMethodCallExpression given an ISymbolTable instance.
-
-
Method Details
-
getArgTypes
- Specified by:
getArgTypesin interfaceINewExpression- Returns:
- An array of IType for the arguments of the method call.
-
setArgTypes
- Parameters:
argTypes- An array of IType for the arguments of the method call.
-
getArgs
- Specified by:
getArgsin interfaceIHasArguments- Specified by:
getArgsin interfaceINewExpression- Returns:
- An array of expressions for corresponding to the arguments in the expression.
-
setArgs
- Parameters:
args- An array of expressions for corresponding to the arguments in the expression.
-
getConstructor
- Specified by:
getConstructorin interfaceINewExpression
-
getArgPosition
public int getArgPosition()- Specified by:
getArgPositionin interfaceIHasArguments
-
setArgPosition
public void setArgPosition(int iArgPos) -
setConstructor
The constructor for the new operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive. -
setValueExpressions
The value expression for the new array operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive. -
getValueExpressions
- Specified by:
getValueExpressionsin interfaceINewExpression
-
setInitializer
-
getInitializer
- Specified by:
getInitializerin interfaceINewExpression
-
addSizeExpression
The size expression for the new array operation. The properties: Constructor, ValueExpressions, and SizeExpression are mutually exclusive. -
getSizeExpressions
- Specified by:
getSizeExpressionsin interfaceINewExpression
-
isCompileTimeConstant
public boolean isCompileTimeConstant()- Specified by:
isCompileTimeConstantin interfaceIParsedElement- Overrides:
isCompileTimeConstantin classParsedElement
-
evaluate
Description copied from interface:IExpressionEvaluates this Expression and returns the result.- Specified by:
evaluatein interfaceIExpression- Overrides:
evaluatein classExpression
-
getArrayClass
-
getComponentClass
-
getClassForRareCaseWhenRunningIJEditorProjectWhereGosuCoreJavaTypesAreSourceBased
-
toString
Description copied from class:ExpressionSubclasses should return a String representing the parsed expression.- Specified by:
toStringin classExpression
-
isAnonymousClass
public boolean isAnonymousClass()- Specified by:
isAnonymousClassin interfaceINewExpression
-
setAnonymousClass
public void setAnonymousClass(boolean anonymous) -
getTypeLiteral
- Specified by:
getTypeLiteralin interfaceINewExpression
-
setTypeLiteral
-
getNamedArgOrder
public int[] getNamedArgOrder() -
setNamedArgOrder
public void setNamedArgOrder(int[] namedArgOrder)
-