Commit graph

2420 commits

Author SHA1 Message Date
Rémi Verschelde
e4c1103af4
Merge pull request #70656 from vonagam/fix-void-returns
GDScript: Disallow return with value in void functions
2023-01-03 12:20:33 +01:00
Rémi Verschelde
a797fa3b3d
Merge pull request #70503 from rune-scape/inner-class-docs
Inner classes get their docs back
2023-01-03 12:15:44 +01:00
Dmitrii Maganov
961b4ac5f5 GDScript: Fix wrong native type for preloaded class 2023-01-03 05:45:06 +02:00
Juan Linietsky
7211e041df Optimizations for GDScript VM
* Removed instruction argument count and instruction prefetching. This is now done on the fly. Reduces jumps.
* OPCODE_DISPATCH now goes directly to the next instruction, like in Godot 3.x.

I have nothing I can use to test performance, so if anyone wants to lend a hand and compare with master (both on debug and release), it would be very welcome.
2023-01-02 23:44:19 +01:00
Adam Scott
c3f12592da Cache script when reloading even if there's errors. 2023-01-01 14:09:17 -05:00
George Marques
8a98110e3e
Merge pull request #62688 from cdemirer/assignments-and-types
Fixes https://github.com/godotengine/godot/issues/62650
2022-12-30 16:38:35 -03:00
George Marques
bc739a4687
GDScript: Make using return of void function an error
Remove the `VOID_ASSIGNMENT` warning since those cases will be errors
now.
2022-12-30 13:35:38 -03:00
George Marques
33afa82fb0
Merge pull request #70613 from vonagam/fix-enum-as-constant
Fixes https://github.com/godotengine/godot/issues/54018
Fixes https://github.com/godotengine/godot/issues/70213
Fixes https://github.com/godotengine/godot/issues/70495
2022-12-30 12:10:50 -03:00
George Marques
0c15844551
GDScript: Error when assigning return value of void function
This also makes built-in method calls empty the return value when the
method is void, to avoid keeping returning a garbage value in such case.
2022-12-30 12:08:58 -03:00
Dmitrii Maganov
056066ee95 GDScript: Fix false name conflicts for unnamed enums 2022-12-29 22:04:13 +02:00
Dmitrii Maganov
9507f65e25 GDScript: Disallow return with value in void functions 2022-12-29 03:06:13 +02:00
Dmitrii Maganov
b6aa4840d8 Fix usage of Enum as constant 2022-12-28 23:04:40 +02:00
Dmitrii Maganov
f67aa3e46d GDScript: Fix return type of constructor call for extending class 2022-12-27 23:02:12 +02:00
cdemirer
bbb21c3fd5 Fix type adjustment skipped when value is considered both not hard and not variant 2022-12-25 17:11:30 +03:00
Ekaterina Vaartis
60692b4e45 Implement export_multiline support for Array[String] and Dictionary
For arrays, specifically check if it's a string array and pass the
type on to the editor. For dictionaries, save the hint on the type and
use it later to draw the multiline editor, except for when adding a
string key, because that doesn't make much sense. All string values
however will be drawn as multiline.
2022-12-25 01:46:57 +03:00
rune-scape
1b77993257 Inner classes get their docs back 2022-12-23 17:39:24 -05:00
Rémi Verschelde
ae4c025da9
Merge pull request #69991 from rune-scape/cast-type
GDScript: Fix cast producing null
2022-12-23 09:22:21 +01:00
Rémi Verschelde
edfa1e8665
Merge pull request #70220 from adamscott/fix-external-enum
Fix external enums not assignable as constants
2022-12-23 09:20:50 +01:00
Rémi Verschelde
e1657bd2a7
Merge pull request #70440 from rune-scape/null-again
Fix GDScript analyzer null literal
2022-12-22 16:02:19 +01:00
Rémi Verschelde
801ef6614d
Merge pull request #70138 from anvilfolk/signals
Add MethodInfo to signal datatype
2022-12-22 16:02:11 +01:00
rune-scape
3228fdb88a Fix GDScript analyzer null literal 2022-12-22 06:02:34 -05:00
Yuri Rubinsky
abaedb54f1 Remove unused code paragraph from gdscript_editor.cpp/complete_code 2022-12-22 11:10:11 +03:00
ocean (they/them)
d93dbab054 Add MethodInfo to signal datatype 2022-12-21 22:49:51 -05:00
ocean (they/them)
fb418685a0 Unify GDScriptAnalyzer in-editor and runtime autoload checks 2022-12-20 19:01:28 -05:00
Yuri Rubinsky
78d296d7ca Add a note for inst_to_dict to prevent using it on built-in instances 2022-12-19 19:12:00 +03:00
Rémi Verschelde
e780dc332a
Merge pull request #70275 from rune-scape/autoload-subscript-regression
Fix autoload subscript regression
2022-12-19 01:12:35 +01:00
rune-scape
9f6ad59da7 Fix autoload subscript regression 2022-12-18 18:36:41 -05:00
Rémi Verschelde
e9f3e7111f
Merge pull request #70237 from quentinguidee/refactor/fix-comma-instead-of-semicolon
Fix use of comma instead of semicolon
2022-12-18 16:55:10 +01:00
Quentin Guidée
e0f1e02cc7
Fix use of comma instead of semicolon
Signed-off-by: Quentin Guidée <quentin.guidee@gmail.com>
2022-12-17 20:17:04 -05:00
Adam Scott
7fc814f697 Fix external enums not assignable as constants
- Add external enums test
- Rename external inner class test
- Clean up `GDScriptAnalyzer::reduce_identifier_from_base` class
  behavior
2022-12-17 17:59:38 -05:00
Adam Scott
1bbb2b4159 Fix outer class lookup 2022-12-17 17:57:00 -05:00
Adam Scott
2fefcf7329 Fix inner class constant assignment 2022-12-17 12:03:03 -05:00
Rémi Verschelde
8d52eea52b
Merge pull request #70000 from rune-scape/find-more-classes
GDScript: Fix built-in script `find_class` bugs
2022-12-17 16:30:34 +01:00
rune-scape
213c94b42f Fix enum value regression 2022-12-16 22:48:25 -05:00
Rémi Verschelde
f18f2740da
Merge pull request #70131 from rune-scape/preload-type-regression
Fix preload type regression
2022-12-16 00:31:26 +01:00
stmSi
2a341a6321 Fixed GDScript crashed when two consecutive unary operators are analysed 2022-12-16 04:45:53 +06:30
rune-scape
17e03c29d6 Fix preload type regression 2022-12-15 16:47:13 -05:00
rune-scape
e1c63fee86 GDScript: Fix built-in script and other find_class bugs 2022-12-15 14:56:23 -05:00
Adam Scott
3684fd249e Fix GDScript::_get_gdscript_from_variant() crash
The crash would happen, theoretically, when getting the type of a invalid
variant.
2022-12-15 12:29:01 -05:00
Rémi Verschelde
6debf86d51
Merge pull request #69471 from rune-scape/rune-out-of-order
GDScript: Out of order member resolution
2022-12-15 07:56:23 +01:00
rune-scape
2dfc6d5b69 GDScript: Allow out of order member resolution 2022-12-14 21:44:05 -05:00
rune-scape
7d0d6aa16f GDScript: Fix cast producing null 2022-12-12 19:57:26 -05:00
rune-scape
08449ab16e Fix String type compatibility being too permissive 2022-12-12 07:27:41 -05:00
Rémi Verschelde
1bfaa73e14
Merge pull request #69416 from anvilfolk/default-val
Add GDScript implicit type conversion for member variables with initializers
2022-12-11 23:58:22 +01:00
ocean (they/them)
c8293a73b4 Add GDScript member initializer implicit type conversion 2022-12-11 16:55:02 -05:00
Rémi Verschelde
8410e7c9c6
Merge pull request #66733 from MewPurPur/unary-op-warnings
Fix unary op warnings never showing
2022-12-11 22:33:58 +01:00
kobewi
7c6b659bd7 Add PropertyInfo overload for GLOBAL_DEF 2022-12-11 21:36:48 +01:00
Rémi Verschelde
05097ded0a
Merge pull request #69897 from poohcom1/fix/function-return-completion
Fix autocomplete on functions returning variants
2022-12-11 15:18:24 +01:00
rune-scape
98e1a2031d Fix subscript of preloaded script 2022-12-11 07:59:43 -05:00
poohcom1
1845d927dc Fix autocomplete on functions returning variants
- When guessing return type, check type hints before last return value
2022-12-11 14:17:27 +07:00
Adam Scott
0139bd04b2 Fix GDScriptCache::clear() crash when clearing packed scenes 2022-12-10 19:10:12 -05:00
Rémi Verschelde
8f6f244680
Merge pull request #69587 from adamscott/fix-constant-base-typing-in-extended-class
Fix constants scope in extended or inner GDScript classes
2022-12-10 21:58:50 +01:00
Adam Scott
beaef88abd Remove debug macro for GDScriptLanguage script_list 2022-12-10 14:09:04 -05:00
Adam Scott
65a49bad5a Fix constant base typing in extended GDScript class 2022-12-10 13:39:45 -05:00
Adam Scott
ff544df926 Fix GDScriptCache to not remove scripts/scenes individually when clearing 2022-12-10 12:48:07 -05:00
Rémi Verschelde
1ac7e5a334
Merge pull request #69518 from rune-scape/rune-analyze-values
GDScript: Preload should make native type
2022-12-10 11:29:50 +01:00
Rémi Verschelde
f6ea295bb1
Merge pull request #69467 from rune-scape/rune-subclass-script-path
GDScript: Fix subclass script path issues
2022-12-10 10:21:19 +01:00
Rémi Verschelde
907298d673
Merge pull request #68747 from rune-scape/rune-stringname-unification
GDScript: Unify StringName and String
2022-12-09 18:06:48 +01:00
Adam Scott
da65b61edb Fix autocomplete crash as it would infinite loop 2022-12-08 23:40:17 -05:00
Adam Scott
59c6642f2a Add missing packed scene cache clear inside GDScriptCache::clear() 2022-12-07 15:29:18 -05:00
Yuri Rubinsky
b229a19688 Fix lookup to docs for variables initialized with get_node 2022-12-07 15:16:04 +03:00
Rémi Verschelde
9bd7ad53f7
Merge pull request #69506 from adamscott/move-gdscript-uninit-to-finalize
Move GDScript uninitialization to `GDScriptLanguage::finish()`
2022-12-06 16:11:21 +01:00
Adam Scott
88f3045301 Move GDScript uninitialization to GDScriptLanguage::finalize()
Co-authored-by: Ricardo Buring <ricardo.buring@gmail.com>
Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2022-12-06 09:35:39 -05:00
Rémi Verschelde
18f7461db8
Merge pull request #69606 from red1939/bug/vscode_crash
Keep GDScriptAnalyzer alive for whole parse()
2022-12-06 11:00:51 +01:00
Rémi Verschelde
85602efef6
Merge pull request #69639 from Chaosus/gds_fix_completion
Fix completion for the raw `get_node` call
2022-12-06 11:00:15 +01:00
Bartosz Bielecki
2af4f7f762 Keep GDScriptAnalyzer alive for whole parse()
Analyzed data is allocated by Parser but kept as a reference in the cache
which in turn is held by the Analyzer. If Analyzer goes away Parser is left
with a tree of dangling references.

Code is analogous to all other usages of Analyzer + Parser pair.
2022-12-06 10:01:18 +01:00
Yuri Rubinsky
20660bb23a Fix completion for the raw get_node call 2022-12-06 10:42:44 +03:00
rune-scape
e79be6ce07 Unify String and StringName 2022-12-05 21:46:47 -05:00
Dmitrii Maganov
97280279ee Fix incomplete shadowing of member properties by parameters 2022-12-06 00:22:56 +02:00
rune-scape
6f8ffd5591 GDScript: preload should make native type 2022-12-04 05:36:17 -05:00
Adam Scott
7bcaa9df9e Fix missing parent class name identifier crash 2022-12-02 21:30:19 -05:00
rune-scape
d531869a7c GDScript: Fix subclass script path issues 2022-12-01 20:43:27 -05:00
Yuri Sizov
bf9cf7d034
Merge pull request #69166 from souplamp/icon-annotation-not-working
Update docs to clarify `@icon` only works with global script classes
2022-12-02 03:04:23 +03:00
souplamp
369c7d2422 Update docs to mention @icon only works with global script classes
Update the docs to clarify that the `@icon` annotation does not work
when only attaching a script to a node, and clarify that the script itself
must be a globally accessible script type.
2022-12-01 12:52:58 -06:00
Rémi Verschelde
4821de146e
Merge pull request #69423 from KoBeWi/parenture
Improve parent signature error
2022-12-01 18:10:31 +01:00
Rémi Verschelde
2d96f63e09
Merge pull request #68481 from dalexeev/gds-fix-dyn-arg-def-val
GDScript 2.0: Fix shift due to skip of non-constant default argument values
2022-12-01 18:09:25 +01:00
kobewi
d1e4146462 Improve parent signature error 2022-12-01 15:16:16 +01:00
Rémi Verschelde
eb555d7559
Merge pull request #69303 from Chaosus/gds_fix_loops
Reset unassigned local variables to null in the loops
2022-12-01 10:21:21 +01:00
VolTer
bfc093c53f Fix unary op warnings never showing 2022-12-01 01:09:10 +01:00
Rémi Verschelde
c868e0b4b9
Merge pull request #69269 from red1939/red1939/master
Acknowledge that a CLASS kind of a DataType might not have an identifier
2022-11-30 10:49:09 +01:00
Bartosz Bielecki
e10b0c5d98 Acknowledge that a CLASS kind of a DataType might not have an identifier 2022-11-30 09:26:50 +01:00
trollodel
c90d0bd84f Use forward-declarations in big editor classes 2022-11-29 09:59:43 +01:00
Yuri Rubinsky
8d2506e811 Reset unassigned local variables to null in the loops 2022-11-28 19:45:24 +03:00
Rémi Verschelde
4555ccdf98
Merge pull request #69224 from adamscott/fix-PackedScene-reload_from_file
Add `PackedScene::reload_from_file()` override
2022-11-28 16:53:36 +01:00
Adam Scott
a34a26eb66 Add PackedScene::reload_from_file() override 2022-11-28 10:23:02 -05:00
Yuri Rubinsky
afbea19a22 Fix lookup code to pass functions with the same name as built-ins 2022-11-28 15:53:14 +03:00
Rémi Verschelde
166066d9f7
Merge pull request #69259 from adamscott/fix-cyclic-reference-base-issue
Fix cyclic reference base being loaded but not valid (which is ok)
2022-11-28 11:45:11 +01:00
Adam Scott
4e60689695 Fix cyclic reference base being loaded but not valid (which is ok) 2022-11-27 15:50:19 -05:00
rune-scape
847c9bd248 GDScript: Avoid using get_global_class_native_base 2022-11-27 03:55:53 -05:00
Rémi Verschelde
c7ceb94e37
Merge pull request #69079 from adamscott/fix-singleton-scene-cyclic-load
Fix singleton scene cyclic loading
2022-11-25 19:29:57 +01:00
Adam Scott
69bb7e5b11 Fix singleton scene cyclic loading 2022-11-25 12:43:55 -05:00
Rémi Verschelde
8b7efd2306
Merge pull request #69134 from jquinl/export_range_int_fix
GDScript: Properly respect `int` type hint for `@export_range`
2022-11-24 23:30:40 +01:00
unknown
5fd382c2ab GDScript: Properly respect int type hint for @export_range
Fixes #69104.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2022-11-24 22:14:05 +01:00
clayjohn
075cea1077 Ensure class name is printed in STATIC_CALLED_ON_INSTANCE warning 2022-11-24 12:06:11 -08:00
Rémi Verschelde
910d6d8e62
GDScript: Only check if ignoring warnings in debug build 2022-11-24 11:50:32 +01:00
Adam Scott
2918689ff1 [godot#68977] Fix constants parameters 2022-11-23 08:15:54 -05:00
Rémi Verschelde
4abbb2d684
GDScript: Don't warn about RETURN_VALUE_DISCARDED by default
This happens too often with normal usage of the API.
The warning can still be useful to find actual bugs where discarding the return
value wasn't intentional, but this should stay enabled manually, at least until
we either improve the API to remove false positives, or improve the warning (e.g.
to only warn about unused return value on const functions).
2022-11-22 15:01:24 +01:00
Rémi Verschelde
0b2dc0f017
Merge pull request #68970 from Chaosus/gds_fix_lambda_signal
Fix using signals in lambda functions
2022-11-22 10:00:05 +01:00
Yuri Rubinsky
f6c8c140f0 Fix using signals in lambda functions 2022-11-22 11:22:41 +03:00
Rémi Verschelde
c474e2f639
Merge pull request #68987 from adamscott/fix-godot#61386-autoload-scenes-implicit-types
Fix autoload scenes implicit types
2022-11-22 08:31:36 +01:00