summaryrefslogtreecommitdiff
path: root/modules/gdscript/gd_function.cpp
AgeCommit message (Collapse)Author
2017-11-16GDScript: Refactor "GD" class prefix to "GDScript"Rémi Verschelde
2017-11-09Make sure we don't leak when an opcode is followed by itselfHein-Pieter van Braam
When compiling with GCC it is now possible for an opcode followed by itself to never leave the scope it is currently in. This leads to a situation where the dtor of a scope local variable isn't called which in turn can lead to a memory leak. By moving the goto outside of the scope of each opcode we guarantee that all dtors have been called before the next opcode gets dispatched. this fixes #12401
2017-10-05Add NIL_IS_VARIANT usage to few definitionsRuslan Mustakov
The missing usage flag led to GDNative API descriptions containting arguments with "void" type.
2017-10-01Replace a OPCODE_BREAK with break in opcode 31Hein-Pieter van Braam
This was a mistake made in 520d84e. There are no more other looping structures left in this function.
2017-09-27Fixed wrong break statement in GDFunction::callScayze
2017-09-25Remove several checks on DEBUG_RELEASEHein-Pieter van Braam
These errors shouldn't be possible on a tested game. Remove the checks on release. Shaves about 10% off of tight loops.
2017-09-25Use computed goto to dispatch next opcodeHein-Pieter van Braam
On compulers that define __GNUC__ use computed goto to directly dispatch the next instruction rather than going through another switch statement. This saves a jump and some comparisons. In tight loops this is is roughly 10% faster than the switch() method.
2017-09-21Implement Linux-style likely()/unlikely() macrosHein-Pieter van Braam
This implement branch prediction macros likely() and unlikely() like in Linux. When using these macros please ensure that when you use them the condition in the branch really is very, very likely or unlikely. Think 90+% of the time. Primarily useful for error checking. (And I implement these macros for all our error checking macros now) See this article for more information: https://kernelnewbies.org/FAQ/LikelyUnlikely There are more places where these macros may make sense in renderer and physics engine. Placing them will come in another commit down the line.
2017-09-19Allow booleanization of all typesHein-Pieter van Braam
We now allow booleanization of all types. This means that empty versions of all types now evaluate to false. So a Vector2(0,0), Dictionary(), etc. This allows you to write GDScript like: if not Dictionary(): print("Empty dict") Booleanization can now also no longer fail. There is no more valid flag, this changes Variant and GDNative API.
2017-09-19Remove more GDScript runtime checks on releaseHein-Pieter van Braam
As a preparation for other performance enhancements to GDScript:call() start by removing more of the GDScript runtime checks on release. This code has been tested with 2d/platformer, 3d/platformer, 3d/materials_test, and goltorus. No regressions were found.
2017-09-02Fix typos 'a' and 'an'Poommetee Ketson
2017-09-02Fix use of unitialized variablesHein-Pieter van Braam
The second in my quest to make Godot 3.x compile with -Werror on GCC7
2017-08-27Fix a crash in gdscript callbacksHein-Pieter van Braam
This fixes a crash running the 'goltorus' project.
2017-08-27Dead code tells no talesRémi Verschelde
2017-08-27Use HTTPS URL for Godot's website in the headersRémi Verschelde
2017-08-24Convert Object::cast_to() to the static versionHein-Pieter van Braam
Currently we rely on some undefined behavior when Object->cast_to() gets called with a Null pointer. This used to work fine with GCC < 6 but newer versions of GCC remove all codepaths in which the this pointer is Null. However, the non-static cast_to() was supposed to be null safe. This patch makes cast_to() Null safe and removes the now redundant Null checks where they existed. It is explained in this article: https://www.viva64.com/en/b/0226/
2017-08-12Updated function argument namesWilson E. Alvarez
2017-08-10Removes type information from method bindsIgnacio Etcheverry
2017-08-07Makes all Godot API's methods Lower CaseIndah Sylvia
2017-06-23Adds completed signal to GDFunctionStateIgnacio Etcheverry
2017-05-27GDScript: Use "is" keyword for type checking.Andreas Haas
Replaces the `extends` keyword with `is` in the context of testing for type compatibility. `extends` is still used for declaring class inheritance. Example: ```gdscript extends Node2D func _input(ev): if ev is InputEventKey: print("yay, key event") ```
2017-05-17Add extended check option to GDFunctionState::is_valid()Pedro J. Estébanez
2017-04-08Add "Godot Engine contributors" copyright lineRémi Verschelde
2017-03-21Fix random crashes when using yield()Pedro J. Estébanez
2017-03-05A Whole New World (clang-format edition)Rémi Verschelde
I can show you the code Pretty, with proper whitespace Tell me, coder, now when did You last write readable code? I can open your eyes Make you see your bad indent Force you to respect the style The core devs agreed upon A whole new world A new fantastic code format A de facto standard With some sugar Enforced with clang-format A whole new world A dazzling style we all dreamed of And when we read it through It's crystal clear That now we're in a whole new world of code
2017-03-05Add a bunch of missing Godot headers in own filesRémi Verschelde
2017-02-28 Various fixes detected using PVS-Studio static analyzer.Thaer Razeq
- Add FIXME tags comments to some unfixed potential bugs - Remove some checks (always false: unsigned never < 0) - Fix some if statements based on reviews. - Bunch of missing `else` statements
2017-02-13Remove bounds check when resuming from yield.Hein-Pieter van Braam
The code would get a pointer to the beginning of the call_args by using operator[] at the stack Vector. This does bound checking. When there are no call_args this bound check fails and the error mentioned in #7796 gets triggered. This bound check is actually not necessary as call_args just gets set to NULL and never dereferenced. This new code will just unconditionally set the pointer to the place where the call_args are if there are any. There is no NULL check for call_args anywhere so this is safe. Fixes #7796
2017-02-13Rename the _MD macro to D_METHODHein-Pieter van Braam
This new name also makes its purpose a little clearer This is a step towards fixing #56
2017-01-15Style: Cosmetic fixes to play nice with clang-formatRémi Verschelde
2017-01-11Both Array and Dictionary are always in shared mode (removed copy on write).Juan Linietsky
2017-01-04-GDScript support for accessing properties directlyJuan Linietsky
-Added code lookup and code completion support for properties too
2017-01-02ObjectTypeDB was renamed to ClassDB. Types are meant to be more generic to ↵Juan Linietsky
Variant. All usages of "type" to refer to classes were renamed to "class" ClassDB has been exposed to GDScript. OBJ_TYPE() macro is now GDCLASS()
2016-09-07Renamed the bind_native functions to bind_vararg, should make it show the ↵Juan Linietsky
documentation more clearly and also make it easier to bind to C#
2016-08-19Brand new networked multiplayerJuan Linietsky
2016-08-05Fix #5891 by not expecting the script instance to be a GDInstanceBojidar Marinov
It could be a placeholder instance as well
2016-06-29Warn instad of crashing when class instance is gone after yield. Closes ↵Juan Linietsky
#5247 , probably closes other yield related crashes
2016-06-20Property reporty base type when a function fails, fixes #4581 probably also ↵Juan Linietsky
closes other issues
2016-06-11Made many built-in gdscript functions return more descriptive errors, closes ↵Juan Linietsky
#5150
2016-05-31Some cleanup to GDScriptJuan Linietsky
separated GDFunction (VM) from GDScript in two different files