* support constset in $if

git-svn-id: trunk@538 -
This commit is contained in:
peter 2005-06-30 08:19:01 +00:00
parent 6cc6711cc2
commit 408bba521a
5 changed files with 39 additions and 4 deletions

1
.gitattributes vendored
View File

@ -5467,6 +5467,7 @@ tests/webtbf/tw3740.pp svneol=native#text/plain
tests/webtbf/tw3790.pp svneol=native#text/plain
tests/webtbf/tw3841.pp svneol=native#text/plain
tests/webtbf/tw4111.pp svneol=native#text/plain
tests/webtbf/tw4139.pp svneol=native#text/plain
tests/webtbf/uw0744.pp svneol=native#text/plain
tests/webtbf/uw0840a.pp svneol=native#text/plain
tests/webtbf/uw0840b.pp svneol=native#text/plain

View File

@ -76,6 +76,9 @@ than 255 characters. That's why using Ansi Strings}
tdoublearray = array[0..7] of byte;
textendedarray = array[0..9] of byte;
pconstset = ^tconstset;
tconstset = set of 0..255;
{ Switches which can be changed locally }
tlocalswitch = (cs_localnone,
{ codegen }

View File

@ -33,9 +33,6 @@ interface
symtype;
type
pconstset = ^tconstset;
tconstset = set of 0..255;
tnodetype = (
emptynode, {No node (returns nil when loading from ppu)}
addn, {Represents the + operator}

View File

@ -670,7 +670,17 @@ implementation
end;
end;
conststring :
read_factor := upper(pchar(value.valueptr))
read_factor := upper(pchar(value.valueptr));
constset :
begin
hs:='';
for l:=0 to 255 do
if l in pconstset(tconstsym(srsym).value.valueptr)^ then
hs:=hs+','+tostr(l);
if hs<>'' then
hs:=hs+',';
read_factor := hs;
end;
end;
end;
end;

24
tests/webtbf/tw4139.pp Executable file
View File

@ -0,0 +1,24 @@
{ %fail }
{ %opt=-Sew }
{ Source provided for Free Pascal Bug Report 4139 }
{ Submitted by "Christian Iversen" on 2005-06-29 }
{ e-mail: chrivers@iversen-net.dk }
{$mode delphi}
type
Foobar = (a, b, c, d);
const
Test = c;
const
List = [a, c];
{$IF Test in List}
{$MESSAGE WARN 'This should work'}
{$IFEND}
begin
end.