Fix frame name for anonymous functions

This commit is contained in:
Rob Lourens 2015-10-22 14:31:41 -07:00
Родитель cf9c2b1c4e
Коммит 5e4dd20b68
2 изменённых файлов: 13 добавлений и 4 удалений

Просмотреть файл

@ -5,9 +5,13 @@ function locals() {
var arr2 = new Array();
arr2.push('array element');
arr2.forEach(x => {
console.log(x);
});
var buffer = new ArrayBuffer(8);
var buffView = new Int32Array(buffer);
buffView[0] = 234;
var s = Symbol('hi');
var bool = true;
var fn = function() {

Просмотреть файл

@ -336,22 +336,27 @@ export class WebKitDebugAdapter implements IDebugAdapter {
// Both? Name?
let source: DebugProtocol.Source;
let sourceName: string;
if (path) {
sourceName = Path.basename(path);
source = {
name: Path.basename(path),
name: sourceName,
path
};
} else {
sourceName = script.url;
source = {
name: script.url,
name: sourceName,
sourceReference: scriptIdToSourceReference(script.scriptId)
};
}
// If the frame doesn't have a function name, it's either an anonymous function
// or eval script. If its source has a name, it's probably an anonymous function.
const frameName = callFrame.functionName || (sourceName ? '(anonymous function)' : '(eval code)');
return {
id: i,
name: callFrame.functionName || '(eval code)', // anything else?
name: frameName,
source,
line: line,
column