Sfoglia il codice sorgente

null closure now returns null (fixed issue #1788)

Nicolas Cannasse 12 anni fa
parent
commit
76b23e03e4
1 ha cambiato i file con 1 aggiunte e 1 eliminazioni
  1. 1 1
      genjs.ml

+ 1 - 1
genjs.ml

@@ -1173,7 +1173,7 @@ let generate com =
 	if has_feature ctx "use.$bind" then begin
 		print ctx "var $_, $fid = 0";
 		newline ctx;
-		print ctx "function $bind(o,m) { if( m.__id__ == null ) m.__id__ = $fid++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = function(){ return f.method.apply(f.scope, arguments); }; f.scope = o; f.method = m; o.hx__closures__[m.__id__] = f; } return f; }";
+		print ctx "function $bind(o,m) { if( m == null ) return null; if( m.__id__ == null ) m.__id__ = $fid++; var f; if( o.hx__closures__ == null ) o.hx__closures__ = {}; else f = o.hx__closures__[m.__id__]; if( f == null ) { f = function(){ return f.method.apply(f.scope, arguments); }; f.scope = o; f.method = m; o.hx__closures__[m.__id__] = f; } return f; }";
 		ctx.separator <- true;
 		newline ctx;
 	end;