From 84aee394509503def889a90836300d08e06f67d5 Mon Sep 17 00:00:00 2001 From: jonas Date: Sun, 27 Dec 2020 13:18:56 +0000 Subject: * factored out the creation of loadnodes for special variables/parameters git-svn-id: https://svn.freepascal.org/svn/fpc/trunk@47857 3ad0048d-3df7-0310-abae-a5850022a9f2 --- compiler/nld.pas | 28 +++++++++++++++++++++++++++- 1 file changed, 27 insertions(+), 1 deletion(-) (limited to 'compiler/nld.pas') diff --git a/compiler/nld.pas b/compiler/nld.pas index ab05bd8776..c6eab85ecf 100644 --- a/compiler/nld.pas +++ b/compiler/nld.pas @@ -182,6 +182,10 @@ interface { Current assignment node } aktassignmentnode : tassignmentnode; + { Create a node tree to load a variable if symbol is assigned, otherwise an error node. + Generates an internalerror if called for an absolutevarsym of the "tovar" kind (those + are only supported for expansion in the parser) } + function gen_load_var(sym: tabstractvarsym): tnode; implementation @@ -192,10 +196,32 @@ implementation defutil,defcmp, cpuinfo, htypechk,pass_1,procinfo,paramgr, - ncon,nflw,ninl,ncnv,nmem,ncal,nutils, + nbas,ncon,nflw,ninl,ncnv,nmem,ncal,nutils, cgbase ; + + function gen_load_var(sym: tabstractvarsym): tnode; + begin + result:=nil; + if assigned(sym) then + begin + if (sym.typ<>absolutevarsym) or + (tabsolutevarsym(sym).abstyp<>tovar) then + begin + result:=cloadnode.create(sym,sym.owner); + end + else + internalerror(2020122601); + end + else + begin + result:=cerrornode.create; + CGMessage(parser_e_illegal_expression); + end; + end; + + {***************************************************************************** TLOADNODE *****************************************************************************} -- cgit v1.2.1