Upgrade to Pro — share decks privately, control downloads, hide ads and more …

mocha - ESNext Transpliler の紹介

mocha - ESNext Transpliler の紹介

古のEcmascript Harmony時代のTransplilerを自作していたので供養します。

More Decks by Taketoshi Aono(青野健利 a.k.a brn)

Other Decks in Programming

Transcript

  1. Name @brn (ꫬꅿ⨳ⵃ) Occupation ؿٗٝزؒٝسؒٝآص،٥ط؎ذ؍ـؒٝآص، Company Cyberagent ،سذؙأةآؔ AI Messenger

    Blog http://abcdef.gets.b6n.ch/ Twitter https://twitter.com/brn227 GitHub https://github.com/brn
  2. Ecmascript 2017 Ecmascript 2016 Ecmascript 6/2015 E Ec cm ma

    as sc cr ri ip pt t h ha ar rm mo on ny y Ecmascript 5 Ecmascript 3
  3. function fibonacci(num) {! var a = 1, b = 0,

    temp;! ! while (num >= 0){! temp = a;! a = a + b;! b = temp;! num--;! }! ! return b;! }!
  4. function fibonacci(num) {! try {! __LINE__ = 2;! var a

    = 1,! b = 0,! temp;! ! __LINE__ = 4;! while (num >= 0){! ! __LINE__ = 5;! temp = a;! ! __LINE__ = 6;! a = a+b;! ! __LINE__ = 7;! b = temp;! ! __LINE__ = 8;! num -- ;! }! __LINE__ = 11;! return b;! } catch(__mocha_error){! __Runtime.exceptionHandler(__LINE__, __FILE__, __mocha_error);! }! }! 
  5. // thisを束縛しない関数宣言 foo(x, y, z) -> console.log(this);! // thisを束縛しない関数式 var

    foo = (x, y, z) -> console.log(this);! // thisを束縛する関数宣言 var foo = (x, y, z) => console.log(this);! // thisを束縛する関数式 foo(x,y,z) => console.log(this);!