anchor.diff:      }
     }
   
  -  static void _consoleLog(msg) native "\$globalThis.console.log(msg);";
  +  static void _consoleLog(msg) {
  +    JS("void", r"$globalThis.console.log(#)", msg);
  +  }
   
     /**
      * Extract the constructor of runnable, so it can be allocated in another
      * isolate.
      */
  -  static Dynamic _getJSConstructor(Isolate runnable) native """
  -    return runnable.constructor;
  -  """;
  +  static Dynamic _getJSConstructor(Isolate runnable) {
  +    return JS("Object", "#.constructor", runnable);
  +  }
   
     /** Extract the constructor name of a runnable */
     // TODO(sigmund): find a browser-generic way to support this.
  -  static Dynamic _getJSConstructorName(Isolate runnable) native """
  -    return runnable.constructor.name;
  -  """;
  +  // TODO(floitsch): is this function still used? If yes, should we use
  +  // Primitives.objectTypeName instead?
  +  static Dynamic _getJSConstructorName(Isolate runnable) {
  +    return JS("Object", "#.constructor.name", runnable);
  +  }
   
     /** Find a constructor given its name. */
  -  static Dynamic _getJSConstructorFromName(String factoryName) native """
  -    return \$globalThis[factoryName];
  -  """;
  -
  -  static Dynamic _getJSFunctionFromName(String functionName) native """
  -    return \$globalThis[functionName];
  -  """;
  +  static Dynamic _getJSConstructorFromName(String factoryName) {
  +    return JS("Object", r"$globalThis[#]", factoryName);
  +  }
  +
  +  static Dynamic _getJSFunctionFromName(String functionName) {
  +    return JS("Object", r"$globalThis[#]", functionName);
  +  }
   
     /**
      * Get a string name for the function, if possible.  The result for
      * anonymous functions is browser-dependent -- it may be "" or "anonymous"
      * but you should probably not count on this.
      */
  -  static String _getJSFunctionName(Function f)
  -    native r"return f.$name || (void 0);";
  +  static String _getJSFunctionName(Function f) {
  +    return JS("Object", r"(#.$name || #)", f, null);
  +  }
   
     /** Create a new JavaScript object instance given its constructor. */
  -  static Dynamic _allocate(var ctor) native "return new ctor();";
  +  static Dynamic _allocate(var ctor) {
  +    return JS("Object", "new #()", ctor);
  +  }
   
     // TODO(sigmund): clean up above, after we make the new API the default:
   
  
positive.code:   void set onmessage(f) {
      throw new Exception("onmessage should not be set on MainManagerStub");
    }
    void postMessage(msg) native r"$globalThis.postMessage(msg);";
    void terminate() {}  // Nothing useful to do here.
  }
  
  
negative.code:  * are actually available.
   */
  class _WorkerStub implements _ManagerStub native "*Worker" {
    get id() => JS("Object", "#.id", this);
    void set id(i) { JS("void", "#.id = #", this, i); }
    void set onmessage(f) { JS("void", "#.onmessage = #", this, f); }
    void postMessage(msg) => JS("Object", "#.postMessage(#)", this, msg);
    // terminate() is implemented by Worker.
    abstract void terminate();
  }
  