Package org.ek9lang.compiler.phase7.generator
package org.ek9lang.compiler.phase7.generator
-
ClassDescriptionBase class for assert expression generators (assertThrows, assertDoesNotThrow).Result of building the assertion expression body.Base class for all IR generators providing common utilities for safer symbol access, temporary variable creation, and type extraction.Both AND/OR are very similar in processing, the only real differences are:
What operation to call and the op code to generate.THE shared vocabulary for stream pipeline IR generation - extend this rather than re-deriving any of these steps inside an individual stage.Pulls out the common code for variable and variable-only declarations.THE application close (Steve, 2026-10-26, closeable matrix Q3 / row H2): an application closes every component it registered that has anoperator close, when the program ends.IR Generation for the assertDoesNotThrow expression.IR Generation for the assertPanic expression.IR Generation for the assert statement.IR Generation for the assertThrows expression.THE assignment of an assignmentExpression to a symbol (the expression is generated bygenerators.assignmentExprGenerator), in one of twoAssignExpressionToSymbol.Modes - TWO per construct on the set,generators.assignToNewSymbolandgenerators.assignToExistingSymbol(IR tidy W3.9, EXPR-15), never one per assignment.What the assignment does to the variable's previous value.Assign-if-unset generator using unified CONTROL_FLOW_CHAIN approach.Creates IR instructions for assignment expressions.Process assignment statement: variable = expression Uses RELEASE-then-RETAIN pattern for memory-safe assignments.THE heads that cap anasync(StreamDemand, decision 15 d): those reached from the async through stages that pass EVERY item on -map,call,teeand anotherhead- in pipeline order.Generates IR instructions for binary operations (e.g., addition, subtraction, comparison, etc.).Creates IR instructions for block statements.Builds a grouping stage's per-item boundary condition into the drain inner body and returns the variable holding its primitive boolean (the helper'sisKeyChanged/isBoundaryresult, already primitive).The runtime tracker a bucketing stage accumulates into, and what it hands downstream.Everything a buffering stage needs.THE evaluation of a call's arguments (EXPR-1): each argument expression is evaluated into its own managed temporary (retained and scope registered byVariableMemoryManagement), in source order, and the temporary's name and resolved type are collected.Whether each argument's temporary carries debug info for the argument's own source position.Generates IR instructions for function/method calls.Generate function invocation for a call stage.THE generated close chain in IR - use it, never build a property close by hand (Steve, 2026-10-06: "if you hold it, you close it"; the C++/Swift destructor model).Result of condition and body generation: the condition case details plus any post-loop instructions from stages like JOIN.THE prelude of a condition statement -assertandrequire(OPS-7): the statement coverage probe, the debug info that is ALWAYS created (the source location is essential for reporting a failure, not just for debugging), the truncated expression text for the failure message, the condition evaluated into a managed temporary (optionally bracketed by the coverage assert window) and its primitive Boolean.The evaluated condition of an assert or require statement.THE resolver of phase-5 quality metrics for one operation, for every IR generator that registers a function entry withCoverageProbePlacer.THE constructor call: every source call that constructs an object is lowered here, and nowhere else.Unified IR generator for EK9 control flow operators using CONTROL_FLOW_CHAIN.Resolves the user-facing display name for a function/method symbol used in coverage and quality reports.THE join key for a construct - the display name (CoverageDisplayName) minus its one cosmetic exception.THE coverage name of a function/method symbol, before the display-only transform - the one resolution bothCoverageDisplayName(bareConstructortrue) andCoverageIdentity(bareConstructorfalse) give; the class javadoc ofCoverageDisplayNamehas the four cases.The source-level names a coverage name is made from (seeCoverageDisplayName): a callable's own name, and an aggregate's name.THE fully-qualified name to use as a coverage/profiling IDENTITY for a callable - stable across every parameterisation of a generic.A variable declaration's instructions as its two halves, known where they are generated: the DECLARATION (the variable's slot, and any declaration that must outlive the evaluation with it) and the INITIALISATION (everything else - the value production).True when this declaration is an operation's returning variable (<- rtn as T: vor<- rtn as T?of a function, method or operator), owned by the caller - not the returning variable of a switch/while/for/try expression.THE index of the first stage that ends a pipeline's demand segment, or -1 when every stage streams (StreamDemand, decision 10 rule B).Generates IR instructions for dict literal expressions.The evaluatedhasNext()condition of a drain loop: its own scope, the instructions that compute it, the variable the helper'shasNext()call wrote and the primitive-boolean variable the loop branches on.THE emission of a dynamic class or dynamic function where it is written (INFRA-2): generate its construct in a freshIRContext(counter isolation), add the construct to the IR module, evaluate the captured expressions, then construct it with those captured values.Creates IR instructions for expressions.Gate the flowing element on a predicate:filtercontinues downstream when the predicate is true,rejectwhen it is false.Generate a nested iterator loop for a flatten stage.Generates IR for for-in loops and expressions: for item in collection.Generates IR for for-range loops and expressions using FOR_RANGE_POLYMORPHIC instruction.Coordinates for-statement IR generation by delegating to specialized generators.A Boolean LEFT operand for a short-circuit AND: a FRESH SSA temp (a head'scounter < limit, never a load of an alloca-backed var) plus its primitive.Unified function call processor using CallDetailsBuilder for method resolution and promotion.THE coverage and profiling probes of one function, method or operator - every IR generator that instruments a callable registers it and places its probes through this; never a private copy of the choreography.The probes of one registered function; each is null when its kind of instrumentation is off.Struct-style data holder for all Phase 7 IR generators and helpers.Evaluates conditions with optional guard variables for all control flow constructs.Result of condition evaluation containing both instructions and primitive condition.Orchestrates the common guard + scope + return variable pattern shared by control flow generators (while, do-while, for-range, for-in, try-catch).Context record passed to core generator lambdas.Generate comparison and conditional wrapper for a head or skipping stage.A runtime helper a stream loop drains - the async executor, a group/split tracker's stored buckets, the tail buffer: the variable holding it, its type and itshasNext/nextpair.Generates IR for if/else statements using CONTROL_FLOW_CHAIN.Generates IR instructions for interpolated string expressions.Static factory for creating complete tree of IR generators ONCE per construct.THE test of whether an application closes this registration at program end (ApplicationClose): the type it is registered AS, or its implementation, has a close.True when the RHS hands back a temp that ALREADY carries a producer +1 (so this consumer must SCOPE_REGISTER only, never a second RETAIN — a second RETAIN leaves two RETAINs against one SCOPE_REGISTER = a +1 ARC leak on the LLVM backend).THE test of whether a member the compiler synthesised is instrumented (given coverage and profiling probes byFunctionProbes): only what an author would recognise.THE test of whether atee's side target (its last pipelinePart) is a bare identifier - a local the pipe can name, so it needs no pre-loop state (StageState.TeeSinkholds an expression target).THE lowering of an iteration SOURCE - shared byfor x in source(ForInGenerator) and a stream'scat source(StreamStatementGenerator); use it, never a third copy.Helper record for iterator setup results.Generate join (left-fold reduction) wrapper for a join stage.Generates IR instructions for list literal expressions.Deals with generating the correct IR Instructions for processing any form of literal.Shared helper for guard variable evaluation in control flow constructs.Generate function call and pipeline item reassignment for a map stage.Creates IR instructions for object access expressions.Result holder for each step in the chain processing.THE operation-body skeleton (IR tidy W3.4, OPS-9): what a callable's body is made of, emitted byOperationBodyPlan.generate(IRInstructionBuilder)in the one order every callable has - use it, never another hand-rolled body.A plan's parts; any part not given is empty, and there is no body scope unlessOperationBodyPlan.Builder.inBodyScope(DebugInfo)is called.One part of a body: adds its instructions through the builder.Deals with the generation of the IR for OperationDetails.THE declaration of a variable that owns the temporaries its initialiser makes (OPS-6): a returning variable (<- rtn as String: String()) and a property (name as String: String()) are declared by no block statement, so the declaration itself closes the closeable temporaries its initialiser creates (StatementOwnedCloseables).What runs inside a pipeline scope (StreamPipelineMachinery.withPipelineScope(List, boolean, String, DebugInfo, List, PipelineScopeBody)): given the scope, the element slot declared in it and the stages' pre-loop state (already emitted), it emits the pipeline's loop or drain.Per-stage-boundary item variable plan.Generates IR instructions for primary references (THIS and SUPER keywords).THE instance initialisation of a type's properties, in declaration order - the body of its_i_init.THE heads that bound the pull of a loop overstages(StreamDemand, decision 10 rule B): everyheadbefore the first stage that ends the demand segment (EndsDemandSegment), in pipeline order.Generates IR instructions for question operator (?) using unified SWITCH_CHAIN_BLOCK.Shared helper for range iteration logic used by both for-range loops and stream for-range sources.Parameters for case constructor (AscendingCase or DescendingCase).Helper record to pass initialization data between methods.IR Generation for the require statement.THE compiler-generatedclose: the one place IR for closing a resource is built, so every route that closes something names the same owner, the same method, the same metadata and the same failure rule.A value to close.The region's first-failure variable, declared (null) BEFORE the region byResourceCloser.declareFirstFailure(ResourceCloser.FirstFailure, DebugInfo)- it must be definitely assigned where the region's handlers start.Processes returningParam context from expression forms of control flow constructs.Generates IR instructions for Boolean AND operations using LOGICAL_AND_BLOCK pattern.Generates IR instructions for Boolean OR operations using LOGICAL_OR_BLOCK pattern.Result of sort transformation: the new iterator setup and the sort index.A run of pipeline stages together with their pre-loop state - the two always travel as a pair, positionally aligned, and are meaningless apart.Result of stage initialization: pre-loop instructions and per-stage state.The pre-loop state of one stateful pipeline stage - one shape per kind of stage, made byStreamPipelineMachinery.generateStageSetup(List, String, DebugInfo)and read by that stage's wrapper.async: theEk9Asyncexecutor.head / skip: the alloca-backed counter, the limit and the constant one it is incremented by.group: theEk9Grouptracker.join: the tracker, the accumulator and the fold function instance and result, pre-allocated.split: theEk9Splittracker.tail: the boundedEk9Tailcircular buffer.tee whose side target is an expression (tee in h.sink(),tee in outputs.err): the variable holding that target, evaluated once before the loop (a bare identifier target needs no state - it is the local).uniq: theEk9Uniqtracker.The three things EVERY stream stage needs, whatever its shape: which stage it is, what runs downstream of it, and the debug info to stamp on what it emits.Result of wrapping stages: the per-iteration body and any post-loop instructions.The UNNAMED half of the closeable ownership rule (Steve, 2026-10-05): "A closeable value you never NAME is owned by the statement that created it and closed when that statement finishes; a closeable value you NAME must be declared as a try-with-resources resource." The named half is phase 5's E81056 (CloseableLocalOrError).WhatStatementOwnedCloseables.own(List, DebugInfo)found.Creates IR instructions for statements.A stage that cannot stream: it must see the whole source before it can emit anything, so instead of wrapping the loop body it REPLACES the pipeline - draining the source into a buffer pre-loop, then emitting from that buffer through the remaining stages.THE demand rule of a stream pipeline:head Nbounds the PULL (decision 10, rule B) - use this, never re-derive which heads gate a loop or how the gate is folded into a loop condition.A stream stage that inspects the flowing element WITHOUT changing it -filter,reject.The buffered-emission engine: the stages that cannot stream, and the pipeline bodies they emit.Produces the loop body-tail after the iterator item is bound: stages + sink.THE record of stream stage function operands that were EVALUATED once, before the pipeline, rather than named - use it, do not re-derive which operands need evaluating.The pipeline machinery shared by the orchestrator and the buffered-emission engine: draining a source to an iterator, planning the per-stage item variables, building the stream loop, and setting up per-stage pre-loop state.A stream stage that CANNOT emit during the loop -join,tail.What a pipeline is reading from: the iterator, the type of element it yields, and whether that source can go on forever.Discriminates a pipeline stage to its generator and nests the wraps.A stream stage that TRANSFORMS the flowing element -map,call,flatten.Generates IR for stream statement pipelines: source | stages | > terminal.Generates short-circuit OR chains for multiple switch case expressions.Result of comparison generation.Generates IR for switch statements and expressions using CONTROL_FLOW_CHAIN.Record to hold evaluation variable information.Generate tail wrapper using an Ek9Tail circular buffer.Generate tee side-pipe and continuation for a tee stage.Helper record for terminal sink setup results.Generates IR for text body methods with implicit String return.Generates IR for throw statements.Generates IR for try/catch/finally constructs using CONTROL_FLOW_CHAIN.THE typed read of a stage's state (StageState):stateaskind, or aCompilerExceptionnaming both - never a cast that turns a wrong or missing state into a null variable name.Generates IR instructions for unary operations (e.g., unary minus, increment, decrement, etc.).Generate tracker call and conditional wrapper for a uniq stage.Creates IR instructions for variable declarations.Creates IR instructions for variable only declarations.Generates IR for while and do-while loops and expressions using CONTROL_FLOW_CHAIN.THE parameters an operation writes as-> name as T(IR tidy W3.4, OPS-8): their declarations - slots the caller owns, each with its coverage statement probe - and their symbols, the same ones.