Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 9 additions & 2 deletions lib/source-map-consumer.js
Original file line number Diff line number Diff line change
Expand Up @@ -1200,9 +1200,16 @@ BasicSourceMapConsumer.prototype.sourceContentFor =
*/
BasicSourceMapConsumer.prototype.generatedPositionFor =
function SourceMapConsumer_generatedPositionFor(aArgs) {
var source = util.getArg(aArgs, 'source');
source = this._findSourceIndex(source);
// Inline the `source` read — same megamorphic-call-site issue that hit
// the line/column reads in PR #72. The hot path is a single property
// access; the "is a required argument" throw is preserved but deferred
// to the slow path: if the lookup fails AND the key is absent, throw.
// Defined values (the hot path) never see the `in` check.
var source = this._findSourceIndex(aArgs.source);
if (source < 0) {
if (!('source' in aArgs)) {
throw new Error('"source" is a required argument.');
}
return {
line: null,
column: null,
Expand Down
Loading