On 7/17/16, 11:45 PM, "Harbs" <harbs.li...@gmail.com> wrote:
>The issue should be clear. > >If MySuperClass.js has not yet been loaded when MySubClass.js is loaded, >goog.inherits(MySubClass, MySuperClass); which is in MySubClass.js will >cause an error. Harbs, if our code normally had problems loading subclasses before base classes, I doubt any of our examples would run. There should be a goog.require for the base class at the top of the subclass's file and that should load the base class before the goog.inherit runs. There is something unique about your scenario. We need a test case in order to determine what it is. > >This code is being added to the JS file right after the constructor is >being defined, but it’s not wrapped in an initializer function so it’s >evaluated as soon as the JS file is loaded. > >If it would be wrapped in an init function, it could be evaluated only >after all files are loaded, so all classes would be defined. > >We’ve been spending the better part of the last day trying to distill >this down to a test case which causes the compiler to load the classes in >the wrong order. We’re getting closer, but we’re not there yet. Even if >we find the specific root cause in my case for the files to be loaded in >the wrong order, I still think it’s a design flaw which should be fixed. >The order of loading files should not matter. The order of loading files currently matters. IMO, it would not be worth it to make it not matter. Google thinks it should matter otherwise they wouldn't have created the goog.require system and deps.js. Thanks, -Alex