google / google/closure-compiler
ADVANCED_OPTIMIZATION - inlining functions that are declared as @externs - and so breaks the externs.
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
When compiling a Function to be called from External code, and declaring the Function in the @externs file so it will be retained without being renamed, this works fine for sufficiently complicated functions. However when the function is very simple, the compiler decides it can be inlined - after which it is no longer present as a function in the compiled code, and so it is no longer available as a @extern.
Tests carried out using the REST API https://closure-compiler.appspot.com/compile with
output_format=json&
output_info=errors&output_info=warnings&output_info=statistics&output_info=compiled_code&
warning_level=default&
compilation_level=ADVANCED_OPTIMIZATIONS&
language=ECMASCRIPT5_STRICT&
js_code= &
js_externs=
The output was Combined.pac - also attached, along with a manually expanded version of that Combined-compiled.pac where we can see that the missing function was inlined by the Compiler.
[Combined-evidence.zip](https://github.com/google/closure-compiler/files/9657008/Combined-evidence.zip)
Contributor guide
Assessment
This issue has not been assessed yet.