Permalink
Browse files

basic expression statements for the calls test

  • Loading branch information...
1 parent 18863d2 commit 1f596f7aceea5cd37a111db9ba1dbee38902b955 @substack committed May 15, 2012
Showing with 16 additions and 1 deletion.
  1. +16 −1 index.js
View
17 index.js
@@ -18,7 +18,8 @@ function Fritter (context) {
this.names = {
call : identifier(6),
catcher : identifier(6),
- catchVar : identifier(6)
+ catchVar : identifier(6),
+ expr : identifier(6)
};
this.stack = [];
this.current = undefined;
@@ -86,6 +87,11 @@ Fritter.prototype.defineContext = function () {
throw err;
};
})();
+
+ context[self.names.expr] = function (ix, expr) {
+ self.current = self.nodes[ix];
+ return expr;
+ };
};
Fritter.prototype.include = function (src, opts) {
@@ -120,6 +126,15 @@ Fritter.prototype.include = function (src, opts) {
node.end = node.loc.end;
nodes.push(node);
}
+ else if (node.type === 'ExpressionStatement') {
+ node.update(
+ names.expr + '(' + nodes.length + ');'
+ + node.source()
+ );
+ node.start = node.loc.start;
+ node.end = node.loc.end;
+ nodes.push(node);
+ }
});
this.source += src_ + ';';

0 comments on commit 1f596f7

Please sign in to comment.