summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_function.h
Commit message (Collapse)AuthorAgeFilesLines
* Remove underscore hacksMax Hilbrunner2021-08-171-5/+1
| | | | | | Way less cruft. :) Co-authored-by: Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com>
* [Net] Single `rpc` annotation. "sync" no longer part of mode.Fabio Alessandrelli2021-07-201-2/+2
| | | | | | | | | | | | | | | | - Move the "sync" property for RPCs to RPCConfig. - Unify GDScript annotations into a single one: - `@rpc(master)` # default - `@rpc(puppet)` - `@rpc(any)` # former `@remote` - Implement three additional `@rpc` options: - The second parameter is the "sync" option (which also calls the function locally when RPCing). One of "sync", "nosync". - The third parameter is the transfer mode (reliable, unreliable, ordered). - The third parameter is the channel (unused for now).
* Rename Reference to RefCountedPedro J. Estébanez2021-06-111-3/+3
|
* Rename Quat to QuaternionMarcel Admiraal2021-06-041-2/+2
|
* Rename Variant TRANSFORM to TRANSFORM3DAaron Franke2021-06-031-1/+1
| | | Also _transform to _transform3d
* Merge pull request #48793 from vnen/gdscript-fix-temp-type-adjustRémi Verschelde2021-05-171-0/+2
|\ | | | | GDScript: Fix crash caused by uninitialized temp stack slots
| * GDScript: Fix crash caused by uninitialized temp stack slotsGeorge Marques2021-05-171-0/+2
| | | | | | | | | | | | 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.
* | GDScript: Add support for builtin static method callsGeorge Marques2021-05-161-0/+1
|/
* GDScript: Implement lambdas compilation and runtimeGeorge Marques2021-04-281-0/+4
|
* GDScript: Adjust type of temporaries when neededGeorge Marques2021-04-161-0/+34
|
* Reduce number of addressing modes in GDScript VMGeorge Marques2021-04-081-11/+13
| | | | | | | | | | | | | | There's now only 3 addressing modes: stack, constant, and member. Self, class, and nil are now present respectively in the first 3 stack slots. Global and class constants are moved to local constants when compiling. Named globals is only present on editor to use on tool singletons, so its use now emits a new instruction to copy the global to the stack. This allow us to further optimize the VM later by embedding the addressing modes in the instructions themselves, which is better done with less permutations.
* GDScript: Properly validate return typeGeorge Marques2021-04-051-0/+4
| | | | | | | When the type cannot be validated at compile time, the runtime must do a check to ensure type safety is kept, as the code might be assuming the return type is correct in another place, leading to crashes if the contract is broken.
* Add typed arrays to GDScriptGeorge Marques2021-03-291-3/+68
| | | | | | | | - 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.
* Initialize class/struct variables with default values in modules/Rafał Mikrut2021-02-081-8/+8
|
* 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 🎆
* Merge pull request #43890 from vnen/gdscript-builtin-functions-refactorRémi Verschelde2020-12-151-1/+10
|\ | | | | GDScript: Refactor builtin functions
| * GDScript: Refactor builtin functionsGeorge Marques2020-11-261-1/+10
| | | | | | | | | | | | | | | | | | | | | | 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.
* | Documentation generation for GDScriptThakee Nathees2020-11-291-0/+6
|/ | | | | | | | | | | | | | | | | | - 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
* GDScript: Add faster instruction for validated constructorGeorge Marques2020-11-211-1/+5
| | | | Only for built-in types.
* GDScript: Add typed iterate instructionsGeorge Marques2020-11-211-0/+38
|
* GDScript: Add faster call instructions for builtin methodsGeorge Marques2020-11-211-0/+4
| | | | | Methods from builtin types can be called by using the function pointer when the argument and base types are known at compile time.
* GDScript: Add faster call instructions for native methodsGeorge Marques2020-11-211-0/+43
|
* GDScript: Add speficic set/get instructionsGeorge Marques2020-11-211-2/+26
| | | | | When the base type is known at compile-time, we can get a direct function pointer that is faster than the regular set/get paths.
* GDScript: Add faster operator for known typesGeorge Marques2020-11-211-0/+4
| | | | | It now uses the direct operator function pointer, which increases performance in evaluation.
* GDScript: Gather instructions arguments beforehandGeorge Marques2020-11-211-27/+33
| | | | | | | | | Almost all instructions need variant arguments. With this change they are loaded in an array before each instruction call. This makes the addressing code be localized to less places, improving compilation overhead and binary size by a small margin. This should not affect performance.
* Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-6/+6
| | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* Prevent cyclic reference between script and its membersPedro J. Estébanez2020-09-101-1/+2
|
* Add GDScript disassemblerGeorge Marques2020-09-011-8/+4
|
* Add GDScript code generation interfaceGeorge Marques2020-09-011-0/+1
| | | | Implement the abstraction by targeting the current VM.
* New GDScript tokenizer and parserGeorge Marques2020-07-201-3/+3
| | | | | | | | | | 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.
* Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-1/+2
| | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-3/+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.
* Port member initialization from constructor to declaration (C++11)Rémi Verschelde2020-05-141-8/+8
| | | | | | | | | | 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.
* Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde2020-05-101-1/+2
| | | | | | | 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.
* Fix object leaks caused by unfulfilled yieldsPedro J. Estébanez2020-05-051-2/+9
| | | | | | | | | | 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.
* Fix leaked objects when game ends with yields in progressPedro J. Estébanez2020-04-291-2/+4
|
* Replace NULL with nullptrlupoDharkael2020-04-021-2/+2
|
* Style: Set clang-format Standard to Cpp11Rémi Verschelde2020-03-171-1/+1
| | | | | | | | | | For us, it practically only changes the fact that `A<A<int>>` is now used instead of the C++03 compatible `A<A<int> >`. Note: clang-format 10+ changed the `Standard` arguments to fully specified `c++11`, `c++14`, etc. versions, but we can't use `c++17` now if we want to preserve compatibility with clang-format 8 and 9. `Cpp11` is still supported as deprecated alias for `Latest`.
* Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky2020-02-201-3/+3
| | | | objects and made them default.
* GDScript: Remove self static reference and create one on callsGeorge Marques2020-02-191-1/+1
| | | | | | This is needed because of the new changes to Variant. The reference counter is increased by adding it to a Variant, which means no GDScript will be freed (or will be double freed if manually freed somewhere).
* Changed logic and optimized ObjectID in ObjectDB and Variant, removed RefPtr.Juan Linietsky2020-02-151-4/+4
|
* Validate instances of objects before trying to check their type in GDScriptBojidar Marinov2020-01-161-7/+15
| | | | Fixes #27582
* Update copyright statements to 2020Rémi Verschelde2020-01-011-2/+2
| | | | | | | | | | | 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.
* Revert "Forbid implicit type conversion in GDScript"Rémi Verschelde2019-03-041-2/+6
|
* GDScript: Forbid implicit type conversionGeorge Marques2019-03-031-6/+2
| | | | | Since types are not present in release builds, this could cause issues where a variable does not have the exact defined type.
* Core: Ensure classes match their header filenameRémi Verschelde2019-02-121-1/+1
| | | | | | | | | | | | | | | Also drop some unused files. Renamed: - `core/dvector.h` -> `pool_vector.h` - `core/io/resource_import.h` -> `resource_importer.h` - `core/sort.h` -> `sort_array.h` - `core/string_db.h` -> `string_name.h` Dropped: - `core/allocators.h` - `core/os/shell.h` - `core/variant_construct_string.cpp`
* Fix many asan and ubsan reported issuesHein-Pieter van Braam2019-01-301-2/+9
| | | | | | | | | This allows most demos to run without any ubsan or asan errors. There are still some things in thirdpart/ and some things in AudioServer that needs a look but this fixes a lot of issues. This should help debug less obvious issues, hopefully. This fixes #25217 and fixes #25218
* GDScript: check for underscore prefix when type-checkingGeorge Marques2019-01-151-2/+8
| | | | | | Some classes are represented internally with an underscore prefix, so we need to make sure we match this representation when type-checking, otherwise the check might fail on a valid scenario.
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* Fix crash on signal/resume to dangling targetPedro J. Estébanez2018-11-251-4/+2
|