mirror of
https://github.com/shaka-project/shaka-player.git
synced 2026-06-14 15:56:38 +03:00
Remove partial exports, broken in new compiler
The old compiler would let us export a static method on a class without exporting the whole class and its constructor. The new compiler silently ignores `@export` for any methods of a non-exported class. This means that for the latest Closure Compiler, we must export any class with exported static methods. In some cases, these are non-utility classes with constructors we'd rather not export, but the constructor is implicitly exported by exporting the class itself. This was initially caught by the integration tests. The error wasn't especially helpful, so I added a try/catch to loadShaka that makes the error more apparent: TypeError: Cannot read property 'registerParserByMime' of undefined To make sure we do not make this mistake again, I've added a check to the extern generator, which was already able to detect these types of classes. I don't know a compiler-based way to do it, since the compiler silently ignores the export annotations in these cases. Issue #2528 Change-Id: I797c75a8098b0bb3cf837588569f878253dec2cf
This commit is contained in:
@@ -11,9 +11,10 @@ goog.require('shaka.util.Iterables');
|
||||
goog.require('shaka.util.StringUtils');
|
||||
|
||||
|
||||
// TODO: revisit this when Closure Compiler supports partially-exported classes.
|
||||
/**
|
||||
* @summary A set of Uint8Array utility functions.
|
||||
* @exportDoc
|
||||
* @export
|
||||
*/
|
||||
shaka.util.Uint8ArrayUtils = class {
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user