Skip to content

Commit

Permalink
fixed missing __future in generated code
Browse files Browse the repository at this point in the history
  • Loading branch information
bjouhier committed Aug 16, 2011
1 parent dcff84f commit 4b5392a
Show file tree
Hide file tree
Showing 14 changed files with 14 additions and 9 deletions.
1 change: 1 addition & 0 deletions examples/diskUsage/diskUsage.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
var __global = typeof global !== 'undefined' ? global : window;var __srcName='./examples/diskUsage/diskUsage_.js';
function __func(_, __this, __arguments, fn, index, frame, body) { if (!_) { return __future.call(__this, fn, __arguments, index); } frame.file = __srcName; frame.prev = __global.__frame; __global.__frame = frame; try { body(); } catch (e) { e.__frame = e.__frame || frame.prev; __propagate(_, e); } finally { __global.__frame = __frame.prev; } }
function __cb(_, frame, offset, col, fn){ var ctx = __global.__context; frame.offset = offset; frame.col = col; return function ___(err, result){ var oldFrame = __global.__frame; __global.__frame = frame; __global.__context = ctx; try { if (err) { err.__frame = err.__frame || frame; return _(err); } return fn(null, result); } catch (ex) { ex.__frame = ex.__frame || frame; return __propagate(_, ex); } finally { __global.__frame = oldFrame; } } }
function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function ___(e, r){ cb(e, r); }; fn.apply(this, args); return function ___(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); }
function __nt(_, frame, fn){ var i = 0; var cb = __cb(_, frame, 0, 0, fn); var safeCb = function ___(){ try { cb(); } catch (ex) { __propagate(cb, ex); } }; if (typeof process != "undefined" && typeof process.nextTick == "function") return function ___(){ if (++i % 20 == 0) process.nextTick(safeCb); else cb(); }; else return function ___(){ if (++i % 20 == 0) setTimeout(safeCb); else cb(); }; }
function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } }
function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } }
Expand Down
1 change: 1 addition & 0 deletions examples/diskUsage/diskUsage2.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
var __global = typeof global !== 'undefined' ? global : window;var __srcName='./examples/diskUsage/diskUsage2_.js';
function __func(_, __this, __arguments, fn, index, frame, body) { if (!_) { return __future.call(__this, fn, __arguments, index); } frame.file = __srcName; frame.prev = __global.__frame; __global.__frame = frame; try { body(); } catch (e) { e.__frame = e.__frame || frame.prev; __propagate(_, e); } finally { __global.__frame = __frame.prev; } }
function __cb(_, frame, offset, col, fn){ var ctx = __global.__context; frame.offset = offset; frame.col = col; return function ___(err, result){ var oldFrame = __global.__frame; __global.__frame = frame; __global.__context = ctx; try { if (err) { err.__frame = err.__frame || frame; return _(err); } return fn(null, result); } catch (ex) { ex.__frame = ex.__frame || frame; return __propagate(_, ex); } finally { __global.__frame = oldFrame; } } }
function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function ___(e, r){ cb(e, r); }; fn.apply(this, args); return function ___(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); }
function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } }
function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } }
(function __$main(_) {
Expand Down
1 change: 1 addition & 0 deletions examples/streams/googleClient.js
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
var __global = typeof global !== 'undefined' ? global : window;var __srcName='./examples/streams/googleClient_.js';
function __func(_, __this, __arguments, fn, index, frame, body) { if (!_) { return __future.call(__this, fn, __arguments, index); } frame.file = __srcName; frame.prev = __global.__frame; __global.__frame = frame; try { body(); } catch (e) { e.__frame = e.__frame || frame.prev; __propagate(_, e); } finally { __global.__frame = __frame.prev; } }
function __cb(_, frame, offset, col, fn){ var ctx = __global.__context; frame.offset = offset; frame.col = col; return function ___(err, result){ var oldFrame = __global.__frame; __global.__frame = frame; __global.__context = ctx; try { if (err) { err.__frame = err.__frame || frame; return _(err); } return fn(null, result); } catch (ex) { ex.__frame = ex.__frame || frame; return __propagate(_, ex); } finally { __global.__frame = oldFrame; } } }
function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function ___(e, r){ cb(e, r); }; fn.apply(this, args); return function ___(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); }
function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } }
function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } }
(function __$main(_) {
Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/compile.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*** Generated by streamline 0.1.36-stack - DO NOT EDIT ***/ "use strict"; var __global = typeof global !== 'undefined' ? global : window;var __srcName='./lib/compiler/compile_.js'; function __func(_, __this, __arguments, fn, index, frame, body) { if (!_) { return __future.call(__this, fn, __arguments, index); } frame.file = __srcName; frame.prev = __global.__frame; __global.__frame = frame; try { body(); } catch (e) { e.__frame = e.__frame || frame.prev; __propagate(_, e); } finally { __global.__frame = __frame.prev; } } function __cb(_, frame, offset, col, fn){ var ctx = __global.__context; frame.offset = offset; frame.col = col; return function ___(err, result){ var oldFrame = __global.__frame; __global.__frame = frame; __global.__context = ctx; try { if (err) { err.__frame = err.__frame || frame; return _(err); } return fn(null, result); } catch (ex) { ex.__frame = ex.__frame || frame; return __propagate(_, ex); } finally { __global.__frame = oldFrame; } } } function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } function __tryCatch(_, fn){ try { fn(); } catch (e) { try { _(e); } catch (ex) { __trap(ex); } } } var fs = require("fs");
/*** Generated by streamline 0.1.36-stack - DO NOT EDIT ***/ "use strict"; var __global = typeof global !== 'undefined' ? global : window;var __srcName='./lib/compiler/compile_.js'; function __func(_, __this, __arguments, fn, index, frame, body) { if (!_) { return __future.call(__this, fn, __arguments, index); } frame.file = __srcName; frame.prev = __global.__frame; __global.__frame = frame; try { body(); } catch (e) { e.__frame = e.__frame || frame.prev; __propagate(_, e); } finally { __global.__frame = __frame.prev; } } function __cb(_, frame, offset, col, fn){ var ctx = __global.__context; frame.offset = offset; frame.col = col; return function ___(err, result){ var oldFrame = __global.__frame; __global.__frame = frame; __global.__context = ctx; try { if (err) { err.__frame = err.__frame || frame; return _(err); } return fn(null, result); } catch (ex) { ex.__frame = ex.__frame || frame; return __propagate(_, ex); } finally { __global.__frame = oldFrame; } } } function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function ___(e, r){ cb(e, r); }; fn.apply(this, args); return function ___(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } function __tryCatch(_, fn){ try { fn(); } catch (e) { try { _(e); } catch (ex) { __trap(ex); } } } var fs = require("fs");



Expand Down
1 change: 1 addition & 0 deletions lib/compiler/transform.js
Original file line number Diff line number Diff line change
Expand Up @@ -1677,6 +1677,7 @@ else {
strict = strict ? '"use strict";' + sep : "";
used.__propagate = used.__propagate || used.__nt || options.tryCatch !== "fast";
used.__trap = used.__trap || used.__propagate || used.__tryCatch || used.__wrapIn || used.__wrapOut;
used.__future = used.__future || used.__func;
// TODO: reenable strict: need to move hoisted functions before try block
return sep + strict + __global +
("var __srcName='" + options.sourceName + "_.js';") +
Expand Down
2 changes: 1 addition & 1 deletion lib/require/server/depend.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*** Generated by streamline 0.1.36-stack - DO NOT EDIT ***/ "use strict"; var __global = typeof global !== 'undefined' ? global : window;var __srcName='./lib/require/server/depend_.js'; function __func(_, __this, __arguments, fn, index, frame, body) { if (!_) { return __future.call(__this, fn, __arguments, index); } frame.file = __srcName; frame.prev = __global.__frame; __global.__frame = frame; try { body(); } catch (e) { e.__frame = e.__frame || frame.prev; __propagate(_, e); } finally { __global.__frame = __frame.prev; } } function __cb(_, frame, offset, col, fn){ var ctx = __global.__context; frame.offset = offset; frame.col = col; return function ___(err, result){ var oldFrame = __global.__frame; __global.__frame = frame; __global.__context = ctx; try { if (err) { err.__frame = err.__frame || frame; return _(err); } return fn(null, result); } catch (ex) { ex.__frame = ex.__frame || frame; return __propagate(_, ex); } finally { __global.__frame = oldFrame; } } } function __nt(_, frame, fn){ var i = 0; var cb = __cb(_, frame, 0, 0, fn); var safeCb = function ___(){ try { cb(); } catch (ex) { __propagate(cb, ex); } }; if (typeof process != "undefined" && typeof process.nextTick == "function") return function ___(){ if (++i % 20 == 0) process.nextTick(safeCb); else cb(); }; else return function ___(){ if (++i % 20 == 0) setTimeout(safeCb); else cb(); }; } function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } var fs = require("fs");
/*** Generated by streamline 0.1.36-stack - DO NOT EDIT ***/ "use strict"; var __global = typeof global !== 'undefined' ? global : window;var __srcName='./lib/require/server/depend_.js'; function __func(_, __this, __arguments, fn, index, frame, body) { if (!_) { return __future.call(__this, fn, __arguments, index); } frame.file = __srcName; frame.prev = __global.__frame; __global.__frame = frame; try { body(); } catch (e) { e.__frame = e.__frame || frame.prev; __propagate(_, e); } finally { __global.__frame = __frame.prev; } } function __cb(_, frame, offset, col, fn){ var ctx = __global.__context; frame.offset = offset; frame.col = col; return function ___(err, result){ var oldFrame = __global.__frame; __global.__frame = frame; __global.__context = ctx; try { if (err) { err.__frame = err.__frame || frame; return _(err); } return fn(null, result); } catch (ex) { ex.__frame = ex.__frame || frame; return __propagate(_, ex); } finally { __global.__frame = oldFrame; } } } function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function ___(e, r){ cb(e, r); }; fn.apply(this, args); return function ___(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } function __nt(_, frame, fn){ var i = 0; var cb = __cb(_, frame, 0, 0, fn); var safeCb = function ___(){ try { cb(); } catch (ex) { __propagate(cb, ex); } }; if (typeof process != "undefined" && typeof process.nextTick == "function") return function ___(){ if (++i % 20 == 0) process.nextTick(safeCb); else cb(); }; else return function ___(){ if (++i % 20 == 0) setTimeout(safeCb); else cb(); }; } function __propagate(_, err){ try { _(err); } catch (ex) { __trap(ex); } } function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } var fs = require("fs");



Expand Down
2 changes: 1 addition & 1 deletion lib/require/server/require.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*** Generated by streamline 0.1.36-stack - DO NOT EDIT ***/ "use strict"; var __global = typeof global !== 'undefined' ? global : window;var __srcName='./lib/require/server/require_.js'; function __func(_, __this, __arguments, fn, index, frame, body) { if (!_) { return __future.call(__this, fn, __arguments, index); } frame.file = __srcName; frame.prev = __global.__frame; __global.__frame = frame; try { body(); } catch (e) { e.__frame = e.__frame || frame.prev; __propagate(_, e); } finally { __global.__frame = __frame.prev; } } function __cb(_, frame, offset, col, fn){ var ctx = __global.__context; frame.offset = offset; frame.col = col; return function ___(err, result){ var oldFrame = __global.__frame; __global.__frame = frame; __global.__context = ctx; try { if (err) { err.__frame = err.__frame || frame; return _(err); } return fn(null, result); } catch (ex) { ex.__frame = ex.__frame || frame; return __propagate(_, ex); } finally { __global.__frame = oldFrame; } } } function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } function __tryCatch(_, fn){ try { fn(); } catch (e) { try { _(e); } catch (ex) { __trap(ex); } } } var fs = require("fs");
/*** Generated by streamline 0.1.36-stack - DO NOT EDIT ***/ "use strict"; var __global = typeof global !== 'undefined' ? global : window;var __srcName='./lib/require/server/require_.js'; function __func(_, __this, __arguments, fn, index, frame, body) { if (!_) { return __future.call(__this, fn, __arguments, index); } frame.file = __srcName; frame.prev = __global.__frame; __global.__frame = frame; try { body(); } catch (e) { e.__frame = e.__frame || frame.prev; __propagate(_, e); } finally { __global.__frame = __frame.prev; } } function __cb(_, frame, offset, col, fn){ var ctx = __global.__context; frame.offset = offset; frame.col = col; return function ___(err, result){ var oldFrame = __global.__frame; __global.__frame = frame; __global.__context = ctx; try { if (err) { err.__frame = err.__frame || frame; return _(err); } return fn(null, result); } catch (ex) { ex.__frame = ex.__frame || frame; return __propagate(_, ex); } finally { __global.__frame = oldFrame; } } } function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function ___(e, r){ cb(e, r); }; fn.apply(this, args); return function ___(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } function __trap(err){ if (err) { if (__global.__context && __global.__context.errorHandler) __global.__context.errorHandler(err); else console.error("UNCAUGHT EXCEPTION: " + err.message + "\n" + err.stack); } } function __tryCatch(_, fn){ try { fn(); } catch (e) { try { _(e); } catch (ex) { __trap(ex); } } } var fs = require("fs");



Expand Down
2 changes: 1 addition & 1 deletion lib/streams/jsonRequest.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/*** Generated by streamline 0.1.36-stack - DO NOT EDIT ***/ "use strict"; var __global = typeof global !== 'undefined' ? global : window;var __srcName='./lib/streams/jsonRequest_.js'; function __func(_, __this, __arguments, fn, index, frame, body) { if (!_) { return __future.call(__this, fn, __arguments, index); } frame.file = __srcName; frame.prev = __global.__frame; __global.__frame = frame; try { body(); } catch (e) { e.__frame = e.__frame || frame.prev; __propagate(_, e); } finally { __global.__frame = __frame.prev; } } function __cb(_, frame, offset, col, fn){ var ctx = __global.__context; frame.offset = offset; frame.col = col; return function ___(err, result){ var oldFrame = __global.__frame; __global.__frame = frame; __global.__context = ctx; try { if (err) { err.__frame = err.__frame || frame; return _(err); } return fn(null, result); } catch (ex) { ex.__frame = ex.__frame || frame; return __propagate(_, ex); } finally { __global.__frame = oldFrame; } } } var streams = require("./streams");
/*** Generated by streamline 0.1.36-stack - DO NOT EDIT ***/ "use strict"; var __global = typeof global !== 'undefined' ? global : window;var __srcName='./lib/streams/jsonRequest_.js'; function __func(_, __this, __arguments, fn, index, frame, body) { if (!_) { return __future.call(__this, fn, __arguments, index); } frame.file = __srcName; frame.prev = __global.__frame; __global.__frame = frame; try { body(); } catch (e) { e.__frame = e.__frame || frame.prev; __propagate(_, e); } finally { __global.__frame = __frame.prev; } } function __cb(_, frame, offset, col, fn){ var ctx = __global.__context; frame.offset = offset; frame.col = col; return function ___(err, result){ var oldFrame = __global.__frame; __global.__frame = frame; __global.__context = ctx; try { if (err) { err.__frame = err.__frame || frame; return _(err); } return fn(null, result); } catch (ex) { ex.__frame = ex.__frame || frame; return __propagate(_, ex); } finally { __global.__frame = oldFrame; } } } function __future(fn, args, i){ var done, err, result; var cb = function(e, r){ done = true; err = e, result = r; }; args = Array.prototype.slice.call(args); args[i] = function ___(e, r){ cb(e, r); }; fn.apply(this, args); return function ___(_){ if (done) _.call(this, err, result); else cb = _.bind(this); } .bind(this); } var streams = require("./streams");



Expand Down
Loading

0 comments on commit 4b5392a

Please sign in to comment.