continuation.js
Advanced tools
Comparing version 0.0.5 to 0.0.6
{ | ||
"name": "continuation.js", | ||
"description": "Continuation support for Node.js", | ||
"version": "0.0.5", | ||
"version": "0.0.6", | ||
"author": "Daishi Kato <daishi@axlight.com>", | ||
@@ -33,3 +33,3 @@ "dependencies": { | ||
}, | ||
"main": "./lib/continuation", | ||
"main": "./lib/continuation.js", | ||
"license": "BSD", | ||
@@ -36,0 +36,0 @@ "engines": { |
@@ -77,4 +77,3 @@ continuation.js | ||
* More tests. | ||
* Avoid duplicating function declarations. | ||
* Support for current continuations (feasible?) | ||
@@ -200,7 +200,5 @@ /* | ||
if (success) { | ||
var index = 0; | ||
while (newbody.length > 0) { | ||
if (newbody[0].type === 'FunctionDeclaration') { | ||
newbody.shift(); | ||
index++; | ||
} else { | ||
@@ -230,9 +228,11 @@ break; | ||
var has_side_effect = function(node) { | ||
if (node && node.type === 'CallExpression') { | ||
if (!node) { | ||
return false; | ||
} else if (node.type === 'CallExpression') { | ||
return true; | ||
} else if (node && node.type === 'UpdateExpression') { | ||
} else if (node.type === 'UpdateExpression') { | ||
return true; | ||
} else if (node && node.type === 'AssignmentExpression') { | ||
} else if (node.type === 'AssignmentExpression') { | ||
return true; | ||
} else if (node && node.type === 'NewExpression') { | ||
} else if (node.type === 'NewExpression') { | ||
return true; | ||
@@ -245,6 +245,19 @@ } else if (node instanceof Object) { | ||
}; | ||
var is_transformable_call = function(node) { | ||
if (!node.callee) { | ||
return false; | ||
} else if (has_side_effect(node.callee)) { | ||
return false; | ||
} else if (node.callee.type === 'Identifier' && node.callee.name === 'CpsEnableWrapper') { | ||
return false; | ||
} else if (node.callee.type === 'MembershipExpression' && node.callee.property.type === 'Identifier' && node.callee.property.name === 'apply') { | ||
return false; | ||
} else { | ||
return true; | ||
} | ||
}; | ||
var walk = function(node) { | ||
if (node && (node.type === 'FunctionDeclaration' || node.type === 'FunctionExpression')) { | ||
return; | ||
} else if (node && node.type === 'CallExpression' && node.callee && !has_side_effect(node.callee) && !(node.callee.type === 'Identifier' && node.callee.name === 'CpsEnableWrapper')) { | ||
} else if (node && node.type === 'CallExpression' && is_transformable_call(node)) { | ||
var kk_varname = root.generate_new_variable_name('kk', exclude_ids); | ||
@@ -251,0 +264,0 @@ var cpsnode = root.deep_clone(node); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is too big to display
118908
2553
79