Compile bytes(N)
Compile to FATE strings for now
This commit is contained in:
parent
1f40d2a321
commit
2291f8d4c1
@ -359,7 +359,7 @@ global_env() ->
|
||||
Fun1 = fun(S, T) -> Fun([S], T) end,
|
||||
TVar = fun(X) -> {tvar, Ann, "'" ++ X} end,
|
||||
SignId = {id, Ann, "signature"},
|
||||
SignDef = {tuple, Ann, [{int, Ann, 0}, {int, Ann, 0}]},
|
||||
SignDef = {bytes, Ann, <<0:64/unit:8>>},
|
||||
Signature = {named_arg_t, Ann, SignId, SignId, {typed, Ann, SignDef, SignId}},
|
||||
SignFun = fun(Ts, T) -> {type_sig, Ann, [Signature], Ts, T} end,
|
||||
TTL = {qid, Ann, ["Chain", "ttl"]},
|
||||
|
@ -294,6 +294,8 @@ type_to_fcode(Env, Sub, {tuple_t, _, Types}) ->
|
||||
type_to_fcode(Env, Sub, {record_t, Fields}) ->
|
||||
FieldType = fun({field_t, _, _, Ty}) -> Ty end,
|
||||
type_to_fcode(Env, Sub, {tuple_t, [], lists:map(FieldType, Fields)});
|
||||
type_to_fcode(_Env, _Sub, {bytes_t, _, _N}) ->
|
||||
string; %% TODO: add bytes type to FATE?
|
||||
type_to_fcode(_Env, Sub, {tvar, _, X}) ->
|
||||
maps:get(X, Sub, any);
|
||||
type_to_fcode(_Env, _Sub, Type) ->
|
||||
@ -321,6 +323,8 @@ expr_to_fcode(_Env, _Type, {contract_pubkey, _, K}) -> {contract_pubkey, K};
|
||||
expr_to_fcode(_Env, _Type, {oracle_pubkey, _, K}) -> {oracle_pubkey, K};
|
||||
expr_to_fcode(_Env, _Type, {oracle_query_id, _, K}) -> {oracle_query_id, K};
|
||||
|
||||
expr_to_fcode(_Env, _Type, {bytes, _, Bin}) -> {string, Bin};
|
||||
|
||||
%% Variables
|
||||
expr_to_fcode(Env, _Type, {id, _, X}) -> resolve_var(Env, [X]);
|
||||
expr_to_fcode(Env, _Type, {qid, _, X}) -> resolve_var(Env, X);
|
||||
|
Loading…
x
Reference in New Issue
Block a user