google / google/closure-compiler

add checks for early references to global names

Open
#583 3 comments 0 reactions 0 assignees View on GitHub
enhancement OTI
Dominant language
JavaScript
Stars
7.7k
Forks
1.2k
Avg merge
2d 12h
Merged PRs (30d)
6

Description

this class of error seems to hit me a bunch:

``` js
// ==ClosureCompiler==
// @compilation_level ADVANCED_OPTIMIZATIONS
// @output_file_name default.js
// ==/ClosureCompiler==

var x = {};
alert(x.y);
x.y = 3;
```

closure-compiler does not warn about this today, but I think it should. I was thinking about either moving the`VariableReferenceCheck` after `CollapseProperties`, or doing something clever in `CheckGlobalNames`.

any thoughts or advice on this?

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.