From 408bba521a02a2bef6e0b4a407f3c3e4ad191d15 Mon Sep 17 00:00:00 2001 From: peter Date: Thu, 30 Jun 2005 08:19:01 +0000 Subject: [PATCH] * support constset in $if git-svn-id: trunk@538 - --- .gitattributes | 1 + compiler/globtype.pas | 3 +++ compiler/node.pas | 3 --- compiler/scanner.pas | 12 +++++++++++- tests/webtbf/tw4139.pp | 24 ++++++++++++++++++++++++ 5 files changed, 39 insertions(+), 4 deletions(-) create mode 100755 tests/webtbf/tw4139.pp diff --git a/.gitattributes b/.gitattributes index df0dc83942..70778db3b2 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/compiler/globtype.pas b/compiler/globtype.pas index f23cfca97a..8e47d980ad 100644 --- a/compiler/globtype.pas +++ b/compiler/globtype.pas @@ -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 } diff --git a/compiler/node.pas b/compiler/node.pas index b60e7e4d08..67183c5cc0 100644 --- a/compiler/node.pas +++ b/compiler/node.pas @@ -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} diff --git a/compiler/scanner.pas b/compiler/scanner.pas index 417fb2eeb3..e3917e6562 100644 --- a/compiler/scanner.pas +++ b/compiler/scanner.pas @@ -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; diff --git a/tests/webtbf/tw4139.pp b/tests/webtbf/tw4139.pp new file mode 100755 index 0000000000..a6c6a467b1 --- /dev/null +++ b/tests/webtbf/tw4139.pp @@ -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.