mirror of
https://gitlab.com/freepascal.org/fpc/source.git
synced 2025-11-07 04:19:34 +01:00
* synchronized with trunk
git-svn-id: branches/wasm@48515 -
This commit is contained in:
commit
ae75c87d65
1
.gitattributes
vendored
1
.gitattributes
vendored
@ -18464,6 +18464,7 @@ tests/webtbs/tw33898.pp -text svneol=native#text/pascal
|
|||||||
tests/webtbs/tw33963.pp svneol=native#text/pascal
|
tests/webtbs/tw33963.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw3402.pp svneol=native#text/plain
|
tests/webtbs/tw3402.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw34021.pp -text svneol=native#text/pascal
|
tests/webtbs/tw34021.pp -text svneol=native#text/pascal
|
||||||
|
tests/webtbs/tw34027.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw34037.pp svneol=native#text/pascal
|
tests/webtbs/tw34037.pp svneol=native#text/pascal
|
||||||
tests/webtbs/tw34055.pp svneol=native#text/plain
|
tests/webtbs/tw34055.pp svneol=native#text/plain
|
||||||
tests/webtbs/tw3411.pp svneol=native#text/plain
|
tests/webtbs/tw3411.pp svneol=native#text/plain
|
||||||
|
|||||||
@ -427,6 +427,10 @@ type
|
|||||||
function queue_subscriptn_multiple_by_name(def: tabstractrecorddef; const fields: array of TIDString): tdef;
|
function queue_subscriptn_multiple_by_name(def: tabstractrecorddef; const fields: array of TIDString): tdef;
|
||||||
{ queue a type conversion operation }
|
{ queue a type conversion operation }
|
||||||
procedure queue_typeconvn(fromdef, todef: tdef); virtual;
|
procedure queue_typeconvn(fromdef, todef: tdef); virtual;
|
||||||
|
{ queue a add operation }
|
||||||
|
procedure queue_addn(def: tdef; const index: tconstexprint); virtual;
|
||||||
|
{ queue a sub operation }
|
||||||
|
procedure queue_subn(def: tdef; const index: tconstexprint); virtual;
|
||||||
{ finalise the queue (so a new one can be created) and flush the
|
{ finalise the queue (so a new one can be created) and flush the
|
||||||
previously queued operations, applying them in reverse order on a...}
|
previously queued operations, applying them in reverse order on a...}
|
||||||
{ ... procdef }
|
{ ... procdef }
|
||||||
@ -2080,6 +2084,18 @@ implementation
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure ttai_typedconstbuilder.queue_addn(def: tdef; const index: tconstexprint);
|
||||||
|
begin
|
||||||
|
inc(fqueue_offset,def.size*int64(index));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
|
procedure ttai_typedconstbuilder.queue_subn(def: tdef; const index: tconstexprint);
|
||||||
|
begin
|
||||||
|
dec(fqueue_offset,def.size*int64(index));
|
||||||
|
end;
|
||||||
|
|
||||||
|
|
||||||
procedure ttai_typedconstbuilder.queue_subscriptn(def: tabstractrecorddef; vs: tfieldvarsym);
|
procedure ttai_typedconstbuilder.queue_subscriptn(def: tabstractrecorddef; vs: tfieldvarsym);
|
||||||
begin
|
begin
|
||||||
inc(fqueue_offset,vs.fieldoffset);
|
inc(fqueue_offset,vs.fieldoffset);
|
||||||
|
|||||||
@ -150,7 +150,7 @@ uses
|
|||||||
defutil,defcmp,
|
defutil,defcmp,
|
||||||
{ pass 1 }
|
{ pass 1 }
|
||||||
htypechk,procinfo,
|
htypechk,procinfo,
|
||||||
nmem,ncnv,ninl,ncon,nld,
|
nmem,ncnv,ninl,ncon,nld,nadd,
|
||||||
{ parser specific stuff }
|
{ parser specific stuff }
|
||||||
pbase,pexpr,
|
pbase,pexpr,
|
||||||
{ codegen }
|
{ codegen }
|
||||||
@ -826,7 +826,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
|||||||
{ maybe pchar ? }
|
{ maybe pchar ? }
|
||||||
else
|
else
|
||||||
if is_char(def.pointeddef) and
|
if is_char(def.pointeddef) and
|
||||||
(node.nodetype<>addrn) then
|
((node.nodetype=stringconstn) or is_constcharnode(node)) then
|
||||||
begin
|
begin
|
||||||
{ create a tcb for the string data (it's placed in a separate
|
{ create a tcb for the string data (it's placed in a separate
|
||||||
asmlist) }
|
asmlist) }
|
||||||
@ -875,7 +875,7 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
|||||||
{ maybe pwidechar ? }
|
{ maybe pwidechar ? }
|
||||||
else
|
else
|
||||||
if is_widechar(def.pointeddef) and
|
if is_widechar(def.pointeddef) and
|
||||||
(node.nodetype<>addrn) then
|
(node.nodetype in [stringconstn,ordconstn]) then
|
||||||
begin
|
begin
|
||||||
if (node.nodetype in [stringconstn,ordconstn]) then
|
if (node.nodetype in [stringconstn,ordconstn]) then
|
||||||
begin
|
begin
|
||||||
@ -912,13 +912,13 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
|||||||
Message(parser_e_illegal_expression);
|
Message(parser_e_illegal_expression);
|
||||||
end
|
end
|
||||||
else
|
else
|
||||||
if (node.nodetype=addrn) or
|
if (node.nodetype in [addrn,addn,subn]) or
|
||||||
is_proc2procvar_load(node,pd) then
|
is_proc2procvar_load(node,pd) then
|
||||||
begin
|
begin
|
||||||
{ insert typeconv }
|
{ insert typeconv }
|
||||||
inserttypeconv(node,def);
|
inserttypeconv(node,def);
|
||||||
hp:=node;
|
hp:=node;
|
||||||
while assigned(hp) and (hp.nodetype in [addrn,typeconvn,subscriptn,vecn]) do
|
while assigned(hp) and (hp.nodetype in [addrn,typeconvn,subscriptn,vecn,addn,subn]) do
|
||||||
hp:=tunarynode(hp).left;
|
hp:=tunarynode(hp).left;
|
||||||
if (hp.nodetype=loadn) then
|
if (hp.nodetype=loadn) then
|
||||||
begin
|
begin
|
||||||
@ -927,6 +927,28 @@ function get_next_varsym(def: tabstractrecorddef; const SymList:TFPHashObjectLis
|
|||||||
while assigned(hp) and (hp.nodetype<>loadn) do
|
while assigned(hp) and (hp.nodetype<>loadn) do
|
||||||
begin
|
begin
|
||||||
case hp.nodetype of
|
case hp.nodetype of
|
||||||
|
addn :
|
||||||
|
begin
|
||||||
|
if (is_constintnode(taddnode(hp).right) or
|
||||||
|
is_constenumnode(taddnode(hp).right) or
|
||||||
|
is_constcharnode(taddnode(hp).right) or
|
||||||
|
is_constboolnode(taddnode(hp).right)) and
|
||||||
|
is_pointer(taddnode(hp).left.resultdef) then
|
||||||
|
ftcb.queue_addn(tpointerdef(taddnode(hp).left.resultdef).pointeddef,get_ordinal_value(taddnode(hp).right))
|
||||||
|
else
|
||||||
|
Message(parser_e_illegal_expression);
|
||||||
|
end;
|
||||||
|
subn :
|
||||||
|
begin
|
||||||
|
if (is_constintnode(taddnode(hp).right) or
|
||||||
|
is_constenumnode(taddnode(hp).right) or
|
||||||
|
is_constcharnode(taddnode(hp).right) or
|
||||||
|
is_constboolnode(taddnode(hp).right)) and
|
||||||
|
is_pointer(taddnode(hp).left.resultdef) then
|
||||||
|
ftcb.queue_subn(tpointerdef(taddnode(hp).left.resultdef).pointeddef,get_ordinal_value(taddnode(hp).right))
|
||||||
|
else
|
||||||
|
Message(parser_e_illegal_expression);
|
||||||
|
end;
|
||||||
vecn :
|
vecn :
|
||||||
begin
|
begin
|
||||||
if (is_constintnode(tvecnode(hp).right) or
|
if (is_constintnode(tvecnode(hp).right) or
|
||||||
|
|||||||
27
tests/webtbs/tw34027.pp
Normal file
27
tests/webtbs/tw34027.pp
Normal file
@ -0,0 +1,27 @@
|
|||||||
|
uses
|
||||||
|
strings;
|
||||||
|
|
||||||
|
type tz = record
|
||||||
|
name : pchar;
|
||||||
|
end;
|
||||||
|
const aa :array[0..2] of char = 'aa'#0;
|
||||||
|
|
||||||
|
const testArrZ : array [0..4] of tz = (
|
||||||
|
(name: @aa), { Ok }
|
||||||
|
(name: pchar(@aa)), { Ok }
|
||||||
|
(name: pchar(@aa)+1),
|
||||||
|
(name: pchar(@aa)+1+1),
|
||||||
|
(name: pchar(@aa)+1+1-1)
|
||||||
|
);
|
||||||
|
|
||||||
|
var b : pchar;
|
||||||
|
|
||||||
|
begin
|
||||||
|
b:=pchar(@aa)+1; {Ok}
|
||||||
|
if strlen(testArrZ[2].name)<>1 then
|
||||||
|
halt(1);
|
||||||
|
if strlen(testArrZ[3].name)<>0 then
|
||||||
|
halt(2);
|
||||||
|
if strlen(testArrZ[4].name)<>1 then
|
||||||
|
halt(2);
|
||||||
|
end.
|
||||||
Loading…
Reference in New Issue
Block a user