Skip to content

Commit

Permalink
Address comments in code review
Browse files Browse the repository at this point in the history
  • Loading branch information
hildjj committed May 10, 2018
1 parent 1ea5ee3 commit 14de5f8
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
8 changes: 4 additions & 4 deletions dist/source-map.js
Expand Up @@ -1461,7 +1461,8 @@ const INTERNAL = Symbol("smcInternal");
class SourceMapConsumer {
constructor(aSourceMap, aSourceMapURL) {
// If the constructor was called by super(), just return Promise<this>.
// Yes, this is a hack to retain the pre-existing API.
// Yes, this is a hack to retain the pre-existing API of the base-class
// constructor also being an async factory function.
if (aSourceMap == INTERNAL) {
return Promise.resolve(this);
}
Expand Down Expand Up @@ -2686,11 +2687,10 @@ function _factory(aSourceMap, aSourceMapURL) {
sourceMap = util.parseSourceMapInput(aSourceMap);
}

return Promise.resolve().then(_ => {
return sourceMap.sections != null
const consumer = sourceMap.sections != null
? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
: new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
});
return Promise.resolve(consumer);
}

function _factoryBSM(aSourceMap, aSourceMapURL) {
Expand Down
8 changes: 4 additions & 4 deletions lib/source-map-consumer.js
Expand Up @@ -17,7 +17,8 @@ const INTERNAL = Symbol("smcInternal");
class SourceMapConsumer {
constructor(aSourceMap, aSourceMapURL) {
// If the constructor was called by super(), just return Promise<this>.
// Yes, this is a hack to retain the pre-existing API.
// Yes, this is a hack to retain the pre-existing API of the base-class
// constructor also being an async factory function.
if (aSourceMap == INTERNAL) {
return Promise.resolve(this);
}
Expand Down Expand Up @@ -1242,11 +1243,10 @@ function _factory(aSourceMap, aSourceMapURL) {
sourceMap = util.parseSourceMapInput(aSourceMap);
}

return Promise.resolve().then(_ => {
return sourceMap.sections != null
const consumer = sourceMap.sections != null
? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
: new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
});
return Promise.resolve(consumer);
}

function _factoryBSM(aSourceMap, aSourceMapURL) {
Expand Down

0 comments on commit 14de5f8

Please sign in to comment.