Class StackConsistencyScope
- All Implemented Interfaces:
Serializable, ICanCaptureVariables, IScope, IScopedSymbol, ISymbol, ISymbolNature, ITokenReference
- See Also:
-
Nested Class Summary
Nested classes/interfaces inherited from interface IScope
IScope.ScopeType -
Constructor Summary
ConstructorsConstructorDescriptionStackConsistencyScope(IScope enclosingScope) StackConsistencyScope(IScope enclosingScope, IScope.ScopeType scopeType) -
Method Summary
Modifier and TypeMethodDescriptionClone the symbol and re-parent if this symbol like a method should have a parent.Clones the content of this into the new copy.booleanTwo symbols are the same symbol when they agree on name, category, genus, mutability AND the declaration site they came from.Make the scope that holds the captured variables (if any accessible).inthashCode()Mixes in exactly the fieldsSymbol.equals(Object)compares, and nothing else.resolve(SymbolSearch search) Find the nearest symbol of that name up the scope tree.Try and resolve a symbol but exclude looking in captured variables.resolveInThisScopeOnly(SymbolSearch search) Just look in own scope.voidsetCapturedVariables(CaptureScope capturedVariables) So that a number of variables can be captured when a new dynamic type is defined.Methods inherited from class ScopedSymbol
cloneIntoScopeSymbol, copyScopedSymbolProperties, define, findNearestDynamicBlockScopeInEnclosingScopes, findNearestNonBlockScopeInEnclosingScopes, getActualScope, getAllSymbolsMatchingName, getAnySuperTypeOrFunction, getEnclosingScope, getEncounteredExceptionToken, getFriendlyScopeName, getOuterMostTypeOrFunction, getScopeName, getScopeType, getSymbolsForThisScope, isMarkedPure, isMutable, isNotMarkedPure, isScopeAMatchForEnclosingScope, isTerminatedNormally, resolveMatchingMethods, resolveMatchingMethodsInThisScopeOnly, resolveMember, resolveWithParentScope, setEncounteredExceptionToken, setMarkedPure, setOuterMostTypeOrFunction, setScopeTypeMethods inherited from class Symbol
clearInitialisedBy, cloneIntoSymbol, copySymbolProperties, getAssignableCostTo, getAssignableCostTo, getCategory, getFriendlyName, getFullyQualifiedName, getGenus, getInitialisedBy, getName, getParsedModule, getProduceFullyQualifiedName, getSourceToken, getSquirrelledData, getSymbolTypeAsString, getType, getUnCoercedAssignableCostTo, isAssignableTo, isAssignableTo, isDevSource, isEk9Core, isExactSameType, isInjectionExpected, isLibSource, isNullAllowed, isPromotionSupported, isReferenced, putSquirrelledData, setCategory, setEk9Core, setGenus, setInitialisedBy, setInjectionExpected, setName, setNotMutable, setNullAllowed, setParsedModule, setProduceFullyQualifiedName, setReferenced, setSourceToken, setType, toStringMethods inherited from interface ISymbol
clearInitialisedBy, getAssignableCostTo, getAssignableCostTo, getFriendlyName, getFullyQualifiedName, getInitialisedBy, getName, getParsedModule, getSourceToken, getSquirrelledData, getType, getUnCoercedAssignableCostTo, isAssignableTo, isAssignableTo, isDeclaredAsConstant, isDevSource, isExactSameType, isExtensionOfInjectable, isFromLiteral, isIncomingParameter, isInitialised, isInjectable, isInjectionExpected, isLibSource, isLoopVariable, isMarkedAbstract, isNullAllowed, isPrivate, isPromotionSupported, isPropertyField, isProtected, isPublic, isReferenced, isReturningParameter, putSquirrelledData, setInitialisedBy, setInjectionExpected, setName, setNotMutable, setNullAllowed, setParsedModule, setReferenced, setType, setTypeMethods inherited from interface ISymbolNature
getCategory, getGenus, isApplication, isConceptualTypeParameter, isConstant, isControl, isEk9Core, isFunction, isGenericInNature, isMethod, isParameterisedType, isPrimitiveType, isTemplateFunction, isTemplateType, isType, isVariable, setGenusMethods inherited from interface ITokenReference
setSourceToken
-
Constructor Details
-
StackConsistencyScope
-
StackConsistencyScope
-
-
Method Details
-
getCapturedVariables
Description copied from interface:ICanCaptureVariablesMake the scope that holds the captured variables (if any accessible).- Specified by:
getCapturedVariablesin interfaceICanCaptureVariables- Returns:
- The scope holding the captured variables.
-
setCapturedVariables
Description copied from interface:ICanCaptureVariablesSo that a number of variables can be captured when a new dynamic type is defined.- Specified by:
setCapturedVariablesin interfaceICanCaptureVariables- Parameters:
capturedVariables- The variables to capture.
-
resolveInThisScopeOnly
Description copied from interface:IScopeJust look in own scope.- Specified by:
resolveInThisScopeOnlyin interfaceIScope- Overrides:
resolveInThisScopeOnlyin classScopedSymbol
-
resolveExcludingCapturedVariables
Description copied from interface:ICanCaptureVariablesTry and resolve a symbol but exclude looking in captured variables.- Specified by:
resolveExcludingCapturedVariablesin interfaceICanCaptureVariables
-
resolve
Description copied from interface:IScopeFind the nearest symbol of that name up the scope tree.- Specified by:
resolvein interfaceIScope- Overrides:
resolvein classScopedSymbol
-
clone
Description copied from interface:ISymbolClone the symbol and re-parent if this symbol like a method should have a parent. Other symbols like VariableSymbols are un-parented- Specified by:
clonein interfaceIScope- Specified by:
clonein interfaceIScopedSymbol- Specified by:
clonein interfaceISymbol- Overrides:
clonein classScopedSymbol
-
cloneIntoStackConsistencyScope
Clones the content of this into the new copy. -
equals
Description copied from class:SymbolTwo symbols are the same symbol when they agree on name, category, genus, mutability AND the declaration site they came from.The source token is part of identity deliberately. Name alone is not enough: symbol names are unqualified here, so two unrelated variables both called
count, or two types calledFooin different modules, would otherwise compare equal. The compiler relies on telling those apart -CodeFlowMapkeys initialisation state onMap<IScope, Map<ISymbol, SymbolAccess>>, and conflating two same-named declarations there makes flow analysis attribute one variable's initialisation to another.That distinction used to be present ONLY in
Symbol.hashCode(), which is why this looked like it worked: two same-named symbols compared equal yet hashed apart, so hash collections usually - but not reliably - kept them separate, while any directequalscall saw them as one. Encoding it here makes the two agree. SeeSymbolEqualsHashCodeContractTest.- Overrides:
equalsin classScopedSymbol
-
hashCode
public int hashCode()Description copied from class:SymbolMixes in exactly the fieldsSymbol.equals(Object)compares, and nothing else.A hashCode may legitimately use FEWER fields than equals (that only causes collisions, which are correct), but never MORE: any extra field makes two symbols that compare equal land in different buckets, so a HashSet silently holds visible duplicates and a HashMap lookup misses an entry that is present. This method used to mix in purity, which no equals at THIS level consults - purity belongs in
FunctionSymbol, the level whose equals compares it. The source token stays, and is now matched bySymbol.equals(Object). SeeSymbolEqualsHashCodeContractTest.- Overrides:
hashCodein classScopedSymbol
-