Smart pascal source code
type
TProc = procedure;
{ unit1.pas unit }
var
a: array of TProc;
proc: TProc;
procedure Dummy;
begin
{just to test}
end;
procedure Test;
begin
{just to test}
end;
begin
if Dummy in a then
Writeln('bug1');
proc := Dummy;
A.Add(proc);
if proc not in a then
Writeln('bug2');
if Dummy in a then
Writeln('ok');
{
ok
}
{ unit2.pas unit }
a.add(proc);
If nil In a Then
writeln('0');
If proc In a Then
writeln('1');
If @proc In a Then
writeln('2');
If Test In a Then
writeln('bug1');
If @Test In a Then
writeln('bug2');
{
0
1
2
}
{ unit1.js }
var a = [],
proc = null;
function Dummy() {
/* 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;
function Test() {
/* 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");
}