google / google/closure-compiler
Argument Count Error
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
I am running the version of Closure Compiler that I downloaded yesterday.
I would think the below code would produce a warning regarding the number of arguments used in the call to `staticMethod` (within `onload`). It does not. But if `privatelyUsedMethod`'s declaration and reference (within `staticMethod`) are deleted, I get the warning I would expect.
``` js
var StaticClass = {
privatelyUsedMethod : function() {},
staticMethod : function(msg) {
alert(msg);
StaticClass.privatelyUsedMethod();
}
};
window.onload = function() { StaticClass.staticMethod(); };
```
Also, I would think the below code would give me a warning too, but since `StaticClass` is declared after the reference to `staticMethod` (in `onload`), no warnings are displayed. But when I reference `staticMethod` after declaring `StaticClass`, I see the warnings I would expect.
``` js
window.onload = function() { StaticClass.staticMethod(); };
var StaticClass = {
staticMethod : function(msg) {
alert(msg);
}
};
```
I believe these are bugs. Would someone help please? Thanks.
Contributor guide
Assessment
This issue has not been assessed yet.