Commit graph

267 commits

Author SHA1 Message Date
Juan Linietsky
5e512b705e Support threads in the script debugger
* This implementation adds threads on the side of the client (script debugger).
* Some functions of the debugger are optimized.
* The profile is also now thread safe using atomics.
* The editor can switch between multiple threads when debugging.

This PR adds threaded support for the script language debugger. Every thread has its own thread local data and it will connect to the debugger using multiple thread IDs.
This means that, now, the editor can receive multiple threads entering debug mode at the same time.
2023-07-26 12:06:45 +02:00
ocean (they/them)
7d29ac0bf2 GDScript: solve _populate_class_members() cyclic dependency problem 2023-07-08 15:34:20 -04:00
Danil Alexeev
84c8946565
GDScript: Remove unnecessary name check in _get_property_list() 2023-06-22 12:41:44 +03:00
jpcerrone
8ce8216d17 Fix errors destroying script with static variables
Fixes #78376
After #78138 'script_list' is now cleared in 'GDScriptLanguage::finish'
Because of that, we can safely remove the removal from that list that
happens on 'GDScript::~GDScript'.
2023-06-21 12:33:21 -03:00
Danil Alexeev
a0577eb23b
GDScript: Fix _get_script_name() function collision for SCU build 2023-06-20 12:03:54 +03:00
Rémi Verschelde
ae00187b58
Merge pull request #77129 from dalexeev/gds-fix-static-var-bugs-part-1
GDScript: Fix some bugs with static variables and functions
2023-06-19 21:18:18 +02:00
Rémi Verschelde
5f9175f969
Merge pull request #76954 from Rindbee/return-null-on-fail-load-script
Returns null and does not cache when the source code of the script fails to load
2023-06-19 21:17:47 +02:00
Danil Alexeev
aebbbda080
GDScript: Fix some bugs with static variables and functions 2023-06-16 22:52:11 +03:00
Rindbee
cbce374f68 Returns null and does not cache when the source code of the script fails to load
This usually means that an `ERR_FILE*` error occurred.

Previously, using `GDScriptCache::get_full_script()` would ignore errors during loading.
Now, all errors are not ignored.

Judging in which period the error occurred, it can be judged based on the return value:
1. null + err : Error during script loading (load_source_code()).
2. script + err: Error during script parsing.
2023-06-15 21:06:10 +08:00
Rémi Verschelde
25b2f1780a
Style: Harmonize header includes in modules
This applies our existing style guide, and adds a new rule to that style
guide for modular components such as platform ports and modules:

Includes from the platform port or module ("local" includes) should be listed
first in their own block using relative paths, before Godot's "core" includes
which use "absolute" (project folder relative) paths, and finally thirdparty
includes.

Includes in `#ifdef`s come after their relevant section, i.e. the overall
structure is:

- Local includes
  * Conditional local includes
- Core includes
  * Conditional core includes
- Thirdparty includes
  * Conditional thirdparty includes
2023-06-15 14:35:45 +02:00
kobewi
c646f7df70 Clear SelfList when destroying GDScriptLanguage 2023-06-12 16:04:26 +02:00
Rémi Verschelde
7780926b25
GDScript: Fix template_debug compilation with TOOLS/DEBUG macro mismatch 2023-04-28 11:09:12 +02:00
George Marques
0ba6048ad3
Add support for static variables in GDScript
Which allows editable data associated with a particular class instead of
the instance. Scripts with static variables are kept in memory
indefinitely unless the `@static_unload` annotation is used or the
`static_unload()` method is called on the GDScript.

If the custom function `_static_init()` exists it will be called when
the class is loaded, after the static variables are set.
2023-04-27 09:51:44 -03:00
ocean (they/them)
6783ff69c0 Improve and fix GDScript documentation generation & behavior
Removes documentation generation (docgen) from the GDScript compiler to
its own file. Adds support for GDScript enums and signal parameters and
quite a few other assorted fixes and improvements.
2023-04-21 10:17:30 -04:00
Dmitrii Maganov
4e34cf238a GDScript: Change parser representation of class extends 2023-03-13 01:40:13 +02:00
Yuri Sizov
496bd94c21 Prevent cache corruption when saving resources in the editor 2023-03-08 19:46:55 +01:00
voidedWarranties
bd5ab9f9b4 Remove unused ScriptLanguage methods 2023-02-26 22:30:56 -08:00
Yuri Sizov
6212da66e8
Merge pull request #72867 from vnen/gdscript-limit-call-depth
GDScript: Add limit to call depth
2023-02-17 17:00:46 +03:00
Danil Alexeev
220898a69f
GDScript: Remove treat_warnings_as_errors project setting 2023-02-10 10:16:33 +03:00
George Marques
34f0a2ca46
GDScript: Add limit to call depth
The hard limit is set at 2048 depth which seems sensible between
legitimate recursive calls while still avoiding a crash because of a
stack overflow in most of the cases.

Note that it is still possible to reach the stack limit and get an
overflow before reaching a call depth. This is intended as a half-way
measure to stop crashing in most cases, since there's no reliable nor
portable way to check the amount of stack memory left.
2023-02-07 17:09:40 -03:00
Rémi Verschelde
604493eb6e
Merge pull request #65910 from KoBeWi/gdsus
Cleanup function state connections when destroying instance
2023-02-03 16:13:06 +01:00
Rémi Verschelde
e768e02b78
Merge pull request #72444 from reduz/fix-global-class-parsing
Fix global script class parsing.
2023-01-31 13:20:00 +01:00
Juan Linietsky
1bbe0a2b2f Fix global script class parsing.
* Broke with #72226
* Restored previous version of the code, made it even more error tolerant.
* Added a warning to **not** change the code.

Fixes #72226.
2023-01-31 12:43:25 +01:00
Dmitrii Maganov
5909f9f075 GDScript: Fix issues with typed arrays 2023-01-31 11:54:41 +02:00
George Marques
aee7b7363b
GDScript: Avoid calling non-static methods on native classes 2023-01-28 20:33:01 -03:00
Danil Alexeev
b004f8180e
GDScript: Allow constant expressions in annotations 2023-01-25 18:43:56 +03:00
Rémi Verschelde
ebd0b40f6e
Merge pull request #71687 from reduz/support-script-class-name-in-efs
Support script global resource name in EditorFileSystem
2023-01-21 16:54:23 +01:00
Juan Linietsky
dddd8d43f6 Support script global resource name in EditorFileSystem
* Works for binary and text files.
* Makes EditorQuickOpen work with custom resources again.
* Information is cached and easily accessible.

Properly fixes #66179. Supersedes #66215 and supersedes #62417

**WARNING**: This required breaking backwards binary compatibility (.res and .scn files). Files saved after this PR is merged will no longer open in any earlier versions of Godot.
2023-01-21 14:19:27 +01:00
George Marques
7e5c2f945d
Remove references to compiled GDScript in export
This feature was removed from GDScript so it should not be present on
the interface nor in the saved export presets.
2023-01-20 15:09:07 -03:00
Adam Scott
e3e55b29ce Add default virtual gdscript:// path to GDScript instances 2023-01-12 10:27:38 -05:00
Adam Scott
d22199990e Resolve GDScript::clear() heap-use-after-free ASAN errors 2023-01-07 11:51:36 -05:00
Rémi Verschelde
163f6f5fe8
Merge pull request #68429 from KoBeWi/PropertySettings
Add PropertyInfo overload for GLOBAL_DEF
2023-01-06 22:59:29 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Rémi Verschelde
a797fa3b3d
Merge pull request #70503 from rune-scape/inner-class-docs
Inner classes get their docs back
2023-01-03 12:15:44 +01:00
rune-scape
1b77993257 Inner classes get their docs back 2022-12-23 17:39:24 -05:00
ocean (they/them)
fb418685a0 Unify GDScriptAnalyzer in-editor and runtime autoload checks 2022-12-20 19:01:28 -05:00
Rémi Verschelde
8d52eea52b
Merge pull request #70000 from rune-scape/find-more-classes
GDScript: Fix built-in script `find_class` bugs
2022-12-17 16:30:34 +01:00
rune-scape
e1c63fee86 GDScript: Fix built-in script and other find_class bugs 2022-12-15 14:56:23 -05:00
Adam Scott
3684fd249e Fix GDScript::_get_gdscript_from_variant() crash
The crash would happen, theoretically, when getting the type of a invalid
variant.
2022-12-15 12:29:01 -05:00
ocean (they/them)
c8293a73b4 Add GDScript member initializer implicit type conversion 2022-12-11 16:55:02 -05:00
kobewi
7c6b659bd7 Add PropertyInfo overload for GLOBAL_DEF 2022-12-11 21:36:48 +01:00
Adam Scott
beaef88abd Remove debug macro for GDScriptLanguage script_list 2022-12-10 14:09:04 -05:00
Rémi Verschelde
f6ea295bb1
Merge pull request #69467 from rune-scape/rune-subclass-script-path
GDScript: Fix subclass script path issues
2022-12-10 10:21:19 +01:00
Adam Scott
88f3045301 Move GDScript uninitialization to GDScriptLanguage::finalize()
Co-authored-by: Ricardo Buring <ricardo.buring@gmail.com>
Co-authored-by: kleonc <9283098+kleonc@users.noreply.github.com>
2022-12-06 09:35:39 -05:00
rune-scape
d531869a7c GDScript: Fix subclass script path issues 2022-12-01 20:43:27 -05:00
kobewi
e9a3e49086 Cleanup function state connections when destroying instance
Co-authored-by: Adam Scott <ascott.ca@gmail.com>
2022-12-02 00:20:11 +01:00
Adam Scott
5704055d30 Fix cyclic references in GDScript 2.0 2022-11-18 16:41:31 -05:00
Rune
bce6f1792e GDScript compiler subclass bugfixes 2022-11-13 02:29:21 -08:00
Wei Guo
d0edd36f80 Fix built-in script path of GDScript 2022-10-25 03:41:18 +08:00
bruvzg
0103af1ddd
Fix MSVC warnings, rename shadowed variables, fix uninitialized values, change warnings=all to use /W4. 2022-10-07 11:32:33 +03:00