-
Notifications
You must be signed in to change notification settings - Fork 119
add support to eval code and solve file:// url bug #220
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -161,6 +161,7 @@ export class SourceMap { | |
* Will return null instead of a mapping on the next line (different from generatedPositionFor). | ||
*/ | ||
public authoredPositionFor(line: number, column: number): MappedPosition { | ||
if (global['evalSources'] && global['evalSources'].find(s => this._generatedPath == s) && line > 0) line--; // check if eval code | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do you need to adjust the line differently based on whether it's an eval script or not? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think when code is an eval script, then |
||
// source-map lib uses 1-indexed lines. | ||
line++; | ||
|
||
|
@@ -223,7 +224,7 @@ export class SourceMap { | |
return null; | ||
} else { | ||
return { | ||
line: position.line - 1, // Back to 0-indexed lines | ||
line: global["evalSources"] && global["evalSources"].find(s => s == this._generatedPath) ? position.line : position.line - 1, // check if eval code else Back to 0-indexed lines | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same here - the 0-indexed or 1-indexed lines are a property of the source-map lib, it doesn't matter whether the code originated as an eval script or not. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same as previous answer. I think either generated and authored code relay on |
||
column: position.column, | ||
source: this._generatedPath | ||
}; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't use
global
, try to find another way to share this list between modules.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I tried import/export without success. Do you have another idea ?