google / google/closure-compiler
circular references prevent code motion
- Dominant language
- JavaScript
- Stars
- 7.7k
- Forks
- 1.2k
- Avg merge
- 2d 12h
- Merged PRs (30d)
- 6
Description
Create two modules:
``` js
// module 1
/** @constructor */ function Foo() {}
Foo.prototype.descriptor = Foo.prototype;
```
``` js
// module 2
window.foo = new Foo()
```
and run the compiler with all the cross-module motion passes on.
Expected result: Foo gets moved into module 2
Actual result: Nothing gets moved
Repro link:
http://closure-compiler-debugger.appspot.com/#input0%3D%252F**%2520%2540constructor%2520*%252F%2520function%2520Foo()%2520%257B%257D%26input1%3Dwindow.foo%2520%253D%2520new%2520Foo()%253B%26conformanceConfig%26externs%26refasterjs-template%26includeDefaultExterns%3D1%26CHECK_SYMBOLS%3D1%26CHECK_TYPES%3D1%26CROSS_MODULE_CODE_MOTION%3D1%26CROSS_MODULE_METHOD_MOTION%3D1%26LANG_IN_IS_ES6%3D1%26MISSING_PROPERTIES%3D1%26PRESERVE_TYPE_ANNOTATIONS%3D1%26PRETTY_PRINT%3D1%26TRANSPILE%3D1
Contributor guide
Assessment
This issue has not been assessed yet.