The sources of the Free Pascal compiler, RTL, packages and utilities. See https://www.freepascal.org/ for more info.
Go to file
svenbarth 6b03193783 Switching from overloaded type symbol to unique symbol per generic.
Reasons for the "unique symbol" approach:
- no special search operations for cross unit search needed (which is supported by Delphi) => less performance impact
- no special care needed to really find the correct generic => less increase of parser complexity

Currently all generic tests except tgeneric29.pp compile and inline specializations work as well.

The changes in detail:
* pdecl.pas/types_dec:
- The variables used to hold the final name of the symbol are now prefixed with "gen". In case of non-generics the prefixed ones are equal to the non-prefixed ones (e.g. orgtypename=genorgtypename). In case of a generic symbol the "gen"-variants contain the type parameter count suffix (e.g. '$1' in case of 'TTest<T>') as well.
- The unmodified pattern is used to insert and detect a dummy symbol with that name, so that type declarations and - more important - inline specializations can find that symbol.
- In non-Delphi modes this symbol is also used to detect whether we have a type redefinition which is not allowed currently; its typedef points to the generic def.
- In mode Delphi the def of that dummy symbol (which contains an undefineddef) is modified when a corresponding non-generic type is parsed, so that it contains the def of the real type.

* pdecsub.pas/parse_proc_head
- consume_generic_type_parameter now only parses the type parameters and picks the generic with the correct amount of parameters. The verification of the order and names of the parameters needs to be added again.
- it also does not use "def" anymore, but it sets "srsym"
- in parse_proc_head the symbol (srsym) is only searched if the symbol isn't assigned already; in case of a generic in mode FPC it will find the dummy symbol that points to the generic def

* pexpr.pas
- in factor_read_id there are three cases to handle:
 + the symbol is not assigned => error
 + a possible generic symbol (either an undefined def or the non-generic variant) => no error and no hints
 + a non-generic symbol => hints
 Point 1 is handled correctly, point 2 and 3 aren't currently and also they might be needed to be moved somewhere else
- sub_expr:
 + a node can be a tloadvmtaddrnode as well if the non-generic variant of a generic symbol is a class
 + we can only check afterwards whether the specialization was successful

* pgenutil.pas/generate_specialization
using the count of the parsed types the correct symbol can be found easily

git-svn-id: branches/svenbarth/generics@19424 -
2011-10-09 16:05:31 +00:00
compiler Switching from overloaded type symbol to unique symbol per generic. 2011-10-09 16:05:31 +00:00
ide * Avoid unitialized VM variable in Preferences method 2011-07-02 07:03:00 +00:00
installer + packages fcl-js and hermes added 2011-02-20 20:48:16 +00:00
packages * Fixed DeleteKey. Deleting the last key does not delete the section (Delphi/Windows compatible) 2011-07-16 14:11:30 +00:00
rtl * fixed compilation on targets where tthreadid is not an integer type after 2011-07-16 12:03:35 +00:00
tests Rebase to revision 18000 2011-07-16 16:19:33 +00:00
utils * Reverted r17969, now fpmake distclean is implemented 2011-07-13 20:25:02 +00:00
.gitattributes Rebase to revision 18000 2011-07-16 16:19:33 +00:00
.gitignore + Added libogc binding and examples for Wii 2011-02-23 21:59:42 +00:00
Makefile * regenerated 2011-06-05 17:18:13 +00:00
Makefile.fpc * compile win 64-bit IDE default. It works now, and even gdb is starting to work. 2010-12-15 19:16:48 +00:00