onelang
Version:
OneLang transpiler framework core
21 lines (20 loc) • 1.05 kB
TypeScript
import { OneAst as one } from "../Ast";
import { AstVisitor } from "../AstVisitor";
import { LangFileSchema } from "../../Generator/LangFileSchema";
/**
* Fills out `isMutable` and `isUnused` properties of variables.
*
* It sets `isMutable` to `false` and `isUnused` to `true` by default, and if a variable
* has a reference then it sets `isUnused` to `false` and if the reference is used
* for modification, then it sets `isMutable` to `true`
*/
export declare class FillVariableMutability extends AstVisitor<boolean> {
lang: LangFileSchema.LangFile;
constructor(lang: LangFileSchema.LangFile);
protected visitBinaryExpression(expr: one.BinaryExpression, isMutable: boolean): void;
protected visitCallExpression(callExpr: one.CallExpression, isMutable: boolean): void;
protected visitVariable(stmt: one.VariableBase): void;
protected visitVariableRef(expr: one.VariableRef, isMutable: boolean): void;
protected visitUnaryExpression(expr: one.UnaryExpression): void;
process(schema: one.Schema): void;
}