Пример #1
0
 protected virtual XBinding CreateBinding(string key)
 {
     if (String.IsNullOrWhiteSpace(key))
         throw new ArgumentNullException();
     XBinding result = new XBinding(key);
     this.Bindings.Add(key, result);
     return result;
 }
Пример #2
0
        public XClass(ClassDefinition definition, XSystemDictionary smalltalk)
        {
            if ((definition == null) || (smalltalk == null))
                throw new ArgumentNullException();

            this.Name = definition.Name.Value;
            if (!String.IsNullOrWhiteSpace(definition.SuperclassName.Value) && (definition.SuperclassName.Value != "nil"))
                this._superclass = smalltalk.GetOrCreateBinding(definition.SuperclassName.Value);
            this.InstanceState = definition.InstanceState.Value;

            this.ClassVariables = new ClassVariablesPool(definition.ClassVariableNames);
            this.ClassInstanceVariables = new ClassInstanceVariablesPool(this, definition.ClassInstanceVariableNames);
            this.ImportedPools = new ImportedPoolsPool(smalltalk, definition.ImportedPoolNames);
            this.InstanceVariableNames = definition.InstanceVariableNames.Select(sr => sr.Value).ToArray();
        }
Пример #3
0
 public override XBinding GetBinding(string key)
 {
     XBinding result = this.InternalGetBinding(key);
     if (result != null)
         return result;
     // Try the superclasses
     XClass super = this.Owner.Superclass;
     if (super == null)
         return null;
     // Check if this is defined in a superclass
     result = super.ClassInstanceVariables.InternalGetBinding(key);
     if (result == null)
         return null; // No definition exists in the superclasses.
     // The class-instance-variable is defined in a superclass, create a local binding.
     result = new XBinding(key);
     this.Bindings.Add(key, result);
     return result;
 }
Пример #4
0
        public bool FileInProgramInitializer(Installer.Definitions.ProgramInitializer initializer)
        {
            XBinding binding = new XBinding("Program Initializer"); // The key is not really used
            binding.MakeVariable();
            this.Initializers.Add(new KeyValuePair<XBinding, object>(binding, this.CreateEvaluatableObject(initializer.ParseTree)));

            return true;
        }