debugger: style

pull/22966/head
Ryan Dahl 2010-12-30 10:32:41 -08:00
parent 9244a64b59
commit 109f845e49
1 changed files with 5 additions and 9 deletions

View File

@ -357,17 +357,15 @@ Client.prototype.step = function(action, count, cb) {
var helpMessage = "Commands: run, print, step, next, continue, scripts, backtrace, version, quit";
function SourceUnderline(source_text, position) {
if (!source_text) {
return;
}
function SourceUnderline(sourceText, position) {
if (!sourceText) return;
// Create an underline with a caret pointing to the source position. If the
// source contains a tab character the underline will have a tab character in
// the same place otherwise the underline will have a space character.
var underline = '';
for (var i = 0; i < position; i++) {
if (source_text[i] == '\t') {
if (sourceText[i] == '\t') {
underline += '\t';
} else {
underline += ' ';
@ -376,7 +374,7 @@ function SourceUnderline(source_text, position) {
underline += '^';
// Return the source line text with the underline beneath.
return source_text + '\n' + underline;
return sourceText + '\n' + underline;
}
function SourceInfo(body) {
@ -389,10 +387,8 @@ function SourceInfo(body) {
result += '[unnamed]';
}
}
result += ' line ';
result += ':';
result += body.sourceLine + 1;
result += ' column ';
result += body.sourceColumn + 1;
return result;
}