Esempio n. 1
0
        public override IoObject proto(IoState state)
        {
            IoString pro = new IoString();
            pro.state = state;
            //    pro.tag.cloneFunc = new IoTagCloneFunc(this.clone);
            //    pro.tag.compareFunc = new IoTagCompareFunc(this.compare);
            pro.createSlots();
            pro.createProtos();
            state.registerProtoWithFunc(name, new IoStateProto(name, pro, new IoStateProtoFunc(this.proto)));
            pro.protos.Add(state.protoWithInitFunc("Object"));

            IoCFunction[] methodTable = new IoCFunction[] {
                new IoCFunction("appendStr", new IoMethodFunc(IoString.slotAppendStr)),
                new IoCFunction("at", new IoMethodFunc(IoString.slotAt)),
                new IoCFunction("reverse", new IoMethodFunc(IoString.slotReverse)),
            };

            pro.addTaglessMethodTable(state, methodTable);
            return pro;
        }
Esempio n. 2
0
 public override IoObject clone(IoState state)
 {
     IoString proto = state.protoWithInitFunc(name) as IoString;
     IoString result = new IoString();
     result.state = state;
     result.value = proto.value;
     result.createProtos();
     result.createSlots();
     result.protos.Add(proto);
     return result;
 }