Static analysis in JS of Uno NativeModule calls

If a JS library makes a call to an Uno module’s function that hasn’t been defined using the “AddMember” mechanism (like

AddMember(new NativeFunction("getWeather",(NativeCallback)GetWeather));

), there is no static error at the build process to alert you to a call to an undefined error. The only error is a later semi-cryptic run-time CallType error.

I propose the following for Javascript code:

  1. For each Uno module defined in the project,
  2. Gather list of all members that are exported by that Uno module
  3. For each reference to the Uno module in Javascript, ensure that the member has been exposed (or even exists) – if not, log the failure as a compilation error and present to the user.

You can do this with NativeModules, and it works:

module.doit = function () {
    return 55;
}

JS is a interprented language, and you can evalute string. Even though what you propose looks like a good idea, I don’t think it is possible to do.