[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
+10 -15
View File
@@ -2467,19 +2467,15 @@ TEST_F(FormRegressionTest, StringLt) {
std::string type = "(function string string symbol)";
std::string expected =
"(begin\n"
" (let\n"
" ((s4-1\n"
" (min\n"
" ((method-of-type string length) arg0)\n"
" ((method-of-type string length) arg1)\n"
" )\n"
" )\n"
" )\n"
" (dotimes\n"
" (v1-4 s4-1)\n"
" (let ((s4-1 (min (length arg0) (length arg1))))\n"
" (dotimes (v1-4 s4-1)\n"
" (cond\n"
" ((< (-> arg0 data v1-4) (-> arg1 data v1-4)) (return #t))\n"
" ((< (-> arg1 data v1-4) (-> arg0 data v1-4)) (return #f))\n"
" ((< (-> arg0 data v1-4) (-> arg1 data v1-4))\n"
" (return #t)\n"
" )\n"
" ((< (-> arg1 data v1-4) (-> arg0 data v1-4))\n"
" (return #f)\n"
" )\n"
" )\n"
" )\n"
" )\n"
@@ -2714,9 +2710,8 @@ TEST_F(FormRegressionTest, StripStripTrailingWhitespace) {
std::string type = "(function string symbol)";
std::string expected =
"(begin\n"
" (when (nonzero? ((method-of-type string length) arg0))\n"
" (let\n"
" ((v1-6 (&+ (-> arg0 data) (+ ((method-of-type string length) arg0) -1))))\n"
" (when (nonzero? (length arg0))\n"
" (let ((v1-6 (&+ (-> arg0 data) (+ (length arg0) -1))))\n"
" (while\n"
" (and\n"
" (>= (the-as int v1-6) (the-as int (-> arg0 data)))\n"