MCPcopy Create free account
hub / github.com/ZDoom/Raze / catch

Function catch

source/common/scripting/vm/vmexec.h:1954–2007  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1952 }
1953#if 0
1954 catch(VMException *exception)
1955 {
1956 // Try to find a handler for the exception.
1957 PClass *extype = exception->GetClass();
1958
1959 while(--try_depth >= 0)
1960 {
1961 pc = exception_frames[try_depth];
1962 assert(pc->op == OP_CATCH);
1963 while (pc->a > 1)
1964 {
1965 // CATCH must be followed by JMP if it doesn't terminate a catch chain.
1966 assert(pc[1].op == OP_JMP);
1967
1968 PClass *type;
1969 int b = pc->b;
1970
1971 if (pc->a == 2)
1972 {
1973 ASSERTA(b);
1974 type = (PClass *)reg.a[b];
1975 }
1976 else
1977 {
1978 assert(pc->a == 3);
1979 ASSERTKA(b);
1980 type = (PClass *)konsta[b].o;
1981 }
1982 ASSERTA(pc->c);
1983 if (type == extype)
1984 {
1985 // Found a handler. Store the exception in pC, skip the JMP,
1986 // and begin executing its code.
1987 reg.a[pc->c] = exception;
1988 pc += 2;
1989 goto begin;
1990 }
1991 // This catch didn't handle it. Try the next one.
1992 pc += 1 + JMPOFS(pc + 1);
1993 assert(pc->op == OP_CATCH);
1994 }
1995 if (pc->a == 1)
1996 {
1997 // Catch any type of VMException. This terminates the chain.
1998 ASSERTA(pc->c);
1999 reg.a[pc->c] = exception;
2000 pc += 1;
2001 goto begin;
2002 }
2003 // This frame failed. Try the next one out.
2004 }
2005 // Nothing caught it. Rethrow and let somebody else deal with it.
2006 throw;
2007 }
2008#endif
2009 catch (CVMAbortException &err)
2010 {

Callers

nothing calls this directly

Calls 5

GetClassMethod · 0.80
MaybePrintMessageMethod · 0.80
AppendFormatMethod · 0.80
PCToLineMethod · 0.80
GetCharsMethod · 0.45

Tested by

no test coverage detected