protected override NameBinding ResolveBinding(string name) { NameBinding result = null; foreach (var poolBinding in this.Class.ImportedPoolBindings) { if (poolBinding.Value != null) { RTB.PoolVariableOrConstantBinding binding; poolBinding.Value.TryGetValue(name, out binding); if (binding != null) { if (result != null) { return(new ErrorBinding(name, CodeGenerationErrors.PoolVariableNotUnique)); } if (binding is RTB.PoolConstantBinding) { result = new PoolConstantBinding(name, poolBinding, (RTB.PoolConstantBinding)binding); } else { result = new PoolVariableBinding(name, poolBinding, (RTB.PoolVariableBinding)binding); } } } } return(result); // null means try outer scope. }
protected override NameBinding ResolveBinding(string name) { NameBinding result = null; RTB.PoolVariableOrConstantBinding binding; this.Pool.TryGetValue(name, out binding); if (binding != null) { if (binding is RTB.PoolConstantBinding) result = new PoolConstantBinding(name, (RTB.PoolConstantBinding)binding); else result = new PoolVariableBinding(name, (RTB.PoolVariableBinding)binding); } return result; // null means try outer scope. }
public static PoolVariableBinding CreatePoolVariableBinding(SmalltalkRuntime runtime, PoolBinding poolBinding, string name) { if (runtime == null) { throw new ArgumentNullException("runtime"); } if (poolBinding == null) { throw new ArgumentNullException("poolBinding"); } Symbol varName = runtime.GetSymbol(name); PoolVariableBinding binding = new PoolVariableBinding(varName); poolBinding.Value.Add(binding); return(binding); }
protected override NameBinding ResolveBinding(string name) { NameBinding result = null; RTB.PoolVariableOrConstantBinding binding; this.Pool.TryGetValue(name, out binding); if (binding != null) { RTB.PoolBinding poolBinding = this.Pool.Runtime.GlobalScope.GetPoolBinding(this.Pool.Name); System.Diagnostics.Debug.Assert(poolBinding != null, String.Format("Could not find pool binding named {0}.", this.Pool.Name.Value)); if (binding is RTB.PoolConstantBinding) { result = new PoolConstantBinding(name, poolBinding, (RTB.PoolConstantBinding)binding); } else { result = new PoolVariableBinding(name, poolBinding, (RTB.PoolVariableBinding)binding); } } return(result); // null means try outer scope. }
protected override NameBinding ResolveBinding(string name) { NameBinding result = null; foreach (var poolBinding in this.Class.ImportedPoolBindings) { if (poolBinding.Value != null) { RTB.PoolVariableOrConstantBinding binding; poolBinding.Value.TryGetValue(name, out binding); if (binding != null) { if (result != null) return new ErrorBinding(name, RuntimeCodeGenerationErrors.PoolVariableNotUnique); if (binding is RTB.PoolConstantBinding) result = new PoolConstantBinding(name, (RTB.PoolConstantBinding) binding); else result = new PoolVariableBinding(name, (RTB.PoolVariableBinding) binding); } } } return result; // null means try outer scope. }