-
Notifications
You must be signed in to change notification settings - Fork 1.2k
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
Static class functions can be erroneously removed in ADVANCED mode #2763
Comments
What happens is this.
|
As a workaround, you can use the class Foo {
/** @nocollapse */
static print() {
console.log('f');
}
constructor() {
this.constructor.print();
}
}
let x = new Foo(); |
This seems to happen anytime the static method is not called directly from the class.
The problem doesn't occur when the
|
I'm running into this issue as well, from a slightly different angle. Demo link.
Output:
|
A little different but probably connected case /**
* @nocollapse
* @namespace
*/
var NN ={}
NN.Container = class {
constructor() {
console.log("some")
}
getId() {
return new Date()
}
}
console.log(new NN.Container().getId()) when compiled with
results in
Here console.log("some") is missing. The whole NN.Container constructor is missing. So there should be a '@nocollapse' at the NN.Container level |
Created Google internal issue http://b/143308051 |
In a simple example with ADVANCED optimizations enabled
The call to the
print
function remains, but the implementation is missing.Live Example
The text was updated successfully, but these errors were encountered: