I modified the function insertErrorIR in ast-to-ir.js like this:
/** Throw an error object containing an error message */ function insertErrorIR(context, errorName, errorMsg) { // Find the error contructor var errorCtor = undefined; //FIXME: was just: var errorCtor; print("insertErrorIR errorName="+String(errorName)); //FIXME switch (errorName) { case 'RangeError': errorCtor = insertCtxReadIR(context, ['rangeerror']); break; case 'ReferenceError': errorCtor = insertCtxReadIR(context, ['referror']); break; case 'SyntaxError': errorCtor = insertCtxReadIR(context, ['syntaxerror']); break; case 'TypeError': errorCtor = insertCtxReadIR(context, ['typeerror']); break; case 'URIError': errorCtor = insertCtxReadIR(context, ['urierror']); break; } print("errorCtor="+String(errorCtor)); //FIXME assert ( errorCtor !== undefined, 'error constructor not found for: "' + errorName + '"' );
// Create a new context from which to throw the exception var throwCtx = context.pursue(null);
// Insert a call to the error constructor var excVal = insertPrimCallIR( throwCtx, 'makeError', [ errorCtor, ConstValue.getConst(errorMsg) ] );
// Throw the error created throwToIR(context, throwCtx, excVal); }
and now get a little further in the bootstrap:
Generating IR for: "object layout source" Generating IR for: "FFI wrapper source" Generating IR for: "runtime/utility.js" Generating IR for: "runtime/primitives.js" insertCondErrorIR errorName=TypeError insertErrorIR errorName=TypeError errorCtor=box $t_35 = load_box $t_33, $t_34 insertCondErrorIR errorName=TypeError insertErrorIR errorName=TypeError errorCtor=box $t_14 = load_box $t_12, $t_13 insertCondErrorIR errorName=TypeError insertErrorIR errorName=TypeError errorCtor=box $t_27 = load_box $t_25, $t_26 Generating IR for: "runtime/strings.js" Generating IR for: "runtime/ffi.js" Generating IR for: "runtime/rtinit.js" Performing IR lowering for: "object layout source" Performing IR lowering for: "FFI wrapper source" Performing IR lowering for: "runtime/utility.js" Performing IR lowering for: "runtime/primitives.js" Performing IR lowering for: "runtime/strings.js" Performing IR lowering for: "runtime/ffi.js" Performing IR lowering for: "runtime/rtinit.js" Generating machine code for: "object layout source" *** RUN-TIME ERROR *** SplitError: position '11' happens at the beginning of the interval
So it seems that my changes have removed the bug "error constructor not found for: "TypeError"" but it is not clear why...
I guess the next problem can wait until the first two are fixed...
Marc
Afficher les réponses par date