fix: java file lineNumer lose

Signed-off-by: MiaoWoo <admin@yumc.pw>
This commit is contained in:
MiaoWoo 2020-12-17 16:59:06 +08:00
parent f35c8cd3fb
commit 6617171472

View File

@ -91,7 +91,7 @@ export class MiaoScriptConsole implements Console {
ex(ex: Error) { ex(ex: Error) {
this.stack(ex).forEach(line => this.console(line)) this.stack(ex).forEach(line => this.console(line))
} }
readSourceMap(fileName: string, lineNumber: number) { readSourceMap(fileName: string, lineNumber: any) {
try { try {
if (fileName.endsWith('js')) { if (fileName.endsWith('js')) {
if (MiaoScriptConsole.sourceMaps[fileName] === undefined) { if (MiaoScriptConsole.sourceMaps[fileName] === undefined) {
@ -154,9 +154,10 @@ export class MiaoScriptConsole implements Console {
} else { } else {
let className = trace.className let className = trace.className
var fileName = trace.fileName as string var fileName = trace.fileName as string
var lineNumber = trace.lineNumber
if (className.startsWith('jdk.nashorn.internal.scripts')) { if (className.startsWith('jdk.nashorn.internal.scripts')) {
className = className.substr(className.lastIndexOf('$') + 1) className = className.substr(className.lastIndexOf('$') + 1)
var { fileName, lineNumber } = this.readSourceMap(trace.fileName, trace.lineNumber) var { fileName, lineNumber } = this.readSourceMap(fileName, lineNumber)
if (fileName.startsWith(root)) { fileName = fileName.split(root)[1] } if (fileName.startsWith(root)) { fileName = fileName.split(root)[1] }
} else { } else {
if (!global.debug) { if (!global.debug) {