Package sc.lang.java
Class IdentifierExpression
- java.lang.Object
-
- sc.lang.SemanticNode
-
- sc.lang.java.JavaSemanticNode
-
- sc.lang.java.Definition
-
- sc.lang.java.Statement
-
- sc.lang.java.Expression
-
- sc.lang.java.ArgumentsExpression
-
- sc.lang.java.IdentifierExpression
-
- All Implemented Interfaces:
ISemanticNode
,ISrcStatement
,IUserDataNode
,IClassBodyStatement
,IDefinition
,ITypedObject
,IValueNode
,ILifecycle
- Direct Known Subclasses:
ArrayElementExpression
,NewExpression
,TypedMethodExpression
public class IdentifierExpression extends ArgumentsExpression
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static class
IdentifierExpression.IdentifierType
-
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 java.util.List<IString>
identifiers
NewExpression
innerCreator
-
Fields inherited from class sc.lang.java.ArgumentsExpression
arguments
-
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 IdentifierExpression()
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addBreakpointNodes(java.util.List<ISrcStatement> res, ISrcStatement srcStatement)
Adds all of the generated statements to the resulting list, for the case where more than one fromStatement points to the same src statement.void
addDependentTypes(java.util.Set<java.lang.Object> types, JavaSemanticNode.DepTypeCtx mode)
void
addIdentifier(int ix, java.lang.String identifier, IdentifierExpression.IdentifierType idType, java.lang.Object boundType)
java.lang.String
addNodeCompletions(JavaModel origModel, JavaSemanticNode origNode, java.lang.String extMatchPrefix, int offset, java.lang.String dummyIdentifier, java.util.Set<java.lang.String> candidates, boolean nextNameInPath, int max)
This works like suggestCompletions but designed to conform to the requirements of IntelliJ.boolean
applyPartialValue(java.lang.Object value)
When Parser.enablePartialValues is set, and we do not complete parsing the input we'll have a set of errors which represent model fragments.protected static java.lang.String
argsToGenerateString(SemanticNodeList<Expression> args, int nestingDepth)
boolean
callsSuper(boolean checkModSuper)
Does this method call "super(xxx)" for a constructor definitionboolean
callsSuperMethod(java.lang.String methName)
Does this method call super.methName()boolean
callsThis()
boolean
canMakeBindable()
void
changeExpressionsThis(TypeDeclaration oldThis, TypeDeclaration outerType, java.lang.String newThisPrefix)
void
changeToRHS()
Called when we are moving an expression from the left to the right hand side.void
clearStarted()
protected java.lang.String
convertPropertyToGetName(int ix, java.lang.String propertyName)
static java.lang.String
convertPropertyToSetName(java.lang.String propertyName)
void
convertToSetMethod(Expression arg)
Only needed for expressions that are the left hand side of the equals signstatic IdentifierExpression
create(java.lang.String... args)
static IdentifierExpression
create(IString... args)
static IdentifierExpression
createMethodCall(SemanticNodeList arguments, java.lang.String... idents)
IdentifierExpression
deepCopy(int options, java.util.IdentityHashMap<java.lang.Object,java.lang.Object> oldNewMap)
Performs a deep copy of the semantic node tree.protected Expression
doCastOnConvert(Expression arg)
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)
ExecResult
exec(ExecutionContext ctx)
Statement.RuntimeStatus
execForRuntime(LayeredSystem runtimeSys)
When choosing in which runtimes to run this statement, returns the member or type of the method or field used in the expression.static java.lang.Object
findClosestMethod(java.lang.Object currentType, java.lang.String nextName, java.util.List<Expression> args)
For error checking, return a method of the same name which has the fewest mismatching argumentsISrcStatement
findFromStatement(ISrcStatement st)
Returns the statement that was generated from the given src statement.void
generateIdentString(java.lang.StringBuilder sb, int ix)
java.util.List<IString>
getAllIdentifiers()
java.lang.Object
getAssignedProperty()
java.lang.String
getBindingTypeName()
Subclasses override this to return the class name to use for the binding expressionjava.lang.Object
getBoundType(int ix)
java.lang.Object
getBoundTypeNoParamType(int ix)
Expression[]
getConstrArgs()
java.lang.Object
getGenericType()
java.lang.Object
getGenericTypeForIdentifier(int ix)
java.lang.String
getIdentifierPathName(int ix)
IdentifierExpression.IdentifierType
getIdentifierType(int ix)
static IdentifierExpression.IdentifierType
getIdentifierTypeFromType(java.lang.Object boundType)
boolean
getLHSAssignmentTyped()
boolean
getNodeContainsPart(ISrcStatement fromSt)
If this statement, as part of the transformed model was generated from this provided source statement.ParseRange
getNodeErrorRange()
Returns null to mark the entire node - otherwise return a range that's more convenient for markingjava.lang.Object
getParentReferenceType()
Returns the type which is referring to the value of this expressionExpression
getParentReferenceTypeExpression()
For "a.b.c", returns an expression which evaluates "a.b"java.lang.String
getQualifiedClassIdentifier()
java.lang.String
getReferencePropertyName()
Only implemented for subclasses that can return needsSetMethod=true.java.lang.Object
getReferenceType()
Returns the type which is referring to the value of this expressionjava.lang.Object
getTypeDeclaration()
java.lang.Object
getTypeForIdentifier(int ix)
boolean
isConstant()
boolean
isDeclaredConstant()
This is like isConstant but does not "start" anything so you can use it during initializationboolean
isGetSetConversionDisabled(int ix)
boolean
isInferredFinal()
boolean
isInferredSet()
boolean
isReferenceInitializer()
boolean
isSettableExpr()
boolean
isSimpleReference()
boolean
isStaticTarget()
static void
makeBindable(Statement expr, java.lang.String propertyName, IdentifierExpression.IdentifierType idType, java.lang.Object boundType, java.lang.Object typeForIdentifier, java.lang.Object referenceType, boolean referenceOnly, boolean checkAnnotations)
Utility method for IdentifierExpr and SelectExpr to apply the data binding contract to a given property of the referenced object.void
markFixedSuper()
boolean
needsEnclosingClass()
Disables the optimization where 'object foo extends bar' omits class foo for simple configuration objects.boolean
needsGetMethod(int ix)
static boolean
needsGetSet(IdentifierExpression.IdentifierType idType, java.lang.Object boundType)
boolean
needsSetMethod()
If we are part of an assignment and our last value points to a field with a set method and we are not in the set method itself, we need to be transformed into a setX expression.boolean
needsTransform()
protected int
offset()
boolean
producesHtml()
boolean
propagatesInferredType(Expression child)
boolean
refreshBoundTypes(int flags)
void
removeIdentifier(int ix)
void
reresolveTypeReference()
void
setAccessTimeForRefs(long time)
void
setAssignment(boolean assign)
Only needed for expressions that are the left hand side of the equals signvoid
setBindingInfo(BindingDirection dir, Statement dest, boolean nested)
BindingDirection only set if this is a top-level bindingvoid
setIdentifier(int ix, java.lang.String identifier, IdentifierExpression.IdentifierType idType, java.lang.Object boundType)
protected void
setIdentifiersFromArgs(java.lang.String... args)
boolean
setInferredType(java.lang.Object inferredType, 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.void
setParentNode(ISemanticNode node)
void
setValue(java.lang.Object valueToSet, ExecutionContext ctx)
void
start()
void
stop()
void
styleNode(IStyleAdapter adapter)
Styling for identifier expressions is complicated because the information we need to do the styling is at this level, but the elements we are styling are buried down in the parse-tree of this node.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)
Used to create a list of suggestions to complete this node.java.lang.String
toGenerateString()
boolean
transform(ILanguageModel.RuntimeType runtime)
All definitions share the ability to inherit their definitions.void
transformBindingArgs(SemanticNodeList<Expression> bindArgs, sc.lang.java.Expression.BindDescriptor bd)
From "a.b.c" to: Bind.bind(<enclosingObject or class>, boundFieldName,int
transformTemplate(int ix, boolean statefulContext)
A pass over the semantic node tree to convert template statements into layer cake statements.Statement
transformToJS()
void
validate()
void
visitTypeReferences(CycleInfo info, TypeContext ctx)
overridden by nodes to visit values in the reference chain-
Methods inherited from class sc.lang.java.ArgumentsExpression
getBodyStatements
-
Methods inherited from class sc.lang.java.Expression
addChildBodyStatements, addInitStatements, applyJSConversion, canInsertStatementBefore, clearInferredType, createBindingParameters, createFromValue, createImportedIdentExpr, evalBinding, evalBindingParameters, evalBindingParametersWithThis, evalDouble, evalLong, formatExprToJS, getAbsoluteGenericTypeName, getGenericArgumentType, getGenericTypeName, getMethodTypeArguments, getNodeErrorText, getNodeWarningText, getNotFoundError, getPrimitiveValue, getRuntimeClass, getUnwrappedExpr, getUserVisibleName, hasInferredType, initBinding, inNamedPropertyMethod, inObjectGetMethod, inPropertyMethodForDef, isLeafStatement, isReferenceValueObject, isVoidType, needsParenWrapper, parse, toDefinitionString, toLanguageString, toSafeLanguageString, toString, transformBinding
-
Methods inherited from class sc.lang.java.Statement
addMappingForSrcStatement, addMappingForSrcStatement, addMappingForStatement, addMemberByName, addMembersByName, addReturnStatements, addStatementNodeCompletions, addToFileLineIndex, checkFromStatementRef, childIsTopLevelStatement, clearDynFields, clearTransformed, collectConstructorPropInit, collectReferenceInitializers, conflictsWith, displayError, displayFormattedError, displayRangeError, displayTypeError, evalRemoteExprs, execSys, findStatement, formatToJS, getBuildInitExpression, getChildNestingDepth, getComment, getCurrentMethod, getFromStatement, getIndentStr, getNestingDepth, getNumStatementLines, getRuntimeStatus, getSrcStatement, getStatementTerminator, getUserData, hasErrors, initDynStatement, initDynStatement, initDynStatements, isIncompleteStatement, isLabeled, isLineStatement, matchesStatement, modifyDefinition, setComment, setFromStatement, setUserData, 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, startModifiers, transformDefaultModifier, useDefaultModifier
-
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
-
Methods inherited from class sc.lang.SemanticNode
changeLanguage, clearInitialized, clearParseNode, 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, setParseErrorNode, setParselet, setParseletId, setParseNode, setParseNodeValid, setProperty, setProperty, spaceAfterParen, 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, 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, setParseErrorNode, setParseletId, setParseNode, setParseNodeValid, toHeaderString, toLanguageString, toModelString, validateParseNode
-
-
-
-
Field Detail
-
identifiers
public java.util.List<IString> identifiers
-
innerCreator
public NewExpression innerCreator
-
-
Method Detail
-
getAllIdentifiers
public java.util.List<IString> getAllIdentifiers()
-
create
public static IdentifierExpression create(IString... args)
-
create
public static IdentifierExpression create(java.lang.String... args)
-
createMethodCall
public static IdentifierExpression createMethodCall(SemanticNodeList arguments, java.lang.String... idents)
-
setIdentifiersFromArgs
protected void setIdentifiersFromArgs(java.lang.String... args)
-
setAssignment
public void setAssignment(boolean assign)
Description copied from class:Expression
Only needed for expressions that are the left hand side of the equals sign- Overrides:
setAssignment
in classExpression
-
start
public void start()
- Specified by:
start
in interfaceILifecycle
- Overrides:
start
in classDefinition
-
validate
public void validate()
- Specified by:
validate
in interfaceILifecycle
- Overrides:
validate
in classDefinition
-
getIdentifierTypeFromType
public static IdentifierExpression.IdentifierType getIdentifierTypeFromType(java.lang.Object boundType)
-
visitTypeReferences
public void visitTypeReferences(CycleInfo info, TypeContext ctx)
Description copied from class:JavaSemanticNode
overridden by nodes to visit values in the reference chain- Overrides:
visitTypeReferences
in classArgumentsExpression
-
getAssignedProperty
public java.lang.Object getAssignedProperty()
-
getBoundType
public java.lang.Object getBoundType(int ix)
-
getBoundTypeNoParamType
public java.lang.Object getBoundTypeNoParamType(int ix)
-
makeBindable
public static void makeBindable(Statement expr, java.lang.String propertyName, IdentifierExpression.IdentifierType idType, java.lang.Object boundType, java.lang.Object typeForIdentifier, java.lang.Object referenceType, boolean referenceOnly, boolean checkAnnotations)
Utility method for IdentifierExpr and SelectExpr to apply the data binding contract to a given property of the referenced object. When referenceOnly = true, this is a getX reference only - not requiring that the referred property be made bindable. This method both ensures the property is registered with it's parent type and adds a reference to that type in ReverseDependencies - reflecting the dependency from the type which needs this property bindable. When checkAnnotations is true, referenceOnly starts out false but then turns to 'true' if this property is marked as @Bindable so that we inject it during the code-gen phase (i.e. not manual bindable).
-
isSimpleReference
public boolean isSimpleReference()
- Overrides:
isSimpleReference
in classExpression
-
getReferenceType
public java.lang.Object getReferenceType()
Returns the type which is referring to the value of this expression
-
getParentReferenceType
public java.lang.Object getParentReferenceType()
Returns the type which is referring to the value of this expression- Overrides:
getParentReferenceType
in classExpression
-
getParentReferenceTypeExpression
public Expression getParentReferenceTypeExpression()
For "a.b.c", returns an expression which evaluates "a.b"- Overrides:
getParentReferenceTypeExpression
in classExpression
-
getReferencePropertyName
public java.lang.String getReferencePropertyName()
Description copied from class:Expression
Only implemented for subclasses that can return needsSetMethod=true. For "a.b.c" returns "c"- Overrides:
getReferencePropertyName
in classExpression
-
findClosestMethod
public static java.lang.Object findClosestMethod(java.lang.Object currentType, java.lang.String nextName, java.util.List<Expression> args)
For error checking, return a method of the same name which has the fewest mismatching arguments
-
offset
protected int offset()
-
getIdentifierPathName
public java.lang.String getIdentifierPathName(int ix)
-
getQualifiedClassIdentifier
public java.lang.String getQualifiedClassIdentifier()
-
eval
public java.lang.Object eval(java.lang.Class expectedType, ExecutionContext ctx)
-
setValue
public void setValue(java.lang.Object valueToSet, ExecutionContext ctx)
- Overrides:
setValue
in classExpression
-
exec
public ExecResult exec(ExecutionContext ctx)
- Overrides:
exec
in classExpression
-
isStaticTarget
public boolean isStaticTarget()
- Specified by:
isStaticTarget
in classExpression
-
needsGetSet
public static boolean needsGetSet(IdentifierExpression.IdentifierType idType, java.lang.Object boundType)
-
needsTransform
public boolean needsTransform()
- Specified by:
needsTransform
in interfaceISemanticNode
- Overrides:
needsTransform
in classExpression
-
transform
public boolean transform(ILanguageModel.RuntimeType runtime)
Description copied from class:Definition
All definitions share the ability to inherit their definitions. They must set the "overrides" property when they figure out if they are replacing another definition.- Specified by:
transform
in interfaceISemanticNode
- Overrides:
transform
in classExpression
-
needsSetMethod
public boolean needsSetMethod()
If we are part of an assignment and our last value points to a field with a set method and we are not in the set method itself, we need to be transformed into a setX expression.- Overrides:
needsSetMethod
in classExpression
-
needsGetMethod
public boolean needsGetMethod(int ix)
-
doCastOnConvert
protected Expression doCastOnConvert(Expression arg)
-
convertPropertyToSetName
public static java.lang.String convertPropertyToSetName(java.lang.String propertyName)
-
convertPropertyToGetName
protected java.lang.String convertPropertyToGetName(int ix, java.lang.String propertyName)
-
convertToSetMethod
public void convertToSetMethod(Expression arg)
Description copied from class:Expression
Only needed for expressions that are the left hand side of the equals sign- Overrides:
convertToSetMethod
in classExpression
-
isGetSetConversionDisabled
public boolean isGetSetConversionDisabled(int ix)
-
getTypeForIdentifier
public java.lang.Object getTypeForIdentifier(int ix)
-
getGenericTypeForIdentifier
public java.lang.Object getGenericTypeForIdentifier(int ix)
-
getLHSAssignmentTyped
public boolean getLHSAssignmentTyped()
- Overrides:
getLHSAssignmentTyped
in classExpression
-
getGenericType
public java.lang.Object getGenericType()
- Overrides:
getGenericType
in classExpression
-
getIdentifierType
public IdentifierExpression.IdentifierType getIdentifierType(int ix)
-
getTypeDeclaration
public java.lang.Object getTypeDeclaration()
-
isReferenceInitializer
public boolean isReferenceInitializer()
- Overrides:
isReferenceInitializer
in classExpression
-
stop
public void stop()
- Specified by:
stop
in interfaceILifecycle
- Overrides:
stop
in classStatement
-
reresolveTypeReference
public void reresolveTypeReference()
-
clearStarted
public void clearStarted()
- Specified by:
clearStarted
in interfaceISemanticNode
- Overrides:
clearStarted
in classSemanticNode
-
setBindingInfo
public void setBindingInfo(BindingDirection dir, Statement dest, boolean nested)
Description copied from class:Expression
BindingDirection only set if this is a top-level binding- Overrides:
setBindingInfo
in classExpression
-
getBindingTypeName
public java.lang.String getBindingTypeName()
Description copied from class:Expression
Subclasses override this to return the class name to use for the binding expression- Overrides:
getBindingTypeName
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
-
transformBindingArgs
public void transformBindingArgs(SemanticNodeList<Expression> bindArgs, sc.lang.java.Expression.BindDescriptor bd)
From "a.b.c" to: Bind.bind(<enclosingObject or class>, boundFieldName,- Overrides:
transformBindingArgs
in classExpression
-
changeExpressionsThis
public void changeExpressionsThis(TypeDeclaration oldThis, TypeDeclaration outerType, java.lang.String newThisPrefix)
- Overrides:
changeExpressionsThis
in classExpression
-
addNodeCompletions
public java.lang.String addNodeCompletions(JavaModel origModel, JavaSemanticNode origNode, java.lang.String extMatchPrefix, int offset, java.lang.String dummyIdentifier, java.util.Set<java.lang.String> candidates, boolean nextNameInPath, int max)
Description copied from class:JavaSemanticNode
This works like suggestCompletions but designed to conform to the requirements of IntelliJ. We don't support the live programming use case in this version and have access (possibly) to the original model and original node which most closely approximates this node which is being parsed (so we can use more context to do a better job of matching because those values are all resolved).- Overrides:
addNodeCompletions
in classStatement
-
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:JavaSemanticNode
Used to create a list of suggestions to complete this node. Returns the character offset into the parse-tree (or command string if there's no parse tree) where the completion should start. Parameters: prefix is the starting sequence of chars in the identifier to complete. All candidates returned will start with the prefix if it's provided. currentType provides a context for the current type if the node is not embedded in a model - i.e. an identifier expression on its own but known to live in a specific type If ctx is not null, it's an execution context we can use to evaluate the "root value" - i.e. in a.b the value of the variable 'a' is evaluated and the returned instance can be used to suggest candidates. This is useful in live-programming situations. The command String parameter is used to determine the offset returned for where the completion starts for the case where the parseNode tree is not available.- Overrides:
suggestCompletions
in classJavaSemanticNode
-
applyPartialValue
public boolean applyPartialValue(java.lang.Object value)
Description copied from class:JavaSemanticNode
When Parser.enablePartialValues is set, and we do not complete parsing the input we'll have a set of errors which represent model fragments. In some cases, it would be nice to put the model together as well as possible for code hinting. This method can append fragments onto it... if so return true.- Overrides:
applyPartialValue
in classJavaSemanticNode
-
styleNode
public void styleNode(IStyleAdapter adapter)
Styling for identifier expressions is complicated because the information we need to do the styling is at this level, but the elements we are styling are buried down in the parse-tree of this node. So far this is the only problematic case for Java so we are living with it but adding some features at the parselets level would help. One problem is that the parseNode for the IdentifierExpression may be expression, optExpression or exprStatement. We optionally need to 'drill down' to get the parse-node for the IdentifierExpression, then wrap the output with any parse nodes we skipped before or after. To handle this at the parselet level, we could skip those levels automatically. Another problem is that the path name is split into the first name, then "." followed by each subsequent name so there's an extra bump in the hierarchy to deal with the second and subsequent path-names. We could add a method called - childStyleHandler which is called for each child parse node that produces an array value (in this case, the identifiers array). It would return null for parse nodes which are ignored in styling or 'member' or 'staticMember' as necessary for each segment in the identifiers array. That method would be passed the current parent parse node, the child-index, and the current parse-node so it could go back into the identifier expression and find the right style for that segment of the path-name. It could probaby just unmap the value array and deal with the hierarchy skip so maybe we don't need that much context in that method.- Specified by:
styleNode
in interfaceISemanticNode
- Overrides:
styleNode
in classSemanticNode
-
callsSuper
public boolean callsSuper(boolean checkModSuper)
Description copied from class:Statement
Does this method call "super(xxx)" for a constructor definition- Overrides:
callsSuper
in classStatement
-
callsSuperMethod
public boolean callsSuperMethod(java.lang.String methName)
Description copied from class:Statement
Does this method call super.methName()- Overrides:
callsSuperMethod
in classStatement
-
markFixedSuper
public void markFixedSuper()
- Overrides:
markFixedSuper
in classStatement
-
getConstrArgs
public Expression[] getConstrArgs()
- Overrides:
getConstrArgs
in classStatement
-
refreshBoundTypes
public boolean refreshBoundTypes(int flags)
- Overrides:
refreshBoundTypes
in classArgumentsExpression
-
transformTemplate
public int transformTemplate(int ix, boolean statefulContext)
Description copied from class:JavaSemanticNode
A pass over the semantic node tree to convert template statements into layer cake statements.- Overrides:
transformTemplate
in classArgumentsExpression
-
addDependentTypes
public void addDependentTypes(java.util.Set<java.lang.Object> types, JavaSemanticNode.DepTypeCtx mode)
- Specified by:
addDependentTypes
in classStatement
-
setAccessTimeForRefs
public void setAccessTimeForRefs(long time)
- Specified by:
setAccessTimeForRefs
in classStatement
-
transformToJS
public Statement transformToJS()
- Specified by:
transformToJS
in classStatement
-
removeIdentifier
public void removeIdentifier(int ix)
-
addIdentifier
public void addIdentifier(int ix, java.lang.String identifier, IdentifierExpression.IdentifierType idType, java.lang.Object boundType)
-
setIdentifier
public void setIdentifier(int ix, java.lang.String identifier, IdentifierExpression.IdentifierType idType, java.lang.Object boundType)
-
deepCopy
public IdentifierExpression deepCopy(int options, java.util.IdentityHashMap<java.lang.Object,java.lang.Object> oldNewMap)
Description copied from interface:ISemanticNode
Performs a deep copy of the semantic node tree. Subclasses should do their own copy implementation to decide what else to copy. Uses the copy options flags above. The default, with 0, just copies the semantic node information so you get a new tree like's it parsed but without parse node info. Use that mode only if you want to throw away the original source and regenerate it all from scratch. Otherwise, you can copy the parse tree as well. If you want to copy the semantic node's initial resolved state - including it's init/start, etc. and whatever the subclass adds to that copy, use CopyState or CopyNormal - for both parse nodes and state.- Specified by:
deepCopy
in interfaceISemanticNode
- Overrides:
deepCopy
in classExpression
-
canMakeBindable
public boolean canMakeBindable()
- Overrides:
canMakeBindable
in classExpression
-
changeToRHS
public void changeToRHS()
Description copied from class:Expression
Called when we are moving an expression from the left to the right hand side.- Overrides:
changeToRHS
in classExpression
-
isDeclaredConstant
public boolean isDeclaredConstant()
Description copied from class:Expression
This is like isConstant but does not "start" anything so you can use it during initialization- Overrides:
isDeclaredConstant
in classExpression
-
isConstant
public boolean isConstant()
- Overrides:
isConstant
in classExpression
-
argsToGenerateString
protected static java.lang.String argsToGenerateString(SemanticNodeList<Expression> args, int nestingDepth)
-
toGenerateString
public java.lang.String toGenerateString()
- Overrides:
toGenerateString
in classExpression
-
generateIdentString
public void generateIdentString(java.lang.StringBuilder sb, int ix)
-
producesHtml
public boolean producesHtml()
- Overrides:
producesHtml
in classExpression
-
getNodeContainsPart
public boolean getNodeContainsPart(ISrcStatement fromSt)
Description copied from class:Statement
If this statement, as part of the transformed model was generated from this provided source statement. Override this statement to control which generated statements are produced from a given stc statement.- Specified by:
getNodeContainsPart
in interfaceISrcStatement
- Overrides:
getNodeContainsPart
in classStatement
-
findFromStatement
public ISrcStatement findFromStatement(ISrcStatement st)
Description copied from class:Statement
Returns the statement that was generated from the given src statement. This will end up being the first one we encounter in the search for the src statement in the chain of fromStatements.- Specified by:
findFromStatement
in interfaceISrcStatement
- Overrides:
findFromStatement
in classExpression
-
addBreakpointNodes
public void addBreakpointNodes(java.util.List<ISrcStatement> res, ISrcStatement srcStatement)
Description copied from interface:ISrcStatement
Adds all of the generated statements to the resulting list, for the case where more than one fromStatement points to the same src statement. These are used to determine which statements in the generated code should cause a 'break' when the developer sets a breakpoint on this statement.- Specified by:
addBreakpointNodes
in interfaceISrcStatement
- Overrides:
addBreakpointNodes
in classStatement
-
needsEnclosingClass
public boolean needsEnclosingClass()
Description copied from class:Statement
Disables the optimization where 'object foo extends bar' omits class foo for simple configuration objects. Certain constructs like methods, fields, clearly disable this. Others like EnclosingType.this also will because we can only evaluate that expression in the context of a class (unless I suppose the object happens to be a child of the same outer type)- Overrides:
needsEnclosingClass
in classStatement
-
setInferredType
public boolean setInferredType(java.lang.Object inferredType, 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 classExpression
-
isInferredSet
public boolean isInferredSet()
- Overrides:
isInferredSet
in classExpression
-
isInferredFinal
public boolean isInferredFinal()
- Overrides:
isInferredFinal
in classExpression
-
propagatesInferredType
public boolean propagatesInferredType(Expression child)
- Overrides:
propagatesInferredType
in classExpression
-
execForRuntime
public Statement.RuntimeStatus execForRuntime(LayeredSystem runtimeSys)
Description copied from class:Statement
When choosing in which runtimes to run this statement, returns the member or type of the method or field used in the expression. Not always possible to determine so return null in those other cases.- Overrides:
execForRuntime
in classStatement
-
setParentNode
public void setParentNode(ISemanticNode node)
- Specified by:
setParentNode
in interfaceISemanticNode
- Overrides:
setParentNode
in classSemanticNode
-
getNodeErrorRange
public ParseRange getNodeErrorRange()
Description copied from interface:ISemanticNode
Returns null to mark the entire node - otherwise return a range that's more convenient for marking- Specified by:
getNodeErrorRange
in interfaceISemanticNode
- Overrides:
getNodeErrorRange
in classStatement
-
isSettableExpr
public boolean isSettableExpr()
- Overrides:
isSettableExpr
in classExpression
-
-