Esempio n. 1
0
        void BeginCatch(ISehHandlerBlock block, AbcCode code, AbcExceptionHandler e, ref int var, bool dupException, bool catchAnyException)
        {
            var beginIndex = code.Count;

            var catchInfo = new CatchInfo
            {
                CatchAnyException = catchAnyException
            };
            bool coerceAny = catchAnyException;

            if (var < 0 || catchAnyException)
            {
                coerceAny           = true;
                var                 = SharedExceptionVar;
                catchInfo.IsTempVar = true;
            }
            catchInfo.ExceptionVar = var;
            e.LocalVariable        = var;

            var handlerInfo = block.Tag as SehHandlerInfo;

            if (handlerInfo == null)
            {
                handlerInfo = new SehHandlerInfo {
                    CatchInfo = catchInfo
                };
                block.Tag = handlerInfo;
            }
            else
            {
                handlerInfo.CatchInfo = catchInfo;
            }

            //NOTE: we store exception in temp variable to use for rethrow operation
            if (dupException && !catchAnyException)
            {
                code.Dup();
            }

            if (coerceAny)
            {
                code.CoerceAnyType();
            }

            //store exception in variable to use for rethrow operation
            code.SetLocal(var);

            _resolver.Add(code[beginIndex], new ExceptionTarget(e));
        }
Esempio n. 2
0
 void KillExceptionVariable(AbcCode code, CatchInfo ci)
 {
     if (!ci.IsVarKilled)
     {
         ci.IsVarKilled = true;
         if (ci.IsTempVar)
         {
             code.Add(KillTempVarCore(ci.ExceptionVar));
         }
         else
         {
             //NOTE: Fix to avoid VerifyError when types can not be reconciled.
             //code.PushUndefined();
             //code.SetLocal(ci.ExceptionVar);
             //code.Add(InstructionCode.Kill, ci.varExc);
         }
     }
 }