* add "doregister" parameter to tstringdef.create*, and don't register

temporary defs created in the scanner for evaluating compile time
    expressions

git-svn-id: trunk@32047 -
This commit is contained in:
Jonas Maebe 2015-10-13 15:59:09 +00:00
parent 2778bf55c7
commit e921d7847a
4 changed files with 26 additions and 26 deletions

View File

@ -116,11 +116,11 @@ implementation
{ t:=cstringdef.createlong(tordconstnode(p).value))}
Message(parser_e_invalid_string_size);
tordconstnode(p).value:=255;
def:=cstringdef.createshort(int64(tordconstnode(p).value));
def:=cstringdef.createshort(int64(tordconstnode(p).value),true);
end
else
if tordconstnode(p).value<>255 then
def:=cstringdef.createshort(int64(tordconstnode(p).value));
def:=cstringdef.createshort(int64(tordconstnode(p).value),true);
consume(_RECKKLAMMER);
end;
p.free;

View File

@ -225,17 +225,17 @@ implementation
bool64type:=corddef.create(bool64bit,low(int64),high(int64),true);
cansichartype:=corddef.create(uchar,0,255,true);
cwidechartype:=corddef.create(uwidechar,0,65535,true);
cshortstringtype:=cstringdef.createshort(255);
cshortstringtype:=cstringdef.createshort(255,true);
{ should we give a length to the default long and ansi string definition ?? }
clongstringtype:=cstringdef.createlong(-1);
cansistringtype:=cstringdef.createansi(0);
clongstringtype:=cstringdef.createlong(-1,true);
cansistringtype:=cstringdef.createansi(0,true);
if target_info.system in systems_windows then
cwidestringtype:=cstringdef.createwide
cwidestringtype:=cstringdef.createwide(true)
else
cwidestringtype:=cstringdef.createunicode;
cunicodestringtype:=cstringdef.createunicode;
cwidestringtype:=cstringdef.createunicode(true);
cunicodestringtype:=cstringdef.createunicode(true);
{ length=0 for shortstring is open string (needed for readln(string) }
openshortstringtype:=cstringdef.createshort(0);
openshortstringtype:=cstringdef.createshort(0,true);
{$ifdef x86}
create_fpu_types;
{$ifndef FPC_SUPPORT_X87_TYPES_ON_WIN64}

View File

@ -921,7 +921,7 @@ type
sintdef:=torddef.create(s64bit,low(int64),high(int64),false);
uintdef:=torddef.create(u64bit,low(qword),high(qword),false);
booldef:=torddef.create(pasbool8,0,1,false);
strdef:=tstringdef.createansi(0);
strdef:=tstringdef.createansi(0,false);
setdef:=tsetdef.create(sintdef,0,255);
realdef:=tfloatdef.create(s80real);
end;

View File

@ -832,15 +832,15 @@ interface
encoding : tstringencoding;
stringtype : tstringtype;
len : asizeint;
constructor createshort(l : byte);virtual;
constructor createshort(l: byte; doregister: boolean);virtual;
constructor loadshort(ppufile:tcompilerppufile);
constructor createlong(l : asizeint);virtual;
constructor createlong(l: asizeint; doregister: boolean);virtual;
constructor loadlong(ppufile:tcompilerppufile);
constructor createansi(aencoding:tstringencoding);virtual;
constructor createansi(aencoding: tstringencoding; doregister: boolean);virtual;
constructor loadansi(ppufile:tcompilerppufile);
constructor createwide;virtual;
constructor createwide(doregister: boolean);virtual;
constructor loadwide(ppufile:tcompilerppufile);
constructor createunicode;virtual;
constructor createunicode(doregister: boolean);virtual;
constructor loadunicode(ppufile:tcompilerppufile);virtual;
function getcopy : tstoreddef;override;
function stringtypname:string;
@ -1194,7 +1194,7 @@ implementation
else
symtable:=current_module.localsymtable;
symtablestack.push(symtable);
current_module.ansistrdef:=cstringdef.createansi(current_settings.sourcecodepage);
current_module.ansistrdef:=cstringdef.createansi(current_settings.sourcecodepage,true);
symtablestack.pop(symtable);
end;
result:=tstringdef(current_module.ansistrdef);
@ -2168,9 +2168,9 @@ implementation
Tstringdef
****************************************************************************}
constructor tstringdef.createshort(l : byte);
constructor tstringdef.createshort(l: byte; doregister: boolean);
begin
inherited create(stringdef,true);
inherited create(stringdef,doregister);
stringtype:=st_shortstring;
encoding:=0;
len:=l;
@ -2187,9 +2187,9 @@ implementation
end;
constructor tstringdef.createlong(l : asizeint);
constructor tstringdef.createlong(l: asizeint; doregister: boolean);
begin
inherited create(stringdef,true);
inherited create(stringdef,doregister);
stringtype:=st_longstring;
encoding:=0;
len:=l;
@ -2206,9 +2206,9 @@ implementation
end;
constructor tstringdef.createansi(aencoding:tstringencoding);
constructor tstringdef.createansi(aencoding: tstringencoding; doregister: boolean);
begin
inherited create(stringdef,true);
inherited create(stringdef,doregister);
stringtype:=st_ansistring;
encoding:=aencoding;
len:=-1;
@ -2225,9 +2225,9 @@ implementation
end;
constructor tstringdef.createwide;
constructor tstringdef.createwide(doregister: boolean);
begin
inherited create(stringdef,true);
inherited create(stringdef,doregister);
stringtype:=st_widestring;
if target_info.endian=endian_little then
encoding:=CP_UTF16LE
@ -2250,9 +2250,9 @@ implementation
end;
constructor tstringdef.createunicode;
constructor tstringdef.createunicode(doregister: boolean);
begin
inherited create(stringdef,true);
inherited create(stringdef,doregister);
stringtype:=st_unicodestring;
if target_info.endian=endian_little then
encoding:=CP_UTF16LE