Ejemplo n.º 1
0
        public override void  tryAction(Try a)
        {
            int updatePos = encodeActionHeader(a);

            writer.writeUI8(a.flags);
            int trySizePos = writer.Pos;

            writer.writeUI16(0);             // try size
            writer.writeUI16(0);             // catch size
            writer.writeUI16(0);             // finally size

            if (a.hasRegister())
            {
                writer.writeUI8(a.catchReg);
            }
            else
            {
                writer.writeString(a.catchName);
            }

            // we have emitted the try action, what follows is label mgmt
            updateActionHeader(updatePos);

            int tryStart = writer.Pos;

            updates.Add(new UpdateEntry(tryStart, trySizePos, a));
        }
Ejemplo n.º 2
0
        private void  patchForwardBranches()
        {
            // now patch forward branches
            //UPGRADE_TODO: Method 'java.util.Iterator.hasNext' was converted to 'System.Collections.IEnumerator.MoveNext' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratorhasNext'"
            for (System.Collections.IEnumerator i = updates.GetEnumerator(); i.MoveNext();)
            {
                //UPGRADE_TODO: Method 'java.util.Iterator.next' was converted to 'System.Collections.IEnumerator.Current' which has a different behavior. "ms-help://MS.VSCC.v80/dv_commoner/local/redirect.htm?index='!DefaultContextWindowIndex'&keyword='jlca1073_javautilIteratornext'"
                UpdateEntry entry = (UpdateEntry)i.Current;
                switch (entry.source.code)
                {
                case flash.swf.ActionConstants_Fields.sactionIf:
                case flash.swf.ActionConstants_Fields.sactionJump:
                    int target = getLabelOffset(((Branch)entry.source).target);
                    writer.writeSI16at(entry.updatePos, target - entry.anchor);
                    break;

                case flash.swf.ActionConstants_Fields.sactionWith:
                    int endWith = getLabelOffset(((With)entry.source).endWith);
                    writer.writeUI16at(entry.updatePos, endWith - entry.anchor);
                    break;

                case flash.swf.ActionConstants_Fields.sactionWaitForFrame:
                case flash.swf.ActionConstants_Fields.sactionWaitForFrame2:
                    int skipTarget = getLabelCount(((WaitForFrame)entry.source).skipTarget);
                    writer.writeUI8at(entry.updatePos, skipTarget - entry.anchor);
                    break;

                case flash.swf.ActionConstants_Fields.sactionTry:
                    Try t      = (Try)entry.source;
                    int endTry = getLabelOffset(t.endTry);
                    writer.writeUI16at(entry.updatePos, endTry - entry.anchor);
                    entry.anchor = endTry;
                    if (t.hasCatch())
                    {
                        int endCatch = getLabelOffset(t.endCatch);
                        writer.writeUI16at(entry.updatePos + 2, endCatch - entry.anchor);
                        entry.anchor = endCatch;
                    }
                    if (t.hasFinally())
                    {
                        int endFinally = getLabelOffset(t.endFinally);
                        writer.writeUI16at(entry.updatePos + 4, endFinally - entry.anchor);
                    }
                    break;

                default:
                    Debug.Assert(false, "invalid action in UpdateEntry");
                    break;
                }
            }
        }
Ejemplo n.º 3
0
		public override void  tryAction(Try a)
		{
			int updatePos = encodeActionHeader(a);
			
			writer.writeUI8(a.flags);
			int trySizePos = writer.Pos;
			writer.writeUI16(0); // try size
			writer.writeUI16(0); // catch size
			writer.writeUI16(0); // finally size
			
			if (a.hasRegister())
				writer.writeUI8(a.catchReg);
			else
				writer.writeString(a.catchName);
			
			// we have emitted the try action, what follows is label mgmt
			updateActionHeader(updatePos);
			
			int tryStart = writer.Pos;
			updates.Add(new UpdateEntry(tryStart, trySizePos, a));
		}