Skip to content

Instantly share code, notes, and snippets.

@flaviut
Last active August 29, 2015 13:58
Show Gist options
  • Save flaviut/7c93e80361cbedd125a4 to your computer and use it in GitHub Desktop.
Save flaviut/7c93e80361cbedd125a4 to your computer and use it in GitHub Desktop.
if (TMP1279.status == 0) {
NimStringDesc* volatile line_157648;
NimStringDesc* volatile HEX3Atmp_157699;
FILE* volatile f_157701;
NimStringDesc* volatile res_157703;
F.len+=4;
F.s[2].address = (void*)&line_157648; F.s[2].typ = (&NTI143); F.s[2].name = "line";
F.s[3].address = (void*)&HEX3Atmp_157699; F.s[3].typ = (&NTI143); F.s[3].name = ":tmp";
F.s[4].address = (void*)&f_157701; F.s[4].typ = (&NTI9804); F.s[4].name = "f";
F.s[5].address = (void*)&res_157703; F.s[5].typ = (&NTI143); F.s[5].name = "res";
line_157648 = 0;
HEX3Atmp_157699 = 0;
endb(848, "compiler/msgs.nim");
HEX3Atmp_157699 = tofullpath_156777(i.Fileindex);
endb(2312, "lib/system.nim");
f_157701 = open_10017(HEX3Atmp_157699, ((NU8) 0), -1);
endb(2313, "lib/system.nim");
endb(2313, "lib/system.nim");
res_157703 = rawNewString(80);
endb(2314, "lib/system.nim");
while (1) {
NIM_BOOL LOC13;
endb(2314, "lib/system.nim");
LOC13 = 0;
LOC13 = readline_10287(f_157701, &res_157703);
if (!LOC13) goto LA12;
endb(2313, "lib/system.nim");
line_157648 = res_157703;
endb(849, "compiler/msgs.nim");
addsourceline_157596(i.Fileindex, line_157648);
} LA12: ;
endb(2315, "lib/system.nim");
fclose(f_157701);
popSafePoint();
}
F.len-=4;
else {
popSafePoint();
setFrame((TFrame*)&F);
if (isObj(getCurrentException()->Sup.m_type, (&NTI1433))) {
TMP1279.status = 0;
popCurrentException();
}
}
Full method
-----------------------------------------------
N_NIMCALL(trope138007*, sourceline_156144)(tlineinfo155519 i) {
trope138007* result;
NI TMP1282;
nimfrs("sourceLine", "msgs.nim", 6, 2)
F.s[0].address = (void*)&result; F.s[0].typ = (&NTI138005); F.s[0].name = "result";
F.s[1].address = (void*)&i; F.s[1].typ = (&NTI155519); F.s[1].name = "i";
result = 0;
endb(844, "compiler/msgs.nim");
{
endb(844, "compiler/msgs.nim");
if (!(i.Fileindex < ((NI32) 0))) goto LA3;
endb(844, "compiler/msgs.nim");
endb(844, "compiler/msgs.nim");
result = NIM_NIL;
goto BeforeRet;
}
LA3: ;
endb(846, "compiler/msgs.nim");
{
NIM_BOOL LOC7;
TSafePoint TMP1279;
endb(846, "compiler/msgs.nim");
LOC7 = 0;
endb(846, "compiler/msgs.nim");
endb(846, "compiler/msgs.nim");
LOC7 = !(((gglobaloptions_128109 &(1<<((((NU8) 31))&31)))!=0));
if (!(LOC7)) goto LA8;
endb(846, "compiler/msgs.nim");
endb(846, "compiler/msgs.nim");
if ((NU)(i.Fileindex) >= (NU)(fileinfos_155640->Sup.len)) raiseIndexError();
LOC7 = (fileinfos_155640->data[i.Fileindex].Lines->Sup.len == 0);
LA8: ;
if (!LOC7) goto LA9;
endb(847, "compiler/msgs.nim");
pushSafePoint(&TMP1279);
TMP1279.status = setjmp(TMP1279.context);
if (TMP1279.status == 0) {
NimStringDesc* volatile line_157648;
NimStringDesc* volatile HEX3Atmp_157699;
FILE* volatile f_157701;
NimStringDesc* volatile res_157703;
F.len+=4;
F.s[2].address = (void*)&line_157648; F.s[2].typ = (&NTI143); F.s[2].name = "line";
F.s[3].address = (void*)&HEX3Atmp_157699; F.s[3].typ = (&NTI143); F.s[3].name = ":tmp";
F.s[4].address = (void*)&f_157701; F.s[4].typ = (&NTI9804); F.s[4].name = "f";
F.s[5].address = (void*)&res_157703; F.s[5].typ = (&NTI143); F.s[5].name = "res";
line_157648 = 0;
HEX3Atmp_157699 = 0;
endb(848, "compiler/msgs.nim");
HEX3Atmp_157699 = tofullpath_156777(i.Fileindex);
endb(2312, "lib/system.nim");
f_157701 = open_10017(HEX3Atmp_157699, ((NU8) 0), -1);
endb(2313, "lib/system.nim");
endb(2313, "lib/system.nim");
res_157703 = rawNewString(80);
endb(2314, "lib/system.nim");
while (1) {
NIM_BOOL LOC13;
endb(2314, "lib/system.nim");
LOC13 = 0;
LOC13 = readline_10287(f_157701, &res_157703);
if (!LOC13) goto LA12;
endb(2313, "lib/system.nim");
line_157648 = res_157703;
endb(849, "compiler/msgs.nim");
addsourceline_157596(i.Fileindex, line_157648);
} LA12: ;
endb(2315, "lib/system.nim");
fclose(f_157701);
popSafePoint();
}
F.len-=4;
else {
popSafePoint();
setFrame((TFrame*)&F);
if (isObj(getCurrentException()->Sup.m_type, (&NTI1433))) {
TMP1279.status = 0;
popCurrentException();
}
}
if (TMP1279.status != 0) reraiseException();
}
LA9: ;
endb(838, "compiler/msgs.nim");
{
NimStringDesc* LOC20;
endb(838, "compiler/msgs.nim");
endb(852, "compiler/msgs.nim");
endb(852, "compiler/msgs.nim");
if (!!((((NI) (i.Fileindex)) < fileinfos_155640->Sup.len))) goto LA18;
endb(838, "compiler/msgs.nim");
endb(838, "compiler/msgs.nim");
LOC20 = 0;
LOC20 = HEX24_157672(TMP1280);
internalerror_157569(LOC20);
}
LA18: ;
endb(854, "compiler/msgs.nim");
{
endb(854, "compiler/msgs.nim");
endb(854, "compiler/msgs.nim");
if ((NU)(i.Fileindex) >= (NU)(fileinfos_155640->Sup.len)) raiseIndexError();
if (!(fileinfos_155640->data[i.Fileindex].Lines->Sup.len < ((NI) (i.Line)))) goto LA23;
endb(854, "compiler/msgs.nim");
endb(854, "compiler/msgs.nim");
result = NIM_NIL;
goto BeforeRet;
}
LA23: ;
endb(856, "compiler/msgs.nim");
if ((NU)(i.Fileindex) >= (NU)(fileinfos_155640->Sup.len)) raiseIndexError();
endb(856, "compiler/msgs.nim");
TMP1282 = subInt(i.Line, ((NI16) 1));
if (TMP1282 < -32768 || TMP1282 > 32767) raiseOverflow();
if ((NU)((NI16)(TMP1282)) >= (NU)(fileinfos_155640->data[i.Fileindex].Lines->Sup.len)) raiseIndexError();
result = fileinfos_155640->data[i.Fileindex].Lines->data[(NI16)(TMP1282)];
BeforeRet: ;
popFrame();
return result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment