flow/condition/compile

Source: src/flow/condition/compile.ts

A condition checked whole against the types of what it may read, before the first spawn.

Every address must exist and be typed, the result must be a boolean and compared sides must agree. Enums are strict: "aproved" compared with an approved | rejected field is refused here, since at run time it would only ever be false and the loop would spin to its cap. A string a model wrote in the person’s language compares to no literal at all, for the same reason: "Yes" against a clicked "Oui" is silently false.

Problems are collected, not thrown at the first: a flow is refused with every fault at once. A part already refused is read no further, so one typo is one problem and not the three that follow from it.

Condition

type

export type Condition = {
	/** The condition as the file writes it. */
	readonly source: string;
	/** Its parsed form, which only the evaluator reads. */
	readonly expr: Expr;
	readonly [checked]: true;
};

A condition that passed the check. Only compileCondition makes one, and only one can be evaluated.