Skip to content

Commit

Permalink
save #12
Browse files Browse the repository at this point in the history
  • Loading branch information
army8735 committed Aug 25, 2014
1 parent 0333123 commit cc88629
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
6 changes: 5 additions & 1 deletion src/Rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ var Rest = Class(function(jsdc) {
};
//主表达式中含有生成的对象,不是直接引用,需创建一个临时变量保存引用
if(needTemp) {
self.jsdc.append('var ' + temp + '=');
self.jsdc.append('function(){var ' + temp + '=');
var first = node.first();
eventbus.on(first.nid(), function(node2, start) {
if(!start) {
Expand Down Expand Up @@ -113,6 +113,10 @@ var Rest = Class(function(jsdc) {
this.jsdc.append('.concat(');
this.jsdc.append(node.last().first().token().content());
this.jsdc.append(')');
if(o.needTemp) {
//主表达式中含有生成的对象,不是直接引用,使用临时变量引用
this.jsdc.append(';return ' + o.temp + '}');
}
}
},
arrltr: function(node, start) {
Expand Down
6 changes: 5 additions & 1 deletion web/Rest.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ define(function(require, exports, module) {
};
//主表达式中含有生成的对象,不是直接引用,需创建一个临时变量保存引用
if(needTemp) {
self.jsdc.append('var ' + temp + '=');
self.jsdc.append('function(){var ' + temp + '=');
var first = node.first();
eventbus.on(first.nid(), function(node2, start) {
if(!start) {
Expand Down Expand Up @@ -114,6 +114,10 @@ define(function(require, exports, module) {
this.jsdc.append('.concat(');
this.jsdc.append(node.last().first().token().content());
this.jsdc.append(')');
if(o.needTemp) {
//主表达式中含有生成的对象,不是直接引用,使用临时变量引用
this.jsdc.append(';return ' + o.temp + '}');
}
}
},
arrltr: function(node, start) {
Expand Down

0 comments on commit cc88629

Please sign in to comment.