Beispiel #1
0
        public bool MoveNext()
        {
            if (pc == -1)
            {
                return(false);
            }

            pc = runner.RunBlock(block, vf, pc);

            // -1 means EndOfMethod
            return(pc == -1 ? false : true);
        }
Beispiel #2
0
        public bool RunCatch(Exception e)
        {
            foreach (var c in TryNode.Catches)
            {
                var type = $"{c.Declaration.Type}";
                var rt   = Runner.Resolver.GetType(type);

                if (rt == null)
                {
                    continue;
                }
                if (e.GetType().IsSubclassOf(rt))
                {
                    var vf = new VarFrame(Runner.Vars);
                    vf.SetValue($"{c.Declaration.Identifier}", HybInstance.Object(e));
                    Runner.RunBlock(c.Block, vf);
                    return(true);
                }
            }

            return(false);
        }