Commit 974ecdc0

974ecdc06b31Merged

Yukihiro "Matz" Matsumoto <[email protected]> · 6 months ago · 3 files · +2 added · ~1 modified

Description

Merge pull request #101 from sacckey/fix/constant-path-class-method-dispatch

Support class method dispatch on ConstantPath receivers

Details

Commit
974ecdc06b31
Parent
56443c2314c9
Merge parent
3794739160d3

spinel_codegen.rbmodifiedView file

@@ -16253,9 +16253,10 @@
1625316253 end
1625416254
1625516255 def compile_constant_recv_expr(nid, mname, recv, rc)
16256- # ARGV methods
16257- if @nd_type[recv] == "ConstantReadNode"
16258- if @nd_name[recv] == "ARGV"
16256+ rcname = constructor_class_name(recv)
16257+ if rcname != ""
16258+ # ARGV methods
16259+ if rcname == "ARGV"
1625916260 if mname == "length"
1626016261 return "sp_argv.len"
1626116262 end
@@ -16264,11 +16265,7 @@
1626416265 return "((" + idx_expr + " < sp_argv.len) ? sp_argv.data[(int)" + idx_expr + "] : NULL)"
1626516266 end
1626616267 end
16267- end
16268-
16269- # Math
16270- if @nd_type[recv] == "ConstantReadNode"
16271- rcname = @nd_name[recv]
16268+ # Math
1627216269 if rcname == "Math"
1627316270 if mname == "sqrt"
1627416271 return "sqrt(" + compile_arg0(nid) + ")"