public GlobalScope(RTB.SmalltalkNameScope nameScope, BindingScope outerScope) : base(outerScope) { if (nameScope == null) { throw new ArgumentNullException(); } this.NameScope = nameScope; }
public SmalltalkNameScope Copy(SmalltalkNameScope outerScope) { SmalltalkNameScope result = new SmalltalkNameScope(this.Runtime, outerScope); result.Classes.AddRange(this.Classes); result.GlobalConstants.AddRange(this.GlobalConstants); result.GlobalVariables.AddRange(this.GlobalVariables); result.Pools.AddRange(this.Pools); result.ProtectedNames.AddRange(this.ProtectedNames); result.Initializers.AddRange(this.Initializers); return(result); // NB: Result IS NOT write-protected. }
public SmalltalkNameScope(SmalltalkRuntime runtime, SmalltalkNameScope outerScope) { if (runtime == null) throw new ArgumentNullException("runtime"); this.Runtime = runtime; this.Classes = new DiscreteBindingDictionary<ClassBinding>(runtime, 50); this.GlobalConstants = new DiscreteBindingDictionary<GlobalConstantBinding>(runtime, 20); this.GlobalVariables = new DiscreteBindingDictionary<GlobalVariableBinding>(runtime, 20); this.Pools = new DiscreteBindingDictionary<PoolBinding>(runtime, 20); this.ProtectedNames = new List<Symbol>(); this.OuterScope = outerScope; }
public SmalltalkNameScope(SmalltalkRuntime runtime, SmalltalkNameScope outerScope) { if (runtime == null) { throw new ArgumentNullException("runtime"); } this.Runtime = runtime; this.Classes = new DiscreteBindingDictionary <ClassBinding>(runtime, 50); this.GlobalConstants = new DiscreteBindingDictionary <GlobalConstantBinding>(runtime, 20); this.GlobalVariables = new DiscreteBindingDictionary <GlobalVariableBinding>(runtime, 20); this.Pools = new DiscreteBindingDictionary <PoolBinding>(runtime, 20); this.Initializers = new InitializerList(); this.ProtectedNames = new List <Symbol>(); this.OuterScope = outerScope; }
public static BindingScope ForProgramInitializer(SmalltalkNameScope globalNameScope) { return BindingScope.ForGlobalInitializer(globalNameScope); // Same as global initializer }
public static BindingScope ForPoolInitializer(Pool pool, SmalltalkNameScope nameScope) { return new PoolScope(pool, new GlobalScope(nameScope)); }
public static BindingScope ForInstanceMethod(SmalltalkClass cls, SmalltalkNameScope globalNameScope) { if (cls == null) throw new ArgumentNullException("cls"); if (globalNameScope == null) throw new ArgumentNullException("globalNameScope"); //class_scope := (global_scope + pool_variable_scope) + inheritable_class_variable_scope // X3J20:3.3.2.3 //instance_function_scope := class_scope + instance_variable_scope // X3J20:3.3.2.3 return new InstanceFunctionScope(cls, new ClassScope(cls, new PoolVariableScope(cls, new GlobalScope(globalNameScope)))); }
public static BindingScope ForGlobalInitializer(SmalltalkNameScope globalNameScope) { if (globalNameScope == null) throw new ArgumentNullException("globalNameScope"); return new GlobalScope(globalNameScope); }
public static BindingScope ForClassInitializer(SmalltalkClass cls, SmalltalkNameScope globalNameScope) { if (cls == null) throw new ArgumentNullException("cls"); if (globalNameScope == null) throw new ArgumentNullException("globalNameScope"); //statement_scope := class_funtion_scope + local_scope + reserved_scope // Class Initializer - X3J20:3.4.3 //home_context_scope := class_funtion_scope return new ClassFunctionScope(cls, new ClassScope(cls, new PoolVariableScope(cls, new GlobalScope(globalNameScope)))); }
public override bool ValidateProgramInitializer(SmalltalkNameScope globalNameScope, IIntermediateCodeValidationErrorSink errorSink) { return this.Validate(globalNameScope, errorSink, rt => this.CompileProgramInitializer(rt, globalNameScope)); }
private bool Validate(SmalltalkNameScope globalNameScope, IIntermediateCodeValidationErrorSink errorSink, Func<SmalltalkRuntime, InitializerCompilationResult> func) { return AstIntermediateMethodCode.Validate(this.ParseTree, errorSink, delegate() { Expression rt = Expression.Parameter(typeof(SmalltalkRuntime), "rt"); Expression self = Expression.Parameter(typeof(object), "self"); return func(globalNameScope.Runtime); }); }
private InitializerCompilationResult CompileProgramInitializer(SmalltalkRuntime runtime, SmalltalkNameScope globalNameScope) { return this.Compile(runtime, BindingScope.ForProgramInitializer(globalNameScope), ReservedScope.ForProgramInitializer()); }
private InitializerCompilationResult CompilePoolItemInitializer(SmalltalkRuntime runtime, Pool pool, SmalltalkNameScope globalNameScope) { return this.Compile(runtime, BindingScope.ForPoolInitializer(pool, globalNameScope), ReservedScope.ForPoolInitializer()); }
private InitializerCompilationResult CompileClassInitializer(SmalltalkRuntime runtime, SmalltalkClass cls, SmalltalkNameScope globalNameScope) { return this.Compile(runtime, BindingScope.ForClassInitializer(cls, globalNameScope), ReservedScope.ForClassInitializer()); }
public SmalltalkNameScope Copy() { SmalltalkNameScope result = new SmalltalkNameScope(this.Runtime, this.OuterScope); result.Classes.AddRange(this.Classes); result.GlobalConstants.AddRange(this.GlobalConstants); result.GlobalVariables.AddRange(this.GlobalVariables); result.Pools.AddRange(this.Pools); result.ProtectedNames.AddRange(this.ProtectedNames); return result; // NB: Result IS NOT write-protected. }
/// <summary> /// This is internal metnod used by the Intaller to redefine the globals in the runtime. /// </summary> /// <param name="scope">New globals scope containing the global (end-user defined) globals.</param> public void SetGlobalScope(SmalltalkNameScope scope) { if (scope == null) throw new ArgumentNullException(); scope.WriteProtect(); this.GlobalScope = scope; }