Commit Graph

380 Commits

Author SHA1 Message Date
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
2bf25954b4 GDScript: Add is not operator 2024-02-04 17:36:53 +03:00
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
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
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
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
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
c7f68a27ec Add UID support to GDScript files 2024-01-17 22:30:56 +01:00
92a7c26806 Allow specifying a scene in completion tests 2024-01-08 22:38:41 +01:00
b88535fe23 Merge pull request #85178 from HolonProduction/completion-tests
Add unit test runner for autocompletion
2024-01-08 11:51:03 +01:00
b31acb0cd5 GDScript: Allow utility functions to be used as Callable 2024-01-05 21:16:53 +03:00
af4cbaf751 Add unit test runner for autocompletion 2024-01-05 17:49:51 +01:00
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
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
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
10dcb21d8b GDScript: Fix accessing static function as Callable in static context 2023-12-12 22:19:39 +03:00
b04263644c Core: Allow methods of built-in Variant types to be used as Callables 2023-10-25 15:53:52 +03:00
7f4721a941 GDScript: Fix non-static call is allowed in static var lambda body 2023-10-20 20:43:07 +03:00
0c2202c56e GDScript: Fix incorrect error message for utility functions 2023-10-16 14:09:57 +03:00
668ba2d1a5 GDScript: Allow empty parentheses for property getter declaration 2023-10-11 09:54:17 +03:00
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
9e2273abc7 GDScript: Add error when exporting node in non [Node]-derived classes 2023-10-05 13:50:26 +03:00
ed0b3c08e1 Core: Fix Object::has_method() for script static methods 2023-10-04 19:44:32 +03:00
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
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
74c937079c Add type_string() utility 2023-10-02 17:41:20 +02:00
ba96d4f631 GDScript: Fix UNSAFE_CALL_ARGUMENT warning for Variant constructors 2023-09-30 13:57:09 +03:00
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
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
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
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
cb8b89fd95 GDScript: Add return type covariance and parameter type contravariance 2023-09-28 12:27:36 +03:00
aa474c9feb Merge pull request #75988 from dalexeev/gds-unsafe-call-argument
GDScript: Improve call analysis
2023-09-27 19:07:46 +02:00
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
ceda13720b Check if any global script class is shadowed by a variable 2023-09-26 16:47:17 +08:00
16e860bcb3 GDScript: Fix duplication of inherited script properties 2023-09-23 15:30:23 +03:00
10b00bc2ea GDScript: Prevent constructing and inheriting engine singletons 2023-09-22 17:30:00 +03:00
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
3c35e7f1d6 GDScript: Make array literal typed if for loop variable type is specified 2023-09-21 11:25:59 +03:00
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
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
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
c35cb51d74 GDScript: Fix subscript resolution for constant non-metatypes 2023-09-19 22:26:06 +03:00
729c9b4d4b GDScript: Add check for super() methods not being implemented 2023-09-17 16:21:28 -04:00
6c1be30836 Merge pull request #81605 from dalexeev/gds-fix-some-lambda-bugs
GDScript: Fix some lambda bugs
2023-09-16 21:23:42 +02:00
b1eb737719 GDScript: Fix some lambda bugs 2023-09-14 14:22:23 +03:00
ceda960131 Remove REDUNDANT_FOR_VARIABLE_TYPE
Remove REDUNDANT_FOR_VARIABLE_TYPE
2023-09-12 20:04:32 -05:00
5c43e4c1ef Fix various typos with codespell
Using 2.2.6.dev180+ge3a2cfbd.
2023-09-12 08:54:18 +02:00
2964c7d51c GDScript: Add raw string literals (r-strings) 2023-09-11 18:34:33 +03:00
0202a36a7a Language Server: Improve hovered symbol resolution, fix renaming bugs, implement reference lookup
Co-Authored-By: Ryan Brue <56272643+ryanabx@users.noreply.github.com>
Co-Authored-By: BooksBaum <15612932+booksbaum@users.noreply.github.com>
2023-09-11 09:46:34 -05:00