Package sc.lang.java
Class CastExpression
- java.lang.Object
-
- All Implemented Interfaces:
ISemanticNode
,ISrcStatement
,IUserDataNode
,IClassBodyStatement
,IDefinition
,ITypedObject
,IValueNode
,ILifecycle
public class CastExpression extends ChainedExpression
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class sc.lang.java.Statement
Statement.ErrorRangeInfo, Statement.RuntimeStatus
-
Nested classes/interfaces inherited from class sc.lang.java.JavaSemanticNode
JavaSemanticNode.DepTypeCtx, JavaSemanticNode.DepTypeMode, JavaSemanticNode.MemberCache, JavaSemanticNode.MemberType
-
-
Field Summary
Fields Modifier and Type Field Description JavaType
type
-
Fields inherited from class sc.lang.java.ChainedExpression
expression
-
Fields inherited from class sc.lang.java.Expression
bindingDirection, bindingStatement, inactive, nestedBinding, replacedByStatement, UnknownReferredType
-
Fields inherited from class sc.lang.java.Statement
childNestingDepth, errorArgs, excluded, fromStatement
-
Fields inherited from class sc.lang.java.Definition
modifiers, overrides
-
Fields inherited from class sc.lang.java.JavaSemanticNode
debugDisablePrettyToString, STOP_SEARCHING_SENTINEL
-
Fields inherited from class sc.lang.SemanticNode
debugDiffTrace, initialized, PARENT_NODE_PROPERTY, parentNode, PARSE_NODE_PROPERTY, parseletId, parseNode, parseNodeInvalid, processed, started, transformed, validated
-
Fields inherited from interface sc.lang.ISemanticNode
CopyAll, CopyIndependent, CopyInitLevels, CopyNormal, CopyParseNode, CopyReplace, CopyState, CopyTransformed, SkipParseNode
-
-
Constructor Summary
Constructors Constructor Description CastExpression()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addDependentTypes(java.util.Set<java.lang.Object> types, JavaSemanticNode.DepTypeCtx mode)
static CastExpression
create(java.lang.String typeName, Expression chainedExpression)
static CastExpression
create(JavaType type, Expression chainedExpression)
java.lang.Object
eval(java.lang.Class expectedType, ExecutionContext ctx)
void
evalBindingArgs(java.util.List<java.lang.Object> bindArgs, boolean isStatic, java.lang.Class expectedType, ExecutionContext ctx)
java.lang.String
getBindingTypeName()
For binding purposes, this acts like a pass-thru.int
getChildNestingDepth()
java.lang.Object
getTypeDeclaration()
boolean
refreshBoundTypes(int flags)
void
setAccessTimeForRefs(long time)
void
setBindingInfo(BindingDirection dir, Statement dest, boolean nested)
Propagates the binding information to nested expressionsboolean
setInferredType(java.lang.Object infType, boolean finalType)
Called once for each parent-child expression relationship during the start process to propagate the parent's inferredType to the child as we walk up the expression tree so that, for example, we know the initial information in the parameter type so we can find the right method, so the method's parameter types further refine types of the args.int
suggestCompletions(java.lang.String prefix, java.lang.Object currentType, ExecutionContext ctx, java.lang.String command, int cursor, java.util.Set<java.lang.String> candidates, java.lang.Object continuation, int max)
Try completing the last operandjava.lang.String
toGenerateString()
void
transformBindingArgs(SemanticNodeList<Expression> bindArgs, sc.lang.java.Expression.BindDescriptor bd)
Produces binding arguments for the operator and the two nested bindingsStatement
transformToJS()
-
Methods inherited from class sc.lang.java.ChainedExpression
addBreakpointNodes, applyPartialValue, changeExpressionsThis, getChainedExpression, isStaticTarget, propagatesInferredType, setChainedExpression, visitTypeReferences
-
Methods inherited from class sc.lang.java.Expression
addChildBodyStatements, addInitStatements, applyJSConversion, canInsertStatementBefore, canMakeBindable, changeToRHS, clearInferredType, convertToSetMethod, createBindingParameters, createFromValue, createImportedIdentExpr, deepCopy, evalBinding, evalBindingParameters, evalBindingParametersWithThis, evalDouble, evalLong, exec, findFromStatement, formatExprToJS, getAbsoluteGenericTypeName, getBodyStatements, getGenericArgumentType, getGenericType, getGenericTypeName, getLHSAssignmentTyped, getMethodTypeArguments, getNodeErrorText, getNodeWarningText, getNotFoundError, getParentReferenceType, getParentReferenceTypeExpression, getPrimitiveValue, getReferencePropertyName, getRuntimeClass, getUnwrappedExpr, getUserVisibleName, hasInferredType, initBinding, inNamedPropertyMethod, inObjectGetMethod, inPropertyMethodForDef, isConstant, isDeclaredConstant, isInferredFinal, isInferredSet, isLeafStatement, isReferenceInitializer, isReferenceValueObject, isSettableExpr, isSimpleReference, isVoidType, needsParenWrapper, needsSetMethod, needsTransform, parse, producesHtml, setAssignment, setValue, toDefinitionString, toLanguageString, toSafeLanguageString, toString, transform, transformBinding
-
Methods inherited from class sc.lang.java.Statement
addMappingForSrcStatement, addMappingForSrcStatement, addMappingForStatement, addMemberByName, addMembersByName, addNodeCompletions, addReturnStatements, addStatementNodeCompletions, addToFileLineIndex, callsSuper, callsSuperMethod, callsThis, checkFromStatementRef, childIsTopLevelStatement, clearDynFields, clearTransformed, collectConstructorPropInit, collectReferenceInitializers, conflictsWith, displayError, displayFormattedError, displayRangeError, displayTypeError, evalRemoteExprs, execForRuntime, execSys, findStatement, formatToJS, getBuildInitExpression, getComment, getConstrArgs, getCurrentMethod, getFromStatement, getIndentStr, getNestingDepth, getNodeContainsPart, getNodeErrorRange, getNumStatementLines, getRuntimeStatus, getSrcStatement, getStatementTerminator, getUserData, hasErrors, initDynStatement, initDynStatement, initDynStatements, isIncompleteStatement, isLabeled, isLineStatement, markFixedSuper, matchesStatement, modifyDefinition, needsEnclosingClass, setComment, setFromStatement, setUserData, stop, updateFromStatementRef
-
Methods inherited from class sc.lang.java.Definition
addInheritedAnnotationProcessor, addModifier, getAccessLevel, getAnnotation, getAnnotations, getAnnotationValueKey, getComputedModifiers, getDefinitionProcessors, getEnclosingTypeName, getExtraModifiers, getInternalAccessLevel, getModifierFlags, getRepeatingAnnotation, getScope, getScopeDefinition, getScopeName, getScopeProcessor, hasAnnotation, hasModifier, init, isDefaultSync, mergeModifiers, modifiersToString, process, processModifiers, removeAnnotation, setAnnotations, setModifierFlags, start, startModifiers, transformDefaultModifier, useDefaultModifier, validate
-
Methods inherited from class sc.lang.java.JavaSemanticNode
addDependentType, declaresConstructor, definesConstructor, definesMember, definesMethod, definesType, detectCycles, displayVerboseWarning, displayWarning, findMember, findMemberOwner, findMethod, findType, findType, getDependencyDisabledText, getEnclosingBlockStatement, getEnclosingIMethod, getEnclosingIType, getEnclosingMethod, getEnclosingMethod, getEnclosingStatement, getEnclosingTag, getEnclosingTemplate, getEnclosingType, getExecMode, getImportedTypeName, getJavaLanguage, getJavaModel, getLayeredSystem, getMessageString, getRootTag, getRootType, getStructuralEnclosingType, isCollapsibleNode, isDynamicType, isStatic, needsDataBinding, refreshNode, runtimeError, toFileString, transformTemplate
-
Methods inherited from class sc.lang.SemanticNode
changeLanguage, clearInitialized, clearParseNode, clearStarted, computeNearString, containsChild, deepEquals, diffNode, ensureValidated, equals, formatLeftParenDelegateToParent, formatSpaceBeforeAngleBracket, getAnyChildParseNode, getChildAtIndex, getEnclosingSrcStatement, getLanguageModel, getNodeCount, getParentNode, getParseErrorNode, getParseletId, getParseNode, getRootNode, getStartIndex, getStopSemanticProps, getTransformed, hashCode, indexOfChild, isInitialized, isParseNodeValid, isProcessed, isSemanticChildValue, isSemanticProperty, isSemanticProperty, isStarted, isTrailingSrcStatement, isValidated, regenerate, regenerateIfTracking, removeChild, replaceChild, restoreParseNode, restoreParseNode, sameSrcLocation, serialize, setParentNode, setParseErrorNode, setParselet, setParseletId, setParseNode, setParseNodeValid, setProperty, setProperty, spaceAfterParen, styleNode, styleNode, toDeclarationString, toDefinitionString, toDefinitionString, toHeaderString, toLanguageString, toLocationString, toLocationString, toLocationString, toModelString, toModelString, validateParseNode
-
Methods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
-
Methods inherited from interface sc.lang.java.IDefinition
getEnclosingIType
-
Methods inherited from interface sc.lang.ISemanticNode
changeLanguage, clearInitialized, clearParseNode, clearStarted, containsChild, deepEquals, diffNode, getChildAtIndex, getDependencyDisabledText, getNodeCount, getParentNode, getParseErrorNode, getParseletId, getParseNode, getRootNode, getTransformed, indexOfChild, isInitialized, isParseNodeValid, isSemanticChildValue, isStarted, isTrailingSrcStatement, isValidated, process, refreshNode, regenerate, regenerateIfTracking, removeChild, replaceChild, restoreParseNode, serialize, setParentNode, setParseErrorNode, setParseletId, setParseNode, setParseNodeValid, styleNode, toHeaderString, toLanguageString, toModelString, validateParseNode
-
-
-
-
Field Detail
-
type
public JavaType type
-
-
Method Detail
-
create
public static CastExpression create(java.lang.String typeName, Expression chainedExpression)
-
create
public static CastExpression create(JavaType type, Expression chainedExpression)
-
eval
public java.lang.Object eval(java.lang.Class expectedType, ExecutionContext ctx)
-
getTypeDeclaration
public java.lang.Object getTypeDeclaration()
- Specified by:
getTypeDeclaration
in interfaceITypedObject
- Overrides:
getTypeDeclaration
in classChainedExpression
-
getBindingTypeName
public java.lang.String getBindingTypeName()
For binding purposes, this acts like a pass-thru. we do not even have to insert parens since they are implied.- Overrides:
getBindingTypeName
in classExpression
-
transformBindingArgs
public void transformBindingArgs(SemanticNodeList<Expression> bindArgs, sc.lang.java.Expression.BindDescriptor bd)
Produces binding arguments for the operator and the two nested bindings- Overrides:
transformBindingArgs
in classExpression
-
evalBindingArgs
public void evalBindingArgs(java.util.List<java.lang.Object> bindArgs, boolean isStatic, java.lang.Class expectedType, ExecutionContext ctx)
- Overrides:
evalBindingArgs
in classExpression
-
setBindingInfo
public void setBindingInfo(BindingDirection dir, Statement dest, boolean nested)
Propagates the binding information to nested expressions- Overrides:
setBindingInfo
in classChainedExpression
-
refreshBoundTypes
public boolean refreshBoundTypes(int flags)
- Overrides:
refreshBoundTypes
in classChainedExpression
-
addDependentTypes
public void addDependentTypes(java.util.Set<java.lang.Object> types, JavaSemanticNode.DepTypeCtx mode)
- Overrides:
addDependentTypes
in classChainedExpression
-
setAccessTimeForRefs
public void setAccessTimeForRefs(long time)
- Overrides:
setAccessTimeForRefs
in classChainedExpression
-
transformToJS
public Statement transformToJS()
- Overrides:
transformToJS
in classChainedExpression
-
toGenerateString
public java.lang.String toGenerateString()
- Overrides:
toGenerateString
in classExpression
-
suggestCompletions
public int suggestCompletions(java.lang.String prefix, java.lang.Object currentType, ExecutionContext ctx, java.lang.String command, int cursor, java.util.Set<java.lang.String> candidates, java.lang.Object continuation, int max)
Description copied from class:ChainedExpression
Try completing the last operand- Overrides:
suggestCompletions
in classChainedExpression
-
setInferredType
public boolean setInferredType(java.lang.Object infType, boolean finalType)
Description copied from class:Expression
Called once for each parent-child expression relationship during the start process to propagate the parent's inferredType to the child as we walk up the expression tree so that, for example, we know the initial information in the parameter type so we can find the right method, so the method's parameter types further refine types of the args. The last time we call it, finalType is set to true. When an error occurs and the type becomes "unknown" - we call this with type = UnknownReferredType and finalType =true- Overrides:
setInferredType
in classChainedExpression
-
getChildNestingDepth
public int getChildNestingDepth()
- Specified by:
getChildNestingDepth
in interfaceISemanticNode
- Overrides:
getChildNestingDepth
in classStatement
-
-