Commit Graph

108 Commits

Author SHA1 Message Date
a7029e4c8a Merge pull request #91364 from vnen/gdscript-implicit-ready-base-first
GDScript: Call implicit ready on base script first
2024-05-02 17:31:32 +02:00
99b702ea3d GDScript: Call implicit ready on base script first
It is generally expected that the base class is called before the
inherited clas. This commit implements this behavior for the implicit
ready function (`@onready` annotation) to make it consistent with the
expectations.
2024-05-02 11:25:52 -03:00
731ea17dd4 Merge pull request #91192 from vnen/gdscript-validated-native-static-calls
GDScript: Perform validated calls with static methods
2024-05-01 09:55:04 +02:00
2778069025 GDScript: Fix object iterator opcodes 2024-04-26 09:21:55 +03:00
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
4136ed7fc8 GDScript: Fix test reset_uninit_local_vars.gd failure 2024-04-24 20:49:52 +03:00
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
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
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
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
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
809c6817be Add tests for signal await with parameters 2024-04-08 19:12:01 +02:00
27d7760f41 GDScript: Fix uninitialized local variables not being reset 2024-03-30 23:25:30 +03:00
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
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
ef1909fca3 GDScript: Fix @warning_ignore annotation issues 2024-03-12 19:00:06 +03:00
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
1e61e42250 [GDScript] Fix some test file paths 2024-03-04 19:11:28 +01:00
d90c9db27f Core: Add Callable.create static method for Variant callables 2024-02-29 10:45:00 +03:00
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
081fa324fd set has_type false if it is BUILTIN but Variant::NIL 2024-02-11 13:47:12 +00: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
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
b31acb0cd5 GDScript: Allow utility functions to be used as Callable 2024-01-05 21:16:53 +03: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
3a3a2011f4 GDScript: Add @export_storage annotation 2023-12-19 20:56:30 +03:00
10dcb21d8b GDScript: Fix accessing static function as Callable in static context 2023-12-12 22:19:39 +03:00
6e996a597f GDScript: Fix UNSAFE_CAST warning 2023-10-27 12:42:00 +03:00
b04263644c Core: Allow methods of built-in Variant types to be used as Callables 2023-10-25 15:53:52 +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
ed0b3c08e1 Core: Fix Object::has_method() for script static methods 2023-10-04 19:44:32 +03:00
ba96d4f631 GDScript: Fix UNSAFE_CALL_ARGUMENT warning for Variant constructors 2023-09-30 13:57:09 +03: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
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
16e860bcb3 GDScript: Fix duplication of inherited script properties 2023-09-23 15:30:23 +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
b1eb737719 GDScript: Fix some lambda bugs 2023-09-14 14:22:23 +03:00
462d8f4752 GDScript: Fix get_*_list() methods return incorrect info 2023-09-04 00:21:03 +03:00
6c59ed9485 GDScript: Add static typing for for loop variable 2023-08-17 20:54:34 +03:00
f19377160c GDScript: Fix regression with native signal not found 2023-08-02 15:42:36 +03:00
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
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
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
c211c22abc Merge pull request #78389 from rune-scape/rune-match-stringnames
GDScript: Strings and StringNames match
2023-06-19 21:18:42 +02:00
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
4db1d09bf5 Merge pull request #73657 from mashumafi/callable-ctor
Fix: Get constructor as Callable
2023-06-18 16:27:42 +02:00
aebbbda080 GDScript: Fix some bugs with static variables and functions 2023-06-16 22:52:11 +03:00