Class ConstructorStateExtractor
java.lang.Object
org.ek9lang.compiler.phase5.flow.ConstructorStateExtractor
Extracts collection/container state information from constructor calls and literal expressions.
Detects constructor calls on built-in collection and container types (List, Dict, Optional) and literal expressions ([...], {...}) to determine their initial SET/UNSET and EMPTY/NON-EMPTY state at construction time.
Detection rules:
[1, 2, 3](list literal) → SET and NON-EMPTY{"key": 1}(dict literal) → SET and NON-EMPTYList() of String→ SET and EMPTYDict() of (String, Integer)→ SET and EMPTYOptional("hello")→ SET and NON-EMPTYOptional() of String→ UNSET and EMPTY
-
Constructor Summary
ConstructorsConstructorDescriptionConstructorStateExtractor(SymbolsAndScopes symbolsAndScopes, Ek9Types ek9Types) -
Method Summary
Modifier and TypeMethodDescriptionExtract a CollectionStateValue from an assignment expression if it is a collection/container constructor or literal.Extract a CollectionStateValue from an expression if it is a collection/container constructor or literal.
-
Constructor Details
-
ConstructorStateExtractor
-
-
Method Details
-
extractFromAssignment
Extract a CollectionStateValue from an assignment expression if it is a collection/container constructor or literal.- Parameters:
assignExpr- the assignment expression to examine- Returns:
- a CollectionStateValue if a known constructor pattern is detected, null otherwise
-
extractFromExpression
Extract a CollectionStateValue from an expression if it is a collection/container constructor or literal.- Parameters:
expr- the expression to examine- Returns:
- a CollectionStateValue if a known pattern is detected, null otherwise
-