-
Notifications
You must be signed in to change notification settings - Fork 319
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make compatible with closure advanced compilation (#374)
* Fully support Closure compiler including ADVANCED_OPTIMIZATIONS Currently, compiling lit-element with the Closure compiler results in a clean build but a number of hard JS errors due to a few issues: - static methods being collapsed (i.e. removed entirely) - Object.hasOwnPropertyName() looking for static properties that have been rewritten by the compiler - static property initializers not being run when @exported The last issue is a compiler bug being tracked internally, but all three need to be worked around before this will compile and run cleanly. This includes all of the necessary fixes, including addressing the last issue by moving the Object.hasOwnPropertyName('_classProperties') check to _finalize(). This is necessary to ensure that _classProperties is defined before it's iterated in observedProperties on an element that has no properties. Another option for making _finalized and _classProperties public would be to move to checking this._finalized and this._classProperties and not needing to access them by name - I thought that was out of scope for this but would be happy to change to that style if reviewers prefer. * Make compatible with closure compiler * uses `JSCompiler_renameProperty` where literal names are needed instead of using `@export` * The private `_classProperties` is no longer created by default. Instead `_ensureClassProperties` was added and is called to make sure that the specific class has its own storage for class properties. * Adds a test that ensure a subclass cannot alter a superclass. The condition tested here would only fail after merging #359. * optimization: ensures `LitElement` is marked as `finalized` so that it does not ever try to finalize. * Format. * Use JSCompiler_renameProperty for `properties` * Minor updates based on review feedback. * Remove @nocollapse from static fields with no initializer
- Loading branch information
1 parent
85fe270
commit 231eb95
Showing
3 changed files
with
107 additions
and
23 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters