Smart pascal source code type
TProc = procedure;{ unit1.pas unit }var
a: arrayof TProc;
proc: TProc;
procedureDummy;begin{just to test}end;
procedureTest;begin{just to test}end;
beginif Dummy in a thenWriteln('bug1');
proc := Dummy;
A.Add(proc);
if proc notin a thenWriteln('bug2');
if Dummy in a thenWriteln('ok');
{
ok
}{ unit2.pas unit }
a.add(proc);
IfnilIn a Thenwriteln('0');
If proc In a Thenwriteln('1');
If @proc In a Thenwriteln('2');
If Test In a Thenwriteln('bug1');
If @Test In a Thenwriteln('bug2');
{
0
1
2
}
{ unit1.js }
var a = [],
proc = null;
functionDummy() {
/* null */
};
if (a.indexOf(Dummy)>=0) {
WriteLn("bug1");
}
proc = Dummy;
a.push(proc);
if (!(a.indexOf(proc)>=0)) {
WriteLn("bug2");
}
if (a.indexOf(Dummy)>=0) {
WriteLn("ok");
}
{ unit2.js }
var a = [],
proc = null;
functionTest() {
/* null */
};
a.push(proc);
if (a.indexOf(null)>=0) {
WriteLn("0");
}
if (a.indexOf(proc)>=0) {
WriteLn("1");
}
if (a.indexOf(proc)>=0) {
WriteLn("2");
}
if (a.indexOf(Test)>=0) {
WriteLn("bug1");
}
if (a.indexOf(Test)>=0) {
WriteLn("bug2");
}