Same-name extern methods preventing code removal for provably side-effect-free code
See original GitHub issueThe compiler should be able to compile the following example to zero:
(function() {
/** @final */
class Foo {
get() {}
foo() {}
}
new Foo().get();
new Foo().foo();
})();
Instead, it can remove the call to foo()
, but it cannot remove the call to get()
, presumably because of an extern that’s being conflated somewhere.
Issue Analytics
- State:
- Created 7 years ago
- Comments:6 (4 by maintainers)
Top Results From Across the Web
Releases · google/closure-compiler Wiki - GitHub
This fixes a dead code removal with TypeScript 4.4, which uses this pattern for functions imported from modules. When the special first parameter...
Read more >SideEffectFree (checker-framework 3.27.0 API)
A method is called side-effect-free if it has no visible side-effects, such as setting a field of an object that existed before the...
Read more >Bug patterns
Each bug pattern includes code examples of both positive and negative cases; these examples are used in our regression test suite.
Read more >It's probably time to stop recommending Clean Code (2020)
The idea of code telling a story is that a unit of work should explain what it does through its use of well...
Read more >API - esbuild
External paths are applied both before and after path resolution, which lets you match against both the import path in the source code...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
I don’t see any class in the output:
In any case, it looks like I needed to turn on DisambiguateProperties. With that on, it does in fact behave as you say.
@shicks Something else going on with the debugger there. The code isn’t being transpiled (there’s a class in the output).