Commit Graph

508 Commits

Author SHA1 Message Date
Jonas Maebe
5ca1bd2a32 * if the unit of a procedure call is explicitly specified, limit the search
for (overloaded) procsyms to that unit (mantis #17220)

git-svn-id: trunk@15887 -
2010-08-23 20:51:40 +00:00
florian
700f687692 * nested open array constructors are not allowed, resolves #17213
git-svn-id: trunk@15876 -
2010-08-22 20:13:27 +00:00
florian
24fea58b92 + initial implementation of iso style gotos in iso mode
* made setjmp/longjmp accessible to the compiler by compiler proc, they are used by the iso goto code

git-svn-id: trunk@15711 -
2010-08-05 19:20:46 +00:00
Jonas Maebe
b18a4617bb * fixed calling static TP-style object methods from within other methods
(mantis #16954)

git-svn-id: trunk@15598 -
2010-07-18 11:01:12 +00:00
Jonas Maebe
60041ebf8b * allow exit(value) in exception blocks. Forbidding this dates back to
when this construct was still handled by custom code (mantis #16803)

git-svn-id: trunk@15492 -
2010-06-29 16:56:59 +00:00
Jonas Maebe
e36857742f * allow taking the address of an indexed array function result
(mantis #16772)

git-svn-id: trunk@15475 -
2010-06-25 12:42:27 +00:00
paul
c62c487b24 compiler: fix nested type typecast (issue #0016222)
git-svn-id: trunk@15122 -
2010-04-09 17:10:52 +00:00
paul
24d8a7d833 compiler: start implementation of class constructors/destructors: parsing is ready but at the moment neither class constructors nor destructors are called - this is to be implemented
git-svn-id: trunk@15109 -
2010-04-03 09:14:12 +00:00
paul
c879230f08 compiler: fix parsing and handling of typed constants declared inside classes/objects + tests
git-svn-id: trunk@15094 -
2010-03-30 07:09:44 +00:00
paul
973d947d6c compiler: allow const, type, var and class var sections for objects + test
git-svn-id: trunk@15092 -
2010-03-30 04:22:19 +00:00
paul
1b614b526a compiler:
- add own symbol table for enumeration to store enumeration elements
  - reimplement enumeration member traverse using symbol table instead of firstenum/nextenum - that members are removed
  - implement TEnum.Element access syntax - element is searched in the enumeration symtable in this case instead of global/local symtables
  - implement {$SCOPEDENUM ON/OFF} local switch
  + tests

git-svn-id: trunk@15051 -
2010-03-25 05:46:53 +00:00
Jonas Maebe
88f5addd1c * do not typecheck statements before checking whether they are valid,
because the associated simplifications can turn invalid statements
    into valid statements (based on patch by Aleksa Todorovic, mantis
    #15594)

git-svn-id: trunk@14998 -
2010-03-09 21:13:22 +00:00
Jonas Maebe
d60e1f674c * automatically try to call procvars that are subscripted or used in a
with-statement, both in FPC and TP/Delphi modes (mantis #15728)

git-svn-id: trunk@14881 -
2010-02-10 16:12:18 +00:00
Jonas Maebe
2be600afff * support objc.id.<anyobjcmethod> in Delphi mode (mantis #15607)
git-svn-id: trunk@14822 -
2010-01-28 16:14:42 +00:00
paul
ba3744b38e compiler: translate_disp_call:
- fix arguments description if the first argument is empty
  - fix restype field value (describes result value type in variant types)

git-svn-id: trunk@14790 -
2010-01-24 12:06:52 +00:00
florian
c6ffbe9eda * support string constants > 255 chars
* don't cut off anymore string constants silently at 255 chars

git-svn-id: trunk@14789 -
2010-01-24 09:28:46 +00:00
paul
e82edfb0fb compiler: allow Assigned call for dispinterfaces
git-svn-id: trunk@14750 -
2010-01-19 14:26:11 +00:00
paul
1ae0cebc1a compiler: implement dispinterface properties + modified test
git-svn-id: trunk@14747 -
2010-01-19 09:58:08 +00:00
paul
77a2c316dd compiler: use sp_internal instead of vo_is_internal for internal symbols used for static fields, remove vo_is_internal
git-svn-id: trunk@14631 -
2010-01-14 03:50:01 +00:00
paul
55702ed4c0 compiler: fix nested class types
git-svn-id: trunk@14616 -
2010-01-11 19:32:16 +00:00
paul
6e51a4d4a9 compiler: fix nested class types and consts usage outside class declaration
git-svn-id: trunk@14615 -
2010-01-11 18:35:08 +00:00
paul
166f8a63a2 compiler: implement class constants + tests
git-svn-id: trunk@14609 -
2010-01-11 08:43:10 +00:00
paul
3ed4c58502 compiler:
- implement class properties: properties which can access only static fields and static class methods
  - tests
  - fix a possibility to call an instance method from the class method

git-svn-id: trunk@14585 -
2010-01-09 18:37:54 +00:00
paul
ea88883915 compiler: fix access to static class fields from the static class methods + extended test
git-svn-id: trunk@14574 -
2010-01-08 10:54:35 +00:00
paul
67ae263dd9 compiler: load methodpointer for static class methods - fixes internal error 200305061 when some class member is called inside the class static method + test
git-svn-id: trunk@14571 -
2010-01-07 20:35:23 +00:00
Jonas Maebe
5cca798316 * fix crashes when compiling with -gt
git-svn-id: trunk@14548 -
2010-01-05 19:52:53 +00:00
Jonas Maebe
af85e45b67 + support for id.anyobjcmethodinscope() calls for Objective-Pascal code,
using standard FPC overload selection logic
  * fixed detection of references to static symbol tables for class
    helpers

git-svn-id: trunk@14234 -
2009-11-21 00:14:21 +00:00
Jonas Maebe
b495fbb991 * let search_class_helper() only return class helper methods; it could
also return regular objcclass methods before, because these are also
    registered under class helper procsyms for future id.anymethod support
  * give an error when calling an inherited method from an objccategory
    method, if that is not declared in the parent of the extended class
    (since calling inherited in an objccategory method is the same as
     calling inherited in a method of the extended class; if a method is
     replaced, calling inherited will *not* call the original method
     from the original class)

git-svn-id: trunk@14213 -
2009-11-18 21:49:57 +00:00
Jonas Maebe
9e87f42b16 * made internalerror unique
git-svn-id: trunk@14195 -
2009-11-16 00:06:17 +00:00
Jonas Maebe
559e284bd0 * merged r13762-14047 from trunk
git-svn-id: branches/objc@14048 -
2009-11-04 15:50:26 +00:00
paul
aa5a5e79ce merge revisions: 13909,13923,13924,13934,13935,13942,13943,13944,13946,13948,13950,13951,13952,13983,13994:
rtl: add enumerators to the basic classes
tests: add enumerators test which compiles and work both by fpc and dcc
compiler: 
  + start for-in loop implementation: implement for-in loop for types (enumerations and ranges), strings, arrays and sets. todo: perform type checking, optimize array and string loops - use temp for expression, implement for-in loop for classes
test:
  + add a simple test for the 'for-in' loop
compiler: fix string for-in loop. now it uses a temp variable to store string expression result
complier: fix for-in array loop. use a temp variable for the loop expression only if loop is not an open array loop
complier: continue enumerator implementation:
  + add operator enumerator which give an ability to add enumerator for an existent type (for example to override builtin string enumerator)
  + add class enumerator support via delphi compatible GetEnumerator method + enumerator class/object template (function MoveNext: Boolean; property Current)
  + tests
compiler: fix for-in loop for arrays. delphi does not copy arrays to a temp variable and it is possible to change array during loop. + test
compiler: add reference for the enumerator operator when it is used + another test for operator enumerator for a class
compiler: add reference for the enumerator operator when it is used + another test for operator enumerator for a class
compiler: enumerator directive support:
  + allow to mark methods and properties by 'enumerator MoveNext' and 'enumerator Current' modifiers. Parser checks return types and duplicates.
  + prefer *marked* by enumerator directive methods and properties than GetEnumerator and Current builtin symbols
  + increase ppu version
  + test
rtl: add IEnumerator and IEnumerable interfaces declarations
tests: for-in loop tests:
  + add small comment at the top of test program
compiler: allow 'enumerator MoveNext' for the interface function declaration + test
compiler: move all for-in loop helpers to the nflw unit
compiler: don't allow the compiler to choose the non-valid enumerator operator for the for-in loop

git-svn-id: trunk@14008 -
2009-11-02 03:24:48 +00:00
paul
e784ec1079 merge revisions 13898-13899:
- compiler: allow message after the *deprecated* keyword
 - compiler: raise an internal error if deprecated message is trying to set to a non clear string pointer

git-svn-id: trunk@13997 -
2009-11-01 14:06:30 +00:00
Jonas Maebe
a149674a75 Merged revisions 13458-13596 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13598 -
2009-08-25 19:47:36 +00:00
Jonas Maebe
666f345df4 * allow objcclasstype.classmethod()
git-svn-id: branches/objc@13591 -
2009-08-25 18:26:06 +00:00
Jonas Maebe
0eec337a00 - removed SUPPORT_UNALIGNED, FPC_SUPPORTS_UNALIGNED and FPC_UNALIGNED_FIXED
defines and ifdefs (already all defined by 2.2.4)

git-svn-id: trunk@13581 -
2009-08-23 07:51:26 +00:00
Jonas Maebe
a64c5a7b23 * fixed bug that sporadically caused the column of certain nodes to
change, resulting in slightly different DWARF debug information
    (mantis #13508)

    The cause was saving a node pointer in a local variable, processing
    it further, and later on checking whether it changed by comparing
    the stored and the current instance pointer. The problem was that
    the node could have been freed and reallocated at the same address
    (but with different contents), so this check sometimes resulted
    in (hard to reproduce) false negatives.

git-svn-id: trunk@13580 -
2009-08-22 22:15:27 +00:00
Jonas Maebe
5885866990 + support for objcencode() (equivalent of Objective-C's @encode()) + test
+ functionality to encode Objective-C function signatures (untested)

git-svn-id: branches/objc@13557 -
2009-08-18 19:54:02 +00:00
florian
10ede51609 * access static fields by a absolute sym pointing to the symbol for the space allocation, resolves #14124
git-svn-id: trunk@13512 -
2009-08-10 18:46:23 +00:00
florian
6c99746074 * forbid the usage of Result(x) as function call, resolves #14248
git-svn-id: trunk@13492 -
2009-08-06 19:06:23 +00:00
Jonas Maebe
2799cfd83f + parser-side of objcprotocol() expression to obtain the metaclass
associated with an Objective-C protocol. Code generator part will
    always generate an internalerror currently, because it cannot yet
    be implemented (needs support for generating RTTI for Objective-C
    classes)

git-svn-id: branches/objc@13461 -
2009-07-26 16:03:37 +00:00
Jonas Maebe
335e159c11 Merged revisions 13351-13373,13376-13457 via svnmerge from
svn+ssh://jonas@svn.freepascal.org/FPC/svn/fpc/trunk

git-svn-id: branches/objc@13458 -
2009-07-26 14:31:50 +00:00
Jonas Maebe
5a2ccfff52 --WARNING: start build process with FPC 2.2.4; won't work when
starting with a previous 2.3.1 or compiler built from the objc branch
  + added basic objcprotocol support (only for external protocols
    currently)
     o use in type declaration: "type xp = objcprotocol ... end;"
     o when defining a root class that implements it:
       "type yc = objcclass(xp) ... end" (note: no support yet
       for something like "objcclass(id,xp)" or so)
     o when defining a non-root class that implements a protocol:
       "type zc = objcclass(nsobject,xp) ... end"
     o includes support for "required" and "optional" sections
     o no support yet for the objcprotocol(<protocol>) expression
       that enables getting a class instance representing the
       protocol (e.g., for use with "conformsToProtocol:")
     o message names have to specified in protocol declarations,
       but if an objcclass implements a protocol, the message names do
       not have to be repeated (but if they are, they have to match;
       the same goes when overriding inherited methods)
  + allow specifying the external name of Objective-C classes and
    protocols, since classes and protocols can have the same name
    (and you cannot use the same Pascal identifier in such caseq)
  + added NSObject protocol, and make the NSObject class use it
  + added missing NSObject class methods that have the same name
    as instance methods (added "class" name prefix to avoid clashes)
  * fixed several cases where the compiler did not treat Objective-C
    classes/protocols the same as Object Pascal classes/interfaces
    (a.o., forward declarations, alignment, regvars, several type
     conversions, ...)
  * allow "override" directive in objcclass declarations, and print
    a hint if it's forgotten in an external declaration (because it
    doesn't really matter there, and may make automated header
    conversion harder than necessary) and an error if will be used in
    a non-external declaration (because it is not possible to start
    a new vmt entry-tree in Objective-C, you can only override parent
    methods)
  * reject objcclasses/protocols as parameters to typeof()
  * don't try to test VMT validity of objcclasses/protocols

git-svn-id: branches/objc@13375 -
2009-07-09 20:48:28 +00:00
Jonas Maebe
52c6f14de5 * do not allow local type definitions such as string[1] and "file of byte"
inside parameter lists and function results (fixes second problem
    reported in mantis #14104, see also
    http://wiki.freepascal.org/User_Changes_Trunk#Local_type_definitions_in_parameter_lists
    )

git-svn-id: trunk@13372 -
2009-07-08 20:21:37 +00:00
Jonas Maebe
6165536b5e + added {$modeswitch objectivec1}/-Mobjectivec1 mode switch to enable
the use of Objective-C 1.0 constructs. Because it is a mode switch, it
    can be used cumulatively with every syntax mode. Note that a {$mode xxx}
    statement resets all mode switches as well, so you cannot use the
    -Mobjectivec1 variant if you have such a statement in a unit. This
    modeswitch is currently only enabled for Darwin/PowerPC and Darwin/i386,
    as the backend support is not yet implemented for other platforms.
  + implemented selector() statement that can be used to create an Objective-C
    selector for the message with the specified *constant* name (in the future,
    it will also work for Objective-C method identifiers)
  + added SEL type to the system unit (the selector() statement returns it)
  + added all Objective-C segments to the assembler writers
  + (currently mostly dummy) objc1 unit that is automatically included if the
    {$modeswitch objectivec1} statement is used
  + some tests for the selector() statement

git-svn-id: trunk@12870 -
2009-03-08 18:40:32 +00:00
Jonas Maebe
da461c5154 * fixed calling static class methods from inside other static class methods
git-svn-id: trunk@12866 -
2009-03-08 12:38:02 +00:00
florian
a0a1e6aae2 * small indention fix
git-svn-id: trunk@12360 -
2008-12-12 21:47:44 +00:00
peter
8419161964 * current_objectdef is now always valid when parsing is within the
context of a class. This can be either the class declaration or
    a method implementation
  * replaced all current_procinfo.procdef._class with current_objectdef

git-svn-id: trunk@12059 -
2008-11-12 18:54:39 +00:00
peter
af437d5beb * refactor the forward type declaration handling, remove
global typecanbeforward and move 'class of ..' parsing
    to ptype

git-svn-id: trunk@12045 -
2008-11-09 22:07:36 +00:00
peter
b6dcffe79b * remove obsolete bt_specialize
git-svn-id: trunk@12031 -
2008-11-07 00:14:08 +00:00
florian
57f3e2f40a * forbid access to properties in class methods
* readability fix

git-svn-id: trunk@11838 -
2008-09-28 20:16:13 +00:00