From 52aa528db40cbdeada068ba042abfbb1f223ca04 Mon Sep 17 00:00:00 2001 From: yann300 Date: Thu, 8 Dec 2016 16:03:12 +0100 Subject: [PATCH] fix find scope in internalcalltree --- src/util/internalCallTree.js | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/util/internalCallTree.js b/src/util/internalCallTree.js index 5876415160..ea8446d903 100644 --- a/src/util/internalCallTree.js +++ b/src/util/internalCallTree.js @@ -32,13 +32,15 @@ class InternalCallTree { findScope (vmtraceIndex) { var scopeId = util.findLowerBoundValue(vmtraceIndex, Object.keys(this.scopeStarts)) - var scopes = this.scopes[scopeId] - var reg = /(.\d)$/ - while (scopes.lastStep < vmtraceIndex) { - scopeId = scopeId.match(reg) - scopes = this.scopes[scopeId[1]] + scopeId = this.scopeStarts[scopeId] + var scope = this.scopes[scopeId] + var reg = /(.\d|\d)$/ + while (scope.lastStep && scope.lastStep < vmtraceIndex) { + var matched = scopeId.match(reg) + scopeId = scopeId.replace(matched[1], '') + scope = this.scopes[scopeId] } - return scopes + return scope } }