Commit graph

3155 commits

Author SHA1 Message Date
Rémi Verschelde 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
George Marques 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
A Thousand Ships c4e24d2b3b
[GDScript] Correctly report invalid read-only access 2024-05-01 12:28:47 +02:00
Rémi Verschelde 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
Rémi Verschelde 273a643145
Merge pull request #89647 from AThousandShips/read_only_dict
[Core] Fix property access on read-only `Dictionary`
2024-05-01 09:54:48 +02:00
Rémi Verschelde c4733e8003
Merge pull request #90860 from vnen/gdscript-get-dependencies
GDScript: Implement `get_dependencies()`
2024-04-29 12:30:12 +02:00
Rémi Verschelde 296758a8f8
Merge pull request #90552 from vnen/gdscript-constructor-callable-release
GDScript: Assume constructor to be accessible from class
2024-04-29 12:30:08 +02:00
Rémi Verschelde d216a385a6
Merge pull request #90498 from vnen/gdscript-resolve-scene-autoload-types
GDScript: Resolve types from autoload scenes
2024-04-29 12:30:02 +02:00
Rémi Verschelde 13fbd42c37
Merge pull request #90975 from aaronfranke/plugin-org
Organize existing code for editor plugins
2024-04-29 10:09:45 +02:00
Rémi Verschelde c33cd94509
Merge pull request #90949 from rhofour/gdignore
LSP: Have `GDScriptWorkspace::list_script_files` respect `.gdignore`.
2024-04-29 10:09:42 +02:00
Aaron Franke 1bcbbe96c4
Organize existing code for editor plugins 2024-04-27 11:59:58 -07:00
George Marques 8b7fc225f0
GDScript: Resolve types from autoload scenes
When the autoload is a scene, it now extracts the script from it and
use it to further infer nested types.
2024-04-26 10:46:19 -03:00
Danil Alexeev 2778069025
GDScript: Fix object iterator opcodes 2024-04-26 09:21:55 +03:00
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
Rémi Verschelde 6b28cb6721
Merge pull request #89884 from HolonProduction/tests-batch-2
Completion Tests: Add script to owner
2024-04-23 19:10:57 +02:00
Rémi Verschelde 13b66bcea2
Merge pull request #89738 from dalexeev/gds-docgen-improve-non-constant
GDScript: Improve DocGen for non-constant expressions
2024-04-23 19:10:51 +02:00
Rémi Verschelde e8eca0b3f0
Merge pull request #90601 from rune-scape/rune-gdscript-dependant-parser-ref-errors
GDScript: Fix out of date errors in depended scripts
2024-04-22 22:18:15 +02:00
A Thousand Ships ec29c3e784
[Core] Fix property access on read-only Dictionary 2024-04-22 13:57:34 +02:00
R. Alex Hofer 2452176990 Have GDScriptWorkspace::list_script_files respect .gdignore. 2024-04-20 13:29:27 -04:00
Rémi Verschelde 931f878390
Merge pull request #88899 from AThousandShips/gdscript_clean
[GDScript] Clean up some unused code
2024-04-19 16:26:58 +02:00
rune-scape 6b88c86cec GDScript: invalidate GDScriptParserRef when reloading 2024-04-18 14:05:58 -07:00
George Marques dc73440f89
GDScript: Implement get_dependencies()
The parser and analyzer now track the dependencies of the script and
return the list when the resource loader ask for them.

What is considered a dependency:

- Any `preload()` call.
- The base script this one extends.
- Any identifier, including types, that refers to global scripts.
- Any autoload singleton reference.
2024-04-18 11:54:37 -03:00
Rémi Verschelde 978d206f34
Merge pull request #90794 from vnen/gdscript-no-unused-constant-warning-with-underscore
GDScript: Suppress unused constant warning with underscore
2024-04-18 15:17:13 +02:00
George Marques a3b3a20ac0
GDScript: Suppress unused constant warning with underscore
The warning message mentions that local constants prefixed with `_` does
not generate the warning. This commit actually implements this warning
suppression.
2024-04-18 09:58:23 -03: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
A Thousand Ships c070c12ddd
[GDScript] Clean up some unused code 2024-04-16 15:59:38 +02:00
Rémi Verschelde 684e7aa37a
Merge pull request #89472 from dalexeev/gds-fix-bin-tokenizer-continuation-lines
GDScript: Fix continuation lines in `GDScriptTokenizerBuffer`
2024-04-15 18:14:38 +02:00
George Marques 030995c10d
GDScript: Allow casting enum to int
An enum value is always an integer so the cast is valid. The code here
now consider this case to avoid giving an error message.
2024-04-12 11:49:21 -03:00
Aiden Storey 74177d79c9
Fix multiline array/dictionary match statements
Currently array and dictionary expressions cannot be spread over
multiple lines in match statements.

Adding mutliline push/pop while parsing the pattern for bracket and
brace enables the ability for these to be multiline. This enables more
complex patterns to be matched without exceeding line limits.

Fixes #90372
2024-04-12 10:59:28 +02:00
George Marques e761982979
GDScript: Assume constructor to be accessible from class
Since the constructor is accessed directly from the class, even if not
marked `static`, it can be retrieved as a Callable without an instance.
2024-04-11 20:28:46 -03:00
Rémi Verschelde 67076c167d
Merge pull request #90448 from vnen/gdscript-infer-string-format
GDScript: Infer type with string format operator
2024-04-10 17:49:49 +02: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
George Marques 4bdba718c5
GDScript: Infer type with string format operator
If the left value type is known to be String, assume the format operator
(`%`) will return a string, since it works with any type in the right
hand side. This is also used by type inference even if the right hand
type is unknown at compile time.
2024-04-10 11:49:30 -03:00
Danil Alexeev 02253b6b91
GDScript: Fix continuation lines in GDScriptTokenizerBuffer 2024-04-10 08:51:02 +03:00
Rémi Verschelde 9a9045cf7a
Merge pull request #89382 from dcaoc03/master
Fix enum autocompletion for core classes
2024-04-09 22:25:13 +02: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
Danil Alexeev 98dac9e39c
GDScript: Fix highlighting escapes in multiline raw strings 2024-04-09 10:21:10 +03:00
kobewi 809c6817be Add tests for signal await with parameters 2024-04-08 19:12:01 +02:00
Rémi Verschelde 8f1b5d68f1
Merge pull request #90039 from AThousandShips/load_relative_note
[Doc] Document loading behavior with relative paths
2024-04-08 11:20:40 +02:00
Rémi Verschelde a2f6698098
Merge pull request #89659 from dalexeev/gds-hl-fix-types
GDScript: Fix `for` expression is highlighted as type
2024-04-08 11:20:17 +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
A Thousand Ships 2508c2e309
[Doc] Document loading behavior with relative paths 2024-03-30 13:33:49 +01:00
HolonProduction d2c2194937 Completion Tests: Add script to owner 2024-03-25 16:17:44 +01:00
ppphp d4e1a74efb Add 'override' mark to ResourceFormat class 2024-03-25 04:06:34 +08:00
Rémi Verschelde 48cf825839
Merge pull request #89451 from AThousandShips/emit_fix
[Core] Disconnect one-shot signals before calling callbacks
2024-03-24 01:15:52 +01:00
Danil Alexeev 0498305b6b
GDScript: Improve DocGen for non-constant expressions 2024-03-21 12:23:54 +03:00