Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7f77edadb3 | ||
|
|
a9511dfbe5 | ||
|
|
064e7aa1bb | ||
|
|
1e9f98aa51 | ||
|
|
11e24d53a1 |
@@ -351,7 +351,9 @@ function OutputStream(options) {
|
||||
AST_Node.DEFMETHOD("print", function(stream, force_parens){
|
||||
var self = this, generator = self._codegen;
|
||||
stream.push_node(self);
|
||||
if (force_parens || self.needs_parens(stream)) {
|
||||
var needs_parens = self.needs_parens(stream);
|
||||
var fc = self instanceof AST_Function && !stream.option("beautify");
|
||||
if (force_parens || (needs_parens && !fc)) {
|
||||
stream.with_parens(function(){
|
||||
self.add_comments(stream);
|
||||
self.add_source_map(stream);
|
||||
@@ -359,6 +361,7 @@ function OutputStream(options) {
|
||||
});
|
||||
} else {
|
||||
self.add_comments(stream);
|
||||
if (needs_parens && fc) stream.print("!");
|
||||
self.add_source_map(stream);
|
||||
generator(self, stream);
|
||||
}
|
||||
|
||||
15
lib/parse.js
15
lib/parse.js
@@ -168,7 +168,9 @@ function is_identifier_char(ch) {
|
||||
};
|
||||
|
||||
function is_identifier_string(str){
|
||||
for (var i = str.length; --i >= 0;) {
|
||||
var i = str.length;
|
||||
if (i == 0) return false;
|
||||
while (--i >= 0) {
|
||||
if (!is_identifier_char(str.charAt(i)))
|
||||
return false;
|
||||
}
|
||||
@@ -1338,15 +1340,8 @@ function parse($TEXT, options) {
|
||||
|
||||
function is_assignable(expr) {
|
||||
if (!options.strict) return true;
|
||||
switch (expr[0]+"") {
|
||||
case "dot":
|
||||
case "sub":
|
||||
case "new":
|
||||
case "call":
|
||||
return true;
|
||||
case "name":
|
||||
return expr[1] != "this";
|
||||
}
|
||||
if (expr instanceof AST_This) return false;
|
||||
return (expr instanceof AST_PropAccess || expr instanceof AST_Symbol);
|
||||
};
|
||||
|
||||
var maybe_assign = function(no_in) {
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
"description": "JavaScript parser, mangler/compressor and beautifier toolkit",
|
||||
"homepage": "http://lisperator.net/uglifyjs",
|
||||
"main": "tools/node.js",
|
||||
"version": "2.3.1",
|
||||
"version": "2.3.2",
|
||||
"engines": { "node" : ">=0.4.0" },
|
||||
"maintainers": [{
|
||||
"name": "Mihai Bazon",
|
||||
|
||||
@@ -19,12 +19,14 @@ dot_properties: {
|
||||
a["if"] = "if";
|
||||
a["*"] = "asterisk";
|
||||
a["\u0EB3"] = "unicode";
|
||||
a[""] = "whitespace";
|
||||
}
|
||||
expect: {
|
||||
a.foo = "bar";
|
||||
a["if"] = "if";
|
||||
a["*"] = "asterisk";
|
||||
a.\u0EB3 = "unicode";
|
||||
a[""] = "whitespace";
|
||||
}
|
||||
}
|
||||
|
||||
@@ -38,11 +40,13 @@ dot_properties_es5: {
|
||||
a["if"] = "if";
|
||||
a["*"] = "asterisk";
|
||||
a["\u0EB3"] = "unicode";
|
||||
a[""] = "whitespace";
|
||||
}
|
||||
expect: {
|
||||
a.foo = "bar";
|
||||
a.if = "if";
|
||||
a["*"] = "asterisk";
|
||||
a.\u0EB3 = "unicode";
|
||||
a[""] = "whitespace";
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user