|
@@ -1028,6 +1028,9 @@ implementation
|
|
membercall : boolean;
|
|
membercall : boolean;
|
|
callflags : tcallnodeflags;
|
|
callflags : tcallnodeflags;
|
|
propaccesslist : tpropaccesslist;
|
|
propaccesslist : tpropaccesslist;
|
|
|
|
+ static_name : shortstring;
|
|
|
|
+ sym: tsym;
|
|
|
|
+ srsymtable : tsymtable;
|
|
begin
|
|
begin
|
|
{ property parameters? read them only if the property really }
|
|
{ property parameters? read them only if the property really }
|
|
{ has parameters }
|
|
{ has parameters }
|
|
@@ -1052,7 +1055,8 @@ implementation
|
|
begin
|
|
begin
|
|
if getpropaccesslist(propsym,palt_write,propaccesslist) then
|
|
if getpropaccesslist(propsym,palt_write,propaccesslist) then
|
|
begin
|
|
begin
|
|
- case propaccesslist.firstsym^.sym.typ of
|
|
|
|
|
|
+ sym:=propaccesslist.firstsym^.sym;
|
|
|
|
+ case sym.typ of
|
|
procsym :
|
|
procsym :
|
|
begin
|
|
begin
|
|
callflags:=[];
|
|
callflags:=[];
|
|
@@ -1060,8 +1064,8 @@ implementation
|
|
membercall:=maybe_load_methodpointer(st,p1);
|
|
membercall:=maybe_load_methodpointer(st,p1);
|
|
if membercall then
|
|
if membercall then
|
|
include(callflags,cnf_member_call);
|
|
include(callflags,cnf_member_call);
|
|
- p1:=ccallnode.create(paras,tprocsym(propaccesslist.firstsym^.sym),st,p1,callflags);
|
|
|
|
- addsymref(propaccesslist.firstsym^.sym);
|
|
|
|
|
|
+ p1:=ccallnode.create(paras,tprocsym(sym),st,p1,callflags);
|
|
|
|
+ addsymref(sym);
|
|
paras:=nil;
|
|
paras:=nil;
|
|
consume(_ASSIGNMENT);
|
|
consume(_ASSIGNMENT);
|
|
{ read the expression }
|
|
{ read the expression }
|
|
@@ -1078,7 +1082,19 @@ implementation
|
|
fieldvarsym :
|
|
fieldvarsym :
|
|
begin
|
|
begin
|
|
{ generate access code }
|
|
{ generate access code }
|
|
- propaccesslist_to_node(p1,st,propaccesslist);
|
|
|
|
|
|
+ if (sp_static in sym.symoptions) then
|
|
|
|
+ begin
|
|
|
|
+ static_name:=lower(sym.owner.name^)+'_'+sym.name;
|
|
|
|
+ searchsym_in_class(tobjectdef(sym.owner.defowner),tobjectdef(sym.owner.defowner),static_name,sym,srsymtable);
|
|
|
|
+ if assigned(sym) then
|
|
|
|
+ check_hints(sym,sym.symoptions,sym.deprecatedmsg);
|
|
|
|
+ p1.free;
|
|
|
|
+ p1:=nil;
|
|
|
|
+ { static syms are always stored as absolutevarsym to handle scope and storage properly }
|
|
|
|
+ propaccesslist_to_node(p1,nil,tabsolutevarsym(sym).ref);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ propaccesslist_to_node(p1,st,propaccesslist);
|
|
include(p1.flags,nf_isproperty);
|
|
include(p1.flags,nf_isproperty);
|
|
consume(_ASSIGNMENT);
|
|
consume(_ASSIGNMENT);
|
|
{ read the expression }
|
|
{ read the expression }
|
|
@@ -1102,12 +1118,25 @@ implementation
|
|
begin
|
|
begin
|
|
if getpropaccesslist(propsym,palt_read,propaccesslist) then
|
|
if getpropaccesslist(propsym,palt_read,propaccesslist) then
|
|
begin
|
|
begin
|
|
- case propaccesslist.firstsym^.sym.typ of
|
|
|
|
|
|
+ sym := propaccesslist.firstsym^.sym;
|
|
|
|
+ case sym.typ of
|
|
fieldvarsym :
|
|
fieldvarsym :
|
|
begin
|
|
begin
|
|
- { generate access code }
|
|
|
|
- propaccesslist_to_node(p1,st,propaccesslist);
|
|
|
|
- include(p1.flags,nf_isproperty);
|
|
|
|
|
|
+ { generate access code }
|
|
|
|
+ if (sp_static in sym.symoptions) then
|
|
|
|
+ begin
|
|
|
|
+ static_name:=lower(sym.owner.name^)+'_'+sym.name;
|
|
|
|
+ searchsym_in_class(tobjectdef(sym.owner.defowner),tobjectdef(sym.owner.defowner),static_name,sym,srsymtable);
|
|
|
|
+ if assigned(sym) then
|
|
|
|
+ check_hints(sym,sym.symoptions,sym.deprecatedmsg);
|
|
|
|
+ p1.free;
|
|
|
|
+ p1:=nil;
|
|
|
|
+ { static syms are always stored as absolutevarsym to handle scope and storage properly }
|
|
|
|
+ propaccesslist_to_node(p1,nil,tabsolutevarsym(sym).ref);
|
|
|
|
+ end
|
|
|
|
+ else
|
|
|
|
+ propaccesslist_to_node(p1,st,propaccesslist);
|
|
|
|
+ include(p1.flags,nf_isproperty);
|
|
end;
|
|
end;
|
|
procsym :
|
|
procsym :
|
|
begin
|
|
begin
|
|
@@ -1116,7 +1145,7 @@ implementation
|
|
membercall:=maybe_load_methodpointer(st,p1);
|
|
membercall:=maybe_load_methodpointer(st,p1);
|
|
if membercall then
|
|
if membercall then
|
|
include(callflags,cnf_member_call);
|
|
include(callflags,cnf_member_call);
|
|
- p1:=ccallnode.create(paras,tprocsym(propaccesslist.firstsym^.sym),st,p1,callflags);
|
|
|
|
|
|
+ p1:=ccallnode.create(paras,tprocsym(sym),st,p1,callflags);
|
|
paras:=nil;
|
|
paras:=nil;
|
|
include(p1.flags,nf_isproperty);
|
|
include(p1.flags,nf_isproperty);
|
|
end
|
|
end
|
|
@@ -1184,7 +1213,7 @@ implementation
|
|
assigned(tcallnode(p1).procdefinition) and
|
|
assigned(tcallnode(p1).procdefinition) and
|
|
not(po_classmethod in tcallnode(p1).procdefinition.procoptions) and
|
|
not(po_classmethod in tcallnode(p1).procdefinition.procoptions) and
|
|
not(tcallnode(p1).procdefinition.proctypeoption=potype_constructor) then
|
|
not(tcallnode(p1).procdefinition.proctypeoption=potype_constructor) then
|
|
- Message(parser_e_only_class_methods_via_class_ref);
|
|
|
|
|
|
+ Message(parser_e_only_class_members_via_class_ref);
|
|
end;
|
|
end;
|
|
fieldvarsym:
|
|
fieldvarsym:
|
|
begin
|
|
begin
|
|
@@ -1203,17 +1232,20 @@ implementation
|
|
begin
|
|
begin
|
|
if isclassref then
|
|
if isclassref then
|
|
if assigned(p1) and
|
|
if assigned(p1) and
|
|
- is_self_node(p1) then
|
|
|
|
- Message(parser_e_only_class_methods)
|
|
|
|
|
|
+ (
|
|
|
|
+ is_self_node(p1) or
|
|
|
|
+ (assigned(current_procinfo) and ([po_staticmethod,po_classmethod] <= current_procinfo.procdef.procoptions) and
|
|
|
|
+ (current_procinfo.procdef._class = classh))) then
|
|
|
|
+ Message(parser_e_only_class_members)
|
|
else
|
|
else
|
|
- Message(parser_e_only_class_methods_via_class_ref);
|
|
|
|
|
|
+ Message(parser_e_only_class_members_via_class_ref);
|
|
p1:=csubscriptnode.create(sym,p1);
|
|
p1:=csubscriptnode.create(sym,p1);
|
|
end;
|
|
end;
|
|
end;
|
|
end;
|
|
propertysym:
|
|
propertysym:
|
|
begin
|
|
begin
|
|
- if isclassref then
|
|
|
|
- Message(parser_e_only_class_methods_via_class_ref);
|
|
|
|
|
|
+ if isclassref and not (sp_static in sym.symoptions) then
|
|
|
|
+ Message(parser_e_only_class_members_via_class_ref);
|
|
handle_propertysym(tpropertysym(sym),sym.owner,p1);
|
|
handle_propertysym(tpropertysym(sym),sym.owner,p1);
|
|
end;
|
|
end;
|
|
typesym:
|
|
typesym:
|
|
@@ -1595,7 +1627,11 @@ implementation
|
|
if is_member_read(srsym,srsymtable,p1,hdef) then
|
|
if is_member_read(srsym,srsymtable,p1,hdef) then
|
|
begin
|
|
begin
|
|
if (srsymtable.symtabletype=ObjectSymtable) then
|
|
if (srsymtable.symtabletype=ObjectSymtable) then
|
|
- p1:=load_self_node;
|
|
|
|
|
|
+ if (assigned(current_procinfo) and ([po_staticmethod,po_classmethod] <= current_procinfo.procdef.procoptions)) then
|
|
|
|
+ { no self node in static class methods }
|
|
|
|
+ p1:=cloadvmtaddrnode.create(ctypenode.create(hdef))
|
|
|
|
+ else
|
|
|
|
+ p1:=load_self_node;
|
|
{ not srsymtable.symtabletype since that can be }
|
|
{ not srsymtable.symtabletype since that can be }
|
|
{ withsymtable as well }
|
|
{ withsymtable as well }
|
|
if (srsym.owner.symtabletype=ObjectSymtable) then
|
|
if (srsym.owner.symtabletype=ObjectSymtable) then
|