SWFProcessing.SWFModeller.ABC.DoABC.Merge C# (CSharp) Method

Merge() private method

Merges some code into this code.
private Merge ( DoABC abc, SWFContext ctx ) : void
abc DoABC The code to merge into this object. Once merged, you should /// discard 'abc'.
ctx SWFContext
return void
        internal void Merge(DoABC abc, SWFContext ctx)
        {
            /* Because we want everything to be object references... */

            AbcCode abcCode = abc.Code; /* This is a kludge to force initial parsing of the abc data, if not done already */
            AbcCode thisCode = this.Code;

            abc.Disassemble(); /* This ensures that the code is disassembled into mergable form */
            this.Disassemble();

            foreach (AS3ClassDef clazz in abc.Code.Classes)
            {
                AS3ClassDef classCollision = thisCode.GetClassByQName(clazz.Name.QualifiedName);
                if (classCollision != null)
                {
                    throw new SWFModellerException(
                            SWFModellerError.CodeMerge,
                            "Class name collision on " + clazz.Name,
                            ctx.Sentinel("ClassNameCollision"));
                }

                thisCode.AddClass(clazz);
            }
        }