Prepare for repl
. . . . . . Revert "Update sophia_stdlib.md (#350)" This reverts commit 7b8957b46af059ab6c24d0675ff8c351da3d60d2. revert . expose lookup . . . . . .
This commit is contained in:
parent
381a7c98cd
commit
73f040afb6
@ -1,4 +1,4 @@
|
|||||||
{"1.1.0",
|
{"1.2.0",
|
||||||
[{<<"aebytecode">>,
|
[{<<"aebytecode">>,
|
||||||
{git,"https://github.com/aeternity/aebytecode.git",
|
{git,"https://github.com/aeternity/aebytecode.git",
|
||||||
{ref,"0699f35b0398bac6cd4468da654d608375bd853d"}},
|
{ref,"0699f35b0398bac6cd4468da654d608375bd853d"}},
|
||||||
@ -24,5 +24,8 @@
|
|||||||
[
|
[
|
||||||
{pkg_hash,[
|
{pkg_hash,[
|
||||||
{<<"eblake2">>, <<"EC8AD20E438AAB3F2E8D5D118C366A0754219195F8A0F536587440F8F9BCF2EF">>},
|
{<<"eblake2">>, <<"EC8AD20E438AAB3F2E8D5D118C366A0754219195F8A0F536587440F8F9BCF2EF">>},
|
||||||
{<<"getopt">>, <<"C73A9FA687B217F2FF79F68A3B637711BB1936E712B521D8CE466B29CBF7808A">>}]}
|
{<<"getopt">>, <<"C73A9FA687B217F2FF79F68A3B637711BB1936E712B521D8CE466B29CBF7808A">>}]},
|
||||||
|
{pkg_hash_ext,[
|
||||||
|
{<<"eblake2">>, <<"3C4D300A91845B25D501929A26AC2E6F7157480846FAB2347A4C11AE52E08A99">>},
|
||||||
|
{<<"getopt">>, <<"53E1AB83B9CEB65C9672D3E7A35B8092E9BDC9B3EE80721471A161C10C59959C">>}]}
|
||||||
].
|
].
|
||||||
|
@ -14,8 +14,13 @@
|
|||||||
|
|
||||||
-export([ infer/1
|
-export([ infer/1
|
||||||
, infer/2
|
, infer/2
|
||||||
|
, unfold_types_in_type/2
|
||||||
, unfold_types_in_type/3
|
, unfold_types_in_type/3
|
||||||
|
, switch_scope/2
|
||||||
, pp_type/2
|
, pp_type/2
|
||||||
|
, lookup_env1/4
|
||||||
|
, name/1
|
||||||
|
, qname/1
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-include("aeso_utils.hrl").
|
-include("aeso_utils.hrl").
|
||||||
@ -159,6 +164,10 @@
|
|||||||
|
|
||||||
%% -- Environment manipulation -----------------------------------------------
|
%% -- Environment manipulation -----------------------------------------------
|
||||||
|
|
||||||
|
-spec switch_scope(qname(), env()) -> env().
|
||||||
|
switch_scope(Scope, Env) ->
|
||||||
|
Env#env{namespace = Scope}.
|
||||||
|
|
||||||
-spec push_scope(namespace | contract, aeso_syntax:con(), env()) -> env().
|
-spec push_scope(namespace | contract, aeso_syntax:con(), env()) -> env().
|
||||||
push_scope(Kind, Con, Env) ->
|
push_scope(Kind, Con, Env) ->
|
||||||
Ann = aeso_syntax:get_ann(Con),
|
Ann = aeso_syntax:get_ann(Con),
|
||||||
@ -403,7 +412,7 @@ lookup_env(Env, Kind, Ann, Name) ->
|
|||||||
end
|
end
|
||||||
end.
|
end.
|
||||||
|
|
||||||
-spec lookup_env1(env(), type | term, aeso_syntax:ann(), qname()) -> false | {qname(), fun_info()}.
|
-spec lookup_env1(env(), type | term, aeso_syntax:ann(), qname()) -> false | {qname(), fun_info() | type_info()}.
|
||||||
lookup_env1(#env{ namespace = Current, used_namespaces = UsedNamespaces, scopes = Scopes }, Kind, Ann, QName) ->
|
lookup_env1(#env{ namespace = Current, used_namespaces = UsedNamespaces, scopes = Scopes }, Kind, Ann, QName) ->
|
||||||
Qual = lists:droplast(QName),
|
Qual = lists:droplast(QName),
|
||||||
Name = lists:last(QName),
|
Name = lists:last(QName),
|
||||||
@ -1586,13 +1595,13 @@ app_t(Ann, Name, Args) -> {app_t, Ann, Name, Args}.
|
|||||||
lookup_name(Env, As, Name) ->
|
lookup_name(Env, As, Name) ->
|
||||||
lookup_name(Env, As, Name, []).
|
lookup_name(Env, As, Name, []).
|
||||||
|
|
||||||
lookup_name(Env = #env{ namespace = NS, current_function = {id, _, Fun} = CurFn }, As, Id, Options) ->
|
lookup_name(Env = #env{ namespace = NS, current_function = CurFn }, As, Id, Options) ->
|
||||||
case lookup_env(Env, term, As, qname(Id)) of
|
case lookup_env(Env, term, As, qname(Id)) of
|
||||||
false ->
|
false ->
|
||||||
type_error({unbound_variable, Id}),
|
type_error({unbound_variable, Id}),
|
||||||
{Id, fresh_uvar(As)};
|
{Id, fresh_uvar(As)};
|
||||||
{QId, {_, Ty}} ->
|
{QId, {_, Ty}} ->
|
||||||
when_warning(warn_unused_variables, fun() -> used_variable(NS, Fun, QId) end),
|
when_warning(warn_unused_variables, fun() -> used_variable(NS, name(CurFn), QId) end),
|
||||||
when_warning(warn_unused_functions,
|
when_warning(warn_unused_functions,
|
||||||
fun() -> register_function_call(NS ++ qname(CurFn), QId) end),
|
fun() -> register_function_call(NS ++ qname(CurFn), QId) end),
|
||||||
Freshen = proplists:get_value(freshen, Options, false),
|
Freshen = proplists:get_value(freshen, Options, false),
|
||||||
|
@ -26,7 +26,7 @@
|
|||||||
-type ann_format() :: '?:' | hex | infix | prefix | elif.
|
-type ann_format() :: '?:' | hex | infix | prefix | elif.
|
||||||
|
|
||||||
-type ann() :: [ {line, ann_line()} | {col, ann_col()} | {format, ann_format()} | {origin, ann_origin()}
|
-type ann() :: [ {line, ann_line()} | {col, ann_col()} | {format, ann_format()} | {origin, ann_origin()}
|
||||||
| stateful | private | payable | main | interface].
|
| stateful | private | payable | main | interface | entrypoint].
|
||||||
|
|
||||||
-type name() :: string().
|
-type name() :: string().
|
||||||
-type id() :: {id, ann(), name()}.
|
-type id() :: {id, ann(), name()}.
|
||||||
@ -42,6 +42,7 @@
|
|||||||
| {contract_child, ann(), con(), [con()], [decl()]}
|
| {contract_child, ann(), con(), [con()], [decl()]}
|
||||||
| {contract_interface, ann(), con(), [con()], [decl()]}
|
| {contract_interface, ann(), con(), [con()], [decl()]}
|
||||||
| {namespace, ann(), con(), [decl()]}
|
| {namespace, ann(), con(), [decl()]}
|
||||||
|
| {include, ann(), {string, ann(), string()}}
|
||||||
| {pragma, ann(), pragma()}
|
| {pragma, ann(), pragma()}
|
||||||
| {type_decl, ann(), id(), [tvar()]} % Only for error msgs
|
| {type_decl, ann(), id(), [tvar()]} % Only for error msgs
|
||||||
| {type_def, ann(), id(), [tvar()], typedef()}
|
| {type_def, ann(), id(), [tvar()], typedef()}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user