Commit graph

77 commits

Author SHA1 Message Date
Juan Linietsky
1bbe0a2b2f Fix global script class parsing.
* Broke with #72226
* Restored previous version of the code, made it even more error tolerant.
* Added a warning to **not** change the code.

Fixes #72226.
2023-01-31 12:43:25 +01:00
Danil Alexeev
d4b78c352f
GDScript: Fix @export_enum works only with int 2023-01-30 12:30:37 +03:00
Rémi Verschelde
a3dae9e548
Merge pull request #72285 from vnen/gdscript-variable-match
GDScript: Allow variables in match patterns
2023-01-29 02:45:48 +01:00
George Marques
c68b2358d5
GDScript: Allow variables in match patterns
To restore an ability available in 3.x and reduce compatibility changes.
2023-01-28 19:53:27 -03:00
Dmitrii Maganov
31e0ae2012 GDScript: Fix constant conversions 2023-01-29 00:01:53 +02:00
Danil Alexeev
b004f8180e
GDScript: Allow constant expressions in annotations 2023-01-25 18:43:56 +03:00
Danil Alexeev
13215638a9
Clarify error message about script-level annotation 2023-01-24 13:10:45 +03:00
Rémi Verschelde
81fe3715b8
Merge pull request #71914 from vnen/gdscript-no-continue-match
GDScript: Remove function of `continue` for match statement
2023-01-23 15:35:55 +01:00
George Marques
9462ae4783
GDScript: Remove function of continue for match statement
The keyword is confusing and rarely is used in the intended way. It is
removed now in favor of a future feature (pattern guards) to avoid
breaking compatibility later.
2023-01-22 18:45:24 -03:00
George Marques
7548e043fc
Add support for Unicode identifiers in GDScript
This is using an adapted version of UAX#31 to not rely on the ICU
database (which isn't available in builds without TextServerAdvanced).
It allows most characters used in diverse scripts but not everything.
2023-01-21 13:39:40 -03:00
Rémi Verschelde
1c3653e083
Merge pull request #67774 from aaronfranke/script-annotations
Make script annotations be placed before `class_name` and `extends`
2023-01-16 22:20:44 +01:00
Rémi Verschelde
c6f4c0ac54
Merge pull request #70899 from adamscott/fix-vector-inf
Fix parse error using Vector{2,3,4}.INF
2023-01-12 15:59:01 +01:00
George Marques
7319fa6082
Merge pull request #70713 from vonagam/fix-unnamed-enum-outer-conflicts 2023-01-12 11:22:01 -03:00
Adam Scott
44d1d72af1 Add GDScript .editorconfig rules
- Uniformize `.gd` unit test files indentation to tabs (where needed)
2023-01-10 12:25:35 -05:00
Rémi Verschelde
c2f7c2d31a
Merge pull request #70655 from vonagam/fix-assert-multiline
GDScript: Fix multiline and trailing comma for assert
2023-01-09 14:19:37 +01:00
Adam Scott
c45b9245ae Fix parse error using Vector{2,3,4}.INF 2023-01-08 16:14:40 -05:00
Dmitrii Maganov
71f7c8a9d3 GDScript: Fix multiline and trailing comma for assert 2023-01-08 20:18:46 +02: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
Dmitrii Maganov
056066ee95 GDScript: Fix false name conflicts for unnamed enums 2022-12-29 22:04:13 +02:00
Aaron Franke
6590e1fd8a
Make script annotations placed before class_name and extends 2022-12-19 22:01:29 -06:00
souplamp
5bdd883dfd change RETURN_VALUE_DISCARDED GDScript warn text
changed RETURN_VALUE_DISCARDED GDscript warning text to mention how the return value of a function is discarded; update GDScript parser warning test to include new warning text.
2022-11-21 15:04:04 -06:00
clayjohn
0a51bb4ca5 Add STATIC_CALLED_ON_INSTANCE warning to highlight
when static functions are called directly from objects
2022-10-14 10:43:42 -07:00
clayjohn
be1e9acb7c Implement RETURN_VALUE_DISCARDED warning in GDscript 2022-10-13 11:56:45 -07:00
Hugo Locurcio
6afbf0bd5a
Improve dictionary printing to avoid confusion with arrays
- Add leading and trailing spaces within dictionaries, as the `{}`
  characters are hard to distinguish from `[]` on some fonts.
  This is especially helpful with empty arrays and dictionaries.
2022-10-04 20:33:40 +02:00
Hugo Locurcio
291d3aaabe
Improve null and object printing to avoid confusion with arrays
- Use different syntax for object printing to avoid confusion with arrays.
- Print null as `<null>` to avoid confusion with a string `"null"`.
- Display `<empty>` in editor resource pickers to avoid confusion
  with array-based properties.
2022-08-31 15:31:49 +02:00
Rémi Verschelde
f0eb3ac5d3
Merge pull request #62701 from cdemirer/for-variable-conflict 2022-07-06 16:02:49 +02:00
Yuri Sizov
f85bafaa11 Add grouping annotations for class properties in GDScript 2022-07-05 22:01:40 +03:00
cdemirer
dbdf0174b4 Do error when for variable conflicts with a variable in scope 2022-07-04 12:30:39 +03:00
George Marques
67156aa4c2
Merge pull request #61666 from nathanfranke/fix-match-bind
gdscript: use correct error for unused bind match, suppress with underscore
2022-06-15 10:21:34 -03:00
George Marques
15740c37a3
Merge pull request #57151 from cdemirer/fix-match-array-dict-pattern-logic-error
Fix logic errors in match-statement Array & Dictionary patterns
2022-06-14 21:30:05 -03:00
Nathan Franke
3d61246bc4
use correct error for unused bind match, suppress with underscore 2022-06-03 13:28:33 -05:00
George Marques
eba3e0a9fc
GDScript: Support % in shorthand for get_node
The `%` is used in scene unique nodes. Now `%` can also be used instead
of `$` for the shorthand, besides being allowed generally anywhere in
the path as the prefix for a node name.
2022-05-27 13:46:18 -03:00
George Marques
1b76a9d705
GDScript: Fix lambda captures in default argument values 2022-05-23 21:38:31 -03:00
George Marques
969f1980d2
GDScript: Fix if after lambda being seen as ternary 2022-05-23 21:13:25 -03:00
George Marques
0a28b4cd94
GDScript: Do not allow standalone lambdas
They cannot be accessed in this case, so an error is shown to avoid
misleading the uses, especially in case of named lambdas.
2022-05-23 12:25:03 -03:00
Rémi Verschelde
e22255edaf
Merge pull request #55201 from Scony/fix-unreachable-code-false-positive 2022-05-18 16:04:12 +02:00
Rémi Verschelde
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
Nathan Franke
58fcad20ef
quote strings inside arrays and dictionaries 2022-05-03 13:37:13 -05:00
PastMoments
b3704e664d Fixes GDScript define nested dictionary and array as constants #50285 2022-04-19 08:57:23 -04:00
cdemirer
3c5b9d1be3 Fix issues with multiple bind patterns in match statement 2022-04-04 15:47:08 +08:00
strank
7d48afa96d Add test cases for accessing parent elements from child class 2022-03-04 12:41:20 -05:00
cdemirer
3afe50c2fa Fix logic errors in match-statement Array & Dictionary Patterns 2022-03-02 19:05:18 +08:00
Rémi Verschelde
89eb6d372d
Merge pull request #57591 from vnen/gdscript-enum-fixes 2022-02-04 13:49:15 +01:00
George Marques
ad6e2e82a9
GDScript: Consolidate behavior for assigning enum types
This makes sure that assigning values to enum-typed variables are
consistent. Same enum is always valid, different enum is always
invalid (without casting) and assigning `int` creates a warning
if there is no casting.

There are new test cases to ensure this behavior doesn't break in
the future.
2022-02-03 13:32:16 -03:00
Rémi Verschelde
e1706be25d
Merge pull request #57052 from KoBeWi/nosort 2022-01-23 00:27:01 +01:00
Rémi Verschelde
182a36db47
Merge pull request #55214 from Scony/fix-gdscript-crash-2
Fix GDScript parser crash on 'dollar mixed with assignment' expression
2022-01-22 20:30:54 +01:00
kobewi
f056cb8ebc Don't sort printed Dictionary 2022-01-22 13:45:02 +01:00
luz paz
a124f1effe Fix various typos
Found via ` codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inout,leapyear,lod,nd,numer,ois,ony,paket,seeked,sinc,switchs,te,uint,varn`
Update editor/import/resource_importer_layered_texture.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update doc/classes/TileSetScenesCollectionSource.xml

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/graph_edit.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/resources/animation.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Update scene/gui/rich_text_label.cpp

Co-authored-by: Raul Santos <raulsntos@gmail.com>
Revert previously committed change
2022-01-02 01:03:58 -05:00
Yuri Roubinsky
566895732c Fix shadowed global identifier warning duplication 2021-12-13 11:54:23 +03:00
Pawel Lampe
1a15a3adf6 Fix GDScript parser crash on 'dollar mixed with assignment' expression
fixes #53696
2021-11-21 21:18:46 +01:00