Ejemplo n.º 1
0
 public void Dump(IndentedTextWriter w)
 {
     w.WriteLine(Enum.GetName(typeof(ActionKind), this.ActionId));
     ActionRecords.CurrentConstantPool = cp;
     for (int i = 0; i < Statements.Count; i++)
     {
         ActionRecords.AutoLineLabel(w);
         Statements[i].Dump(w);
     }
 }
Ejemplo n.º 2
0
 public void ToFlashAsm(IndentedTextWriter w)
 {
     w.WriteLine("function '" + FunctionName + "' " + ActionRecords.GetLabel((int)CodeSize));             // todo: function end code label
     ActionRecords.CurrentConstantPool = cp;
     for (int i = 0; i < Statements.Count; i++)
     {
         ActionRecords.AutoLineLabel(w);
         Statements[i].ToFlashAsm(w);
     }
 }
Ejemplo n.º 3
0
        public void ToFlashAsm(IndentedTextWriter w)
        {
            w.Write("function2 '" + FunctionName + "' ");
            string comma = "";

            if (Parameters.Count > 0)
            {
                w.Write("(");
                foreach (KeyValuePair <uint, string> p in Parameters)
                {
                    w.Write(comma + "r:" + p.Key + "='" + p.Value + "'");
                    comma = ", ";
                }
                w.Write(") ");
            }

            if (Preloads != PreloadFlags.Empty)
            {
                // in the order: this, arguments, super, _root, _parent, _global
                uint regIndex = 1;
                comma = "";

                w.Write("(");
                int pl = (int)Preloads;
                for (int i = 1; i < (int)PreloadFlags.End; i *= 2)
                {
                    if ((i & pl) != 0)
                    {
                        w.Write(comma + "r:" + regIndex++ + "=" + PreloadFlagToString((PreloadFlags)i) + " ");
                        comma = ", ";
                    }
                }
                //if ((PreloadFlags)(Preloads & PreloadFlags.This) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=this ");
                //    comma = ", ";
                //}
                //if ((PreloadFlags)(Preloads & PreloadFlags.Arguments) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=arguments ");
                //    comma = ", ";
                //}
                //if ((PreloadFlags)(Preloads & PreloadFlags.Super) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=super ");
                //    comma = ", ";
                //}
                //if ((PreloadFlags)(Preloads & PreloadFlags.Root) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=_root ");
                //    comma = ", ";
                //}
                //if ((PreloadFlags)(Preloads & PreloadFlags.Parent) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=_parent ");
                //    comma = ", ";
                //}
                //if ((PreloadFlags)(Preloads & PreloadFlags.Global) != PreloadFlags.Empty)
                //{
                //    w.Write(comma + "r:" + regIndex++ + "=_global ");
                //    comma = ", ";
                //}
                w.Write(") ");
            }

            w.Write(ActionRecords.GetLabel((int)CodeSize) + " ");
            w.WriteLine("maxreg=" + RegisterCount);

            ActionRecords.CurrentConstantPool = cp;
            for (int i = 0; i < Statements.Count; i++)
            {
                ActionRecords.AutoLineLabel(w);
                Statements[i].ToFlashAsm(w);
            }
        }