Exemplo n.º 1
0
        public static void CreatePool(SmalltalkRuntime runtime, PoolBinding binding)
        {
            if (runtime == null)
            {
                throw new ArgumentNullException("runtime");
            }
            if (binding == null)
            {
                throw new ArgumentNullException("binding");
            }

            binding.SetValue(new Pool(runtime, binding.Name));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Create the pool object (and sets the value of the binding).
        /// </summary>
        /// <param name="installer">Context within which the pool is to be created.</param>
        /// <returns>Returns true if successful, otherwise false.</returns>
        protected internal override bool CreateGlobalObject(IDefinitionInstallerContext installer)
        {
            if (installer == null)
            {
                throw new ArgumentNullException();
            }
            // 1. Get the binding to the global
            Symbol      name    = installer.Runtime.GetSymbol(this.Name.Value);
            PoolBinding binding = installer.GetLocalPoolBinding(name);

            // 2. Check consistency that we didn't mess up in the implementation.
            if (binding == null)
            {
                throw new InvalidOperationException("Should have found a binding, because CreateGlobalBinding() created it!");
            }
            if (binding.Value != null)
            {
                throw new InvalidOperationException("Should be an empty binding, because CreateGlobalBinding() complained if one already existed!");
            }
            // 3. Create the pool object.
            binding.SetValue(new Pool(installer.Runtime, name));
            return(true);
        }