Skip to content

Commit 8770586

Browse files
committed
Remove location information from the runtime as Babel >=6.5.0 does a
search by location and barfs if multiple nodes appearantly occupy the same source locations
1 parent e25e644 commit 8770586

File tree

2 files changed

+14
-2
lines changed

2 files changed

+14
-2
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "fast-async",
3-
"version": "6.0.15",
3+
"version": "6.0.16",
44
"dependencies": {
55
"nodent": "^2.4.0"
66
},

plugin.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,19 @@ module.exports = function (types) {
3636
compiler.asynchronize(pr,undefined,opts,compiler.log) ;
3737

3838
function getRuntime(symbol,fn) {
39-
return compiler.parse(symbol+"="+fn.toString().replace(/[\s]+/g," "),null,opts).ast.body[0] ;
39+
var runtime = symbol+"="+fn.toString().replace(/[\s]+/g," ")+";\n" ;
40+
opts.parser.ranges = false ;
41+
opts.parser.locations = false ;
42+
var ast = compiler.parse(runtime,null,opts).ast.body[0] ;
43+
// Remove location information from the runtime as Babel >=6.5.0 does a search by
44+
// location and barfs if multiple nodes appearantly occupy the same source locations
45+
ast = JSON.parse(JSON.stringify(ast,function replacer(key, value) {
46+
if (key==="start" || key==="end")
47+
return undefined;
48+
return value;
49+
})) ;
50+
51+
return ast ;
4052
}
4153
pr.ast.body.unshift(getRuntime('Function.prototype.$asyncbind',Function.prototype.$asyncbind)) ;
4254
}

0 commit comments

Comments
 (0)