Skip to content
This repository has been archived by the owner on Sep 7, 2023. It is now read-only.

Commit

Permalink
(fix) Adjust generated code for main/init
Browse files Browse the repository at this point in the history
Signed-off-by: Jerome Simeon <[email protected]>
  • Loading branch information
jeromesimeon committed Jun 11, 2018
1 parent ddf7744 commit 8ee058e
Show file tree
Hide file tree
Showing 4 changed files with 1,484 additions and 1,472 deletions.
4 changes: 4 additions & 0 deletions mechanization/Ergo/Lang/ErgoExpand.v
Original file line number Diff line number Diff line change
Expand Up @@ -85,8 +85,12 @@ Section ErgoExpand.
match_of_sigs namespace v0 effparam0 effparamrest ss
end.

Definition filter_init sigs :=
filter (fun s => if (string_dec s.(cto_signature_name) clause_init_name) then false else true) sigs.

Definition create_main_clause_for_contract (namespace:string) (c:ergo_contract) : eresult ergo_clause :=
let sigs := lookup_contract_signatures c in
let sigs := filter_init sigs in
let effparams := EVar "request"%string :: nil in
elift
(fun disp =>
Expand Down
48 changes: 26 additions & 22 deletions mechanization/Translation/ErgoCalculustoJavaScriptCicero.v
Original file line number Diff line number Diff line change
Expand Up @@ -121,29 +121,33 @@ Section ErgoCalculustoJavaScriptCicero.
match sigs with
| nil => nil
| sig :: rest =>
let fname := sig.(cto_signature_name) in
let params := sig.(cto_signature_params) in
let outtype := sig.(cto_signature_output) in
let emitstype := sig.(cto_signature_emits) in
match params with
| nil => filter_signatures namespace rest
| (_,reqtype)::nil =>
match reqtype, outtype, emitstype with
| CTOClassRef reqname, CTOClassRef outname, Some (CTOClassRef emitsname) =>
let qreqname := absolute_ref_of_relative_ref namespace reqname in
let qoutname := absolute_ref_of_relative_ref namespace outname in
let qemitsname := absolute_ref_of_relative_ref namespace emitsname in
(fname,qreqname,qoutname,qemitsname) :: (filter_signatures namespace rest)
| CTOClassRef reqname, CTOClassRef outname, None =>
let qreqname := absolute_ref_of_relative_ref namespace reqname in
let qoutname := absolute_ref_of_relative_ref namespace outname in
let qemitsname := default_emits in
(fname,qreqname,qoutname,qemitsname) :: (filter_signatures namespace rest)
| _, _, _ =>
filter_signatures namespace rest
if (string_dec sig.(cto_signature_name) clause_main_name)
then
filter_signatures namespace rest
else
let fname := sig.(cto_signature_name) in
let params := sig.(cto_signature_params) in
let outtype := sig.(cto_signature_output) in
let emitstype := sig.(cto_signature_emits) in
match params with
| nil => filter_signatures namespace rest
| (_,reqtype)::nil =>
match reqtype, outtype, emitstype with
| CTOClassRef reqname, CTOClassRef outname, Some (CTOClassRef emitsname) =>
let qreqname := absolute_ref_of_relative_ref namespace reqname in
let qoutname := absolute_ref_of_relative_ref namespace outname in
let qemitsname := absolute_ref_of_relative_ref namespace emitsname in
(fname,qreqname,qoutname,qemitsname) :: (filter_signatures namespace rest)
| CTOClassRef reqname, CTOClassRef outname, None =>
let qreqname := absolute_ref_of_relative_ref namespace reqname in
let qoutname := absolute_ref_of_relative_ref namespace outname in
let qemitsname := default_emits in
(fname,qreqname,qoutname,qemitsname) :: (filter_signatures namespace rest)
| _, _, _ =>
filter_signatures namespace rest
end
| _ :: _ => filter_signatures namespace rest
end
| _ :: _ => filter_signatures namespace rest
end
end.

Definition ergoc_package_to_javascript_cicero
Expand Down
1,508 changes: 755 additions & 753 deletions packages/ergo-cli/lib/ergoc-lib.js

Large diffs are not rendered by default.

1,396 changes: 699 additions & 697 deletions packages/ergo-compiler/lib/ergo-core.js

Large diffs are not rendered by default.

0 comments on commit 8ee058e

Please sign in to comment.