Skip to content

Commit

Permalink
Unify error message when read method field
Browse files Browse the repository at this point in the history
  • Loading branch information
yuxiaomao committed Jun 18, 2024
1 parent efd35a5 commit ece6460
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions hld/Eval.hx
Original file line number Diff line number Diff line change
Expand Up @@ -1331,7 +1331,9 @@ class Eval {
return ptr == null ? AUndef(f.t) : AAddr(ptr.offset(offset), f.t);
}
var f = p.methods.get(name);
if( f != null && ptr != null ) {
if( f != null ) {
if( ptr == null )
return AUndef(f.t);
// HMethod
var vt = readPointer(ptr);
var vobj = readPointer(vt.offset(align.ptr));
Expand All @@ -1340,7 +1342,11 @@ class Eval {
return AMethod(v, readPointer(vmethods.offset(f.index * align.ptr)), f.t);
}
var f = p.methods.get("get_"+name);
if( f != null && ptr != null && allowEvalGetters ) {
if( f != null ) {
if( ptr == null )
return AUndef(f.t);
if( !allowEvalGetters )
throw "Eval not allowed get_" + name + "()";
var f = readFieldAddress(v, "get_"+name);
switch( f ) {
case AMethod(obj, ptr, HFun(ft)) if( ft.args.length == 1 ):
Expand Down

0 comments on commit ece6460

Please sign in to comment.