Commit graph

79 commits

Author SHA1 Message Date
Thakee Nathees
f3149817ff fixed: saving gdscript with cyclic inheritance crash the editor
Fix: #9609
(cherry picked from commit c2ab35bdde)
2020-05-11 10:50:45 +02:00
Pedro J. Estébanez
64344e6d1d Fix object leaks caused by unfulfilled yields
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-05 17:53:47 +02:00
Rémi Verschelde
8b0e2a409b
Merge pull request #35218 from bojidar-bg/26691-parse-error-errors
Fix errors raised when showing parse errors in the editor
2020-01-16 22:32:49 +01:00
Bojidar Marinov
da5b138e64
Fix errors raised when showing parse errors in the editor
Fixes #26691
2020-01-16 22:12:24 +02:00
ChibiDenDen
86aa12e806 Keep a weak reference to orphan subclasses to reuse on class reload 2020-01-15 22:54:01 +02:00
George Marques
7d4fc79eb3
Add GDScript warning for standalone expression
This makes the error message clearer as it might be used to call
functions with side effects.
2020-01-09 08:30:14 -03:00
Rémi Verschelde
a7f49ac9a1 Update copyright statements to 2020
Happy new year to the wonderful Godot community!

We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.

Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
George Marques
cb887324e6
GDScript: Convert values when setting member variables
This allows doing: self.x = 1 even if self.x is declared as float.
2019-12-13 12:51:53 -03:00
George Marques
cbf5641a74
Disable GDScript warning for unused class variable by default 2019-12-11 11:02:07 -03:00
Hugo Locurcio
247767eb89
Document how to bypass the unused argument/variable warning in message
Note that prefixing with an underscore only works with unused arguments
and local variables, not class variables and signals.

This closes #26056.
2019-11-27 22:52:43 +01:00
mashumafi
d7137a6b72 Add setting to exclude addons from script warnings 2019-11-07 23:01:22 -05:00
George Marques
15800b4db8
GDScript: Avoid editor crashes when there's cyclic inheritance
Make sure the script is fully compiled before looking into the base.
2019-11-01 12:00:20 -03:00
Rémi Verschelde
dec10dd776
Merge pull request #32051 from qarmin/some_error_explanation
Added some obvious errors explanations
2019-09-25 11:51:54 +02:00
qarmin
17732fe698 Added some obvious errors explanations 2019-09-25 10:28:50 +02:00
luz.paz
91ecd7b6a6 Fix misc. source comment typos
Found using `codespell -q 3 -S ./thirdparty,*.po -L ang,ba,cas,dof,doubleclick,fave,hist,leapyear,lod,nd,numer,ois,paket,seeked,sinc,switchs,te,uint -D ~/Projects/codespell/codespell_lib/data/dictionary.txt `
2019-09-19 14:36:52 -04:00
toasteater
e2121c97ae Make VarArg methods return types show up as Variant in API json
VarArg methods have the return type Object in the API json for GDNative. This
can cause undefined behavior in some language bindings due to lack of
documentation on VarArg methods' behavior.

This changes the MethodInfo of:

- CSharpScript::_new
- GDScript::_new
- PluginScript::_new
2019-08-26 16:36:51 +00:00
Robin Hübner
6ab118c464 Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in "platform", "modules/gdnative", "modules/gdscript" directories. 2019-08-09 11:13:24 +02:00
qarmin
3c154eb93b Remove unnecessary code and add some error explanations 2019-07-01 12:59:42 +02:00
qarmin
4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
Rémi Verschelde
defd960276
Merge pull request #27886 from LeonardMeagher2/obj_to_string
Allow overriding how scripted objects are converted to strings
2019-05-20 22:37:01 +02:00
Rémi Verschelde
e0574e1d98 Fix typos with codespell
Using codespell 1.15.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
doubleclick
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
```
2019-05-19 13:10:35 +02:00
Leonard Meagher
f7eb426e2e Allow overriding how scripted objects are converted to strings
solves #26796

- ADD `String to_string()` method to Object which can be overriden by `String _to_string()` in scripts
- ADD `String to_string(r_valid)` method to ScriptInstance to allow langauges to control how scripted objects are converted to strings
- IMPLEMENT to_string for GDScriptInstance, VisualScriptInstance, and NativeScriptInstance
- ADD Documentation about `Object.to_string` and `Object._to_string`
- Changed `Variant::operator String` to use `obj->to_string()`
2019-05-03 15:06:05 -07:00
Bojidar Marinov
f9d9530902
Fix slight issues with autocompletion and member lists in GDScript
Fixes #27152
Fixes #28591
2019-05-02 17:13:45 +03:00
lupoDharkael
14078fbb82 GDScript: add variable shadowing warning 2019-04-15 18:19:14 +02:00
Ignacio Etcheverry
ad2127a3e8 Replace a few #if/#elif with #ifdef and "#elif defined" 2019-04-05 23:41:51 +02:00
Hugo Locurcio
5a574a4f29
Fix typo in GDScript narrowing conversion warning message
This closes #26790.
2019-03-08 14:28:33 +01:00
Juan Linietsky
b63c506ad8 Close file handles after use of new get_as_utf8_strings, fixes #26578 2019-03-04 09:53:02 -03:00
George Marques
bda60bfa29
Add a dependency search mode for GDScript parser
- This mode avoids loading any other resource.
- Search for class_name now uses this mode, to avoid loading in the scan
thread.
- Implement get_dependencies() for GDScript loader, now exporting
dependencies only should include the preloaded resources.
2019-03-03 16:51:54 -03:00
Rémi Verschelde
f2003b1a7e
Merge pull request #26034 from QbieShay/issue_25596
Inheriting from virtual class no longer causes the engine to crash.
2019-02-28 11:00:20 +01:00
QbieShay
8f22c2684f Inheriting from virtual class no longer causes the engine to crash, it prints an error instead.
Co-authored-by: Hein-Pieter van Braam <hp@tmm.cx>
2019-02-27 20:42:20 +01:00
marxin
8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Ignacio Etcheverry
2f8d1a321a Fix exported property values being lost if base GDScript fails to parse 2019-02-14 02:36:19 +01:00
Juan Linietsky
6504b88547 Ensure get script method list also checks base classes, fixes #23384 2019-01-25 10:09:44 -03:00
George Marques
f4546fc0cd GDScript: don't allow calling non-static function from script 2019-01-23 17:42:06 -02:00
Rémi Verschelde
658296856c
Merge pull request #24877 from neikeq/issue-24280
Fix properties being lost when reloading placeholder GDScript instance
2019-01-10 18:02:57 +01:00
Ignacio Etcheverry
ea85ff0dc2 Fix properties being lost when reloading placeholder GDScript instance
During reloading in `GDScriptLanguage::reload_all_scripts` a placeholder instance that must remain so is replaced with a new placeholder instance. The state is then restored by calling `ScriptInstance::set` for each property. This does not work if the script is missing the properties due to build/parse failing.
The fix for such cases is to call `placeholder_set_fallback` instead of `set` on the script instance.

I took this chance to move the `build_failed` flag from `PlaceHolderScriptInstance` to `Script`. That improves the code a lot. I also renamed it to `placeholder_fallback_enabled` which is a much better name (`build_failed` could lead to misunderstandings).
2019-01-10 01:58:50 +01:00
Rémi Verschelde
b16c309f82 Update copyright statements to 2019
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
Juan Linietsky
3a93499f89 Allow signal connecting even if script is invalid (only when compiled with tools), fixes #17070 2018-11-27 19:55:37 -03:00
Rémi Verschelde
7a9e4c2602
Merge pull request #22953 from DualMatrix/properties_gone
Fixed parents export vars not appearing in inspector if parent is class_name.
2018-11-22 19:34:41 +01:00
Ignacio Etcheverry
7c4c646749 Fix GDScript placeholder fallback 2018-11-10 20:06:17 +01:00
Rémi Verschelde
1169196f04
Merge pull request #22779 from Superwaitsum/LimitSettings
Limit several project settings
2018-10-25 11:38:06 +02:00
Superwaitsum
e5041ad0f5 Add some limits on the Editor Settings 2018-10-24 19:46:33 -05:00
Jakub Grzesik
ba02ccbbe0 Optional getters/setters editor autocomplete
solves #22291
2018-10-23 11:30:14 +02:00
DualMatrix
34c4bfeb01 Fixed parents properties not appearing in inspector if parent is class_name.
Fixed parents properties not appearing in inspector if parent is class_name.
2018-10-12 01:08:14 +02:00
Rémi Verschelde
7b081a7fc8 Fix warnings about unhandled enum value in switch [-Wswitch]
Fixes GCC 5 warnings of the form:

core/io/http_client.cpp:288:9: warning: enumeration value 'STATUS_SSL_HANDSHAKE_ERROR' not handled in switch [-Wswitch]
core/io/marshalls.cpp:806:9: warning: enumeration value 'AABB' not handled in switch [-Wswitch]

Those can be trivial cases where adding a default fallback is the solution,
or more complex issues/hidden bugs where missed values are actually meant
to be handled.
2018-09-27 18:34:30 +02:00
George Marques
b1187b9a2f
GDScript: Revert extra deletion when creating instance
Revert part of e4af39cbc0 that was causing
a crash.
2018-09-19 11:17:47 -03:00
Fabio Alessandrelli
c0e4d7efca Add GDScript slave keyword deprecation warning. 2018-09-15 01:50:34 +02:00
Fabio Alessandrelli
d6b31daec6 Rename slave keyword to puppet
The slave keyword will still be available as deprecated in 3.1 but will
be dropped from future releases.
2018-09-15 00:06:03 +02:00
Rémi Verschelde
1a16dabfb5
Merge pull request #21982 from luzpaz/misc-typos
Misc. typos
2018-09-13 10:59:00 +02:00
luz.paz
08bde5b2de Misc. typos
Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
2018-09-12 21:39:17 -04:00