public override IDiscreteBinding GetBinding(ExecutionContext executionContext)
            {
                Pool pool = executionContext.Runtime.GetPool(this.PoolName);

                if (pool == null)
                {
                    return(null);
                }
                PoolVariableOrConstantBinding binding = null;

                pool.TryGetValue(this.VariableName, out binding);
                return(binding);
            }
        public static string GetMoniker(PoolBinding poolBinding, PoolVariableOrConstantBinding binding)
        {
            if (poolBinding == null)
            {
                throw new ArgumentNullException("poolBinding");
            }
            if (binding == null)
            {
                throw new ArgumentNullException("binding");
            }

            return(DiscreteBindingCallSiteBinderBase.GetMoniker(
                       DiscreteBindingCallSiteBinderBase.PoolItemPrefix,
                       poolBinding.Name.Value,
                       binding.Name.Value));
        }
Exemplo n.º 3
0
        public CompiledInitializer CreateInitializer(InitializerDefinition definition, IDefinitionInstallerContext installer)
        {
            PoolBinding poolBinding = installer.GetPoolBinding(this.PoolName);

            if ((poolBinding == null) || (poolBinding.Value == null))
            {
                return(null);
            }
            PoolVariableOrConstantBinding binding = poolBinding.Value[this.PoolItemName];

            if (binding == null)
            {
                return(null);
            }
            return(new RuntimePoolItemInitializer(this.ParseTree, new DebugInfoService(this.SourceCodeService), binding, this.PoolName));
        }
Exemplo n.º 4
0
        public static CompiledInitializer AddPoolInitializer(SmalltalkRuntime runtime, SmalltalkNameScope scope, Type delegateType, string delegateName, string poolName, string poolItemName)
        {
            PoolBinding poolBinding = scope.GetPoolBinding(poolName);

            if ((poolBinding == null) || (poolBinding.Value == null))
            {
                throw new ArgumentException(String.Format("Pool named {0} does not exist.", poolName));
            }
            PoolVariableOrConstantBinding binding = poolBinding.Value[poolItemName];

            if (binding == null)
            {
                throw new ArgumentException(String.Format("Pool variable or constant named {0} does not exist in pool {1}.", poolItemName, poolName));
            }
            return(NativeLoadHelper.AddInitializer(scope, InitializerType.PoolVariableInitializer, binding, delegateType, delegateName));
        }
 public RuntimePoolItemInitializer(InitializerNode parseTree, IDebugInfoService debugInfoService, PoolVariableOrConstantBinding binding, string poolName)
     : base(InitializerType.PoolVariableInitializer, binding, parseTree, debugInfoService)
 {
     if (String.IsNullOrWhiteSpace(poolName))
     {
         throw new ArgumentNullException("poolName");
     }
     this.PoolName = poolName;
 }