Beispiel #1
0
        public void Serialize(BinaryWriter writer, CSWCSerizlizer serizlizer)
        {
            writer.Write(id);
            writer.Write(name);
            writer.Write(define_class_id);
            writer.Write(isoutclass);
            writer.Write(hasTryStmt);
            writer.Write((ushort)totalStackSlots);

            serizlizer.SerializeObject(writer, (scopes.ScopeBase)scope);

            //writer.Write(opSteps.Count);
            //for (int i = 0; i < opSteps.Count; i++)
            //{
            //	var step = opSteps[i];
            //	serizlizer.SerializeObject(writer, step);
            //}

            writer.Write((ushort)instructions.Length);
            for (int i = 0; i < instructions.Length; i++)
            {
                var step = instructions[i];
                serizlizer.SerializeObject(writer, step);
            }

            writer.Write((ushort)regConvFromVar.Length);
            for (int i = 0; i < regConvFromVar.Length; i++)
            {
                StackSlotAccessor conv = regConvFromVar[i];
                //conv.Serialize(writer, serizlizer);
                serizlizer.SerializeObject(writer, conv);
            }
        }
Beispiel #2
0
        public override void Serialize(BinaryWriter writer, CSWCSerizlizer serizlizer)
        {
            writer.Write(9);
            base.Serialize(writer, serizlizer);

            serizlizer.SerializeObject(writer, superClass);
            serizlizer.SerializeObject(writer, thisClass);

            //throw new NotImplementedException();
        }
Beispiel #3
0
        public void Serialize(BinaryWriter writer, CSWCSerizlizer serizlizer)
        {
            for (int i = 0; i < operFunctions.Length; i++)
            {
                var dict = operFunctions[i];
                writer.Write(dict.Count);
                foreach (var item in dict)
                {
                    writer.Write(item.Key.v1);
                    writer.Write(item.Key.v2);

                    serizlizer.SerializeObject(writer, item.Value.define);
                    serizlizer.SerializeObject(writer, item.Value.func);
                }
            }
        }
        public override void Serialize(BinaryWriter writer,CSWCSerizlizer serizlizer)
        {
            writer.Write(2);

            //private readonly int indexofMember;
            writer.Write(indexofMember);
            //private readonly string _name;
            writer.Write(_name);

            //public readonly ASBinCode.rtti.Class _class;
            serizlizer.SerializeObject(writer,_class);
            //public MethodGetterBase getter;
            serizlizer.SerializeObject(writer,getter);
            //public MethodGetterBase setter;
            serizlizer.SerializeObject(writer,setter);
        }
        public override void Serialize(BinaryWriter writer,CSWCSerizlizer serizlizer)
        {
            //protected int indexofMember;
            writer.Write(indexofMember);
            //private readonly string _name;
            writer.Write(_name);
            //public readonly int refdefinedinblockid;
            writer.Write(refdefinedinblockid);
            //protected int functionid;
            writer.Write(functionid);

            ///// <summary>
            ///// 比如说,私有方法就肯定不是虚方法
            ///// </summary>
            //protected bool isNotReadVirtual = false;
            writer.Write(isNotReadVirtual);

            base.Serialize(writer,serizlizer);

            //protected readonly ASBinCode.rtti.Class _class;
            serizlizer.SerializeObject(writer,_class);
        }
Beispiel #6
0
        public override void Serialize(BinaryWriter writer,CSWCSerizlizer serizlizer)
        {
            writer.Write(4);
            base.Serialize(writer,serizlizer);

            //public bool isPublic;
            writer.Write(isPublic);
            //public bool isInternal;
            writer.Write(isInternal);
            //public bool isPrivate;
            writer.Write(isPrivate);
            //public bool isProtected;
            writer.Write(isProtected);
            //public bool isStatic;
            writer.Write(isStatic);
            //public List<FieldMeta> metas;

            writer.Write(metas.Count);
            for (int i = 0; i < metas.Count; i++)
            {
                serizlizer.SerializeObject(writer,metas[i]);
            }
        }
 public override void Serialize(BinaryWriter writer, CSWCSerizlizer serizlizer)
 {
     writer.Write(1);
     base.Serialize(writer, serizlizer);
     serizlizer.SerializeObject(writer, link);
 }
 public override void Serialize(BinaryWriter writer, CSWCSerizlizer serizlizer)
 {
     writer.Write(8);
     base.Serialize(writer, serizlizer);
     serizlizer.SerializeObject <SourceToken>(writer, token);
 }
Beispiel #9
0
        public void Serialize(BinaryWriter writer, CSWCSerizlizer serizlizer)
        {
            //public OpCode opCode;
            writer.Write((byte)opCode);
            //	public SourceToken token;
            serizlizer.SerializeObject(writer, token);
            ///// <summary>
            ///// 行标
            ///// </summary>
            //public string flag;

            //if (flag == null) //行标在运行时无用,不序列化
            {
                writer.Write(false);
            }
            //else
            //{
            //	writer.Write(true);
            //	writer.Write(flag);
            //}


            ///// <summary>
            ///// 跳转偏移量
            ///// </summary>
            //public int jumoffset;
            writer.Write(jumoffset);
            ///// <summary>
            ///// 所属标签
            ///// </summary>
            //public Stack<string> labels;
            //if (labels == null) //运行时labels完全无用
            {
                writer.Write(false);
            }
            //else
            //{
            //	writer.Write(true);
            //	string[] lbls = labels.ToArray();
            //	writer.Write(lbls.Length);
            //	for (int i = 0; i < lbls.Length; i++)
            //	{
            //		writer.Write(lbls[i]);
            //	}
            //}

            ///// <summary>
            ///// 当前行在哪个try块里
            ///// -1表示不在任何try块里
            ///// </summary>
            //public int tryid;
            writer.Write(tryid);
            ///// <summary>
            ///// 当前块所属try类型
            ///// 0 try 1 catch 2 finally
            ///// </summary>
            //public int trytype;
            writer.Write(trytype);

            //public LeftValueBase reg;
            serizlizer.SerializeObject(writer, reg);
            //public RightValueBase arg1;
            serizlizer.SerializeObject(writer, arg1);
            //public RightValueBase arg2;
            serizlizer.SerializeObject(writer, arg2);

            ///// <summary>
            ///// 输出结果类型
            ///// </summary>
            //public RunTimeDataType regType;
            writer.Write(regType);
            ///// <summary>
            ///// 输入参数1类型
            ///// </summary>
            //public RunTimeDataType arg1Type;
            writer.Write(arg1Type);
            ///// <summary>
            ///// 输入参数2类型
            ///// </summary>
            //public RunTimeDataType arg2Type;
            writer.Write(arg2Type);


            writer.Write(memregid1);
            writer.Write(memregid2);
            writer.Write(memregid3);

            writer.Write(constnumber1);
            writer.Write(constnumber2);
        }