コード例 #1
0
 public BuiltinClass(string name, BuiltinClass builtinClass, Dictionary <string, BuiltinFunction> methods,
                     Dictionary <string, BuiltinFunction> staticMethods, bool isClassInstance = false)
 {
     this.name            = name;
     superclass           = builtinClass;
     this.methods         = methods;
     this.staticMethods   = staticMethods;
     this.IsClassInstance = isClassInstance;
 }
コード例 #2
0
        public object Call(Interpreter interpreter, List <object> args)
        {
            var instance = new BuiltinClass(
                name,
                superclass.Call(interpreter, args) as BuiltinClass,
                methods,
                staticMethods,
                true
                );

            BuiltinFunction constructor = GetMethod("constructor");

            if (constructor != null)
            {
                constructor.Bind(instance, superclass).Call(interpreter, args);
            }

            return(instance);
        }