Example #1
0
 /// <summary>
 /// Initialize a new instance of the <see cref="ScriptClass"/> class using the specified parameters.
 /// </summary>
 /// <param name="name">The name of the class.</param>
 /// <param name="super">The super class.</param>
 /// <param name="constructor">The constructor of the class.</param>
 public ScriptClass(
     string name,
     ScriptClass super,
     ScriptConstructor constructor)
     : base(name, super)
 {
     Super             = super;
     FieldInitializers = new Dictionary <string, Expression>();
     Constructor       = constructor;
 }
Example #2
0
        public ScriptClassCreator(RuntimeContext closure, string name, IClassObject super)
        {
            ScriptClass sup;

            if (super == null)
            {
                sup = ObjectClass.Instance;
            }
            else
            {
                sup = super as ScriptClass;
                if (sup == null)
                {
                    throw new InvalidOperationException(ExceptionResource.NotInheritable);
                }
            }
            Super   = sup;
            Class   = new ScriptClass(name, sup, null);
            Context = new FunctionContext(closure);
            Context.Memory.HoistingDecalreClass(Context, name);
            Context.Memory.DecalreClass(Context, name, Class);
        }