Commit Graph

734 Commits

Author SHA1 Message Date
nickysn
213e61eae5 + introduce the anf_ofs address node flag - indicates that the node was
generated by ofs()

git-svn-id: trunk@38670 -
2018-04-03 15:28:27 +00:00
Jonas Maebe
2919d97f91 * support asssigning @class.classmethod to a procvar of object in FPC modes
(mantis #14103)

git-svn-id: trunk@37925 -
2018-01-06 17:47:44 +00:00
nickysn
78e0f6c68b + added an i8086-specific FarAddr() function, similar to Addr(), but always
returns a far pointer, regardless of the current memory model

git-svn-id: trunk@37628 -
2017-11-27 16:41:48 +00:00
svenbarth
f6a867ef04 * move handling of Concat to tinlinenode so that it can be easily extended for dynamic arrays
+ added test

git-svn-id: trunk@37429 -
2017-10-08 10:39:34 +00:00
svenbarth
83f5b27e02 * check helpertype instead of the extendeddef to judge whether inherited should be allowed or not
git-svn-id: trunk@37224 -
2017-09-15 20:52:42 +00:00
svenbarth
6acba684d4 * class helpers: fix calling virtual methods of the extended type using inherited
git-svn-id: trunk@37060 -
2017-08-25 19:36:56 +00:00
svenbarth
0b02dab684 + new Delphi-compatible intrinsic GetTypeKind() which returns the TTypeKind of a type as a constant value (and thus can be optimized away in If- and Case-statements)
+ added test

git-svn-id: trunk@36875 -
2017-08-11 22:12:53 +00:00
svenbarth
eb9b4fb71f * fix for Mantis #31973: resolve dummy symbols earlier and print a nice error message if a generic dummy could not be resolved to an ordinary symbol
+ added test
* adjusted test tw9673 which should have never worked as is (what if TList would have been "of T" instead of "of byte"?)

git-svn-id: trunk@36468 -
2017-06-09 14:41:26 +00:00
nickysn
efc5e339d0 * use an enum instead of integer constants to represent inline numbers
* compinnr.inc include file converted to a unit
* inline number field size stored in ppu increased from byte to longint
* inlines in the parse tree (when written with the -vp option) now printed with
  their enum name, instead of number

git-svn-id: trunk@36174 -
2017-05-10 14:41:43 +00:00
florian
b1dff29cbf * removed unused units
git-svn-id: trunk@36165 -
2017-05-09 19:53:14 +00:00
svenbarth
1aa80f77cb - remove no longer needed global variable allow_array_constructor
git-svn-id: trunk@36103 -
2017-05-04 21:58:14 +00:00
svenbarth
6d512ddac7 * allow nested array constructors inside normal code blocks (body & except)
git-svn-id: trunk@36102 -
2017-05-04 21:56:33 +00:00
svenbarth
82b2d22ed6 * keep track of allow_array_constructor as part of the array constructor node
git-svn-id: trunk@36099 -
2017-05-04 21:52:21 +00:00
maciej-izak
16a11c8b7a Bug fix for getting pointer to function result (mantis #10933 #19861)
git-svn-id: trunk@35495 -
2017-03-01 13:23:02 +00:00
svenbarth
22e579cc74 * fix for Mantis #31107: disallow calling of ordinary record methods using the record's type.
git-svn-id: trunk@35113 -
2016-12-12 22:08:28 +00:00
florian
2b6ccb3565 * better error recovery
git-svn-id: trunk@34923 -
2016-11-19 22:00:00 +00:00
svenbarth
531829c072 * don't check for hints if we have a specialization with the same name as the to be used generic (though since the typedef would be errordef it wouldn't print anything anyway...)
git-svn-id: trunk@34531 -
2016-09-16 15:15:19 +00:00
svenbarth
50f2aab0ef * fix for Mantis #22192: handle the case that a specialization has the same name as the generic it's based on as in that case the typedef of the symbol is an errordef; therefor we need to use the symbol's real name
+ added test

git-svn-id: trunk@34530 -
2016-09-16 15:13:27 +00:00
svenbarth
7dd0130ac2 * generate_specialization_phase2() might also return an errordef, so check for that instead of simply using the symbol; fixes access violations of tgenconstraint{38,39,40}.pp
git-svn-id: trunk@34460 -
2016-09-08 18:34:30 +00:00
svenbarth
aaceb5518f * fix Mantis #30494 by applying patch from Maciej Izak
+ added test

git-svn-id: trunk@34381 -
2016-08-26 14:23:23 +00:00
nickysn
c2305809dc + added an i8086-embedded target support to the compiler (RTL and makefile
support are not done yet)

git-svn-id: trunk@33999 -
2016-06-17 19:15:24 +00:00
svenbarth
a2c9c75e97 Convert Insert() and Delete() to intrinsics in preparation for dynamic array support for these two procedures.
Since overloading compilerprocs does not work each procedure got its own unique name, but they are using the new compilerproc extension to map them to the Insert and Delete symbol so that error messages can be shown with the respective name for the procedure declarations instead of fpc_shortstr_delete for example.

git-svn-id: trunk@33895 -
2016-06-03 21:25:49 +00:00
svenbarth
04adcf2a12 Fix for Mantis #30179 and #30203.
pexpr.pas:
  * handle_factor_typenode: rework code for records and objects so that Delphi style specializations are handled as well
  * sub_expr.generate_inline_specialization: also do a typecheck pass on pload to be sure that we have a resultdef

+ added tests

git-svn-id: trunk@33876 -
2016-06-01 20:06:40 +00:00
svenbarth
c3c345d569 Fix for Mantis #30202.
pexpr.pas, sub_expr.generate_inline_specialization:
  * do_member_read() needs to happen independently of whether we're calling a method of the same object (was incorrectly copypasted code... :/ )

+ added test

git-svn-id: trunk@33875 -
2016-06-01 20:03:59 +00:00
Jonas Maebe
712e4f90d6 - removed (unnecessary) use of ctemprefnode.create_offset() while parsing
array constructors

git-svn-id: trunk@33732 -
2016-05-21 10:28:25 +00:00
Jonas Maebe
661be0baad * replaced ctemprefnode.create_offset() usage in variant array indexing
operations

git-svn-id: trunk@33731 -
2016-05-21 10:28:22 +00:00
Jonas Maebe
a0296d7311 * fixed indentation
git-svn-id: trunk@33192 -
2016-03-06 14:44:17 +00:00
svenbarth
94c0938edd Reverted accidentally committed inline if-then-else expression (committed in r33048 when I reverted the IfThen()... -.- )
git-svn-id: trunk@33111 -
2016-02-19 21:51:56 +00:00
svenbarth
25744dd3f1 Fix for Mantis #29609.
pexpr.pas, factor.factor_read_id:
  * don't use a cloadvmtaddrnode for accessing class properties in records

+ added test

git-svn-id: trunk@33110 -
2016-02-19 21:37:02 +00:00
svenbarth
8287773b16 Reverted revision 33036. This feature is too controverse to be left in.
git-svn-id: trunk@33048 -
2016-02-04 19:26:51 +00:00
svenbarth
ed94ca4b24 Add support for IfThen() instrinsic that works like the if-statement in that it evaluates only the expression that is indeed executed.
The result type of the intrinsic is determined by the Then-expression to provide a bit of control. There might however be some situations in which this fails, for this exceptions need to be added (e.g. a constant string needs to be converted to a normal string).

compinnr.inc:
  + add new constant in_ifthen_x_y_z for the IfThen() intrinsic
psystem.pas: 
  + create_intern_symbols: add symbol for IfThen() intrinsic
pexpr.pas:
  * statement_syssym: parse parameters of IfThen() intrinsic and return corresponding inline node
ninl.pas, tinlinenode:
  + new method handle_ifthen() which converts the inline node to an if-node which assigns the expressions to a temp node that is returned
  * pass_typecheck: handle in_ifthen_x_y_z using handle_ifthen()
  * pass_1: in_ifthen_x_y_z does not need a first pass as it's already converted after the typecheck pass

+ added tests

git-svn-id: trunk@33036 -
2016-01-31 14:29:12 +00:00
svenbarth
61b12af82b Fix for Mantis #29321.
pexpr.pas, postfixoperators:
  * also handle type helpers for static arrays

+ added test

git-svn-id: trunk@32845 -
2016-01-04 22:02:24 +00:00
Jonas Maebe
9ea38f4577 * support static fields in nested types in records, by always including
support for nested types when generating an access to a static fied;
    we also always do that when generating the mangled name of a static
    field declaration in symcreat.make_field_static() (mantis #29030)

git-svn-id: trunk@32517 -
2015-11-24 16:04:19 +00:00
svenbarth
b2988ad8c0 pexpr.pas, sub_expr:
* generate_inline_specialization: fix Delphi-style inline specializations of generic methods

git-svn-id: trunk@32438 -
2015-11-21 15:59:11 +00:00
florian
1142fdeccd * initialize variables to avoid warnings
git-svn-id: trunk@32428 -
2015-11-21 14:14:30 +00:00
svenbarth
89d37c1e69 pgentype.pas:
+ new constant inline_specialization_block_types to easily keep track of block types in which inline specialization is allowed
pexpr.pas:
  * use new inline_specializatio_block_types instead of a inline constant set

git-svn-id: trunk@32388 -
2015-11-21 11:05:58 +00:00
svenbarth
0471db5bb6 pexpr.pas, factor.factor_read_id:
* handle specializations after a type symbol

git-svn-id: trunk@32387 -
2015-11-21 10:52:19 +00:00
svenbarth
ae8316b1b4 Implement two phase specialization to support inline specialization of generic functions in non-Delphi modes.
pexpr.pas, factor.factor_read_id:
  * instead of using generate_specialization() use generate_specialization_phase1() and (for non-procdefs) generate_specialization_phase2
  * pass generated specialization context for procdef on to the generated call nodes which do the second part of the specialization then

git-svn-id: trunk@32384 -
2015-11-20 18:37:32 +00:00
svenbarth
74c79803f7 Extend tlocalvarsym with the ability to not register it if needed.
git-svn-id: trunk@32375 -
2015-11-20 11:29:21 +00:00
svenbarth
fe39de1573 pexpr.pas:
* sub_expr: don't extract the def from the node using gettypedef, but use the already retrieved symbol instead

git-svn-id: trunk@32371 -
2015-11-20 10:22:08 +00:00
florian
70b8789262 o basic extended pascal support:
+ automatically loaded helper unit
  * Makefiles adapted
  * mode switch
  * mode switches reorganized
+ TimeStamp support

git-svn-id: trunk@32330 -
2015-11-15 15:13:36 +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
nickysn
75dc2ad7e1 + implemented Seg(procedure) on i8086
git-svn-id: trunk@32222 -
2015-11-02 16:37:19 +00:00
nickysn
072139cdb7 * fixed ofs(procedure) as well
git-svn-id: trunk@32205 -
2015-10-30 19:30:33 +00:00
nickysn
c25585daee * fixed addr(procedure), mantis #28775
git-svn-id: trunk@32204 -
2015-10-30 15:17:48 +00:00
Jonas Maebe
2cea723a0d * only write the parts of the unit localsymtables that are actually needed:
the defs and syms (recursively) referred by inline routines and by the WPO
    info
   o defs and syms are no longer added immediately to the module's deflist/
     symlist, even if they are created as "registered". Instead,
     "doregister=true" simply means "add it to the symbol table at the
     top of the symtable stack"
   o normally only when a sym/def is deref'ed, it gets added to the module
     symlist/deflist and defid/symid gets a (unique) value
   o in cases where we use(d) the defid to construct unique names within the
     current module, you now have to call call the tdef.new unique_id_str()
     method. If the def was not yet registered, we will reserve room for it
     in the deflist (to get a unique id), but the defid gets set to a
     negative value computed from its position in the deflist. Should it
     have to be written to the ppu file later on, the defid will be
     modified to the actual position in the deflist. For both values,
     new unique_id_str() will return the same result so that references
     to this def before and after actual registrations are the same (needed
     for the JVM backend, but also a good principle in general)

   Overall: don't directly use symid/defid anymore to get unique identifiers,
     but use tdef.new unique_id_str() instead (if necessary, a similar routine
     for tsym can be added)

   The result is the ppu file size gets reduced significantly after its big
   increase as a result of the high level typed constant builder (which creates
   a lot of defs). The result is even more efficient than before, as other
   unneeded defs/syms from the localsymtables don't get saved/restored anymore
   either.

git-svn-id: trunk@32153 -
2015-10-25 19:22:00 +00:00
Jonas Maebe
e921d7847a * add "doregister" parameter to tstringdef.create*, and don't register
temporary defs created in the scanner for evaluating compile time
    expressions

git-svn-id: trunk@32047 -
2015-10-13 15:59:09 +00:00
svenbarth
114dfe41a3 Fix for Mantis #28741.
pexpr.pas:
  * initialize srsym in the classrefdef case; it should not have let to problems, because it's only used if erroroutp1 is false which is only the case if the symbol is assigned, but better save then sorry...

git-svn-id: trunk@31887 -
2015-09-29 12:56:01 +00:00
Jonas Maebe
2b01a7e2c6 * initialize errorp1 for classrefdef after r31856 (mantis #28741, but this
doesn't fix it as there are more problems)

git-svn-id: trunk@31884 -
2015-09-29 07:59:59 +00:00
svenbarth
e2be6f400f Fix for Mantis #28738.
pexpr.pas:
  * the gettypedef() overload should not have been commented... Note to self: don't test things during commits

git-svn-id: trunk@31875 -
2015-09-28 09:25:07 +00:00