[goalc] fix static array length (#836)

* fix static array length

* add some more small fixes
This commit is contained in:
water111
2021-09-08 18:49:49 -04:00
committed by GitHub
parent 468352cb4e
commit 9fdbc2d974
12 changed files with 192 additions and 101 deletions
+1 -1
View File
@@ -320,7 +320,7 @@
(when (and (not sv-224) (>= (-> arg0 coverage) 0.9))
(set! sv-80 (logior sv-80 2))
(set! (-> arg0 ground-poly-normal quad) (-> arg0 poly-normal quad))
(when (!= (-> arg0 poly-pat mode) 1)
(when (!= (-> arg0 poly-pat mode) (pat-mode wall))
(set! (-> arg0 ground-pat) (-> arg0 poly-pat))
(set! (-> arg0 ground-touch-point quad) (-> arg1 best-tri intersect quad))
)
+72 -65
View File
@@ -36,74 +36,78 @@
(new 'static 'sp-field-init-spec
:field #x6
:flags #x1
:initial-value #x3fc00000
:random-mult #x3f800000
:initial-valuef 1.5
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #xb
:flags #x1
:initial-value #x45800000
:random-mult #x3f800000
:initial-valuef 4096.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #xe
:initial-valuef (the-as float #x5)
:random-multf (the-as float #x1)
)
(new 'static 'sp-field-init-spec :field #xe :initial-value 5 :random-mult 1)
(new 'static 'sp-field-init-spec
:field #x12
:flags #x1
:initial-value #x45a66666
:random-mult #x3f800000
:initial-valuef 5324.8
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x13
:flags #x1
:initial-value #x45800000
:random-mult #x3f800000
:initial-valuef 4096.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x14
:flags #x1
:initial-value #x45666666
:random-mult #x3f800000
:initial-valuef 3686.4
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x1a
:flags #x1
:initial-value #x415a740e
:random-mult #x3f800000
:initial-valuef 13.653334
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x23
:flags #x1
:initial-value -1048374674
:random-mult #x3f800000
:initial-valuef -16.383999
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x2e
:initial-value 25
:random-mult 1
:initial-valuef (the-as float #x19)
:random-multf (the-as float #x1)
)
(new 'static 'sp-field-init-spec
:field #x2f
:initial-value #x100
:random-mult 1
:initial-valuef (the-as float #x100)
:random-multf (the-as float #x1)
)
(new 'static 'sp-field-init-spec
:field #x3a
:flags #x1
:initial-value #x46c71c72
:random-range #x45e38e39
:random-mult #x3f800000
:initial-valuef 25486.223
:random-rangef 7281.778
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x3b
:flags #x1
:random-range #x47800000
:random-mult #x3f800000
:random-rangef 65536.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x3e
:flags #x1
:initial-value #x46400000
:random-mult #x3f800000
:initial-valuef 12288.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec :field #x43)
)
@@ -116,110 +120,113 @@
(new 'static 'sparticle-launcher
:init-specs
(new 'static 'inline-array sp-field-init-spec 19
(new 'static 'sp-field-init-spec :field #x1 :initial-value #x200f00)
(new 'static 'sp-field-init-spec
:field #x1
:initial-valuef (the-as float #x200f00)
)
(new 'static 'sp-field-init-spec
:field #x6
:flags #x1
:initial-value #x40000000
:random-mult #x3f800000
:initial-valuef 2.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #xb
:flags #x1
:initial-value #x45c00000
:random-mult #x3f800000
:initial-valuef 6144.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #xd
:flags #x1
:initial-value #x46000000
:random-range #x45800000
:random-mult #x3f800000
:initial-valuef 8192.0
:random-rangef 4096.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x11
:flags #x3
:initial-value -4
:random-mult 1
:initial-valuef (the-as float #xfffffffc)
:random-multf (the-as float #x1)
)
(new 'static 'sp-field-init-spec
:field #x13
:flags #x1
:random-range #x42800000
:random-mult #x3f800000
:random-rangef 64.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x14
:flags #x1
:initial-value #x43000000
:random-range #x43000000
:random-mult #x3f800000
:initial-valuef 128.0
:random-rangef 128.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x15
:flags #x1
:initial-value #x41800000
:random-range #x42000000
:random-mult #x3f800000
:initial-valuef 16.0
:random-rangef 32.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x1a
:flags #x1
:initial-value #x4223d70a
:random-mult #x3f800000
:initial-valuef 40.96
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x22
:flags #x1
:initial-value -1092979698
:random-mult #x3f800000
:initial-valuef -0.42666668
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x24
:flags #x1
:initial-value -1096558838
:random-mult #x3f800000
:initial-valuef -0.32
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x26
:flags #x1
:initial-value -1106522267
:random-mult #x3f800000
:initial-valuef -0.13653333
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x2d
:flags #x1
:initial-value #x3f75c28f
:random-mult #x3f800000
:initial-valuef 0.96
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x2e
:initial-value #x96
:random-mult 1
:initial-valuef (the-as float #x96)
:random-multf (the-as float #x1)
)
(new 'static 'sp-field-init-spec
:field #x2f
:initial-value 12
:random-mult 1
:initial-valuef (the-as float #xc)
:random-multf (the-as float #x1)
)
(new 'static 'sp-field-init-spec
:field #x3a
:flags #x1
:initial-value #x46b8e38e
:random-range #x468e38e4
:random-mult #x3f800000
:initial-valuef 23665.777
:random-rangef 18204.445
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x3b
:flags #x1
:random-range #x47800000
:random-mult #x3f800000
:random-rangef 65536.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec
:field #x3e
:flags #x1
:initial-value #x46400000
:random-mult #x3f800000
:initial-valuef 12288.0
:random-multf 1.0
)
(new 'static 'sp-field-init-spec :field #x43)
)
+10 -2
View File
@@ -903,7 +903,11 @@
)
)
((= v1-59 1)
(if (!= (get-task-status (game-task cave-gnawers)) 5)
(if
(!=
(get-task-status (game-task cave-gnawers))
(task-status need-reminder)
)
(set! s4-2 2)
)
)
@@ -933,7 +937,11 @@
)
)
(else
(if (!= (get-task-status (game-task snow-eggtop)) 5)
(if
(!=
(get-task-status (game-task snow-eggtop))
(task-status need-reminder)
)
(set! s4-2 0)
)
)
@@ -0,0 +1,35 @@
(deftype test-parent-type (basic)
()
(:methods
(test-method (_type_) int)
)
)
(defmethod test-method test-parent-type ((obj test-parent-type))
4
)
(declare-type test-child-type test-parent-type)
(defun test-method-call ((obj test-child-type))
(test-method obj)
)
(deftype test-child-type (test-parent-type)
()
)
(defmethod test-method test-child-type ((obj test-child-type))
12
)
(format #t "~d ~d~%"
(test-method (new 'static 'test-parent-type))
(test-method-call (new 'static 'test-child-type))
)
+5
View File
@@ -890,6 +890,11 @@ TEST_F(WithGameTests, ProcessAllocation) {
{"diff is 16\n0\n"});
}
TEST_F(WithGameTests, MethodCallForwardDeclared) {
shared_compiler->runner.run_static_test(env, testCategory, "test-forward-declared-method.gc",
{"4 12\n0\n"});
}
TEST(TypeConsistency, TypeConsistency) {
Compiler compiler;
compiler.enable_throw_on_redefines();