Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

continuation.js

Package Overview
Dependencies
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

continuation.js - npm Package Compare versions

Comparing version 0.0.4 to 0.0.5

15

package.json
{
"name": "continuation.js",
"description": "Continuation support for Node.js",
"version": "0.0.4",
"version": "0.0.5",
"author": "Daishi Kato <daishi@axlight.com>",

@@ -13,3 +13,5 @@ "dependencies": {

"mocha": "*",
"jshint": "*"
"jshint": "*",
"benchmark": "*",
"benmkzoo": "*"
},

@@ -22,7 +24,8 @@ "repository": {

"continuation",
"CPS",
"cps",
"tail calls",
"TCO",
"compile",
"AST"
"tco",
"compiler",
"ast",
"require"
],

@@ -29,0 +32,0 @@ "bin": {

8

README.md

@@ -6,3 +6,3 @@ continuation.js

* It converts JavaScript code into Continuation Passing Style (CPS) code in a best effort manner.
* It transforms JavaScript code into Continuation Passing Style (CPS) code in a best effort manner.
* No new syntax or keyword is required.

@@ -50,2 +50,4 @@ * Fallback mechanism works when CPS is not possible or not implemented.

which transforms all following .js files by `require`.
How it works

@@ -73,3 +75,3 @@ ------------

* Work with try...catch, throw.
* Work with try...catch and throw.
* Better documents.

@@ -79,3 +81,3 @@ * Transform non-tail calls into CPS.

* Avoid duplicating function declarations.
* Less ugly code.
* Support for current continuations (feasible?)

@@ -48,10 +48,16 @@ /*

root.unshift = function(lst, itm) {
root.unshift = function(lst, itm, force) {
if (Array.isArray(itm)) {
for (var i = itm.length - 1; i >= 0; i--) {
lst.unshift(itm[i]);
}
itm = itm.reverse();
} else {
lst.unshift(itm);
itm = [itm];
}
if (!force) {
while (lst.length > 0 && lst[0].type === 'FunctionDeclaration') {
itm.push(lst.shift());
}
}
for (var i = 0; i < itm.length; i++) {
lst.unshift(itm[i]);
}
};

@@ -85,8 +91,5 @@

}
var code = root.parse("function ignore() { var " + l_varname + " = arguments.length - 1;" + thisCopy + argsCopy + "}");
var code = root.parse("var " + l_varname + " = arguments.length - 1;" + thisCopy + argsCopy);
assert.equal(code.type, 'Program');
assert.equal(code.body.length, 1);
assert.equal(code.body[0].type, 'FunctionDeclaration');
assert.equal(code.body[0].body.type, 'BlockStatement');
return code.body[0].body.body;
return code.body;
};

@@ -108,8 +111,5 @@

}
var code = root.parse("function ignore() { var " + k_varname + " = arguments[" + l_varname + "]; if (" + k_varname + " instanceof CpsContinuation) { " + argsPop + fixParams + "}}");
var code = root.parse("var " + k_varname + " = arguments[" + l_varname + "]; if (" + k_varname + " instanceof CpsContinuation) { " + argsPop + fixParams + "}");
assert.equal(code.type, 'Program');
assert.equal(code.body.length, 1);
assert.equal(code.body[0].type, 'FunctionDeclaration');
assert.equal(code.body[0].body.type, 'BlockStatement');
return code.body[0].body.body;
return code.body;
};

@@ -200,5 +200,14 @@

var newbody = root.deep_clone(body.body);
root.convert_function_call_to_new_cps_call(exclude_ids, body.body);
root.convert_function_call_to_new_cps_call(body.body, exclude_ids);
var success = root.convert_normal_body_to_cps_body(k_varname, exclude_ids, newbody);
if (success) {
var index = 0;
while (newbody.length > 0) {
if (newbody[0].type === 'FunctionDeclaration') {
newbody.shift();
index++;
} else {
break;
}
}
var wrapper = root.ast_func_wrapper(k_varname, l_varname, using_arguments && a_varname, params);

@@ -222,3 +231,3 @@ assert.ok(wrapper[1].consequent.body.length >= 0);

root.convert_function_call_to_new_cps_call = function(exclude_ids, body) {
root.convert_function_call_to_new_cps_call = function(body, exclude_ids) {
var has_side_effect = function(node) {

@@ -552,3 +561,3 @@ if (node && node.type === 'CallExpression') {

});
root.unshift(ast.body, root.ast_prog_header());
root.unshift(ast.body, root.ast_prog_header(), true);
return ast;

@@ -555,0 +564,0 @@ };

Sorry, the diff of this file is too big to display

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc