以下の内容はhttps://gfx.hatenadiary.org/entry/20120310/1331384711より取得しました。


How Dart classes work as JS

Dartのクラス機構はどんなものか調べた記録。DartCoffeeScriptよりも遥かに複雑だが、継承メカニズムはほぼ同一だった。
DartからJSにコンパイルされた結果は長いので肝心なところだけ。

function $inherits(child, parent) {
  if (child.prototype.__proto__) {
    child.prototype.__proto__ = parent.prototype;
  } else {
    function tmp() {};
    tmp.prototype = parent.prototype;
    child.prototype = new tmp();
    child.prototype.constructor = child;
  }
}

__proto__はECMA262標準ではないので無視するとしてelseブロックをみると、中間代理クラスtmpがcoffeeのctorとまったく同じ役割である。




以上の内容はhttps://gfx.hatenadiary.org/entry/20120310/1331384711より取得しました。
このページはhttp://font.textar.tv/のウェブフォントを使用してます

不具合報告/要望等はこちらへお願いします。
モバイルやる夫Viewer Ver0.14