diff options
author | Camil Staps | 2023-02-01 21:24:22 +0100 |
---|---|---|
committer | Camil Staps | 2023-02-01 21:31:07 +0100 |
commit | cf5e68a5a2bf31d06f7b84a6b1f5cf350351865d (patch) | |
tree | 9910f66646af33af446a9aed081c3c1d4ef97d60 | |
parent | Remove ambiguity from function definition syntax: Type (x y) could have Type ... (diff) |
Fix argument order in function calls
-rw-r--r-- | snug-clean/src/Snug/Compile.icl | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/snug-clean/src/Snug/Compile.icl b/snug-clean/src/Snug/Compile.icl index 50119f3..757b9c3 100644 --- a/snug-clean/src/Snug/Compile.icl +++ b/snug-clean/src/Snug/Compile.icl @@ -141,14 +141,14 @@ simulator ns globals locals expr=:(ExpApp _ _) = case lookupFunction ns id globals of ?None -> abort ("unknown symbol: " +++ id +++ "\n") // TODO pass error up ?Just info | info.arity == length args -> - mapM_ (simulator ns globals locals) args >>| + mapM_ (simulator ns globals locals) (reverse args) >>| buildThunk (functionLabel ns NodeEntry id) info.arity _ -> abort ("arity mismatch in application\n") // TODO implement Constructor id -> case lookupConstructor ns id globals of ?None -> abort ("unknown constructor: " +++ id +++ "\n") // TODO pass error up ?Just (ConstructorDef _ arg_types) | length arg_types == length args -> - mapM_ (simulator ns globals locals) args >>| + mapM_ (simulator ns globals locals) (reverse args) >>| buildCons (constructorLabel ns id) (length args) _ -> abort ("arity mismatch in application of " +++ id +++ "\n") // TODO implement _ -> // TODO |