bug_ref_fn
Это старая версия документа!
Эта страница посвящена поиску бага связанного с вызовом функции init в произвольном модуле из модуля, в котором используются ссылки на функции.
implement Sh93;
include "sys.m";
sys: Sys;
include "draw.m";
Sh93: module
{
init: fn(ctxt: ref Draw->Context, argv: list of string);
};
SomeT: adt {
f: ref fn();
};
empty() {
sys->print("empty\n");
}
init(ctxt: ref Draw->Context, argv: list of string)
{
sys = load Sys Sys->PATH;
if (0)
{
st:= ref SomeT;
st.f = empty;
st.f();
}
file := "echo.dis";
args : list of string;
args = "\"test\"" :: args;
args = "echo" :: args;
c := load Sh93 file;
if(c == nil) {
err := sys->sprint("%r");
if(err != "permission denied" && err != "access permission denied" && file[0]!='/' && file[0:2]!="./"){
c = load Sh93 "/dis/"+file;
if(c == nil) {
err = sys->sprint("%r");
}
}
if(c == nil) {
sys->print("%s: %s\n", "echo", err);
return;
}
}
c->init(ctxt, args);
if (0)
{
st:= ref SomeT;
st.f = empty;
st.f();
}
}
bug_ref_fn.1765682970.txt.gz · Последнее изменение: — snegovick
