[decompiler] Better support for non-virtual methods (#543)

* fix up nonvirtual method calls and stack new method calls

* look at final in compiler too
This commit is contained in:
water111
2021-05-30 22:52:40 -04:00
committed by GitHub
parent b1a76b2291
commit c4f44e265f
18 changed files with 217 additions and 139 deletions
@@ -41,7 +41,7 @@
((allocation symbol) (type-to-make type) (arg0 int) (arg1 string))
(cond
(arg1
(let* ((s2-1 (max ((method-of-type string length) arg1) arg0))
(let* ((s2-1 (max (length arg1) arg0))
(a0-4
(object-new
allocation
@@ -277,11 +277,7 @@
;; definition for function string<?
(defun string<? ((a string) (b string))
(let
((len
(min ((method-of-type string length) a) ((method-of-type string length) b))
)
)
(let ((len (min (length a) (length b))))
(dotimes (i len)
(cond
((< (-> a data i) (-> b data i))
@@ -298,11 +294,7 @@
;; definition for function string>?
(defun string>? ((a string) (b string))
(let
((len
(min ((method-of-type string length) a) ((method-of-type string length) b))
)
)
(let ((len (min (length a) (length b))))
(dotimes (i len)
(cond
((< (-> a data i) (-> b data i))
@@ -319,11 +311,7 @@
;; definition for function string<=?
(defun string<=? ((a string) (b string))
(let
((len
(min ((method-of-type string length) a) ((method-of-type string length) b))
)
)
(let ((len (min (length a) (length b))))
(dotimes (i len)
(cond
((< (-> a data i) (-> b data i))
@@ -340,11 +328,7 @@
;; definition for function string>=?
(defun string>=? ((a string) (b string))
(let
((len
(min ((method-of-type string length) a) ((method-of-type string length) b))
)
)
(let ((len (min (length a) (length b))))
(dotimes (i len)
(cond
((< (-> a data i) (-> b data i))
@@ -437,8 +421,8 @@
;; definition for function string-strip-trailing-whitespace!
(defun string-strip-trailing-whitespace! ((str string))
(when (nonzero? ((method-of-type string length) str))
(let ((ptr (&+ (-> str data) (+ ((method-of-type string length) str) -1))))
(when (nonzero? (length str))
(let ((ptr (&+ (-> str data) (+ (length str) -1))))
(while
(and
(>= (the-as int ptr) (the-as int (-> str data)))