void Replace(ref ProgObj obj) { if (obj is NameObj named) { var found = Find(named.Name); obj = found ?? throw new CompilationError(ErrorType.ObjectIsNotDefined); } else { obj.Accept(this); } }
public Variable(Variable other) { Name = other.Name; Type = other.Type; }
public Evaluation(ProgObj expr) { Expr = expr; }
public Assignment(ProgObj left, ProgObj right) { Left = left; Right = right; }
public Parameter(Parameter other) { Name = other.Name; Type = other.Type; }
public Parameter(int index, TypeObj type) { Name = ((char)('a' + index)).ToString(); Type = type; }