trying to get propExnSrcloc to do something
This commit is contained in:
parent
2351c6d80e
commit
13c385bd8b
|
@ -597,7 +597,7 @@ var invokeMainModule = function() {
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
function(M, e) {
|
function(M, e) {
|
||||||
var contMarkSet, context, i, appName;
|
var contMarkSet, context, i, appName, contextDiv;
|
||||||
// On main module invokation failure
|
// On main module invokation failure
|
||||||
if (window.console && window.console.log) {
|
if (window.console && window.console.log) {
|
||||||
window.console.log(e.stack || e);
|
window.console.log(e.stack || e);
|
||||||
|
@ -609,30 +609,39 @@ var invokeMainModule = function() {
|
||||||
if (e.hasOwnProperty('racketError') &&
|
if (e.hasOwnProperty('racketError') &&
|
||||||
plt.baselib.exceptions.isExn(e.racketError)) {
|
plt.baselib.exceptions.isExn(e.racketError)) {
|
||||||
contMarkSet = plt.baselib.exceptions.exnContMarks(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) {
|
if (contMarkSet) {
|
||||||
context = contMarkSet.getContext(M);
|
context = contMarkSet.getContext(M);
|
||||||
for (i = 0; i < context.length; i++) {
|
for (i = 0; i < context.length; i++) {
|
||||||
if (plt.runtime.isVector(context[i])) {
|
if (plt.runtime.isVector(context[i])) {
|
||||||
M.params.currentErrorDisplayer(
|
$('<div/>').text('at ' + context[i].elts[0] +
|
||||||
M,
|
|
||||||
$('<div/>').text(' at ' + context[i].elts[0] +
|
|
||||||
', line ' + context[i].elts[2] +
|
', line ' + context[i].elts[2] +
|
||||||
', column ' + context[i].elts[3])
|
', column ' + context[i].elts[3])
|
||||||
.addClass('stacktrace')
|
.addClass('stacktrace')
|
||||||
.css('margin-left', '10px')
|
.css('margin-left', '10px')
|
||||||
.css('whitespace', 'pre')
|
.css('whitespace', 'pre')
|
||||||
.css('color', 'red'));
|
.css('color', 'red')
|
||||||
|
.appendTo(contextDiv);
|
||||||
} else if (plt.runtime.isProcedure(context[i])) {
|
} else if (plt.runtime.isProcedure(context[i])) {
|
||||||
M.params.currentErrorDisplayer(
|
$('<div/>').text('in ' + context[i].displayName)
|
||||||
M,
|
|
||||||
$('<div/>').text(' in ' + context[i].displayName)
|
|
||||||
.addClass('stacktrace')
|
.addClass('stacktrace')
|
||||||
.css('margin-left', '10px')
|
.css('margin-left', '10px')
|
||||||
.css('whitespace', 'pre')
|
.css('whitespace', 'pre')
|
||||||
.css('color', 'red'));
|
.css('color', 'red')
|
||||||
|
.appendTo(contextDiv);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
M.params.currentErrorDisplayer(M, contextDiv);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
|
|
|
@ -2088,7 +2088,7 @@
|
||||||
|
|
||||||
installPrimitiveConstant(
|
installPrimitiveConstant(
|
||||||
'prop:exn:srclocs',
|
'prop:exn:srclocs',
|
||||||
"fixme");
|
baselib.structs.propExnSrcloc);
|
||||||
|
|
||||||
|
|
||||||
installPrimitiveProcedure(
|
installPrimitiveProcedure(
|
||||||
|
|
|
@ -9,9 +9,10 @@
|
||||||
|
|
||||||
//////////////////////////////////////////////////////////////////////
|
//////////////////////////////////////////////////////////////////////
|
||||||
|
|
||||||
var Struct = function (constructorName, fields) {
|
var Struct = function (constructorName, fields, structType) {
|
||||||
this._constructorName = constructorName;
|
this._constructorName = constructorName;
|
||||||
this._fields = [];
|
this._fields = [];
|
||||||
|
this.structType = structType;
|
||||||
};
|
};
|
||||||
|
|
||||||
Struct.prototype.toWrittenString = function (cache) {
|
Struct.prototype.toWrittenString = function (cache) {
|
||||||
|
@ -147,9 +148,9 @@
|
||||||
|
|
||||||
// RawConstructor creates a new struct type inheriting from
|
// RawConstructor creates a new struct type inheriting from
|
||||||
// the parent, with no guard checks.
|
// the parent, with no guard checks.
|
||||||
var RawConstructor = function (name, args) {
|
var RawConstructor = function (name, args, structType) {
|
||||||
var i;
|
var i;
|
||||||
parentType.type.call(this, name, args);
|
parentType.type.call(this, name, args, structType);
|
||||||
for (i = 0; i < initFieldCnt; i++) {
|
for (i = 0; i < initFieldCnt; i++) {
|
||||||
this._fields.push(args[i+parentType.numberOfArgs]);
|
this._fields.push(args[i+parentType.numberOfArgs]);
|
||||||
}
|
}
|
||||||
|
@ -192,7 +193,7 @@
|
||||||
args,
|
args,
|
||||||
baselib.symbols.Symbol.makeInstance(theName),
|
baselib.symbols.Symbol.makeInstance(theName),
|
||||||
function (res) {
|
function (res) {
|
||||||
return new RawConstructor(theName, res); });
|
return new RawConstructor(theName, res, newType); });
|
||||||
},
|
},
|
||||||
|
|
||||||
// predicate
|
// predicate
|
||||||
|
|
|
@ -19,6 +19,7 @@
|
||||||
|
|
||||||
(define: (g [x : Number$]) -> String$ "x")
|
(define: (g [x : Number$]) -> String$ "x")
|
||||||
(check-expect (g 10) "x")
|
(check-expect (g 10) "x")
|
||||||
|
(g "x")
|
||||||
#;(check-error (g "x"))
|
#;(check-error (g "x"))
|
||||||
#;(check-violation-highlights
|
#;(check-violation-highlights
|
||||||
(g "x")
|
(g "x")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user