* skip <type>(<expr>) in the cond. expression parser if eval is false

git-svn-id: trunk@29116 -
This commit is contained in:
florian 2014-11-22 22:45:02 +00:00
parent 66d735c536
commit b7a1418065
3 changed files with 41 additions and 14 deletions

1
.gitattributes vendored
View File

@ -10307,6 +10307,7 @@ tests/tbs/tb0604.pp svneol=native#text/pascal
tests/tbs/tb0605.pp svneol=native#text/pascal
tests/tbs/tb0606.pp svneol=native#text/pascal
tests/tbs/tb0607.pp svneol=native#text/plain
tests/tbs/tb0608.pp svneol=native#text/pascal
tests/tbs/tb205.pp svneol=native#text/plain
tests/tbs/tbs0594.pp svneol=native#text/pascal
tests/tbs/ub0060.pp svneol=native#text/plain

View File

@ -1912,21 +1912,38 @@ type
{ first look for a macros/int/float }
result:=preproc_substitutedtoken(storedpattern,eval);
if eval and (result.consttyp=conststring) then
if searchsym(storedpattern,srsym,srsymtable) then
begin
if searchsym(storedpattern,srsym,srsymtable) then
begin
try_consume_nestedsym(srsym,srsymtable);
if assigned(srsym) then
case srsym.typ of
constsym:
begin
result.free;
result:=texprvalue.create_const(tconstsym(srsym));
end;
enumsym:
begin
result.free;
result:=texprvalue.create_int(tenumsym(srsym).value);
end;
end;
end
end
{ skip id(<expr>) if expression must not be evaluated }
else if not(eval) and (result.consttyp=conststring) then
begin
try_consume_nestedsym(srsym,srsymtable);
if assigned(srsym) then
case srsym.typ of
constsym:
begin
result.free;
result:=texprvalue.create_const(tconstsym(srsym));
end;
enumsym:
begin
result.free;
result:=texprvalue.create_int(tenumsym(srsym).value);
end;
if current_scanner.preproc_token =_LKLAMMER then
begin
preproc_consume(_LKLAMMER);
current_scanner.skipspace;
result:=preproc_factor(false);
if current_scanner.preproc_token =_RKLAMMER then
preproc_consume(_RKLAMMER)
else
Message(scan_e_error_in_preproc_expr);
end;
end;
end

9
tests/tbs/tb0608.pp Normal file
View File

@ -0,0 +1,9 @@
const
c = {$IF Declared(o) And (o<>Integer(0))}Succ{$IFEND}(False);
begin
if c then
halt(1);
writeln('ok');
end.