Commit Graph

1986 Commits

Author SHA1 Message Date
8870e1c75d Fix first value update 2022-05-12 19:11:33 -04:00
a439832035 Fix signal completion in GDScript editor 2022-05-12 16:10:48 +03:00
8b7c7f5a75 Add a new HashMap implementation
Adds a new, cleaned up, HashMap implementation.

* Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing).
* Keeps elements in a double linked list for simpler, ordered, iteration.
* Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much
  for performance vs keeping the key, but helps replace old code).
* Uses a more modern C++ iterator API, deprecates the old one.
* Supports custom allocator (in case there is a wish to use a paged one).

This class aims to unify all the associative template usage and replace it by this one:
* Map<> (whereas key order does not matter, which is 99% of cases)
* HashMap<>
* OrderedHashMap<>
* OAHashMap<>
2022-05-12 11:21:29 +02:00
be8eb6625e Fix incorrect precedence of pow operator in GDScript 2022-05-12 10:09:51 +03:00
dbd7a31507 Implement exponential operator (**) to GDScript/Expressions 2022-05-11 16:30:37 +03:00
9963ae3553 Merge pull request #59863 from cdemirer/fix-match-multiple-bind-single-pattern
Fix issues with multiple bind patterns in match statement
2022-05-11 14:18:02 +02:00
c171f675c8 Merge pull request #60229 from Dorodri/improve-gdscript-range-description 2022-05-11 14:17:39 +02:00
505e15c523 Merge pull request #60732 from CalebJohn/matching_signature_regression_test 2022-05-11 14:15:48 +02:00
f4ece7e736 Merge pull request #60609 from nathanfranke/string-quotes 2022-05-06 08:59:08 +02:00
84f64ddde9 Merge pull request #60723 from reduz/refactor-module-initialization 2022-05-04 19:08:43 +02:00
de0ca3b999 Refactor module initialization
* Changed to use the same stages as extensions.
* Makes the initialization more coherent, helping solve problems due to lack of stages.
* Makes it easier to port between module and extension.
* removed the DRIVER initialization level (no longer needed).
2022-05-04 17:34:51 +02:00
06a2d83e30 Add regression test for gdscript valid function signature
Previously, there was an issue where the gdscript analyzer incorrectly
riased a validation error for code that had a default Dictionary, Array,
or custom type.
2022-05-03 12:46:09 -07:00
58fcad20ef quote strings inside arrays and dictionaries 2022-05-03 13:37:13 -05:00
180e5d3028 Remove RES and REF typedefs in favor of spelled out Ref<>
These typedefs don't save much typing compared to the full `Ref<Resource>`
and `Ref<RefCounted>`, yet they sometimes introduce confusion among
new contributors.
2022-05-03 01:43:50 +02:00
c273ddc3ee Style: Partially apply clang-tidy's cppcoreguidelines-pro-type-member-init
Didn't commit all the changes where it wants to initialize a struct
with `{}`. Should be reviewed in a separate PR.

Option `IgnoreArrays` enabled for now to be conservative, can be
disabled to see if it proposes more useful changes.

Also fixed manually a handful of other missing initializations / moved
some from constructors.
2022-05-02 16:28:25 +02:00
b2841ce194 Improve description for GDScript built-in range
Rewrites the definition of how the function works.
Reworks the style of the examples and adds a negative range example.
Changes the while loop to a range loop in the array backwards example.
2022-04-30 15:17:17 -03:00
a793960a10 Fix cppcheck const parameters
Convert method signature parameters to const where it is possible

# Conflicts:
#	drivers/gles3/rasterizer_canvas_gles3.cpp
#	drivers/gles3/rasterizer_canvas_gles3.h
#	editor/plugins/animation_state_machine_editor.cpp
#	editor/plugins/animation_state_machine_editor.h
2022-04-28 11:35:39 +02:00
f626e8ef91 Merge pull request #60396 from vnen/gdscript-self-lambda 2022-04-27 13:11:24 +02:00
3dd550e1ca Merge pull request #59613 from PastMoments/dict-arr-const-fix 2022-04-27 12:45:30 +02:00
cb5f3a39b9 Merge pull request #60418 from ShimmyShaman/master 2022-04-26 11:11:08 +02:00
bef00b2b0d Merge pull request #60445 from nathanfranke/minor-changes
small changes: improve OS.get_name classref, misc/scripts fixes, remove trailing quote
2022-04-25 23:10:48 +02:00
01d13ab2c1 GDScript: Allow using self in lambdas 2022-04-24 21:49:02 -03:00
1304d72fc1 improve OS.get_name classref, misc/scripts fixes, remove trailing quote 2022-04-22 17:13:08 -05:00
b3922a42e9 improved error msg for gdscript load_source_code 2022-04-22 16:10:48 +12:00
540fca147d Fix typo in GDScript::range doc 2022-04-20 19:38:49 +03:00
b3704e664d Fixes GDScript define nested dictionary and array as constants #50285 2022-04-19 08:57:23 -04:00
7032b111ce Merge pull request #60007 from aaronfranke/gds-op-adj-tr3d
GDScript: Rename OPCODE_TYPE_ADJUST_TRANSFORM to have a 3D suffix
2022-04-15 08:17:27 +02:00
4bf99f4af2 Narrow FileAccess scope to prevent deadlocks. 2022-04-12 10:54:39 +03:00
9381acb6a4 Make FileAccess and DirAccess classes reference counted. 2022-04-11 13:28:51 +03:00
cdbd6056ef GDScript: Fix method call on singletons 2022-04-08 12:20:57 -03:00
f3eca5abef GDScript: Rename OPCODE_TYPE_ADJUST_TRANSFORM to have a 3D suffix 2022-04-07 23:32:56 -05:00
1f62965d26 Add built-in Variant types to autocompletion list
Co-authored-by: Gustav <gusan092@student.liu.se>
2022-04-07 11:10:19 -05:00
4d0fdf2e98 Merge pull request #59947 from vnen/gdscript-static-methods-classdb 2022-04-06 20:57:34 +02:00
4710e2b278 GDScript: Add support for static method calls in native types 2022-04-06 14:14:38 -03:00
f851c4aa33 Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
db8e6bd83f Merge pull request #59885 from Jayman2000/autoload-inheritance-message 2022-04-04 23:56:20 +02:00
1cc7e7ec33 Improve autoload inheritance error message
Autoloaded scripts should always inherit from Node. When you run a
project that tries to autoload a script which doesn’t inherit from Node,
then Godot gives an error.

Before this change, the error said “Script does not inherit a Node”.
That error message is a little bit misleading. If a class inherits a
Node, then one of its superclasses has a Node. If a class inherits
_from_ Node, then one of its superclasses is Node. This change corrects
that mistake.

Fixes #59884.
2022-04-04 15:51:02 -04:00
f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
3c5b9d1be3 Fix issues with multiple bind patterns in match statement 2022-04-04 15:47:08 +08:00
c630c2001d Merge pull request #59633 from EricEzaM/better-code-complete-update
Improve sorting of Code Completion options.
2022-04-03 12:34:00 +02:00
4ab605d14d Improve sorting of Code Completion options.
Done by ordering options by their location in the code - e.g. local, parent class, global, etc.
2022-04-01 20:39:09 +10:00
947d7c8329 Fix some issues found by clang sanitizers. 2022-03-31 18:35:56 +03:00
a647fb3e62 Fix typos with codespell
Using codespell 2.2-dev from current git.

Fix a couple incorrect uses of gendered pronouns.
2022-03-31 14:07:29 +02:00
5ba3b993d5 Merge pull request #59694 from vnen/gdscript-better-call-super 2022-03-30 17:58:11 +02:00
be718285f7 GDScript: Fix issues with completion and super calls
- Make call errors use the call node instead of the calle, which will be
  empty on super calls.
- Don't allow `super()` to be used within lambdas.
2022-03-30 11:58:29 -03:00
0584387918 Fix autocompletion of static methods in built-in types in GDScript 2022-03-30 17:40:41 +03:00
c9b75431f3 Refactor GDScript/C# script templates logic to be editor-only
Not a full refactor as it still goes through ScriptLanguage so it's hacky,
but at least it can now compile without this.
2022-03-28 16:21:00 +02:00
143d13717b Merge pull request #59553 from reduz/script-extension-support 2022-03-28 13:35:21 +02:00
ed14ff5a08 Revert "Sort autocomplete/code completion options in a better way" 2022-03-28 13:31:32 +02:00
795304e34f Merge pull request #59612 from YeldhamDev/style_and_grace 2022-03-28 11:36:27 +02:00