Commit graph

455 commits

Author SHA1 Message Date
George Marques
72e5f8c31e
GDScript: Enable compression on export
Besides the regular option to export GDScript as binary tokens, this
also includes a compression option on top of it. The binary format
needs to encode some information which generally makes it bigger than
the source text. This option reduces that difference by using Zstandard
compression on the buffer.
2024-02-08 11:20:07 -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
7223c5b54a
Fix various typos with codespell
Using 2.2.7.dev115+g0eb441d6.

Had to add `cancelled` to the ignore list, as it's a Wayland signal which
we're handling in our code, so we don't want codespell to fix that "typo".

Also includes the typo fix from #87927.

Co-authored-by: Divyanshu Shekhar <61140213+divshekhar@users.noreply.github.com>
2024-02-07 11:09:34 +01:00
Danil Alexeev
2bf25954b4
GDScript: Add is not operator 2024-02-04 17:36:53 +03:00
Rémi Verschelde
9572cf5ab2
Merge pull request #86823 from dalexeev/gds-utility-func-as-callable
GDScript: Allow utility functions to be used as `Callable`
2024-01-30 17:47:50 +01: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
Rémi Verschelde
baf87e2717
Merge pull request #87294 from vnen/allow-free-callable
Allow `free()` to be used as Callable
2024-01-18 16:35:14 +01:00
Rémi Verschelde
d3003c48b3
Merge pull request #67132 from KoBeWi/This_commit_message_is_auto-generated._Do_not_modify_it-
Add UID support to GDScript files
2024-01-18 16:33:14 +01:00
George Marques
b4e08eb752
Allow free() to be used as Callable
This method is registered in a special way so ClassDB doesn't naturally
know about its existence. Here it is hardcoded if any other option fail
to check if it is about the `free()` method and, if so, say it exists
and return a Callable.
2024-01-18 09:33:44 -03:00
kobewi
c7f68a27ec Add UID support to GDScript files 2024-01-17 22:30:56 +01:00
HolonProduction
92a7c26806 Allow specifying a scene in completion tests 2024-01-08 22:38:41 +01:00
Rémi Verschelde
b88535fe23
Merge pull request #85178 from HolonProduction/completion-tests
Add unit test runner for autocompletion
2024-01-08 11:51:03 +01:00
Danil Alexeev
b31acb0cd5
GDScript: Allow utility functions to be used as Callable 2024-01-05 21:16:53 +03:00
HolonProduction
af4cbaf751 Add unit test runner for autocompletion 2024-01-05 17:49:51 +01:00
Rémi Verschelde
150f2a75b2
Merge pull request #83120 from dalexeev/gds-allow-property-getter-empty-parentheses
GDScript: Allow empty parentheses for property getter declaration
2024-01-04 16:39:16 +01:00
Rémi Verschelde
2bffa3cbc5
Merge pull request #82639 from golfinq/gdscript-improve-indexing-error
GDScript: Improve error messages for invalid indexing
2024-01-04 16:38:58 +01:00
Rémi Verschelde
2e1725bef6
Merge pull request #86088 from dalexeev/gds-fix-static-func-as-callable-in-static-context
GDScript: Fix accessing static function as `Callable` in static context
2024-01-02 18:05:16 +01:00
Rémi Verschelde
b5c6e870e8
Merge pull request #82264 from dalexeev/core-builtin-methods-as-callables
Core: Allow methods of built-in `Variant` types to be used as Callables
2024-01-02 18:05:05 +01:00
Danil Alexeev
10dcb21d8b
GDScript: Fix accessing static function as Callable in static context 2023-12-12 22:19:39 +03:00
Yuri Sizov
bc1949d797 Correctly check scripts that must inherit EditorPlugin
Also updates some error messages related to this kind of check
across the codebase.
2023-11-23 16:24:43 +01:00
Danil Alexeev
b04263644c
Core: Allow methods of built-in Variant types to be used as Callables 2023-10-25 15:53:52 +03: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
0c2202c56e
GDScript: Fix incorrect error message for utility functions 2023-10-16 14:09:57 +03:00
Danil Alexeev
668ba2d1a5
GDScript: Allow empty parentheses for property getter declaration 2023-10-11 09:54:17 +03:00
George Marques
4a7d49a89a
GDScript: Replace ptrcalls on MethodBind to validated calls
This improves the performance of typed calls to engine methods when the
argument types are exact.

Using validated calls delegate more of the work the core instead of
doing argument unpacking in the VM. It also does not need different
instructions for each return type, simplifying the code.
2023-10-06 11:15:44 -03:00
Danil Alexeev
9e2273abc7
GDScript: Add error when exporting node in non [Node]-derived classes 2023-10-05 13:50:26 +03:00
Danil Alexeev
ed0b3c08e1
Core: Fix Object::has_method() for script static methods 2023-10-04 19:44:32 +03:00
Rémi Verschelde
e41582f42f
Merge pull request #82547 from dalexeev/gds-fix-unsafe-call-arg-variant-constructors
GDScript: Fix `UNSAFE_CALL_ARGUMENT` warning for `Variant` constructors
2023-10-03 17:25:28 +02:00
Rémi Verschelde
6de06138c0
Merge pull request #79425 from vnen/gdscript-load-classes-for-debug-tests
GDScript: Load global classes when running debug tests
2023-10-03 17:11:01 +02:00
Rémi Verschelde
5efbed51cc GDScript: Improve error messages for invalid indexing
These errors are very common when using an invalid property name
or calling on an object of the wrong type, and the previous message
was a bit cryptic for users.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
Co-authored-by: golfinq <golfinqz@gmail.com>
2023-10-02 14:23:11 -04:00
Jakub Janšta
74c937079c Add type_string() utility 2023-10-02 17:41:20 +02:00
Danil Alexeev
ba96d4f631
GDScript: Fix UNSAFE_CALL_ARGUMENT warning for Variant constructors 2023-09-30 13:57:09 +03:00
Yuri Sizov
b25f1f9c79 Merge pull request #82477 from dalexeev/gds-covariance-and-contravariance
GDScript: Add return type covariance and parameter type contravariance
2023-09-28 20:04:37 +02:00
Yuri Sizov
78483a1df2 Merge pull request #82186 from dalexeev/gds-fix-property-duplication
GDScript: Fix duplication of inherited script properties
2023-09-28 20:04:18 +02:00
Yuri Sizov
73252669b1 Merge pull request #82030 from dalexeev/gds-make-for-loop-array-literal-typed
GDScript: Make array literal typed if `for` loop variable type is specified
2023-09-28 20:04:12 +02: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
Danil Alexeev
cb8b89fd95
GDScript: Add return type covariance and parameter type contravariance 2023-09-28 12:27:36 +03: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
Rémi Verschelde
9b0b441cf3
Merge pull request #82139 from dalexeev/gds-add-inferred-declaration-warning
GDScript: Add `INFERRED_DECLARATION` warning
2023-09-26 16:36:39 +02:00
Chia-Hsiang Cheng
ceda13720b Check if any global script class is shadowed by a variable 2023-09-26 16:47:17 +08:00
Danil Alexeev
16e860bcb3
GDScript: Fix duplication of inherited script properties 2023-09-23 15:30:23 +03:00
Danil Alexeev
4ce27301d3
GDScript: Add INFERRED_DECLARATION warning 2023-09-22 23:13:52 +03:00
Danil Alexeev
10b00bc2ea
GDScript: Prevent constructing and inheriting engine singletons 2023-09-22 17:30:00 +03: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
3c35e7f1d6
GDScript: Make array literal typed if for loop variable type is specified 2023-09-21 11:25:59 +03:00
Rémi Verschelde
712ebe7d8a
Merge pull request #81332 from dalexeev/gds-fix-update-array-literal-in-weak-context
GDScript: Don't make array literal typed in weak type context
2023-09-20 13:09:23 +02:00
Rémi Verschelde
971f678442
Merge pull request #79510 from dalexeev/gds-fix-const-non-metatype-subscript
GDScript: Fix subscript resolution for constant non-metatypes
2023-09-20 13:09:17 +02:00
Rémi Verschelde
21b132616b
Merge pull request #74995 from dalexeev/gds-r-strings
GDScript: Add raw string literals (r-strings)
2023-09-20 13:09:13 +02:00
Danil Alexeev
c35cb51d74
GDScript: Fix subscript resolution for constant non-metatypes 2023-09-19 22:26:06 +03:00