Class SymbolWrites
mcp.oracle tools - use this,
never a by-name test such as body.contains("this." + name) or a set of assigned NAMES.
It lives in compiler-main (moved down from compiler-services, 2026-10-04) so a phase-5 analysis - the
infinite stream source check, phase5/NeverEndingIterationMarker - reads the SAME write set the
refactoring editors do, rather than a second write-finder.
A write is any place the symbol's value can change:
- an assignment to it -
::==:=?(a pre-flowif x := next() then x?included); - a MUTATING operator applied to it -
+=-=*=/=:~::^::=:++--- decided byOperatorMap.isThisMutatingOperator(String), never a copied list.total += 5performs NO store tototal(Integer._addAssmutates the object in place), so a test that looks only for assignments misses most EK9 mutation. - the TARGET of a stream -
cat items > totaland>>, and theteetarget (| tee in seen): every item is piped (|) into the object in place (operator>,>>ortee; D-1, 2026-10-19 - the value tracker andCompileTimeKnownTextsaw only assignments).
Built on RecordedSymbols, so it is by symbol IDENTITY: a same-named local in another scope, a longer name
sharing a prefix (countLimit vs count), a comment or a String is never a write. A write through a
dynamic function's captured copy counts (the copy shares the object). A property written through any object counts
(other.total += 1 writes the property total). A mutating METHOD call (items.add(x)) is not a
write here: only the grammar's assignments and operators are.
Which operator writes one occurrence is WritingOperator (purely structural); which operator texts write
are IsWritingOperator, IsAssignmentOperator and IsStreamTarget (no-statics lane S3,
2026-10-29: were writingOperator, isWritingOperator, isAssignmentOperator and
isStreamTarget here; writesOf, isWrittenIn and isWrittenBetween are this class's
instance methods).
-
Nested Class Summary
Nested Classes -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanisWrittenBetween(ParsedModule parsedModule, org.antlr.v4.runtime.tree.ParseTree region, Set<ISymbol> symbols, int afterTokenIndex, int beforeTokenIndex) Is any ofsymbolswritten inregionstrictly between two token positions (token indexes in the compiled token stream: passfirst.getStop().getTokenIndex()andsecond.getStart().getTokenIndex()to ask "does anything change these between the two occurrences?").booleanisWrittenIn(ParsedModule parsedModule, org.antlr.v4.runtime.tree.ParseTree region, Set<ISymbol> symbols) Is any ofsymbolswritten anywhere inregion.writesOf(ParsedModule parsedModule, org.antlr.v4.runtime.tree.ParseTree region, ISymbol symbol) Every write tosymbol(or to a captured copy of it) inregion, in source order.
-
Field Details
-
TEE
-
-
Constructor Details
-
SymbolWrites
public SymbolWrites()
-
-
Method Details
-
writesOf
public List<SymbolWrites.Write> writesOf(ParsedModule parsedModule, org.antlr.v4.runtime.tree.ParseTree region, ISymbol symbol) Every write tosymbol(or to a captured copy of it) inregion, in source order. -
isWrittenIn
public boolean isWrittenIn(ParsedModule parsedModule, org.antlr.v4.runtime.tree.ParseTree region, Set<ISymbol> symbols) Is any ofsymbolswritten anywhere inregion. -
isWrittenBetween
public boolean isWrittenBetween(ParsedModule parsedModule, org.antlr.v4.runtime.tree.ParseTree region, Set<ISymbol> symbols, int afterTokenIndex, int beforeTokenIndex) Is any ofsymbolswritten inregionstrictly between two token positions (token indexes in the compiled token stream: passfirst.getStop().getTokenIndex()andsecond.getStart().getTokenIndex()to ask "does anything change these between the two occurrences?").
-