uglifier 1.2.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.

Potentially problematic release.


This version of uglifier might be problematic. Click here for more details.

Files changed (4) hide show
  1. data/VERSION +1 -1
  2. data/lib/uglify.js +21 -11
  3. data/uglifier.gemspec +2 -2
  4. metadata +17 -17
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.2.1
1
+ 1.2.2
@@ -959,8 +959,11 @@ function parse($TEXT, exigent_mode, embed_tokens) {
959
959
  init = is("keyword", "var")
960
960
  ? (next(), var_(true))
961
961
  : expression(true, true);
962
- if (is("operator", "in"))
962
+ if (is("operator", "in")) {
963
+ if (init[0] == "var" && init[1].length > 1)
964
+ croak("Only one variable declaration allowed in for..in loop");
963
965
  return for_in(init);
966
+ }
964
967
  }
965
968
  return regular_for(init);
966
969
  };
@@ -2133,7 +2136,9 @@ var when_constant = (function(){
2133
2136
  case "string": ast = [ "string", val ]; break;
2134
2137
  case "number": ast = [ "num", val ]; break;
2135
2138
  case "boolean": ast = [ "name", String(val) ]; break;
2136
- default: throw new Error("Can't handle constant of type: " + (typeof val));
2139
+ default:
2140
+ if (val === null) { ast = [ "atom", "null" ]; break; }
2141
+ throw new Error("Can't handle constant of type: " + (typeof val));
2137
2142
  }
2138
2143
  return yes.call(expr, ast, val);
2139
2144
  } catch(ex) {
@@ -2575,6 +2580,16 @@ function ast_squeeze(ast, options) {
2575
2580
  });
2576
2581
  };
2577
2582
 
2583
+ function abort_else(c, t, e) {
2584
+ var ret = [ [ "if", negate(c), e ] ];
2585
+ if (t[0] == "block") {
2586
+ if (t[1]) ret = ret.concat(t[1]);
2587
+ } else {
2588
+ ret.push(t);
2589
+ }
2590
+ return walk([ "block", ret ]);
2591
+ };
2592
+
2578
2593
  function make_real_if(c, t, e) {
2579
2594
  c = walk(c);
2580
2595
  t = walk(t);
@@ -2608,9 +2623,10 @@ function ast_squeeze(ast, options) {
2608
2623
  }
2609
2624
  else if (t[0] == "stat") {
2610
2625
  if (e) {
2611
- if (e[0] == "stat") {
2626
+ if (e[0] == "stat")
2612
2627
  ret = best_of(ret, [ "stat", make_conditional(c, t[1], e[1]) ]);
2613
- }
2628
+ else if (aborts(e))
2629
+ ret = abort_else(c, t, e);
2614
2630
  }
2615
2631
  else {
2616
2632
  ret = best_of(ret, [ "stat", make_conditional(c, t[1]) ]);
@@ -2630,13 +2646,7 @@ function ast_squeeze(ast, options) {
2630
2646
  ret = walk([ "block", ret ]);
2631
2647
  }
2632
2648
  else if (t && aborts(e)) {
2633
- ret = [ [ "if", negate(c), e ] ];
2634
- if (t[0] == "block") {
2635
- if (t[1]) ret = ret.concat(t[1]);
2636
- } else {
2637
- ret.push(t);
2638
- }
2639
- ret = walk([ "block", ret ]);
2649
+ ret = abort_else(c, t, e);
2640
2650
  }
2641
2651
  return ret;
2642
2652
  };
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = "uglifier"
8
- s.version = "1.2.1"
8
+ s.version = "1.2.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Ville Lautanala"]
12
- s.date = "2011-12-26"
12
+ s.date = "2012-01-13"
13
13
  s.email = "lautis@gmail.com"
14
14
  s.extra_rdoc_files = [
15
15
  "LICENSE.txt",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uglifier
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.1
4
+ version: 1.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2011-12-26 00:00:00.000000000 Z
12
+ date: 2012-01-13 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: execjs
16
- requirement: &70133427222100 !ruby/object:Gem::Requirement
16
+ requirement: &70201447760420 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: 0.3.0
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *70133427222100
24
+ version_requirements: *70201447760420
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: multi_json
27
- requirement: &70133427218380 !ruby/object:Gem::Requirement
27
+ requirement: &70201447759260 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 1.0.2
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *70133427218380
35
+ version_requirements: *70201447759260
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: rspec
38
- requirement: &70133427310640 !ruby/object:Gem::Requirement
38
+ requirement: &70201447758600 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ~>
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '2.7'
44
44
  type: :development
45
45
  prerelease: false
46
- version_requirements: *70133427310640
46
+ version_requirements: *70201447758600
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: bundler
49
- requirement: &70133427322320 !ruby/object:Gem::Requirement
49
+ requirement: &70201447758120 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ~>
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: '1.0'
55
55
  type: :development
56
56
  prerelease: false
57
- version_requirements: *70133427322320
57
+ version_requirements: *70201447758120
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: jeweler
60
- requirement: &70133427320800 !ruby/object:Gem::Requirement
60
+ requirement: &70201447757540 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ~>
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 1.6.0
66
66
  type: :development
67
67
  prerelease: false
68
- version_requirements: *70133427320800
68
+ version_requirements: *70201447757540
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: rcov
71
- requirement: &70133427318980 !ruby/object:Gem::Requirement
71
+ requirement: &70201447757000 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
- version_requirements: *70133427318980
79
+ version_requirements: *70201447757000
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: rdoc
82
- requirement: &70133427331540 !ruby/object:Gem::Requirement
82
+ requirement: &70201447756180 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ~>
@@ -87,7 +87,7 @@ dependencies:
87
87
  version: '3.11'
88
88
  type: :development
89
89
  prerelease: false
90
- version_requirements: *70133427331540
90
+ version_requirements: *70201447756180
91
91
  description:
92
92
  email: lautis@gmail.com
93
93
  executables: []
@@ -126,7 +126,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
126
126
  version: '0'
127
127
  segments:
128
128
  - 0
129
- hash: -1948507962225552578
129
+ hash: 2894982921452621282
130
130
  required_rubygems_version: !ruby/object:Gem::Requirement
131
131
  none: false
132
132
  requirements: