It would be possible to minify calls to static namespaced methods by replacing the namespaced method into a variable that would be moved to the topmost scope in a function? This of course will only work for explicit static namespaced calls inside function scopes (not on the global scope), so for example:
```
function(){//topmost scope
var a = call.to.another.method();
var j = call.to.another.method;
var b = function(){
var c = call.to.another.method();
var i = j();
}
}
vad d = call.to.another.method();
```
Should be minified as:
```
function(){//topmost scope
var x = call.to.another.method;
var j = call.to.another.method;//not replaced, as it is not a method call...
var a = x();
var b = function(){
var c = x();
var i = j();
}
}
vad d = call.to.another.method();
```
What do you think? Do you believe that would be possible? I'm not sure if you can detect some common patterns that may look similar but are not, like:
```
...
var that = this;
var a = that.method();
...
```
Comments: ** Comment from web user: SoopahMan **
```
function(){//topmost scope
var a = call.to.another.method();
var j = call.to.another.method;
var b = function(){
var c = call.to.another.method();
var i = j();
}
}
vad d = call.to.another.method();
```
Should be minified as:
```
function(){//topmost scope
var x = call.to.another.method;
var j = call.to.another.method;//not replaced, as it is not a method call...
var a = x();
var b = function(){
var c = x();
var i = j();
}
}
vad d = call.to.another.method();
```
What do you think? Do you believe that would be possible? I'm not sure if you can detect some common patterns that may look similar but are not, like:
```
...
var that = this;
var a = that.method();
...
```
Comments: ** Comment from web user: SoopahMan **
Google's Closure Compiler does exactly this.
http://b9dev.blogspot.com/2013/06/getting-started-with-google-closure-on.html
You should probably just switch to that.