public void SetValue(As3Instruction ins, ConstantPoolInfo cPool = null) { switch (ins.Opcode) { case Opcode.PushTrue: ValueKind = Types.ValueKind.True; ValueIndex = 0; break; case Opcode.PushFalse: ValueKind = Types.ValueKind.False; ValueIndex = 0; break; case Opcode.PushString: ValueKind = Types.ValueKind.Utf8; ValueIndex = (ins as As3PushString).String.Index; break; case Opcode.PushShort: ValueKind = Types.ValueKind.Int; int pushShortValue = (ins as As3PushShort).Short; uint intIndex = cPool.IndexOfInt(pushShortValue); if (intIndex == 0) { ValueIndex = cPool.AddIntAtEnd(pushShortValue); } else { ValueIndex = intIndex; } break; case Opcode.PushByte: ValueKind = Types.ValueKind.Int; sbyte pushByte = (ins as As3PushByte).Byte; uint byteIndex = cPool.IndexOfInt(pushByte); if (byteIndex == 0) { ValueIndex = cPool.AddIntAtEnd(pushByte); } else { ValueIndex = byteIndex; } break; case Opcode.PushDouble: ValueKind = Types.ValueKind.Double; ValueIndex = (ins as As3PushDouble).DoubleIndex; break; default: throw new Exception(); } }