Commit Graph

94 Commits

Author SHA1 Message Date
d8db03e31a Fix a few GDScript warning messages for grammar and consistency
Regenerate test results

Improve warning message for `INT_AS_ENUM_WITHOUT_CAST`

Improve `REDUNDANT_AWAIT` message and regenerate tests

Allow warning message for UNASSIGNED_VARIABLE_OP_ASSIGN to display specific operator

Remove "being" from some messages to make them consistent and clearer

Update expected test results

Use Variant::get_operator_name for determining string representation of operator instead of big switch-case

Update tests

Update modules/gdscript/gdscript_warning.cpp

Co-authored-by: Danil Alexeev <dalexeev12@yandex.ru>

Update tests... again
2025-05-06 20:28:01 -07:00
b50d9742c2 Fix is_valid_float, Variant parser, Expression parser, script highlighter, and TextServer not handing capital E in scientific notation. 2025-02-05 18:39:40 +02:00
7d65d0a908 GDScript: Add @warning_ignore_start and @warning_ignore_restore annotations 2024-12-06 15:37:02 +03:00
f86dcd4e67 GDScript: Support tracking multiple analyzer and runtime errors in tests 2024-11-21 22:09:50 +03:00
5c0f2414cd Always add decimal when printing float 2024-10-23 15:00:21 +02:00
85dfd89653 Add @export_tool_button annotation for easily creating inspector buttons
Co-authored-by: jordi <creptthrust@gmail.com>
Co-authored-by: K. S. Ernest (iFire) Lee <ernest.lee@chibifire.com>
Co-authored-by: Mack <86566939+Macksaur@users.noreply.github.com>
2024-09-27 22:24:15 +01:00
9853a69144 Implement typed dictionaries 2024-09-04 10:27:26 -05:00
13a90e938f Merge pull request #70096 from rune-scape/stringname-dict
StringName Dictionary keys
2024-09-03 17:38:06 +02:00
154049ce17 StringName Dictionary keys
also added 'is_string()' method to Variant
and refactored many String type comparisons to use it instead
2024-08-29 13:39:27 -07:00
c1322d41e6 GDScript: Replace assert() with Utils.check() in tests 2024-08-28 17:41:52 +03:00
68898dbcc9 GDScript: Add CONFUSABLE_CAPTURE_REASSIGNMENT warning 2024-06-28 11:12:01 +03:00
24b6edcd38 GDScript: Fix non-global class export 2024-06-20 14:30:12 +03:00
653a8b113a Register the export info correctly when a global class script is used as the variable type for Node 2024-06-03 13:28:17 +01:00
76b2d85c9f GDScript: Fix some export annotation issues 2024-05-13 17:49:06 +03:00
7d03b1de0b Style: Trim trailing whitespace and ensure newline at EOF
Found by apply the file_format checks again via #91597.
2024-05-08 10:12:46 +02:00
f9b488508c Add PackedVector4Array Variant type
Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com>
Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2024-05-03 00:58:27 +02:00
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
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
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
02253b6b91 GDScript: Fix continuation lines in GDScriptTokenizerBuffer 2024-04-10 08:51:02 +03:00
ef1909fca3 GDScript: Fix @warning_ignore annotation issues 2024-03-12 19:00:06 +03:00
882441a0ad Support Array and PackedArray in @export_* 2024-03-06 16:17:54 +09:00
21ee3716c2 Merge pull request #82122 from dalexeev/gds-add-export-hidden-annotation
GDScript: Add `@export_storage` annotation
2024-02-27 21:22:49 +01:00
b4d0a09f15 GDScript: Reintroduce binary tokenization on export
This adds back a function available in 3.x: exporting the GDScript
files in a binary form by converting the tokens recognized by the
tokenizer into a data format.

It is enabled by default on export but can be manually disabled. The
format helps with loading times since, the tokens are easily
reconstructed, and with hiding the source code, since recovering it
would require a specialized tool. Code comments are not stored in this
format.

The `--test` command can also include a `--use-binary-tokens` flag
which will run the GDScript tests with the binary format instead of the
regular source code by converting them in-memory before the test runs.
2024-02-08 11:20:05 -03:00
2bf25954b4 GDScript: Add is not operator 2024-02-04 17:36:53 +03:00
745f8e112f Revert "Add UID support to GDScript files"
This reverts commit c7f68a27ec.

We still think GDScript files need UIDs to allow safe refactoring,
but we're still debating what form those should take exactly.

So far there seems to be agreement that it shouldn't be done via an
annotation as implemented here, so we're reverting this one for now,
to revisit the feature in a future PR.
2024-01-29 21:00:26 +01:00
c7f68a27ec Add UID support to GDScript files 2024-01-17 22:30:56 +01:00
3a3a2011f4 GDScript: Add @export_storage annotation 2023-12-19 20:56:30 +03:00
668ba2d1a5 GDScript: Allow empty parentheses for property getter declaration 2023-10-11 09:54:17 +03:00
9e2273abc7 GDScript: Add error when exporting node in non [Node]-derived classes 2023-10-05 13:50:26 +03:00
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
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
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
2964c7d51c GDScript: Add raw string literals (r-strings) 2023-09-11 18:34:33 +03:00
00ad9e484e GDScript: Allow mixed indentation on blank lines 2023-08-17 10:54:43 +03:00
bf04c55175 Fix lambda parsing continuing on subsequent lines #73273 2023-06-21 12:56:57 +02:00
1ce2425c0e Merge pull request #73363 from dalexeev/gds-fix-min-int-not-representable
GDScript: Fix `MIN_INT` not representable as numeric literal
2023-06-18 16:27:16 +02:00
fba8cbe6db GDScript: Fix repeated _ are allowed after decimal point 2023-06-14 21:47:12 +03:00
13310f3557 GDScript: Reorganize and unify warnings 2023-04-28 18:25:11 +03:00
6596a6c1b5 Merge pull request #72979 from dalexeev/gds-annotation-parsing
GDScript: Fix and improve annotation parsing
2023-04-17 17:14:58 +02:00
ab9f60dd1a fix access to identifiers that are reserved keywords 2023-04-14 20:37:24 +02:00
5038a336be GDScript: Fix and improve annotation parsing 2023-04-14 21:28:46 +03:00
ea5fd3d732 Fix GDScript code style regarding colon 2023-03-05 17:03:20 +03:00
491ded1898 Minor typo and docs URL fixes 2023-02-28 13:38:01 +01:00
b0b1eaeb6d GDScript: Fix parsing unexpected break/continue in lambda 2023-02-23 10:49:06 +02:00
d15511725a GDScript: Fix MIN_INT not representable as numeric literal 2023-02-15 17:41:46 +03:00
dc7f08b556 Merge pull request #72971 from vnen/gdscript-multiline-comment
GDScript: Allow strings as multiline comments
2023-02-09 16:19:03 +01:00
03ea77407c GDScript: Be more lenient with identifiers
- Allow identifiers similar to keywords if they are in ASCII range.
- Allow constants to be treated as regular identifiers.
- Allow keywords that can be used as identifiers in expressions.
2023-02-09 11:19:05 -03:00
f95967c299 GDScript: Allow strings as multiline comments
Bring back the behavior in 3.x that was left out by oversight.
2023-02-09 10:16:00 -03:00
98921d8fba Revert "Remove script class checks when getting function signature"
This reverts commit 0fef203b1f.

This introduced some other issues, as discussed in #72144.
2023-02-07 16:28:52 +01:00