Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mangle object properties #73

Open
hummeleBop opened this issue May 7, 2013 · 6 comments
Open

Mangle object properties #73

hummeleBop opened this issue May 7, 2013 · 6 comments

Comments

@hummeleBop
Copy link

Hi there, Thanks for your AMAZING work ;)
In future, do you plan to mangle object properties ?
I use the application from the git repository.

With the following code:

let u = (function(){
let my_huge_function = function() { return 'test'; };

Object.defineProperties(my_huge_function, {
   very_long_name: { value: "hello", writable: false } } );

my_huge_function.other_very_long_name = "hello 2?";
return my_huge_function.other_very_long_name;
})();

alert(u); // print "hello 2?";

I get:

let u=function(){let a=function(){return'test'};return Object.defineProperties(a,{very_long_name:{value:'hello',writable:!1}}),a.other_very_long_name='hello 2?',a.other_very_long_name}();alert(u)
@vendethiel
Copy link

How would that work? (wrt [] etc).

@michaelficarra
Copy link
Member

@Nami-Doc: The Google Closure Compiler guys don't allow dynamic member access and actually believe that's an acceptable restriction. Hey, to each his own.

@vendethiel
Copy link

Yes, and the compiler totally fails at it, giving everybody strange issues.

@hummeleBop
Copy link
Author

There is an error in my exemple sorry :'(
And I use 'let' keyword

There real code is following

let u = (function(){
let my_huge_function = function() { return 'test'; };

Object.defineProperties(my_huge_function, {
   very_long_name: { value: "hello", writable: false } } );

my_huge_function.other_very_long_name = "hello 2?";
return my_huge_function.other_very_long_name;
})();

alert(u); // print "hello 2?";

and the mangler result :

let u=function(){let a=function(){return'test'};return Object.defineProperties(a,{very_long_name:{value:'hello',writable:!1}}),a.other_very_long_name='hello 2?',a.other_very_long_name}();alert(u)

esmangle is a really nice soft for javascript 1.7.

@vendethiel
Copy link

How would that work? (wrt [] etc).

Do you think disallowing dynamic member access is an acceptable restriction?

@hummeleBop
Copy link
Author

In some cases..
Example of use Object.defineProperties
I create application in xulrunner environment

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants