Commit graph

198 commits

Author SHA1 Message Date
Hilderin 39369db029 Fix synchronization of global class name 2024-06-25 18:33:07 -04:00
Rémi Verschelde 6761923f4f
Merge pull request #90716 from dalexeev/gds-fix-export-annotation-issues
GDScript: Fix some export annotation issues
2024-05-19 11:21:00 +02:00
Rémi Verschelde 0a67ee52d1
Revert "GDScript: Implement get_dependencies()"
This reverts commit dc73440f89.

This commit in some form is needed to fix handling of dependencies on
export, but as it's also used for import, it's exposing some pre-existing
issues which we need to solve first.

So reverting for now to give ourselves time to iron this out for a future
Godot release.

Fixes #91726.
2024-05-13 16:59:43 +02:00
Danil Alexeev 76b2d85c9f
GDScript: Fix some export annotation issues 2024-05-13 17:49:06 +03:00
Danil Alexeev 8122a27eac
GDScript: Fix access non-static members in static context 2024-05-01 19:55:40 +03:00
Rémi Verschelde c4733e8003
Merge pull request #90860 from vnen/gdscript-get-dependencies
GDScript: Implement `get_dependencies()`
2024-04-29 12:30:12 +02:00
rune-scape 6b88c86cec GDScript: invalidate GDScriptParserRef when reloading 2024-04-18 14:05:58 -07:00
George Marques dc73440f89
GDScript: Implement get_dependencies()
The parser and analyzer now track the dependencies of the script and
return the list when the resource loader ask for them.

What is considered a dependency:

- Any `preload()` call.
- The base script this one extends.
- Any identifier, including types, that refers to global scripts.
- Any autoload singleton reference.
2024-04-18 11:54:37 -03:00
Jamie Hill-Daniel 164b34a734 Don't pass self when calling a static function from a non-static context 2024-04-04 21:15:17 +00:00
Rémi Verschelde 453485aede
Merge pull request #89270 from Repiteo/enforce-typename-in-templates
Enforce template syntax `typename` over `class`
2024-03-14 22:34:37 +01:00
Danil Alexeev ef1909fca3
GDScript: Fix @warning_ignore annotation issues 2024-03-12 19:00:06 +03:00
Thaddeus Crews 9903e6779b
Enforce template syntax typename over class 2024-03-07 22:39:09 -06:00
George Marques 8e520454ef
GDScript: Add @export_custom annotation
Allows setting any arbitrary hint, hint string, and usage flags.
Useful for more complex hints or potential future hints not
available as a dedicated annotation.
2024-03-07 10:55:21 -03:00
Danil Alexeev af28f87791
Documentation: Add support for deprecated/experimental messages 2024-02-15 15:59:50 +03:00
George Marques b4d0a09f15
GDScript: Reintroduce binary tokenization on export
This adds back a function available in 3.x: exporting the GDScript
files in a binary form by converting the tokens recognized by the
tokenizer into a data format.

It is enabled by default on export but can be manually disabled. The
format helps with loading times since, the tokens are easily
reconstructed, and with hiding the source code, since recovering it
would require a specialized tool. Code comments are not stored in this
format.

The `--test` command can also include a `--use-binary-tokens` flag
which will run the GDScript tests with the binary format instead of the
regular source code by converting them in-memory before the test runs.
2024-02-08 11:20:05 -03:00
Rémi Verschelde 745f8e112f
Revert "Add UID support to GDScript files"
This reverts commit c7f68a27ec.

We still think GDScript files need UIDs to allow safe refactoring,
but we're still debating what form those should take exactly.

So far there seems to be agreement that it shouldn't be done via an
annotation as implemented here, so we're reverting this one for now,
to revisit the feature in a future PR.
2024-01-29 21:00:26 +01:00
A Thousand Ships 15369fdb1d
Remove unnecessary this-> expressions 2024-01-29 09:59:18 +01:00
kobewi c7f68a27ec Add UID support to GDScript files 2024-01-17 22:30:56 +01:00
Yuri Sizov a6f806f8da Merge pull request #85487 from vnen/gdscript-static-register-annotations
GDScript: Make annotations register statically in parser
2023-12-19 13:02:09 +01:00
Thaddeus Crews 5cf0d772bc
Change container_element_type to vector container 2023-12-05 08:51:49 -06:00
George Marques 39e8cf891d
GDScript: Make annotations register statically in parser
So it only register the annotations once per run instead of doing it
every time a script is parsed.
2023-11-28 17:16:21 -03:00
ryanabx e945a8fbad Fix typo in gdscript_parser.h and gdscript_translation_parser_plugin.cpp 2023-10-23 08:48:36 -05:00
Danil Alexeev 7f4721a941
GDScript: Fix non-static call is allowed in static var lambda body 2023-10-20 20:43:07 +03:00
Danil Alexeev 9e2273abc7
GDScript: Add error when exporting node in non [Node]-derived classes 2023-10-05 13:50:26 +03:00
Yuri Sizov 813cd1dfc8 Merge pull request #80085 from vnen/gdscript-pattern-guards
GDScript: Implement pattern guards for match statement
2023-09-28 20:03:57 +02:00
Yuri Sizov aa474c9feb Merge pull request #75988 from dalexeev/gds-unsafe-call-argument
GDScript: Improve call analysis
2023-09-27 19:07:46 +02:00
George Marques 54a1414500
GDScript: Implement pattern guards for match statement
Within a match statement, it is now possible to add guards in each
branch:

	var a = 0
	match a:
		0 when false: print("does not run")
		0 when true: print("but this does")

This allows more complex logic for deciding which branch to take.
2023-09-27 11:25:25 -03:00
A Thousand Ships 517e9f8aef [Modules] Replace ERR_FAIL_COND with ERR_FAIL_NULL where applicable 2023-09-26 16:44:52 +02:00
Danil Alexeev e8696f9961
GDScript: Improve call analysis
* Add missing `UNSAFE_CALL_ARGUMENT` warning.
* Fix `Object` constructor.
* Display an error for non-existent static methods.
2023-09-21 13:36:39 +03:00
Danil Alexeev 072e9c5c82
GDScript: Fix and improve doc comment parsing 2023-09-16 17:31:50 +03:00
Rémi Verschelde 13f0ab88f2
Merge pull request #81079 from dalexeev/gds-fix-get-method-list
GDScript: Fix `get_*_list()` methods return incorrect info
2023-09-11 15:36:52 +02:00
Danil Alexeev 462d8f4752
GDScript: Fix get_*_list() methods return incorrect info 2023-09-04 00:21:03 +03:00
Yuri Rubinsky 35802374ac Add coloring for completion of vector components 2023-08-30 21:13:25 +03:00
Rémi Verschelde 91c5273ec5
Merge pull request #75656 from YuriSizov/core-iconic-builtins
Add a script method to get its class icon
2023-08-29 12:41:03 +02:00
Yuri Sizov b6c4efe1b1 Merge pull request #80964 from dalexeev/gds-allow-use-local-consts-as-types
GDScript: Allow use local constants as types
2023-08-25 21:26:44 +02:00
Danil Alexeev 68a567bd13
GDScript: Allow use local constants as types 2023-08-25 17:04:04 +03:00
Danil Alexeev 89429b0273
GDScript: Fix lambda resolution with cyclic references 2023-08-25 16:29:11 +03:00
Yuri Sizov 2c77f07aaa Add a script method to get its class icon
Co-authored-by: Danil Alexeev <danil@alexeev.xyz>
2023-08-24 13:05:41 +02:00
Danil Alexeev 6c59ed9485
GDScript: Add static typing for for loop variable 2023-08-17 20:54:34 +03:00
Danil Alexeev 0f27c4ad80
GDScript: Check get_node() shorthand in static functions 2023-08-09 17:11:38 +03:00
Yuri Sizov 3de7dd902c Merge pull request #79880 from dalexeev/gds-fix-id-shadowing-below
GDScript: Fix bug with identifier shadowed below in current scope
2023-07-31 21:01:36 +02:00
Yuri Sizov 41efc7cb86 Merge pull request #78941 from dalexeev/gds-doc-comments-deprecated-and-experimental
GDScript: Add `@deprecated` and `@experimental` doc comment tags
2023-07-31 21:01:08 +02:00
Yuri Sizov efbff1369a Merge pull request #78254 from dalexeev/gds-fix-property-group-name-conflict
GDScript: Fix conflict between property and group names
2023-07-31 21:01:03 +02:00
Danil Alexeev d53fc92b4c
GDScript: Fix bug with identifier shadowed below in current scope 2023-07-26 11:26:57 +03:00
Danil Alexeev c1b450566a
GDScript: Add @deprecated and @experimental doc comment tags 2023-07-08 18:13:19 +03:00
Rémi Verschelde faf3faa8c8
Merge pull request #77744 from dalexeev/gds-reset-block-locals-on-exit
GDScript: Reset local variables on exit from block
2023-06-21 21:51:05 +02:00
Rémi Verschelde 25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
Danil Alexeev bf8f996212
GDScript: Fix conflict between property and group names 2023-06-15 08:36:10 +03:00
Danil Alexeev f3bf75fbb4
GDScript: Reset local variables on exit from block 2023-06-02 13:20:19 +03:00
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