@@ -460,7 +460,8 @@ class Module {
460460 var tguid = macro : cdb. Types . GuidInt < $t > ;
461461 var tableName = s .name ;
462462 var fields : Array <haxe.macro. Expr . Field > = [];
463- if ( s .name .indexOf (' @' ) < 0 ) {
463+ if ( s .name .indexOf (' @' ) < 0 && idField != null ) {
464+ // allowing get() should be possible if we generate an Index for GUID + no ID
464465 fields .push ({
465466 name : " get" ,
466467 pos : pos ,
@@ -471,19 +472,17 @@ class Module {
471472 expr : macro return this .isNull () ? null : $i {modName }.$tableName .getUID (this ),
472473 })
473474 });
474- if ( idField != null ) {
475- fields .push ({
476- name : " fromKind" ,
477- pos : pos ,
478- access : [AStatic ],
479- meta : [{name :" :from" ,params :[],pos :pos }],
480- kind : FFun ({
481- args : [{ name : " kind" , type : TPath ({ name : tkind , pack : [] }) }],
482- ret : TPath ({ name : tname + " Guid" , pack : [] }),
483- expr : macro return kind == null ? cdb. Types . GuidInt .getNull () : cast $i {modName }.$tableName .get (kind ).$guidField .toInt (),
484- })
485- });
486- }
475+ fields .push ({
476+ name : " fromKind" ,
477+ pos : pos ,
478+ access : [AStatic ],
479+ meta : [{name :" :from" ,params :[],pos :pos }],
480+ kind : FFun ({
481+ args : [{ name : " kind" , type : TPath ({ name : tkind , pack : [] }) }],
482+ ret : TPath ({ name : tname + " Guid" , pack : [] }),
483+ expr : macro return kind == null ? cdb. Types . GuidInt .getNull () : cast $i {modName }.$tableName .get (kind ).$guidField .toInt (),
484+ })
485+ });
487486 }
488487 types .push ({
489488 pos : pos ,
0 commit comments