Skip to content

Commit

Permalink
fixup! Add optimization rule for Vector.fromList and Array.fromList
Browse files Browse the repository at this point in the history
  • Loading branch information
minoki committed Sep 11, 2024
1 parent 18122a4 commit e36fa8c
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/codegen-lua.sml
Original file line number Diff line number Diff line change
Expand Up @@ -1419,6 +1419,15 @@ struct
( fn a => L.IndexExp (a, L.ConstExp (L.LiteralString "n"))
, PURE
)
| Primitives.Array_fromList =>
doUnaryExp
( fn xs =>
L.CallExp
( L.VarExp (L.PredefinedId "_VectorOrArray_fromList")
, vector [xs]
)
, PURE
)
| Primitives.Unsafe_Vector_sub _ =>
doBinaryExp
( fn (vec, i) =>
Expand Down

0 comments on commit e36fa8c

Please sign in to comment.