Commit Graph

70 Commits

Author SHA1 Message Date
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
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
0fef203b1f Remove script class checks when getting function signature 2023-02-07 11:48:10 +01:00
d4b78c352f GDScript: Fix @export_enum works only with int 2023-01-30 12:30:37 +03:00
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
b004f8180e GDScript: Allow constant expressions in annotations 2023-01-25 18:43:56 +03:00
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
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
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
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
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
7319fa6082 Merge pull request #70713 from vonagam/fix-unnamed-enum-outer-conflicts 2023-01-12 11:22:01 -03:00
44d1d72af1 Add GDScript .editorconfig rules
- Uniformize `.gd` unit test files indentation to tabs (where needed)
2023-01-10 12:25:35 -05:00
c45b9245ae Fix parse error using Vector{2,3,4}.INF 2023-01-08 16:14:40 -05:00
71f7c8a9d3 GDScript: Fix multiline and trailing comma for assert 2023-01-08 20:18:46 +02:00
056066ee95 GDScript: Fix false name conflicts for unnamed enums 2022-12-29 22:04:13 +02:00
6590e1fd8a Make script annotations placed before class_name and extends 2022-12-19 22:01:29 -06:00
be1e9acb7c Implement RETURN_VALUE_DISCARDED warning in GDscript 2022-10-13 11:56:45 -07:00
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
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
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
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
3d61246bc4 use correct error for unused bind match, suppress with underscore 2022-06-03 13:28:33 -05:00
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
1b76a9d705 GDScript: Fix lambda captures in default argument values 2022-05-23 21:38:31 -03:00
969f1980d2 GDScript: Fix if after lambda being seen as ternary 2022-05-23 21:13:25 -03:00