Skip to content

Commit

Permalink
changed check-expect so it emits location doms to the printer.
Browse files Browse the repository at this point in the history
  • Loading branch information
Danny Yoo committed Aug 3, 2010
1 parent a92ebaa commit 8cde306
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 4 deletions.
34 changes: 31 additions & 3 deletions src/compiler/mzscheme-vm/servlet-htdocs/evaluator.js
Expand Up @@ -51,6 +51,31 @@ var Evaluator = (function() {

var DEFAULT_COMPILATION_SERVLET_URL = "/servlets/standalone.ss";

var rewriteLocationDom = function(dom) {
var newDom = document.createElement("span");
var children = dom.children;
var line, column, id;
for (var i = 0; i < children.length; i++) {
if (children[i]['class'] === 'location-id') {
id = children[i].textContent;
}
if (children[i]['class'] === 'location-offset') {
// ignore for now
}
if (children[i]['class'] === 'location-line') {
line = children[i].textContent;
}
if (children[i]['class'] === 'location-column') {
column = children[i].textContent;
}
if (children[i]['class'] === 'location-span') {
// ignore for now
}
}
newDom.appendChild(document.createTextNode('at line: ' + line + ', column: ' + column + ', in ' + id));
return newDom;
};


var Evaluator = function(options) {
var that = this;
Expand Down Expand Up @@ -80,14 +105,17 @@ var Evaluator = (function() {

this.aState.setPrintHook(function(thing) {
var dom = types.toDomNode(thing);
that.write(dom);
if (helpers.isLocationDom(dom)) {
dom = rewriteLocationDom(dom);
}
that.write(dom);
helpers.maybeCallAfterAttach(dom);
});

this.aState.setDisplayHook(function(thing) {
this.aState.setDisplayHook(function(aStr) {
var dom = document.createElement("span");
dom.style["white-space"] = "pre";
var node = document.createTextNode(thing);
var node = document.createTextNode(aStr);
dom.appendChild(node);
that.write(dom);
helpers.maybeCallAfterAttach(dom);
Expand Down
2 changes: 1 addition & 1 deletion support/externals/mzscheme-vm
Submodule mzscheme-vm updated 4 files
+482 −0 lib/json2.js
+1 −0 lib/order
+39 −5 lib/primitive.js
+4 −4 lib/world/world.js

0 comments on commit 8cde306

Please sign in to comment.