Commit Graph

337 Commits

Author SHA1 Message Date
Michaël Van Canneyt
05f0ceeb26 * Atributes for class/record methods 2024-03-02 14:15:22 +01:00
Michaël Van Canneyt
2c9870f85a * Attributes must be assigned only to elements before the first colon 2024-02-29 10:22:19 +01:00
Michaël Van Canneyt
fb821b8c9b * Allow use of attributes on fields and properties in records and classes 2024-02-25 19:57:39 +01:00
Michaël Van Canneyt
a2939e4187 * Force VMT at first position in system.tobject 2024-02-24 18:11:23 +01:00
florian
906571fa25 * improve pretty printing of symbols 2024-02-19 20:41:08 +01:00
Sven/Sarah Barth
5e05630713 * fix the internal error of #40639; however as the test code in question will only compile correctly with the next commit no test is added yet 2024-02-18 19:35:24 +01:00
Ryan Joseph
2005e3c094 * Apply RTTI directive status to symbol 2024-01-02 07:09:22 +01:00
Michaël Van Canneyt
92f148e667 * Generate hidden class to be used for TVirtualInterface (wasm only) 2023-07-11 08:36:57 +00:00
Sven/Sarah Barth
7133ad7ecc * a type helper that inherits from another type helper may extend a unique type helper of the parent's extended type (thus allowing to make the type helper of the original type available for the aliased type)
+ added tests
2023-06-23 16:15:33 +02:00
florian
a401898139 * spelling fixes 2022-08-04 23:01:35 +02:00
Sven/Sarah Barth
7de854ef1e + add method register_implemented_interface to tobjectdef which registers an implemented interface and - if desired - also initializes the GUID related fields of the objectdef
* use that method in all locations outside symdef that add add an implemented interface

Based on work by Blaise.ru
2022-05-26 21:43:37 +02:00
Sven/Sarah Barth
c3736810ac * if an interface is declared inherit the invokable flag from the parent interface 2022-05-26 21:42:59 +02:00
Sven/Sarah Barth
9664ad4138 * use tparse_proc_flags for parse_proc_head as well 2022-05-26 21:42:53 +02:00
Sven/Sarah Barth
f6a444c6fc * combine the Boolean parameters of read_proc and read_proc_dec into a set 2022-05-26 21:42:53 +02:00
Jonas Maebe
3d3c904ac5 TSymStr: more consistent usage 2022-05-08 15:03:44 +02:00
florian
9e3f647333 * var, type, threadvar, const sections require also in classes etc. at least one declaration, resolves #39599 2022-02-25 21:56:52 +01:00
Sven/Sarah Barth
3f14a19d3e * fix typos in comments, no code changes 2022-02-18 17:54:36 +01:00
Sven/Sarah Barth
2a5023508a + add support for forward declarations of generic classes and interfaces (any implicit pointer type really); fixes #34128 2022-02-18 17:54:23 +01:00
florian
c6874df5c8 * better error recovery, resolves #39485 2021-12-16 22:27:38 +01:00
florian
637976e83f * patch by Marģers to unify internal error numbers, resolves #37888
git-svn-id: trunk@47103 -
2020-10-13 19:59:01 +00:00
svenbarth
04a50733ad * get rid of the scanner message for attributes for real this time (sometimes I *really* hate Git -.-)
git-svn-id: trunk@42413 -
2019-07-13 09:37:44 +00:00
svenbarth
6d0c470a40 * check for unbound attributes inside classes (currently they are only allowed for published properties)
Note: no tests yet as sooner or later most will be dropped once extended RTTI is added

git-svn-id: trunk@42408 -
2019-07-12 22:08:10 +00:00
svenbarth
402728239f * trtti_attribute_list.bind already checks whether the dangling attribute list is assigned or not
git-svn-id: trunk@42395 -
2019-07-12 22:07:24 +00:00
svenbarth
ced3885dbb * generate construction function for the attributes used in a unit using a more straight forward approach
ToDo: "collect" attributes of same type and same argument list and generate constructor only once for them

git-svn-id: trunk@42394 -
2019-07-12 22:07:20 +00:00
svenbarth
d9d2515ada * move binding of a dangling attribute list to a sym's/def's attribute list to a class procedure of trtti_attribute_list
git-svn-id: trunk@42392 -
2019-07-12 22:07:11 +00:00
svenbarth
b5e6c0b98d * ensure that any potentially created constructor call is freed if the attribute is not bound to a def or sym
git-svn-id: trunk@42383 -
2019-07-12 22:06:38 +00:00
svenbarth
ba413bcdfc * fix typo
git-svn-id: trunk@42363 -
2019-07-12 22:05:21 +00:00
svenbarth
39bab2dbcc * rename trtti_attributesdef to trtti_attributes_list
git-svn-id: trunk@42359 -
2019-07-12 22:05:00 +00:00
svenbarth
b2932393df Reintegration of Custom Attributes branch by Joost van der Sluis with patches reworked by Svetozar Belic [patch 1/3]
Implemented attributes for class types and properties (based on work by Joost van der Sluis). Added TCustomAttribute - a base class for attributes. Added TUnitInfo record to RTTI. It contains the unit name and unit options (for now only a flag which specifies if the unit contains attributes). Added several tests for attributes.

git-svn-id: trunk@42356 -
2019-07-12 22:04:48 +00:00
svenbarth
d0eddbcbb9 * fix for Mantis #35735: also handle "generic" keyword inside helper types
+ added test

git-svn-id: trunk@42328 -
2019-07-05 14:12:13 +00:00
Jonas Maebe
281b3ad276 * fix case completeness and unreachable code warnings in compiler that would
be introduced by the next commit

git-svn-id: trunk@42046 -
2019-05-12 14:29:03 +00:00
Jonas Maebe
0b61b5d4cf * added extra header to ppu inside a subsection, so we won't run into
trouble when the ppu version hits 255
  * also moved several ppu flags to a set inside that section

git-svn-id: trunk@41846 -
2019-04-06 21:28:43 +00:00
Jonas Maebe
ed2ae508d0 * only add hidden parameters for objectdef methods after generating the vmt,
so that they take into account inherited calling conventions (mantis #35233)
   o don't needlessly calculate the paraloc info when generating a JVM mangled
     name

git-svn-id: trunk@41716 -
2019-03-16 19:14:14 +00:00
Jonas Maebe
91d5457b38 * moved around/replaced the following procedures to stop nflw from depending
on pdecsub (node units should not depend on parser units):
   o maybe_add_public_default_java_constructor()
   o handle_calling_convention()
   o create_finalizer_procdef() (replaced with create_outline_procdef())
   o insert_record_hidden_paras()
   o handle_calling_convention()
   o proc_add_definition()
   o build_parentfpstruct()
   o maybe_guarantee_record_typesym()
   o get_first_proc_str()
  * factored out the creation of a procinfo for a nested procdef based on a
    subnodetree of the current procdef into tprocinfo.create_for_outlining()

git-svn-id: trunk@40773 -
2019-01-05 16:26:33 +00:00
Jonas Maebe
28df55fe08 * moved handle_calling_convention() to pparautl
git-svn-id: trunk@40772 -
2019-01-05 16:26:29 +00:00
svenbarth
c3ca96279a + add support for threadvars inside classes
+ added tests

git-svn-id: trunk@39288 -
2018-06-23 13:49:12 +00:00
svenbarth
5510b13975 * ensure that sto_has_generic is set when a generic routine has been parsed
git-svn-id: trunk@39230 -
2018-06-15 13:49:03 +00:00
svenbarth
90bd408de4 * fix for Mantis #32355: adjust the meaning of the typehelpers modeswitch for Delphi modes in that it enables the "type helper" syntax as it is in the non-Delphi modes; extending primitive types with record helpers is now always enabled in Delphi modes
+ added test

git-svn-id: trunk@37225 -
2017-09-15 21:09:21 +00:00
svenbarth
a6821c63e0 * store the type of the helper that had been encountered during parsing in the objectdef and by extension the PPU
git-svn-id: trunk@37202 -
2017-09-13 21:24:06 +00:00
svenbarth
236a9b0aa5 * rework the checks for a helper's extended def to be a class so that it can be more easily extended by other objecttypes
git-svn-id: trunk@37022 -
2017-08-21 20:48:02 +00:00
svenbarth
324e63b5d3 * a bit of language consolidation: "type helper" can now be used for records and classes as well
git-svn-id: trunk@36938 -
2017-08-18 15:29:19 +00:00
svenbarth
b6a3d66224 * adjust check for non-static class methods in class helpers in so far that only classes allow such methods (interfaces and objects would not either)
git-svn-id: trunk@36937 -
2017-08-18 15:27:47 +00:00
svenbarth
eef06e9bc6 * move the check whether a subclassed type helper extends a suitable subtype of the parent's extended type to a nested procedure
git-svn-id: trunk@36936 -
2017-08-18 15:25:53 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
maciej-izak
48b149acd4 New tokens for new management operators: Initialize, Finalize, AddRef and Copy. Small code adjustment for parser (pdecobj.pas, pstatmnt.pas, psub.pas, ptype.pas) was required because few of old token has from now value which is outside range of set: _CONSTRUCTOR, _FINALIZATION.
New tokens for operators:
  * _OP_INITIALIZE, _OP_FINALIZE, _OP_ADDREF, _OP_COPY

New tokens:
  * _INITIALIZE, _FINALIZE, _ADDREF, _COPY

git-svn-id: trunk@35438 -
2017-02-18 18:12:45 +00:00
svenbarth
c2fec2e819 * if the objecttype of the forward declaration mismatches use the objecttype previously parsed; fixes access violation of webtbf/tw11970.pp
git-svn-id: trunk@34461 -
2016-09-08 18:42:13 +00:00
svenbarth
0df57b3c87 * forward declarations of helper types are not allowed, so enforce them by trying to parse a "for"; fixes access violation of thlp9.pp
git-svn-id: trunk@34459 -
2016-09-08 18:33:12 +00:00
svenbarth
d3660fec31 Implement support for parsing "generic [class] procedure" and "generic [class] function" in non-Delphi modes. Since "generic" is a prefix it is quite ugly to implement, but from a Pascal language point of view it fits better than "procedure generic xyz".
Supporting such a prefix of course means that all section handling code ("var", "type", etc.) needs to respect the case of a "generic" token followed by "function", "procedure" or "class" and thus abort doing its own business.
Maybe I'll find the time somewhen in the future to rework the parser (plus scanner?) a bit so that code like this gets more easy to add and more importantly less ugly.

pdecsub.pas:
  * extend parse_proc_dec() and parse_record_method_dec() so that they can be told that they are supposed to handle the to be parsed function/procedure/method header as a generic
pdecvar.pas:
  + new entry for tvar_dec_option named "vd_check_generic" to tell read_var_decls() and read_record_fields() to look out for "generic"
  * extend read_var_decls() and read_record_fields() to check for "generic" if needed and to clean up correctly if it is encountered
pdecl.pas:
  * the section handling procedures types_dec(), resourcestring_dec(), var_dec(), threadvar_dec() and consts_dec() all return whether they had encountered a "generic" token that was followed by one of $
pdecobj.pas:
  * extend method_dec() to take a parameter that says whether the method is supposed to be a generic one
  * parse_object_members: while read_record_fields() can handle "generic" we also need to handle the case of "generic" if no fields are allowed anymore
psub.pas:
  * extend read_proc() by the possibility to tell it that the procedure/function to be parsed is supposed to be generic
  * adjust read_declarations() and read_interface_declarations() to keep track of parsed "generic" tokens and to pass them on accordingly
ptype.pas:
  * parse_record_members: same remark as for pdecobj.parse_object_members

git-svn-id: trunk@32380 -
2015-11-20 16:50:58 +00:00
svenbarth
0ff87336aa Convert the Boolean parameters accept_equal, typeonly and hadspecialize of comp_expr(), sub_expr() and factor() to a set parameter and adjust all calls.
pexpr.pas:
  + new enum texprflag and corresponding set texprflags
  * comp_expr: replace accept_equal and typeonly with texprflags parameter
  * factor: replace typeonly and hadspecialize with texprflags parameter
  * sub_expr: replace accept_equal and typeonly with texprflags parameter
  * adjust calls to comp_expr(), factor() and sub_expr()
other units:
  * adjust calls to comp_expr(), factor() and sub_expr() 

git-svn-id: trunk@32269 -
2015-11-07 21:45:03 +00:00
svenbarth
d15cdefc37 pdecsub.pas:
* extend parse_proc_head() with the ability to deal with specializations of procdefs
Note: such a procdef is created as unregistered as this is used to determine the correct overload in tcallcandidates (through the use of the yet to be adapted generate_specialization_phase2())

git-svn-id: trunk@31771 -
2015-09-18 21:31:53 +00:00