summaryrefslogtreecommitdiff
path: root/modules/gdscript
AgeCommit message (Collapse)Author
2020-05-21Merge pull request #33689 from jbuck3/signal-errorRémi Verschelde
Trigger an error when trying to define a preexisting signal in GDScript
2020-05-21Merge pull request #35900 from yamgent/unreachableRémi Verschelde
Fix false positive "Unreachable code" warning for loops
2020-05-19Fix too eager GDScriptFunctionState stack cleanupPedro J. Estébanez
2020-05-16gdscript_parser: Fix "unreachable code" false positive for loopsTan Wang Leng
Depending on the conditional statements of the 'for' and 'while' loops, their body may not even execute once. For example: func a(): var arr = [] for i in arr: return i # can be reached, but analysis says cannot return -1 func b(): var should_loop = false while should_loop: return 1 # can be reached, but analysis says cannot return 0 The parser will complain that the statements after the comment cannot be reached, but it is clearly possible for our scenario. This is because the parser falsely assumes that the loop body will always execute at least once. Fix the code to remove this assumption for both of those loops.
2020-05-15Fix incorrect capabilities notification in LSPOliver Frank
(cherry picked from commit 2173d041af711c111d60d1fc1f45f96f4f8c7271)
2020-05-15break, continue outside of a loop, match statement handledThakee Nathees
2020-05-14Merge pull request #38738 from akien-mga/cause-we-never-go-out-of-styleRémi Verschelde
Style: Remove new line at block start, enforce line between functions, enforce braces in if and loop blocks
2020-05-14Style: Enforce braces around if blocks and loopsRémi Verschelde
Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14Merge pull request #38610 from ThakeeNathees/infer-type-null-errorRémi Verschelde
set parser error when infer type is null
2020-05-14Style: Enforce separation line between function definitionsRémi Verschelde
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.
2020-05-14Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde
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.
2020-05-14Merge pull request #38611 from ThakeeNathees/shadow-var-warning-bug-fixRémi Verschelde
shadowed var warning in nested block bug fix
2020-05-14Modernize remaining uses of 0/NULL instead of nullptr (C++11)Rémi Verschelde
Using clang-tidy's `modernize-use-nullptr`. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2020-05-14Port member initialization from constructor to declaration (C++11)Rémi Verschelde
Using `clang-tidy`'s `modernize-use-default-member-init` check and manual review of the changes, and some extra manual changes that `clang-tidy` failed to do. Also went manually through all of `core` to find occurrences that `clang-tidy` couldn't handle, especially all initializations done in a constructor without using initializer lists.
2020-05-13set parser error when infer type is nullThakee Nathees
2020-05-13Merge pull request #38609 from ↵Rémi Verschelde
ThakeeNathees/range-crash-with-non-numeric-const-fix range() with non-numeric const argument crash fix
2020-05-13Merge pull request #38708 from ThakeeNathees/init-assign-type-parser-bug-fixRémi Verschelde
regression: var declaration type info parser bug fix
2020-05-13regression: static func can't access const fixThakee Nathees
2020-05-13regression: var declaration type info parser bug fixThakee Nathees
2020-05-10Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde
Part of #33027.
2020-05-10Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde
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.
2020-05-10Merge pull request #37160 from ↵Rémi Verschelde
ThakeeNathees/saveing-cyclic-inheritance-crash-fix Fix: saving gdscript with cyclic inheritance crash the editor
2020-05-10Merge pull request #37020 from aaronfranke/rangeRémi Verschelde
Allow using integer vectors for iteration and make range() use them
2020-05-10shadowed var warning in nested block bug fixThakee Nathees
Fix: #38552
2020-05-10range() with non-numeric const argument crash fixThakee Nathees
2020-05-10fixed: saving gdscript with cyclic inheritance crash the editorThakee Nathees
Fix: #9609
2020-05-10more clearer unexpected statement end error messagesThakee Nathees
2020-05-09Merge pull request #38481 from RandomShaper/improve_yieldRémi Verschelde
Fix object leaks caused by unfulfilled yields
2020-05-09Merge pull request #38357 from ThakeeNathees/dict2inst-crash-fixRémi Verschelde
fix: dict2inst crash when constructor has arguments
2020-05-09Merge pull request #37598 from ThakeeNathees/GDScript-type-resolve-bug-fixRémi Verschelde
GDScript class var type resolve bug fixed
2020-05-09Merge pull request #37033 from ThakeeNathees/python-like-str-escapeRémi Verschelde
python like string escape implemented
2020-05-09Merge pull request #38412 from ThakeeNathees/static-func-var-accessRémi Verschelde
parser error for static func access non-static variables
2020-05-09Change get_completion_identifier_is_function to return a boolAaron Franke
A minor bugfix
2020-05-09Allow using integer vectors for iteration and make range() use themAaron Franke
2020-05-05Fix object leaks caused by unfulfilled yieldsPedro J. Estébanez
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.
2020-05-05Merge pull request #37293 from Janglee123/ctrl-click-improvementsRémi Verschelde
Improved go-to definition (Ctrl + Click)
2020-05-05Improved go-to definition (Ctrl + Click)janglee
Co-Authored-By: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
2020-05-03Merge pull request #32534 from Xrayez/fix-dict2inst-initRémi Verschelde
Make `dict2inst` to work with arbitrary `_init` parameters
2020-05-03parser error for static func access non-static variablesThakee Nathees
Fix: #38408
2020-05-02Mention offending function name in "Indented block expected" errorSteven Schoen
2020-05-01Merge pull request #38105 from AndreaCatania/AndreaCatania-patch-2Fabio Alessandrelli
Removed noisy ERR check from Multiplayer API.
2020-04-30Make `dict2inst` to work with arbitrary `_init` parametersAndrii Doroshenko (Xrayez)
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.
2020-04-30fix: dict2inst crash when constructor has argumentsThakee Nathees
2020-04-29Merge pull request #38288 from RandomShaper/imvu/fix_not_freed_gdsfuncstateRémi Verschelde
Fix leaked objects when game ends with yields in progress
2020-04-29Merge pull request #38279 from BigRed-118/assert_mark_as_safe_regression_bugRémi Verschelde
Fix for marking assert lines as safe bug
2020-04-29Fix leaked objects when game ends with yields in progressPedro J. Estébanez
2020-04-29[Core] Rename linear_interpolate to lerpAaron Franke
2020-04-27Fix for marking assert lines as safe bugTom Evans
Calling _reduce_node_type from GDScriptParser::_parse_block for assert was using a current class with a scope that didn't include all functions. Now calling in GDScriptParser::_check_block_types uses the right class type. We also now check the assert node message. The assert line was added to the set_errors associated with assert, since before the error would be reported on the next line
2020-04-27Merge pull request #36927 from ThakeeNathees/export-var-type-reduce-implimentedRémi Verschelde
Fix: export var type reduce() implemented
2020-04-27export var type reduce() implementedThakee Nathees