コード例 #1
0
        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.
        }
コード例 #2
0
ファイル: PoolScope.cs プロジェクト: erlis/IronSmalltalk
 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.
 }
コード例 #3
0
        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);
        }
コード例 #4
0
        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.
        }
コード例 #5
0
 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.
 }