// private constructor // =================== // private Scope(List<Utils.StoreEntry> stack_entries, Int32 stack_offset, List<Utils.StoreEntry> global_entries, FunctionType curr_func, List<Utils.StoreEntry> typedef_entries, List<Utils.StoreEntry> enum_entries) { this.locals = stack_entries; this.esp_pos = stack_offset; this.globals = global_entries; this.func = curr_func; this.typedefs = typedef_entries; this.enums = enum_entries; }
public Env2 InFunction(FunctionType functionType, ImmutableList<ParameterObjectEntry> functionParams) { if (this._functionScope.IsSome) { throw new InvalidProgramException("Is already in a function. Cannot go in function."); } return new Env2( this._globalSymbolTable, Option.Some(new FunctionScope(functionType, functionParams)) ); }
public FunctionScope(FunctionType functionType, ImmutableList<ParameterObjectEntry> functionParams) : this(functionType, functionParams, ImmutableStack<LocalSymbolTable>.Empty) { }
// SetCurrentFunction // ================== // input: Type // ouput: Environment // return a new environment which sets the current function // public Env SetCurrentFunction(FunctionType type) { Scope top = this._scopes.Peek(); return new Env(this._scopes.Pop().Push(top.SetCurrentFunction(type))); }
public FunctionScope(FunctionType functionType, ImmutableList<ParameterObjectEntry> functionParams, ImmutableStack<LocalSymbolTable> localScopes) { this.FunctionType = functionType; this.FunctionParams = FunctionParams; this.LocalScopes = localScopes; }
public FuncCall(Expr func, FunctionType funcType, List<Expr> args) { this.Func = func; this.FuncType = funcType; this.Args = args; }
// SetCurrFunc // =========== // set the current function public Scope SetCurrentFunction(FunctionType type) { return new Scope(this.locals, this.esp_pos, this.globals, type, this.typedefs, this.enums ); }
public FuncDef(String name, StorageClass scs, FunctionType type, Stmt stmt) { this.name = name; this.scs = scs; this.type = type; this.stmt = stmt; }
public FunctionScope(FunctionType functionType, ImmutableList <ParameterObjectEntry> functionParams) : this(functionType, functionParams, ImmutableStack <LocalSymbolTable> .Empty) { }
public FunctionScope(FunctionType functionType, ImmutableList <ParameterObjectEntry> functionParams, ImmutableStack <LocalSymbolTable> localScopes) { this.FunctionType = functionType; this.FunctionParams = FunctionParams; this.LocalScopes = localScopes; }
// SetCurrentFunction // ================== // input: Type // ouput: Environment // return a new environment which sets the current function // public Env SetCurrentFunction(FunctionType type) { Scope top = this._scopes.Peek(); return(new Env(this._scopes.Pop().Push(top.SetCurrentFunction(type)))); }
// SetCurrFunc // =========== // set the current function public Scope SetCurrentFunction(FunctionType type) { return(new Scope(this.locals, this.esp_pos, this.globals, type, this.typedefs, this.enums )); }