George Marques
7ca038effa
GDScript: Perform validated calls with static methods
...
When the types are validated at compile time, this type of call runs
faster. It is already used for instance methods, this adds this
optimization to native static methods as well.
2024-04-25 21:19:40 -03:00
Danil Alexeev
4136ed7fc8
GDScript: Fix test reset_uninit_local_vars.gd
failure
2024-04-24 20:49:52 +03:00
Rémi Verschelde
69a23e64e4
Merge pull request #89990 from dalexeev/gds-reset-uninit-local-vars
...
GDScript: Fix uninitialized local variables not being reset
2024-04-24 18:54:56 +02:00
George Marques
f9048fcd7d
GDScript: Warn when enum variable has no default
...
The default will always be set to `0`, so if it's not a valid value in
the enum, the warning is shown.
2024-04-16 11:46:59 -03:00
Rémi Verschelde
8611fd8400
Merge pull request #90442 from vnen/gdscript-dont-warn-using-default-builtin
...
GDScript: Don't warn on unassigned for builtin-typed variables
2024-04-10 17:49:44 +02:00
George Marques
877802e252
GDScript: Don't warn on unassigned for builtin-typed variables
...
If the type of a variable is a built-in Variant type, then it will
automatically be assigned a default value based on the type. This means
that the explicit initialization may be unnecessary. Thus this commit
removes the warning in such case.
This also changes the meaning of the unassigned warning to happen when
the variable is used before being assigned, not when it has zero
assignments.
2024-04-10 11:59:57 -03:00
Rémi Verschelde
f8ca571efe
Merge pull request #84043 from dalexeev/gds-fix-unsafe-cast-warning
...
GDScript: Fix `UNSAFE_CAST` warning
2024-04-09 22:24:55 +02:00
kobewi
809c6817be
Add tests for signal await with parameters
2024-04-08 19:12:01 +02:00
Danil Alexeev
27d7760f41
GDScript: Fix uninitialized local variables not being reset
2024-03-30 23:25:30 +03:00
A Thousand Ships
db455e5bee
[Core] Disconnect one-shot signals before calling callbacks
...
This prevents infinite recursion with one-shot connections emitting
themselves
2024-03-20 20:24:44 +01:00
Rémi Verschelde
a1c476f9d7
Merge pull request #87680 from AThousandShips/the_angry_count
...
Add methods to get argument count of methods
2024-03-13 22:16:43 +01:00
Danil Alexeev
ef1909fca3
GDScript: Fix @warning_ignore
annotation issues
2024-03-12 19:00:06 +03:00
A Thousand Ships
59bcc2888c
Add methods to get argument count of methods
...
Added to:
* `Callable`s
* `Object`s
* `ClassDB`
* `Script(Instance)`s
2024-03-10 11:02:43 +01:00
A Thousand Ships
1e61e42250
[GDScript] Fix some test file paths
2024-03-04 19:11:28 +01:00
Danil Alexeev
d90c9db27f
Core: Add Callable.create
static method for Variant
callables
2024-02-29 10:45:00 +03:00
Rémi Verschelde
21ee3716c2
Merge pull request #82122 from dalexeev/gds-add-export-hidden-annotation
...
GDScript: Add `@export_storage` annotation
2024-02-27 21:22:49 +01:00
emre0altan
081fa324fd
set has_type false if it is BUILTIN but Variant::NIL
2024-02-11 13:47:12 +00: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
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
Danil Alexeev
b31acb0cd5
GDScript: Allow utility functions to be used as Callable
2024-01-05 21:16:53 +03: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
Danil Alexeev
3a3a2011f4
GDScript: Add @export_storage
annotation
2023-12-19 20:56:30 +03:00
Danil Alexeev
10dcb21d8b
GDScript: Fix accessing static function as Callable
in static context
2023-12-12 22:19:39 +03:00
Danil Alexeev
6e996a597f
GDScript: Fix UNSAFE_CAST
warning
2023-10-27 12:42:00 +03: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
0c2202c56e
GDScript: Fix incorrect error message for utility functions
2023-10-16 14:09:57 +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
ed0b3c08e1
Core: Fix Object::has_method()
for script static methods
2023-10-04 19:44:32 +03: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
Danil Alexeev
ba96d4f631
GDScript: Fix UNSAFE_CALL_ARGUMENT
warning for Variant
constructors
2023-09-30 13:57:09 +03: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
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
Danil Alexeev
16e860bcb3
GDScript: Fix duplication of inherited script properties
2023-09-23 15:30:23 +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
Danil Alexeev
b1eb737719
GDScript: Fix some lambda bugs
2023-09-14 14:22:23 +03:00
Danil Alexeev
462d8f4752
GDScript: Fix get_*_list()
methods return incorrect info
2023-09-04 00:21:03 +03:00
Danil Alexeev
6c59ed9485
GDScript: Add static typing for for
loop variable
2023-08-17 20:54:34 +03:00
Danil Alexeev
f19377160c
GDScript: Fix regression with native signal not found
2023-08-02 15:42:36 +03: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
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
248e5245e4
Merge pull request #73540 from mashumafi/fix-typed-array-add
...
Fix: Typed arrays aren't working with +
2023-06-20 15:12:39 +02:00
Danil Alexeev
a0577eb23b
GDScript: Fix _get_script_name()
function collision for SCU build
2023-06-20 12:03:54 +03:00
Rémi Verschelde
c211c22abc
Merge pull request #78389 from rune-scape/rune-match-stringnames
...
GDScript: Strings and StringNames match
2023-06-19 21:18:42 +02:00
Rémi Verschelde
ae00187b58
Merge pull request #77129 from dalexeev/gds-fix-static-var-bugs-part-1
...
GDScript: Fix some bugs with static variables and functions
2023-06-19 21:18:18 +02:00
Rémi Verschelde
4db1d09bf5
Merge pull request #73657 from mashumafi/callable-ctor
...
Fix: Get constructor as Callable
2023-06-18 16:27:42 +02:00
Danil Alexeev
aebbbda080
GDScript: Fix some bugs with static variables and functions
2023-06-16 22:52:11 +03:00