Commit graph

1536 commits

Author SHA1 Message Date
Rémi Verschelde
59b524ae4c
Merge pull request #49067 from JFonS/fix_gcc_warnings
Fix some warnings raised by GCC-11.1
2021-06-01 10:47:37 +02:00
Hugo Locurcio
1704be0a44
Rename the bundled text editor themes for consistency with themes
The Adaptive text editor theme is the default, and has therefore
been renamed Default for consistency with the Default theme preset.
It keeps its automatic dark/light switch status.

The Default text editor theme was actually a legacy Godot 2-style theme,
so it has been renamed to Godot 2 to match the theme preset.
Its background color has been changed to be a constant opaque color,
since the new editor theme made the theme look less good on a translucent
background. The previous background color on light theme also lacked
contrast.
2021-05-31 14:02:13 +02:00
Rémi Verschelde
364ea7f280
Merge pull request #49114 from vnen/gdscript-fix-self-function-type-check
GDScript: Fix function signature check for self calls
2021-05-26 20:59:17 +02:00
Rémi Verschelde
78bbb2cae1
Merge pull request #49112 from vnen/gdscript-assign-type-check
GDScript: Use analyzer data to decide assignment conversion
2021-05-26 20:34:43 +02:00
George Marques
a23fc45727
GDScript: Fix function signature check for self calls 2021-05-26 15:33:18 -03:00
George Marques
c7459e3855
GDScript: Use analyzer data to decide assignment conversion
Since there might be tricky cases in the analyzer (in the case of unsafe
lines) which would need to be properly checked again. Instead, this
splits the code generator in two functions and use information set by
the analyzer to tell which function to use, without a need to re-check.
2021-05-26 14:09:00 -03:00
jfons
f8e34209af Fix some warnings raised by GCC-11.1 2021-05-25 17:23:53 +02:00
Marcel Admiraal
da5d7db610 Rename File::get_len() get_length() 2021-05-25 11:54:28 +01:00
Rémi Verschelde
215e43242c
Merge pull request #49037 from vnen/fix-callable-freed-crash 2021-05-24 19:52:32 +02:00
George Marques
ea44744e2d
Make Callable not crash on call when the object has been freed
Also add a GDScript test for this case.
2021-05-24 14:23:02 -03:00
George Marques
ffdb3cccd2
GDScript: Fix error handler for tests
This changes the error message to be more clear on the output files and
also fixes an issue with the relative path of the offending file that
was not trimmed correctly.
2021-05-24 14:17:20 -03:00
Tomasz Chabora
b1859510ab Change behavior of String.right 2021-05-20 23:07:57 +02:00
Rémi Verschelde
4219a4cb6f
Fix typos with codespell
Using codespell 2.0.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
seeked
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2021-05-20 12:38:56 +02:00
Rémi Verschelde
169268ae20
Merge pull request #48657 from Calinou/test-add-gdscript
Add a unit test suite for GDScript
2021-05-19 20:49:03 +02:00
Yuri Roubinsky
7b261d1cb7 Show colored rects for autocompletion of Color constants in functions 2021-05-19 14:40:03 +03:00
George Marques
cdb3726fe6
Merge pull request #48347 from Blackiris/fix-temporary-key-not-released
GDScript: Fix temporary value not released when used as a dictionary key
2021-05-17 18:50:25 -03:00
Rémi Verschelde
2fcfc83da9
Merge pull request #48793 from vnen/gdscript-fix-temp-type-adjust
GDScript: Fix crash caused by uninitialized temp stack slots
2021-05-17 17:34:19 +02:00
George Marques
10a1f64968
GDScript: Fix crash caused by uninitialized temp stack slots
This adds initialization to every typed temporary stack slot at the
beginning of the function call instead of emitting instructions, since
those might be in a conditional branch and not be called.
2021-05-17 10:59:43 -03:00
Pedro J. Estébanez
469fa47e06
Make all file access 64-bit (uint64_t)
This changes the types of a big number of variables.

General rules:
- Using `uint64_t` in general. We also considered `int64_t` but eventually
  settled on keeping it unsigned, which is also closer to what one would expect
  with `size_t`/`off_t`.
- We only keep `int64_t` for `seek_end` (takes a negative offset from the end)
  and for the `Variant` bindings, since `Variant::INT` is `int64_t`. This means
  we only need to guard against passing negative values in `core_bind.cpp`.
- Using `uint32_t` integers for concepts not needing such a huge range, like
  pages, blocks, etc.

In addition:
- Improve usage of integer types in some related places; namely, `DirAccess`,
  core binds.

Note:
- On Windows, `_ftelli64` reports invalid values when using 32-bit MinGW with
  version < 8.0. This was an upstream bug fixed in 8.0. It breaks support for
  big files on 32-bit Windows builds made with that toolchain. We might add a
  workaround.

Fixes #44363.
Fixes godotengine/godot-proposals#400.

Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
2021-05-17 15:06:19 +02:00
Rémi Verschelde
a7421612d0
Merge pull request #48767 from vnen/gdscript-builtin-static-methods
GDScript: Add support for builtin static method calls
2021-05-16 22:29:32 +02:00
George Marques
ec783dd885
GDScript: Add support for builtin static method calls 2021-05-16 11:54:33 -03:00
Hugo Locurcio
6c528e4fae
Add a unit test suite for GDScript
This tests run-time script loading.
2021-05-12 16:20:57 +02:00
Rémi Verschelde
8962d36bb1
Merge pull request #33577 from Calinou/highlight-control-flow-keywords
Highlight control flow keywords with a different color
2021-05-07 00:52:50 +02:00
Julien Nguyen
82522662f8 Fix temporary value not released when used as a dictionary key 2021-05-06 22:13:05 +02:00
Rémi Verschelde
ae2359fc1f
Merge pull request #47776 from Razoric480/foreport
Implement LSP didDeleteFiles & make parser aware of sub-nodes
2021-05-06 20:46:18 +02:00
Rémi Verschelde
ee4ef9709d
Merge pull request #46714 from HaSa1002/fix-gdscript-underscore-strict
Fix GDScript Tokenizer being very strict about the number of underscores
2021-05-06 20:19:45 +02:00
Hugo Locurcio
3f078c99f6
Rename IP_Unix, IP_Address and TCP_Server to remove underscores 2021-05-06 02:52:01 +02:00
Hugo Locurcio
e905e8f145
Highlight control flow keywords with a different color
This makes them easier to distinguish from other keywords.
2021-05-05 22:38:12 +02:00
Rémi Verschelde
302b6ef576
Merge pull request #47798 from ray90514/bug#47620
Fix constants at function scope are not defined as constants for completion
2021-05-04 08:20:03 +02:00
Rémi Verschelde
4e06731346
Merge pull request #47958 from Xrayez/gdscript-rename-test-scripts
Rename GDScript test script filenames to use `snake_case`
2021-05-03 15:44:46 +02:00
Rémi Verschelde
5b16020846
Replace remaining uses of NULL with nullptr
Follow-up to #38736 (these uses were likely added after this PR was merged).
2021-04-29 11:53:27 +02:00
George Marques
9ed0f0384c
GDScript: Fix crash when base of an attribute is invalid
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.
2021-04-28 11:09:40 -03:00
George Marques
c201b212c7
GDScript: Implement lambdas compilation and runtime 2021-04-28 11:09:38 -03:00
George Marques
3155368093
GDScript: Add lambdas to the type analyzer
- Lambdas are always callables (no specific signature match).
- Captures from the current context are evaluated.
2021-04-28 10:56:16 -03:00
George Marques
c6e66a43b0
GDScript: Add lambda syntax parsing
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")
2021-04-28 10:56:16 -03:00
Rémi Verschelde
8247667a3e
Core: Drop custom copymem/zeromem defines
We've been using standard C library functions `memcpy`/`memset` for these since
2016 with 67f65f6639.

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.
2021-04-27 16:26:27 +02:00
Hugo Locurcio
5d124c4a8f
Remove uses of auto for better readability and online code reviews
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).
2021-04-26 14:59:28 +02:00
Rémi Verschelde
d1dc28e46c
Merge pull request #48139 from vnen/gdscript-dict-keys
Fix mismatch between String and StringName in dictionary keys
2021-04-24 19:46:59 +02:00
Rémi Verschelde
db90ab86b9
Merge pull request #47891 from Razoric480/lsp-update-filesystem
Make LSP update the filesystem for changed scripts
2021-04-24 13:17:31 +02:00
George Marques
1e4ff2ede6
GDScript: Make sure Lua-style dicts use StringName as keys 2021-04-23 16:00:23 -03:00
George Marques
c7511de02e
GDScript: Fix resolution of dictionary keys
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.
2021-04-23 15:42:33 -03:00
Rémi Verschelde
a9ecf66342
Merge pull request #47956 from vnen/gdscript-double-stack
GDScript: Use special stack space for temporaries to reduce type changes
2021-04-20 17:39:09 +02:00
Andrii Doroshenko (Xrayez)
1e26bf23c2 Rename GDScript test script filenames to use snake_case 2021-04-16 22:16:19 +03:00
George Marques
9411bf05a4
GDScript: Adjust type of temporaries when needed 2021-04-16 12:04:08 -03:00
Rémi Verschelde
200d9a734c
Merge pull request #47701 from vnen/gdscript-test-runner 2021-04-16 10:34:39 +02:00
George Marques
40502a1689
GDScript: Pool temporary values by type on the stack
So the stack slots perform less type changes, which is useful for
future optimizations.
2021-04-14 14:35:51 -03:00
Francois Belair
b16bb33a5b Make LSP update the filesystem of changed scripts
This updates global classes and exposes base member variables.
Fixes #39713
2021-04-14 13:12:39 -04:00
George Marques
8fc4a732de
Merge pull request #47330 from Blackiris/fix-corrupt-scene-when-export-has-setter
Fix corrupt scene when export var has setter
2021-04-14 10:00:57 -03:00
Julien Nguyen
79a16b8a44 Fix corrupt scene when export var has setter 2021-04-14 09:14:50 +02:00
Julien Nguyen
9936abb3d5 Fix type argument in is_builtin which was treated as an address 2021-04-11 20:34:48 +02:00