esperanto-source 0.6.24 → 0.6.25

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 08976919712e0b1fe54d19910737d5a991890b7a
4
- data.tar.gz: 436794d47ac488c939965bef47fa62e228de4c33
3
+ metadata.gz: 93c9293d634c59a0109ee9e96e8b6c2c9e139ef9
4
+ data.tar.gz: 8bdcc0cbbfb0bdafe08ed11f9609cb26b66aff64
5
5
  SHA512:
6
- metadata.gz: 95a5f5a7bc8dd15c8077b222bf4509d76714f5640d6f273df701649bc767691d5046d0a2e90bd7da09626c092cefcb785246e8106335e26e9ec7258e041a21d7
7
- data.tar.gz: 8c4a378d209fbac7ea3a3b28d2bb59322ec87afd0ee921fd3538fe4ede914ecba78ff0f12115d8416c15f7d8e43fc80f29493407363789b65cfbc7dc5242d0c0
6
+ metadata.gz: a4bf23afa304a3c1d2f717db8fc4217706f2541fd8ab4094223805f04d0a4007e5bea8ed11187058f87d08d5269adc64f7fd44f37be51865b69b047eb52f9535
7
+ data.tar.gz: 40da1c572e9f06df508199307b4ce93dee2307ecfa132a96e26b317c13d543a6cc843db1f156e4d85f1147274568e1dedc7e6269ac764d51b0a3df7f1a9cf701
@@ -1,5 +1,5 @@
1
1
  module Esperanto
2
2
  module Source
3
- VERSION = '0.6.24'
3
+ VERSION = '0.6.25'
4
4
  end
5
5
  end
@@ -1,5 +1,5 @@
1
1
  /*
2
- esperanto.js v0.6.24 - 2015-03-31
2
+ esperanto.js v0.6.25 - 2015-04-02
3
3
  http://esperantojs.org
4
4
 
5
5
  Released under the MIT License.
@@ -2139,7 +2139,7 @@
2139
2139
  }
2140
2140
  }
2141
2141
 
2142
- function rewriteExportAssignments ( body, node, exports, scope, capturedUpdates ) {
2142
+ function rewriteExportAssignments ( body, node, parent, exports, scope, capturedUpdates ) {
2143
2143
  var assignee;
2144
2144
 
2145
2145
  if ( node.type === 'AssignmentExpression' ) {
@@ -2170,9 +2170,19 @@
2170
2170
 
2171
2171
  // special case - increment/decrement operators
2172
2172
  if ( node.operator === '++' || node.operator === '--' ) {
2173
- body.replace( node.end, node.end, ((", exports." + exportAs) + (" = " + name) + "") );
2173
+ var prefix = ("");
2174
+ var suffix = ((", exports." + exportAs) + (" = " + name) + "");
2175
+ if ( parent.type !== 'ExpressionStatement' ) {
2176
+ if ( !node.prefix ) {
2177
+ suffix += ((", " + name) + (" " + (node.operator === '++' ? '-' : '+')) + " 1")
2178
+ }
2179
+ prefix += ("( ");
2180
+ suffix += (" )");
2181
+ }
2182
+ body.insert( node.start, prefix );
2183
+ body.insert( node.end, suffix );
2174
2184
  } else {
2175
- body.replace( node.start, node.start, (("exports." + exportAs) + " = ") );
2185
+ body.insert( node.start, (("exports." + exportAs) + " = ") );
2176
2186
  }
2177
2187
  }
2178
2188
  }
@@ -2211,7 +2221,7 @@
2211
2221
  // Rewrite assignments to exports inside functions, to keep bindings live.
2212
2222
  // This call may mutate `capturedUpdates`, which is used elsewhere
2213
2223
  if ( scope !== ast._scope ) {
2214
- rewriteExportAssignments( body, node, exportNames, scope, capturedUpdates );
2224
+ rewriteExportAssignments( body, node, parent, exportNames, scope, capturedUpdates );
2215
2225
  }
2216
2226
 
2217
2227
  if ( node.type === 'Identifier' && parent.type !== 'FunctionExpression' ) {
data/vendor/esperanto.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /*
2
- esperanto.js v0.6.24 - 2015-03-31
2
+ esperanto.js v0.6.25 - 2015-04-02
3
3
  http://esperantojs.org
4
4
 
5
5
  Released under the MIT License.
@@ -7,10 +7,10 @@
7
7
 
8
8
  'use strict';
9
9
 
10
- var _path = require('path');
11
- var sander = require('sander');
12
10
  var acorn = require('acorn');
13
11
  var MagicString = require('magic-string');
12
+ var _path = require('path');
13
+ var sander = require('sander');
14
14
 
15
15
  var hasOwnProp = Object.prototype.hasOwnProperty;
16
16
  var utils_hasOwnProp = hasOwnProp;
@@ -1168,7 +1168,7 @@ function replaceIdentifiers ( body, node, identifierReplacements, scope ) {
1168
1168
  }
1169
1169
  }
1170
1170
 
1171
- function rewriteExportAssignments ( body, node, exports, scope, capturedUpdates ) {
1171
+ function rewriteExportAssignments ( body, node, parent, exports, scope, capturedUpdates ) {
1172
1172
  var assignee;
1173
1173
 
1174
1174
  if ( node.type === 'AssignmentExpression' ) {
@@ -1199,9 +1199,19 @@ function rewriteExportAssignments ( body, node, exports, scope, capturedUpdates
1199
1199
 
1200
1200
  // special case - increment/decrement operators
1201
1201
  if ( node.operator === '++' || node.operator === '--' ) {
1202
- body.replace( node.end, node.end, ((", exports." + exportAs) + (" = " + name) + "") );
1202
+ var prefix = ("");
1203
+ var suffix = ((", exports." + exportAs) + (" = " + name) + "");
1204
+ if ( parent.type !== 'ExpressionStatement' ) {
1205
+ if ( !node.prefix ) {
1206
+ suffix += ((", " + name) + (" " + (node.operator === '++' ? '-' : '+')) + " 1")
1207
+ }
1208
+ prefix += ("( ");
1209
+ suffix += (" )");
1210
+ }
1211
+ body.insert( node.start, prefix );
1212
+ body.insert( node.end, suffix );
1203
1213
  } else {
1204
- body.replace( node.start, node.start, (("exports." + exportAs) + " = ") );
1214
+ body.insert( node.start, (("exports." + exportAs) + " = ") );
1205
1215
  }
1206
1216
  }
1207
1217
  }
@@ -1240,7 +1250,7 @@ function traverseAst ( ast, body, identifierReplacements, importedBindings, impo
1240
1250
  // Rewrite assignments to exports inside functions, to keep bindings live.
1241
1251
  // This call may mutate `capturedUpdates`, which is used elsewhere
1242
1252
  if ( scope !== ast._scope ) {
1243
- rewriteExportAssignments( body, node, exportNames, scope, capturedUpdates );
1253
+ rewriteExportAssignments( body, node, parent, exportNames, scope, capturedUpdates );
1244
1254
  }
1245
1255
 
1246
1256
  if ( node.type === 'Identifier' && parent.type !== 'FunctionExpression' ) {
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: esperanto-source
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.24
4
+ version: 0.6.25
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ryunosuke SATO
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-03-31 00:00:00.000000000 Z
11
+ date: 2015-04-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler