google / google/closure-compiler

Argument Count Error

Open
#730 10 comments 0 reactions 0 assignees View on GitHub
internal-issue-created triage-done
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

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.