Commit graph

228 commits

Author SHA1 Message Date
George Marques
0ba6048ad3
Add support for static variables in GDScript
Which allows editable data associated with a particular class instead of
the instance. Scripts with static variables are kept in memory
indefinitely unless the `@static_unload` annotation is used or the
`static_unload()` method is called on the GDScript.

If the custom function `_static_init()` exists it will be called when
the class is loaded, after the static variables are set.
2023-04-27 09:51:44 -03:00
Yuri Sizov
26fb911f79
Merge pull request #72095 from anvilfolk/gd-docs
Improve GDScript documentation generation & behavior
2023-04-26 16:54:25 +02:00
Rémi Verschelde
45cd5dcad3
Merge pull request #75885 from AThousandShips/compound_fix
[GDScript] Fix incorrect compound assignment
2023-04-25 16:17:02 +02:00
ocean (they/them)
6783ff69c0 Improve and fix GDScript documentation generation & behavior
Removes documentation generation (docgen) from the GDScript compiler to
its own file. Adds support for GDScript enums and signal parameters and
quite a few other assorted fixes and improvements.
2023-04-21 10:17:30 -04:00
Ninni Pipping
e5365da03c [GDScript] Fix incorrect compound assignment
Reverts in-place compound assignments

Added test to ensure correctness
2023-04-14 11:28:44 +02:00
Pedro J. Estébanez
2f4168daeb Fix edge cases of object lifetime when signals involved 2023-04-11 17:27:39 +02:00
Yuri Sizov
a008a06fcb
Merge pull request #72056 from resistor/master
[GDScript] Perform update-and-assign operations in place when possible.
2023-03-20 19:16:30 +01:00
Dmitrii Maganov
55a2ad25bf GDScript: Fix checking if a call is awaited in compiler 2023-03-01 09:31:35 +02:00
Rémi Verschelde
c0f1ed57c4
Merge pull request #73915 from vonagam/fix-conversions-from-native-member
GDScript: Fix conversions from native members accessed by identifier
2023-02-26 19:02:27 +01:00
Rémi Verschelde
1bd0b296e1
Merge pull request #73964 from vonagam/fix-coroutine-compiler-type
GDScript: Fix address type for coroutine results
2023-02-26 16:00:17 +01:00
Rémi Verschelde
c118790eb9
Merge pull request #73899 from vnen/gdscript-init-defaults-beforehand
GDScript: Initialize all defaults beforehand in implicit constructor
2023-02-26 15:59:27 +01:00
Dmitrii Maganov
4efaf15605 GDScript: Fix address type for coroutine results 2023-02-26 08:30:46 +02:00
George Marques
eba984a44f
Revert "GDScript: Fix groups and categories been seen as members"
This reverts commit 6f2a8434c6.

The commit introduces a bug where it creates spurious entries for member
information.
2023-02-25 13:40:31 -03:00
Dmitrii Maganov
281c8c75d3 GDScript: Fix conversions from native members accessed by identifier 2023-02-25 10:53:36 +02:00
George Marques
0e6aa6fc38
GDScript: Initialize all defaults beforehand in implicit constructor
Set all the default values for typed variables before actually trying to
initialize them, including `@onready` ones.

This ensures that if validated calls are being used there will be a
value of the correct type, even if the resolution is done out of order
or deferred because of `@onready`.
2023-02-24 22:01:06 -03:00
George Marques
6f2a8434c6
GDScript: Fix groups and categories been seen as members 2023-02-24 10:03:12 -03:00
George Marques
d076c76551
GDScript: Fix setting native type with script inheritance
Sometimes the inheritance tree is compiled out of order and the base
don't have yet a native type set. This is now changed to not rely on the
base script but use the native type set in the datatype, which is
already resolved by the analyzer.
2023-02-21 14:09:10 -03:00
Dmitrii Maganov
8fe023ad93 GDScript: Rework type check 2023-02-17 19:57:18 +02:00
ocean (they/them)
94dfac8da7 Add return type for GDScript getters 2023-02-15 17:54:38 -05:00
Rémi Verschelde
98921d8fba
Revert "Remove script class checks when getting function signature"
This reverts commit 0fef203b1f.

This introduced some other issues, as discussed in #72144.
2023-02-07 16:28:52 +01:00
Adam Scott
0fef203b1f
Remove script class checks when getting function signature 2023-02-07 11:48:10 +01:00
George Marques
a47d4d57ca
GDScript: Allow void functions to return calls to other void functions 2023-01-31 11:37:30 -03:00
Dmitrii Maganov
5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +02:00
Dmitrii Maganov
011b3895db GDScript: Fix vararg method calls with exact arguments 2023-01-30 19:38:07 +02:00
Owen Anderson
22a0c200c6 [GDScript] Perform update-and-assign operations in place when possible.
This turns two bytecode operations into one by using the assignment
destination directly as the output of the binary operator. This manifests
in operations like `+=`.
2023-01-25 10:22:04 -06:00
George Marques
ba9491f870
Merge pull request #70948 from vnen/gdscript-ptr-method-name-in-debug 2023-01-23 12:24:15 -03:00
George Marques
80e06b29e7
GDScript: Add names for disassembling function pointers
When instructions use function pointers, it's not possible to retrieve
their original names in the disassembly. This stores the names in
vectors (in debug builds) so they can be shown.
2023-01-23 11:04:31 -03:00
George Marques
9462ae4783
GDScript: Remove function of continue for match statement
The keyword is confusing and rarely is used in the intended way. It is
removed now in favor of a future feature (pattern guards) to avoid
breaking compatibility later.
2023-01-22 18:45:24 -03:00
Adam Scott
48e041458f Fix cyclic reference errors while reducing identifiers.
Co-authored-by: Dmitrii Maganov <vonagam@gmail.com>
2023-01-15 19:19:25 -05:00
George Marques
75515e4303
Merge pull request #70987 from vonagam/fix-parameter-conversion-assign 2023-01-12 11:34:13 -03:00
Rémi Verschelde
509da86205
Merge pull request #69590 from anvilfolk/enums
GDScript enum fixes & refactor
2023-01-09 23:10:37 +01:00
ocean (they/them)
366ec895b1 Assorted enum and native type fixes 2023-01-09 11:08:07 -05:00
George Marques
a3816434a6
GDScript: Don't use the NIL address to hold return value of functions
This prevents that the NIL address is filled with another value, which
causes problems for some instructions that read from NIL.
2023-01-09 09:20:18 -03:00
Dmitrii Maganov
a8c2f8a0e1 GDScript: Fix missing conversion for default argument values 2023-01-06 11:49:06 +02:00
Dmitrii Maganov
10e364bf43 GDScript: Fix array as default value for parameter 2023-01-06 06:25:55 +02:00
Dmitrii Maganov
a1d06749f1 Unify typing of variables, constants and parameters in GDScript 2023-01-06 01:10:04 +02:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Rémi Verschelde
4e360ac612
Merge pull request #70702 from vnen/gdscript-error-on-assign-void
GDScript: Error when assigning return value of void function
2023-01-03 12:23:00 +01:00
Rémi Verschelde
a797fa3b3d
Merge pull request #70503 from rune-scape/inner-class-docs
Inner classes get their docs back
2023-01-03 12:15:44 +01:00
George Marques
0c15844551
GDScript: Error when assigning return value of void function
This also makes built-in method calls empty the return value when the
method is void, to avoid keeping returning a garbage value in such case.
2022-12-30 12:08:58 -03:00
Dmitrii Maganov
b6aa4840d8 Fix usage of Enum as constant 2022-12-28 23:04:40 +02:00
rune-scape
1b77993257 Inner classes get their docs back 2022-12-23 17:39:24 -05:00
Rémi Verschelde
ae4c025da9
Merge pull request #69991 from rune-scape/cast-type
GDScript: Fix cast producing null
2022-12-23 09:22:21 +01:00
rune-scape
e1c63fee86 GDScript: Fix built-in script and other find_class bugs 2022-12-15 14:56:23 -05:00
rune-scape
2dfc6d5b69 GDScript: Allow out of order member resolution 2022-12-14 21:44:05 -05:00
rune-scape
7d0d6aa16f GDScript: Fix cast producing null 2022-12-12 19:57:26 -05:00
ocean (they/them)
c8293a73b4 Add GDScript member initializer implicit type conversion 2022-12-11 16:55:02 -05:00
Rémi Verschelde
f6ea295bb1
Merge pull request #69467 from rune-scape/rune-subclass-script-path
GDScript: Fix subclass script path issues
2022-12-10 10:21:19 +01:00
Rémi Verschelde
907298d673
Merge pull request #68747 from rune-scape/rune-stringname-unification
GDScript: Unify StringName and String
2022-12-09 18:06:48 +01:00
rune-scape
e79be6ce07 Unify String and StringName 2022-12-05 21:46:47 -05:00