Commit Graph

269 Commits

Author SHA1 Message Date
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
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
A Thousand Ships c070c12ddd
[GDScript] Clean up some unused code 2024-04-16 15:59:38 +02: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
Danil Alexeev 27d7760f41
GDScript: Fix uninitialized local variables not being reset 2024-03-30 23:25:30 +03:00
Rémi Verschelde 0bcc0e92b3
Merge pull request #86730 from reduz/64-bit-cowdata
Promote CowData to 64 bits
2024-01-19 18:46:11 +01:00
Juan Linietsky 24fe0715b5 Promote CowData to 64 bits
Fixes a lot of bugs, please help me fill the list.
2024-01-19 17:41:10 +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
Rémi Verschelde bf1de980e5
Merge pull request #86569 from rune-scape/rune-fix-lambda-hotswap2
GDScript: Lambda hotswap fixes
2024-01-05 12:05:32 +01:00
rune-scape 49bce5c9ef GDScript: Lambda hotswap fixes 2024-01-04 16:33:54 -08:00
Danil Alexeev 10dcb21d8b
GDScript: Fix accessing static function as `Callable` in static context 2023-12-12 22:19:39 +03:00
Thaddeus Crews 5cf0d772bc
Change container_element_type to vector container 2023-12-05 08:51:49 -06:00
rune-scape 9fb8862d73
GDScript: Lambda hot reloading
Co-authored-by: Adam Scott <ascott.ca@gmail.com>
2023-10-17 15:52:52 -04: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
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 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 16b024ba82
GDScript: Fix crash with `GDScriptNativeClass` 2023-09-25 17:09:20 +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
Rémi Verschelde 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
Danil Alexeev b1eb737719
GDScript: Fix some lambda bugs 2023-09-14 14:22:23 +03:00
ocean (they/them) d330f5642e GDScript: Fix compilation of expressions compiling other classes
This PR is part of ongoing work on fixing cyclic dependencies in the GDScript
compiler.
2023-09-12 11:18:33 -04:00
Rémi Verschelde b539bfb263
Merge pull request #81201 from anvilfolk/rpc
GDScript: Fix subclass methods not inheriting RPC info
2023-09-12 08:49:33 +02:00
ocean (they/them) 711ffabcfe GDScript: fix subclass methods not inheriting RPC info 2023-09-11 11:10:07 -04:00
Danil Alexeev 462d8f4752
GDScript: Fix `get_*_list()` methods return incorrect info 2023-09-04 00:21:03 +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 f19377160c
GDScript: Fix regression with native signal not found 2023-08-02 15:42:36 +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 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
ocean (they/them) 7d29ac0bf2 GDScript: solve `_populate_class_members()` cyclic dependency problem 2023-07-08 15:34:20 -04: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 c211c22abc
Merge pull request #78389 from rune-scape/rune-match-stringnames
GDScript: Strings and StringNames match
2023-06-19 21:18:42 +02:00
Danil Alexeev aebbbda080
GDScript: Fix some bugs with static variables and functions 2023-06-16 22:52:11 +03:00
Danil Alexeev bf8f996212
GDScript: Fix conflict between property and group names 2023-06-15 08:36:10 +03:00
rune-scape fcdd926881 GDScript: Strings and StringNames match 2023-06-14 19:24:28 -07: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
Yuri Sizov 26fb911f79
Merge pull request #72095 from anvilfolk/gd-docs
Improve GDScript documentation generation & behavior
2023-04-26 16:54:25 +02:00
Rémi Verschelde 45cd5dcad3
Merge pull request #75885 from AThousandShips/compound_fix
[GDScript] Fix incorrect compound assignment
2023-04-25 16:17:02 +02:00
ocean (they/them) 6783ff69c0 Improve and fix GDScript documentation generation & behavior
Removes documentation generation (docgen) from the GDScript compiler to
its own file. Adds support for GDScript enums and signal parameters and
quite a few other assorted fixes and improvements.
2023-04-21 10:17:30 -04:00
Ninni Pipping e5365da03c [GDScript] Fix incorrect compound assignment
Reverts in-place compound assignments

Added test to ensure correctness
2023-04-14 11:28:44 +02:00
Pedro J. Estébanez 2f4168daeb Fix edge cases of object lifetime when signals involved 2023-04-11 17:27:39 +02:00
Yuri Sizov a008a06fcb
Merge pull request #72056 from resistor/master
[GDScript] Perform update-and-assign operations in place when possible.
2023-03-20 19:16:30 +01:00
Dmitrii Maganov 55a2ad25bf GDScript: Fix checking if a call is awaited in compiler 2023-03-01 09:31:35 +02:00
Rémi Verschelde c0f1ed57c4
Merge pull request #73915 from vonagam/fix-conversions-from-native-member
GDScript: Fix conversions from native members accessed by identifier
2023-02-26 19:02:27 +01:00