trying to get propExnSrcloc to do something

This commit is contained in:
Danny Yoo 2011-10-03 18:21:01 -04:00
parent 2351c6d80e
commit 13c385bd8b
4 changed files with 25 additions and 14 deletions

View File

@ -597,7 +597,7 @@ var invokeMainModule = function() {
}
},
function(M, e) {
var contMarkSet, context, i, appName;
var contMarkSet, context, i, appName, contextDiv;
// On main module invokation failure
if (window.console && window.console.log) {
window.console.log(e.stack || e);
@ -609,30 +609,39 @@ var invokeMainModule = function() {
if (e.hasOwnProperty('racketError') &&
plt.baselib.exceptions.isExn(e.racketError)) {
contMarkSet = plt.baselib.exceptions.exnContMarks(e.racketError);
contextDiv = $('<div/>');
if (e.racketError.structType &&
plt.baselib.structs.supportsStructureTypeProperty(
e.racketError.structType,
plt.baselib.structs.propExnSrcloc)) {
}
if (contMarkSet) {
context = contMarkSet.getContext(M);
for (i = 0; i < context.length; i++) {
if (plt.runtime.isVector(context[i])) {
M.params.currentErrorDisplayer(
M,
$('<div/>').text(' at ' + context[i].elts[0] +
$('<div/>').text('at ' + context[i].elts[0] +
', line ' + context[i].elts[2] +
', column ' + context[i].elts[3])
.addClass('stacktrace')
.css('margin-left', '10px')
.css('whitespace', 'pre')
.css('color', 'red'));
.css('color', 'red')
.appendTo(contextDiv);
} else if (plt.runtime.isProcedure(context[i])) {
M.params.currentErrorDisplayer(
M,
$('<div/>').text(' in ' + context[i].displayName)
$('<div/>').text('in ' + context[i].displayName)
.addClass('stacktrace')
.css('margin-left', '10px')
.css('whitespace', 'pre')
.css('color', 'red'));
.css('color', 'red')
.appendTo(contextDiv);
}
}
}
M.params.currentErrorDisplayer(M, contextDiv);
}
});
};

View File

@ -2088,7 +2088,7 @@
installPrimitiveConstant(
'prop:exn:srclocs',
"fixme");
baselib.structs.propExnSrcloc);
installPrimitiveProcedure(

View File

@ -9,9 +9,10 @@
//////////////////////////////////////////////////////////////////////
var Struct = function (constructorName, fields) {
var Struct = function (constructorName, fields, structType) {
this._constructorName = constructorName;
this._fields = [];
this.structType = structType;
};
Struct.prototype.toWrittenString = function (cache) {
@ -147,9 +148,9 @@
// RawConstructor creates a new struct type inheriting from
// the parent, with no guard checks.
var RawConstructor = function (name, args) {
var RawConstructor = function (name, args, structType) {
var i;
parentType.type.call(this, name, args);
parentType.type.call(this, name, args, structType);
for (i = 0; i < initFieldCnt; i++) {
this._fields.push(args[i+parentType.numberOfArgs]);
}
@ -192,7 +193,7 @@
args,
baselib.symbols.Symbol.makeInstance(theName),
function (res) {
return new RawConstructor(theName, res); });
return new RawConstructor(theName, res, newType); });
},
// predicate

View File

@ -19,6 +19,7 @@
(define: (g [x : Number$]) -> String$ "x")
(check-expect (g 10) "x")
(g "x")
#;(check-error (g "x"))
#;(check-violation-highlights
(g "x")