summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript.cpp
Commit message (Collapse)AuthorAgeFilesLines
...
| * Core: Move DirAccess and FileAccess to `core/io`Rémi Verschelde2021-06-111-1/+1
| | | | | | | | | | File handling APIs are typically considered part of I/O, and we did have most `FileAccess` implementations in `core/io` already.
* | Merge pull request #49279 from Calinou/rename-string-is-abs-path-methodRémi Verschelde2021-06-111-1/+1
|\ \ | |/ |/| Rename `String.is_abs_path()` to `String.is_absolute_path()`
| * Rename `String.is_abs_path()` to `String.is_absolute_path()`Hugo Locurcio2021-06-031-1/+1
| | | | | | | | This is more consistent with `NodePath.is_absolute()`.
* | [Net] Refactor RPCs, remove RSETsFabio Alessandrelli2021-06-011-113/+8
|/ | | | | | | | | | In this PR: - Removed rset - rpc_config can now optionally configure transfer mode (reliable/unreliable/ordered) and channel (channels are not actually implemented yet.) - Refactor how the RPC id is computed to minimize the logic in Node and scripts that now only needs a single `get_rpc_methods` function.
* Rename File::get_len() get_length()Marcel Admiraal2021-05-251-1/+1
|
* Fix typos with codespellRémi Verschelde2021-05-201-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* Make all file access 64-bit (uint64_t)Pedro J. Estébanez2021-05-171-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Highlight control flow keywords with a different colorHugo Locurcio2021-05-051-0/+13
| | | | This makes them easier to distinguish from other keywords.
* Add runner for GDScript testingGeorge Marques2021-04-081-0/+8
| | | | | | | | | | | | | | | | | | | | | | | | | | | | 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>
* Style: Apply clang-tidy's `modernize-use-nullptr`Rémi Verschelde2021-04-051-1/+1
|
* Merge pull request #46991 from madmiraal/rename-invert-reverseRémi Verschelde2021-04-011-2/+2
|\ | | | | Rename Array.invert() to Array.reverse()
| * Rename Array.invert() to Array.reverse()Marcel Admiraal2021-03-211-2/+2
| | | | | | | | | | Does the same internally for List and Vector<>, which includes all PackedArray types.
* | Add typed arrays to GDScriptGeorge Marques2021-03-291-13/+21
|/ | | | | | | | - 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.
* Improve resource load cachereduz2021-02-111-1/+1
| | | | | | -Added a new method in Resource: reset_state , used for reloading the same resource from disk -Added a new cache mode "replace" in ResourceLoader, which reuses existing loaded sub-resources but resets their data from disk (or replaces them if they chaged type) -Because the correct sub-resource paths are always loaded now, this fixes bugs with subresource folding or subresource ordering when saving.
* Initialize class/struct variables with default values in modules/Rafał Mikrut2021-02-081-12/+1
|
* Update copyright statements to 2021Rémi Verschelde2021-01-011-2/+2
| | | | | | | | | | | | | | Happy new year to the wonderful Godot community! 2020 has been a tough year for most of us personally, but a good year for Godot development nonetheless with a huge amount of work done towards Godot 4.0 and great improvements backported to the long-lived 3.2 branch. We've had close to 400 contributors to engine code this year, authoring near 7,000 commit! (And that's only for the `master` branch and for the engine code, there's a lot more when counting docs, demos and other first-party repos.) Here's to a great year 2021 for all Godot users 🎆
* Rename empty() to is_empty()Marcel Admiraal2020-12-281-10/+10
|
* Merge pull request #43890 from vnen/gdscript-builtin-functions-refactorRémi Verschelde2020-12-151-2/+5
|\ | | | | GDScript: Refactor builtin functions
| * GDScript: Refactor builtin functionsGeorge Marques2020-11-261-2/+5
| | | | | | | | | | | | | | | | | | | | | | They are now called "utility functions" to avoid confusion with methods of builtin types, and be consistent with the naming in Variant. Core utility functions are now available in GDScript. The ones missing in core are added specifically to GDScript as helpers for convenience. Some functions were remove when there are better ways to do, reducing redundancy and cleaning up the global scope.
* | Merge pull request #41095 from ThakeeNathees/GDScript-DocumentationRémi Verschelde2020-12-021-9/+238
|\ \ | | | | | | GDScript(2.0) Documentation generation system
| * | Refactor DocData into core and editor (DocTools) partsThakee Nathees2020-12-021-16/+4
| | |
| * | Documentation generation for GDScriptThakee Nathees2020-11-291-9/+250
| |/ | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - ClassDoc added to GDScript and property reflection data were extracted from parse tree - GDScript comments are collected from tokenizer for documentation and applied to the ClassDoc by the GDScript compiler - private docs were excluded (name with underscore prefix and doesn't have any doc comments) - default values (of non exported vars), arguments are extraced from the parser - Integrated with GDScript 2.0 and new enums were added. - merge conflicts fixed
* / Implement proper error print, Fixes a crash when no error messages are ↵AndreaCatania2020-11-281-2/+6
|/ | | | generated by the analyser.
* Refactored variant constructor logicreduz2020-11-091-1/+2
|
* Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-5/+5
| | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* Merge pull request #41829 from RandomShaper/fix_40353Rémi Verschelde2020-10-011-2/+6
|\ | | | | Avoid warning about harmless unfulfilled yields
| * Avoid warning about harmless unfulfilled yieldsPedro J. Estébanez2020-09-061-2/+6
| |
* | Avoid infinite loop in GDScript at shutdownPedro J. Estébanez2020-09-261-2/+12
| |
* | Ensure cyclic dependencies between scripts are broken at exitPedro J. Estébanez2020-09-101-2/+20
|/
* GDScript: Use pointer instead of references in cacheGeorge Marques2020-08-231-3/+1
| | | | | They are not supposed to be kept alive and this is cleaner and less error-prone than unreferencing the elements.
* GDScript: Add script to cache on reloadGeorge Marques2020-08-181-0/+15
| | | | | | This ensures that scripts created without a resource loader are properly included in the cache (such as builtin scripts) and are not tried to be loaded from the disk.
* Remove multilevel callsGeorge Marques2020-07-241-33/+0
| | | | | | In general they are more confusing to users because they expect inheritance to fully override parent methods. This behavior can be enabled by script writers using a simple super() call.
* Wrap up GDScript 2.0 base implementationGeorge Marques2020-07-221-20/+15
|
* Reintroduce code completionGeorge Marques2020-07-201-1/+1
|
* Add warning checks in GDScript analyzerGeorge Marques2020-07-201-12/+11
| | | | Reenable checking those when validating code.
* Add GDScript cache singletonGeorge Marques2020-07-201-0/+3
|
* New GDScript tokenizer and parserGeorge Marques2020-07-201-310/+147
| | | | | | | | | | Sometimes to fix something you have to break it first. This get GDScript mostly working with the new tokenizer and parser but a lot of things isn't working yet. It compiles and it's usable, and that should be enough for now. Don't worry: other huge commits will come after this.
* Revert "Include gdscript warning name in the warning message."Ryan Roden-Corrent2020-07-141-32/+30
| | | | This reverts commit de3ad3b30ecb8de1aa112df7d61630102f077b5b.
* Include gdscript warning name in the warning message.Ryan Roden-Corrent2020-07-061-30/+32
| | | | | | | | | | | | | | | | | | | | Occasionally you want to ignore a warning with a `warning-ignore` comment, and you have to go into the settings to look up what the actual name of the warning is. This patch appends the warning name to the end of the warning so you know what string to use to ignore it, similar to other linters like pylint. For example ``` "The signal 'blah' is declared but never emitted."; ``` is now ``` "The signal 'blah' is declared but never emitted. (UNUSED_SIGNAL)"; ```
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-55/+108
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: Enforce separation line between function definitionsRémi Verschelde2020-05-141-0/+9
| | | | | | | | | | | | | | | | | | | | | | | I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-146/+0
| | | | | | | | | | | | | | Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
* Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde2020-05-101-1/+2
| | | | Part of #33027.
* Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde2020-05-101-4/+8
| | | | | | | Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
* fixed: saving gdscript with cyclic inheritance crash the editorThakee Nathees2020-05-101-3/+26
| | | | Fix: #9609
* Fix object leaks caused by unfulfilled yieldsPedro J. Estébanez2020-05-051-2/+18
| | | | | | | | | | Now the stack saved in a `GDScriptFunctionState` is cleared as soon as the `yield()` operation is known not to be resumed because either the script, the instance or both are deleted. This clears problems like leaked objects by eliminating cases of circular references between `GDScriptFunctionState`s preventing them and the objects they refer to in their saved stacks from being released. As an example, this makes using `SceneTreeTimer` safer. Furthermore, with this change it's now possible to print early warnings about `yield()`s to released script/instances, as now we know they won't be successfully resumed as the condition for that happens. However, this PR doesn't add such messages, to keep the observed behavior the same for the time being. Also, now a backup of the function name in `GDScriptFunctionState` is used, since the script may not be valid by the time the function name is needed for the resume-after-yield error messages.
* Merge pull request #32534 from Xrayez/fix-dict2inst-initRémi Verschelde2020-05-031-7/+4
|\ | | | | Make `dict2inst` to work with arbitrary `_init` parameters
| * Make `dict2inst` to work with arbitrary `_init` parametersAndrii Doroshenko (Xrayez)2020-04-301-7/+4
| | | | | | | | | | | | | | | | This is achieved by skipping initializer call while creating an instance of a GDScript. This is implemented by passing -1 as an argument count to `_new` and interpreting any value below 0 to mean that the initializer should not be called during instantiation, because internal members of an instance are going to be overridden afterwards.
* | Merge pull request #38105 from AndreaCatania/AndreaCatania-patch-2Fabio Alessandrelli2020-05-011-4/+4
|\ \ | |/ |/| Removed noisy ERR check from Multiplayer API.
| * Removed noisy ERR check from Multiplayer API.Andrea Catania2020-04-221-4/+4
| |