eclipse-archived/ceylon

Optimize the size of the generated Javascript

Opened this issue · 12 comments

If you look into the generated ceylon.html-1.3.4-SNAPSHOT.js file, you will see lines like the following:

function Audio($wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children,audio$){
$init$Audio();
if(audio$===undefined)audio$=new Audio.$$;
if($wgimgr$2bl===undefined){$wgimgr$2bl=$init$Audio().$defs$id(audio$,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bl_=$wgimgr$2bl;
if($wgimgr$2bm===undefined){$wgimgr$2bm=$init$Audio().$defs$clazz(audio$,$wgimgr$2bl,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bm_=$wgimgr$2bm;
if($wgimgr$2bn===undefined){$wgimgr$2bn=$init$Audio().$defs$accessKey(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bn_=$wgimgr$2bn;
if($wgimgr$2bo===undefined){$wgimgr$2bo=$init$Audio().$defs$contentEditable(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bo_=$wgimgr$2bo;
if($wgimgr$2bp===undefined){$wgimgr$2bp=$init$Audio().$defs$contextMenu(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bp_=$wgimgr$2bp;
if($wgimgr$2bq===undefined){$wgimgr$2bq=$init$Audio().$defs$dir(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bq_=$wgimgr$2bq;
if($wgimgr$2br===undefined){$wgimgr$2br=$init$Audio().$defs$draggable(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2br_=$wgimgr$2br;
if($wgimgr$2bs===undefined){$wgimgr$2bs=$init$Audio().$defs$dropZone(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bs_=$wgimgr$2bs;
if($wgimgr$2bt===undefined){$wgimgr$2bt=$init$Audio().$defs$hidden(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bt_=$wgimgr$2bt;
if($wgimgr$2bu===undefined){$wgimgr$2bu=$init$Audio().$defs$lang(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bu_=$wgimgr$2bu;
if($wgimgr$2bv===undefined){$wgimgr$2bv=$init$Audio().$defs$spellcheck(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bv_=$wgimgr$2bv;
if($wgimgr$2bw===undefined){$wgimgr$2bw=$init$Audio().$defs$style(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bw_=$wgimgr$2bw;
if($wgimgr$2bx===undefined){$wgimgr$2bx=$init$Audio().$defs$tabIndex(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bx_=$wgimgr$2bx;
if($wgimgr$2by===undefined){$wgimgr$2by=$init$Audio().$defs$title(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2by_=$wgimgr$2by;
if($wgimgr$2bz===undefined){$wgimgr$2bz=$init$Audio().$defs$translate(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2bz_=$wgimgr$2bz;
if($wgimgr$2c0===undefined){$wgimgr$2c0=$init$Audio().$defs$autoplay(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2c0_=$wgimgr$2c0;
if($wgimgr$2c1===undefined){$wgimgr$2c1=$init$Audio().$defs$controls(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2c1_=$wgimgr$2c1;
if($wgimgr$2c2===undefined){$wgimgr$2c2=$init$Audio().$defs$loop(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2c2_=$wgimgr$2c2;
if($wgimgr$2c3===undefined){$wgimgr$2c3=$init$Audio().$defs$muted(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2c3_=$wgimgr$2c3;
if($wgimgr$2c4===undefined){$wgimgr$2c4=$init$Audio().$defs$preload(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c5,$wgimgr$2c6,children);}
audio$.$wgimgr$2c4_=$wgimgr$2c4;
if($wgimgr$2c5===undefined){$wgimgr$2c5=$init$Audio().$defs$src(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c6,children);}
audio$.$wgimgr$2c5_=$wgimgr$2c5;
if($wgimgr$2c6===undefined){$wgimgr$2c6=$init$Audio().$defs$attributes(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,children);}
audio$.$wgimgr$2c6_=$wgimgr$2c6;
if(children===undefined){children=$init$Audio().$defs$children(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6);}
audio$.$wgimgr$2c7_=children;
FlowCategory(audio$);
PhrasingCategory(audio$);
EmbeddedCategory(audio$);
InteractiveCategory(audio$);
Element("audio",$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,m$1.tpl$([attributeEntry("autoplay",$wgimgr$2c0),attributeEntry("controls",$wgimgr$2c1),attributeEntry("loop",$wgimgr$2c2),attributeEntry("muted",$wgimgr$2c3),attributeEntry("preload",$wgimgr$2c4),attributeEntry("src",$wgimgr$2c5)],$wgimgr$2c6),children,audio$);
return audio$;
}
Audio.$defs$id=function(audio$,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$clazz=function(audio$,$wgimgr$2bl,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$accessKey=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$contentEditable=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$contextMenu=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$dir=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$draggable=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$dropZone=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$hidden=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$lang=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$spellcheck=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$style=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$tabIndex=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$title=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$translate=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$autoplay=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$controls=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$loop=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$muted=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$preload=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c5,$wgimgr$2c6,children){return null};Audio.$defs$src=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c6,children){return null};Audio.$defs$attributes=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,children){return m$1.empty()};Audio.$defs$children=function(audio$,$wgimgr$2bl,$wgimgr$2bm,$wgimgr$2bn,$wgimgr$2bo,$wgimgr$2bp,$wgimgr$2bq,$wgimgr$2br,$wgimgr$2bs,$wgimgr$2bt,$wgimgr$2bu,$wgimgr$2bv,$wgimgr$2bw,$wgimgr$2bx,$wgimgr$2by,$wgimgr$2bz,$wgimgr$2c0,$wgimgr$2c1,$wgimgr$2c2,$wgimgr$2c3,$wgimgr$2c4,$wgimgr$2c5,$wgimgr$2c6){return m$1.empty()};Audio.$crtmm$=function(){return{mod:$CCMM$,'super':{t:Element},ps:[{nm:'id',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:id$ujf2jw')];}},{nm:'clazz',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:clazz$ghieev')];}},{nm:'accessKey',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:accessKey$sqahlg')];}},{nm:'contentEditable',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:contentEditable$9xqzve')];}},{nm:'contextMenu',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:contextMenu$k4kfwx')];}},{nm:'dir',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:dir$sd2uq2')];}},{nm:'draggable',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:draggable$yamhhm')];}},{nm:'dropZone',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:dropZone$has0p8')];}},{nm:'hidden',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:hidden$zglkvp')];}},{nm:'lang',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:lang$qm05e9')];}},{nm:'spellcheck',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:spellcheck$rndxox')];}},{nm:'style',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:style$v6ooee')];}},{nm:'tabIndex',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:tabIndex$4395ga')];}},{nm:'title',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:title$hsyv7b')];}},{nm:'translate',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:translate$ay2b67')];}},{nm:'autoplay',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:autoplay$u0689o')];}},{nm:'controls',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:controls$9tyw21')];}},{nm:'loop',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:loop$qb07bf')];}},{nm:'muted',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:muted$e0nv8c')];}},{nm:'preload',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:preload$3zbymq')];}},{nm:'src',mt:'prm',def:1,$t:Attribute(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:src$s144wb')];}},{nm:'attributes',mt:'prm',def:1,$t:Attributes(),an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:attributes$9h6yfk')];}},{nm:'children',mt:'prm',def:1,$t:{t:m$1.Iterable,a:{Element$Iterable:Content(),Absent$Iterable:{t:m$1.Null}}},pa:3,an:function(){return[m$1.doc("The children of this element.")];}}],sts:[{t:FlowCategory},{t:PhrasingCategory},{t:EmbeddedCategory},{t:InteractiveCategory}],pa:1,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio'),m$1.tagged(m$1.$arr$sa$(["flow","phrasing","embedded","interactive"],{t:m$1.$_String}))];},d:['ceylon.html','Audio']};};
ex$.Audio=Audio;
function $init$Audio(){
if(Audio.$$===undefined){
m$1.initTypeProto(Audio,'ceylon.html::Audio',$init$Element(),$init$FlowCategory(),$init$PhrasingCategory(),$init$EmbeddedCategory(),$init$InteractiveCategory());
(function(audio$){
m$1.atr$(audio$,'$wgimgr$2bl',function(){return this.$wgimgr$2bl_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:id$ujf2jw')];},d:['ceylon.html','Audio','$at','id$ujf2jw']};});
m$1.atr$(audio$,'$wgimgr$2bm',function(){return this.$wgimgr$2bm_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:clazz$ghieev')];},d:['ceylon.html','Audio','$at','clazz$ghieev']};});
m$1.atr$(audio$,'$wgimgr$2bn',function(){return this.$wgimgr$2bn_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:accessKey$sqahlg')];},d:['ceylon.html','Audio','$at','accessKey$sqahlg']};});
m$1.atr$(audio$,'$wgimgr$2bo',function(){return this.$wgimgr$2bo_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:contentEditable$9xqzve')];},d:['ceylon.html','Audio','$at','contentEditable$9xqzve']};});
m$1.atr$(audio$,'$wgimgr$2bp',function(){return this.$wgimgr$2bp_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:contextMenu$k4kfwx')];},d:['ceylon.html','Audio','$at','contextMenu$k4kfwx']};});
m$1.atr$(audio$,'$wgimgr$2bq',function(){return this.$wgimgr$2bq_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:dir$sd2uq2')];},d:['ceylon.html','Audio','$at','dir$sd2uq2']};});
m$1.atr$(audio$,'$wgimgr$2br',function(){return this.$wgimgr$2br_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:draggable$yamhhm')];},d:['ceylon.html','Audio','$at','draggable$yamhhm']};});
m$1.atr$(audio$,'$wgimgr$2bs',function(){return this.$wgimgr$2bs_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:dropZone$has0p8')];},d:['ceylon.html','Audio','$at','dropZone$has0p8']};});
m$1.atr$(audio$,'$wgimgr$2bt',function(){return this.$wgimgr$2bt_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:hidden$zglkvp')];},d:['ceylon.html','Audio','$at','hidden$zglkvp']};});
m$1.atr$(audio$,'$wgimgr$2bu',function(){return this.$wgimgr$2bu_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:lang$qm05e9')];},d:['ceylon.html','Audio','$at','lang$qm05e9']};});
m$1.atr$(audio$,'$wgimgr$2bv',function(){return this.$wgimgr$2bv_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:spellcheck$rndxox')];},d:['ceylon.html','Audio','$at','spellcheck$rndxox']};});
m$1.atr$(audio$,'$wgimgr$2bw',function(){return this.$wgimgr$2bw_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:style$v6ooee')];},d:['ceylon.html','Audio','$at','style$v6ooee']};});
m$1.atr$(audio$,'$wgimgr$2bx',function(){return this.$wgimgr$2bx_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:tabIndex$4395ga')];},d:['ceylon.html','Audio','$at','tabIndex$4395ga']};});
m$1.atr$(audio$,'$wgimgr$2by',function(){return this.$wgimgr$2by_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:title$hsyv7b')];},d:['ceylon.html','Audio','$at','title$hsyv7b']};});
m$1.atr$(audio$,'$wgimgr$2bz',function(){return this.$wgimgr$2bz_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:translate$ay2b67')];},d:['ceylon.html','Audio','$at','translate$ay2b67']};});
m$1.atr$(audio$,'$wgimgr$2c0',function(){return this.$wgimgr$2c0_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:autoplay$u0689o')];},d:['ceylon.html','Audio','$at','autoplay$u0689o']};});
m$1.atr$(audio$,'$wgimgr$2c1',function(){return this.$wgimgr$2c1_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:controls$9tyw21')];},d:['ceylon.html','Audio','$at','controls$9tyw21']};});
m$1.atr$(audio$,'$wgimgr$2c2',function(){return this.$wgimgr$2c2_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:loop$qb07bf')];},d:['ceylon.html','Audio','$at','loop$qb07bf']};});
m$1.atr$(audio$,'$wgimgr$2c3',function(){return this.$wgimgr$2c3_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:muted$e0nv8c')];},d:['ceylon.html','Audio','$at','muted$e0nv8c']};});
m$1.atr$(audio$,'$wgimgr$2c4',function(){return this.$wgimgr$2c4_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:preload$3zbymq')];},d:['ceylon.html','Audio','$at','preload$3zbymq']};});
m$1.atr$(audio$,'$wgimgr$2c5',function(){return this.$wgimgr$2c5_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:src$s144wb')];},d:['ceylon.html','Audio','$at','src$s144wb']};});
m$1.atr$(audio$,'$wgimgr$2c6',function(){return this.$wgimgr$2c6_;},undefined,function(){return{mod:$CCMM$,$t:Attributes(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:attributes$9h6yfk')];},d:['ceylon.html','Audio','$at','attributes$9h6yfk']};});
m$1.atr$(audio$,'children',function(){return this.$wgimgr$2c7_;},undefined,function(){return{mod:$CCMM$,$t:{t:m$1.Iterable,a:{Element$Iterable:Content(),Absent$Iterable:{t:m$1.Null}}},$cont:Audio,pa:3,an:function(){return[m$1.doc("The children of this element.")];},d:['ceylon.html','Audio','$at','children']};});
audio$.toString=function(){return this.string.valueOf();};
})(Audio.$$.prototype);
}
return Audio;
}
ex$.$init$Audio=$init$Audio;$init$Audio();

This pattern is repeated for every object in the module, and is bigger when there are many class parameters, which is the case for the ceylon.html module.

Several remarks on this:

  • For the 2 main parts of this code extract, there are many repetitions of similar code or constants that could be factorized in a local function, which would obviously reduce the code size greatly
  • the $init$Audio(); function is called at start at the module level afaict, which means that this code won't be removed by any Javascript optimizer, since this method will considered used even if the corresponding class is never used. Woudln't it be possible to call these init methods lazily, when the corresponding class is being access / used ?

@chochos any idea about this one ?

or guidelines on where to start ?

That code is generated like that because of defaulted parameters. For every defaulted parameter in the constructor, there is an internal function that returns the default value if the argument is not passed, and that internal function receives all of the constructor's parameters.

I guess another way to do it is to assign the default values in the $init$Foo() function, and then only assign the argument to the field if it's not null:

$init$Audio(); //Inside this, default values are assigned to all parameters of the class initializer
if ($arg1 !== undefined) instance$.$field1_=$arg1;

You have to be careful with classes that have constructors instead of an initializer though.

I guess the $init$Class() function should receive the initializer's parameters so it can create the default values.

ClassGenerator in the js compiler that generates code for classes; the $init$Class() methods are created there IIRC as well as the initializer body and the internal methods to return the default initializer parameters. Also look at TypeGenerator.

BTW is there a reason why we don't use Javascript classes in JS generation ?

you mean like helpers? There are a bunch of helpers in JS...

Oh. Because I started writing this in 2012, and with the constant changes and new features I never had time to update to the newer version of JS (which BTW it says 2015 but that's usually not the year when all browsers and node adopt it).

Ah, OK

And for generation isn't it possible to do something like:

for (attr in [
['$wgimgr$2bl',this.$wgimgr$2bl_,Attribute(),'id$ujf2jw'],
['$wgimgr$2bm',this.$wgimgr$2bm_,Attribute(),'clazz$ghieev'],
...
etc, etc ...
... 
['$wgimgr$2c6',this.$wgimgr$2c6_,Attributes(),'attributes$9h6yfk]
]) {
  m$1.atr$(audio$,attr[0],function(){return attr[1];},undefined,function(){return{mod:$CCMM$,attr[2],$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:'+attr[3])];},d:['ceylon.html','Audio','$at',attr[3]]};});
}

instead of the much longer (especially when there are many class parameters):

m$1.atr$(audio$,'$wgimgr$2bl',function(){return this.$wgimgr$2bl_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:id$ujf2jw')];},d:['ceylon.html','Audio','$at','id$ujf2jw']};});
m$1.atr$(audio$,'$wgimgr$2bm',function(){return this.$wgimgr$2bm_;},undefined,function(){return{mod:$CCMM$,$t:Attribute(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:clazz$ghieev')];},d:['ceylon.html','Audio','$at','clazz$ghieev']};});
...
etc, etc ...
... 
m$1.atr$(audio$,'$wgimgr$2c6',function(){return this.$wgimgr$2c6_;},undefined,function(){return{mod:$CCMM$,$t:Attributes(),$cont:Audio,an:function(){return[m$1.doc$($CCMM$,'ceylon.html:Audio:$at:attributes$9h6yfk')];},d:['ceylon.html','Audio','$at','attributes$9h6yfk']};});

That looks nice, except that it doesn't work for the getter, because of capture. You need to actually execute return this.$blabla every time the getter is called; with this scheme, the getter will always return the value that was stored when the attribute was defined. But I guess you could put function(){return this.$foo} in the array, that should work.

Thanks for your answer. Any idea about how to implement such an optimization ? Doesn't seem obvious from the code.

Also what about the second question of the issue:

  • the $init$Audio(); function is called at start at the module level afaict, which means that this code won't be removed by any Javascript optimizer, since this method will considered used even if the corresponding class is never used. Woudln't it be possible to call these init methods lazily, when the corresponding class is being access / used ?

I don't recall $init$Type() methods being called at the start of the module level; IIRC they're called lazily and the reason they're needed is to make sure a type is always properly initialized before being used.

As for the optimization, take a look at AttributeGenerator.defineAsProperty, that's where the atr$ function call is generated. There must be a look in ClassGenerator or TypeGenerator going through a type's attributes and calling that method.