Age | Commit message (Collapse) | Author |
|
Highlight control flow keywords with a different color
|
|
Implement LSP didDeleteFiles & make parser aware of sub-nodes
|
|
Fix GDScript Tokenizer being very strict about the number of underscores
|
|
|
|
This makes them easier to distinguish from other keywords.
|
|
Fix constants at function scope are not defined as constants for completion
|
|
Rename GDScript test script filenames to use `snake_case`
|
|
Follow-up to #38736 (these uses were likely added after this PR was merged).
|
|
In attribute expressions (`a.b`) it's possible that the base has an
incorrect syntax and thus become a nullptr expression in the tree. This
commit add the check for this case to fail gracefully instead of
crashing.
|
|
|
|
- Lambdas are always callables (no specific signature match).
- Captures from the current context are evaluated.
|
|
Lambda syntax is the same as a the function syntax (using the same
`func` keyword) except that the name is optional and it can be embedded
anywhere an expression is expected. E.g.:
func _ready():
var my_lambda = func(x):
print(x)
my_lambda.call("hello")
|
|
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f66391327b2967a20a89c3627e1dd6e84eb.
There was still the possibility for third-party platform ports to override the
definitions with a custom header, but this doesn't seem useful anymore.
|
|
The current code style guidelines forbid the use of `auto`.
Some uses of `auto` are still present, such as in UWP code (which
can't be currently tested) and macros (where removing `auto` isn't
easy).
|
|
Fix mismatch between String and StringName in dictionary keys
|
|
Make LSP update the filesystem for changed scripts
|
|
|
|
There was a mixup between String and StringName keys. Now they're
clearly separated. This also means you have to consider which type
you're using for the dictionary keys and how you are accessing them.
|
|
GDScript: Use special stack space for temporaries to reduce type changes
|
|
|
|
|
|
|
|
So the stack slots perform less type changes, which is useful for
future optimizations.
|
|
This updates global classes and exposes base member variables.
Fixes #39713
|
|
Blackiris/fix-corrupt-scene-when-export-has-setter
Fix corrupt scene when export var has setter
|
|
|
|
|
|
|
|
|
|
There's now only 3 addressing modes: stack, constant, and member.
Self, class, and nil are now present respectively in the first 3 stack
slots. Global and class constants are moved to local constants when
compiling. Named globals is only present on editor to use on tool
singletons, so its use now emits a new instruction to copy the global to
the stack.
This allow us to further optimize the VM later by embedding the
addressing modes in the instructions themselves, which is better done
with less permutations.
|
|
This is meant for testing the GDScript implementation, not for testing
user scripts nor testing the engine using scripts.
Tests consists in a GDScript file and a .out file with the expected
output. The .out file format is: expected status (based on the enum
GDScriptTest::TestStatus) on the first line, followed by either an error
message or the resulting output. Warnings are added after the first
line, before the output (or compiler errors) if the parser pass without
any error.
The test script must have a function called `test()` which takes no
argument. Such function will be called by the test runner. The test
should not have any dependency unless it's part of the test too. Global
classes (using `class_name`) are registered before the runner starts, so
those should work if needed.
Use the command `godot --gdscript-generate-tests
godot-source/modules/gdscript/tests/scripts` to update the .out files
with the current output (make sure the output are the expected values
before committing).
The tests themselves are part of the doctest suite so those can be
executed with `godot --test`.
Co-authored-by: Andrii Doroshenko (Xrayez) <xrayez@gmail.com>
|
|
Fix infinite loop when guessing argument type from parent class
|
|
|
|
|
|
GDScript: Properly validate return type
|
|
When the type cannot be validated at compile time, the runtime must do a
check to ensure type safety is kept, as the code might be assuming the
return type is correct in another place, leading to crashes if the
contract is broken.
|
|
|
|
|
|
|
|
Rename Array.invert() to Array.reverse()
|
|
Fix a few issues with @export in GDScript
|
|
GDScript: Fix array type check on constants
|
|
They mistakenly pointing to the wrong union member (variable instead of
constant).
|
|
|
|
Also fix the enum type in variables to be integer.
|
|
|
|
This ensures that annotations that rely on the datatype (such as
@export) can validated it timely, allowing compound expressions instead
of only literal values.
|
|
GDScript typed arrays
|
|
- Use `Array[type]` for type-hints. e.g.:
`var array: Array[int] = [1, 2, 3]`
- Array literals are typed if their storage is typed (variable
asssignment of as argument in function all). Otherwise they are
untyped.
|
|
Add unit tests for export templates
|