* New function token2managementoperator for conversion: ttoken to tmanagementoperator

git-svn-id: trunk@35441 -
This commit is contained in:
maciej-izak 2017-02-18 18:58:32 +00:00
parent b912deae33
commit 168e59837a

View File

@ -39,6 +39,11 @@ interface
op_overloading_supported : boolean;
end;
Ttok2opRec=record
tok : ttoken;
managementoperator : tmanagementoperator;
end;
pcandidate = ^tcandidate;
tcandidate = record
next : pcandidate;
@ -133,10 +138,19 @@ interface
(tok:_OP_DEC ;nod:inlinen;inr:in_dec_x;op_overloading_supported:true) { unary overloading supported }
);
tok2ops=4;
tok2op: array[1..tok2ops] of ttok2oprec=(
(tok:_OP_INITIALIZE; managementoperator: mop_initialize),
(tok:_OP_FINALIZE ; managementoperator: mop_finalize),
(tok:_OP_ADDREF ; managementoperator: mop_addref),
(tok:_OP_COPY ; managementoperator: mop_copy)
);
{ true, if we are parsing stuff which allows array constructors }
allow_array_constructor : boolean = false;
function node2opstr(nt:tnodetype):string;
function token2managementoperator(optoken:ttoken):tmanagementoperator;
{ check operator args and result type }
function isbinaryoperatoroverloadable(treetyp:tnodetype;ld:tdef;lt:tnodetype;rd:tdef;rt:tnodetype) : boolean;
@ -219,6 +233,20 @@ implementation
end;
function token2managementoperator(optoken:ttoken):tmanagementoperator;
var
i : integer;
begin
result:=mop_none;
for i:=1 to tok2ops do
if tok2op[i].tok=optoken then
begin
result:=tok2op[i].managementoperator;
break;
end;
end;
function isbinaryoperatoroverloadable(treetyp:tnodetype;ld:tdef;lt:tnodetype;rd:tdef;rt:tnodetype) : boolean;
function internal_check(treetyp:tnodetype;ld:tdef;lt:tnodetype;rd:tdef;rt:tnodetype;var allowed:boolean):boolean;