Commit graph

1061 commits

Author SHA1 Message Date
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
George Marques 64d09b7de5
GDScript: Fix type resolution not being return in some cases
Some situations caused the parser node type to not being update when
trying to resolve the type, returning invalid data and breaking the
parsing when it shouldn't. This patch fix the behavior.
2019-09-24 18:05:20 -03:00
Rémi Verschelde 4f294b958f doc: Sync classref with current source
Fix a few missing bindings or unspecified argument names and default values.
2019-09-24 11:52:06 +02:00
Hugo Locurcio c1fcb22677
Fix line being assigned to twice in the GDScript language server
This closes #32090.
2019-09-23 15:27:30 +02:00
qarmin 50be65bf43 Changed some code found by Clang Tidy and Coverity 2019-09-22 18:45:08 +02:00
Rémi Verschelde 25a1bfed5c
Merge pull request #32210 from Calinou/editor-log-distinguish-messages
Distinguish editor-originating messages in the editor log
2019-09-20 20:22:43 +02:00
Rémi Verschelde fdc2463a1b
Merge pull request #32150 from luzpaz/typos
Fix misc. source comment typos
2019-09-20 17:09:05 +02:00
Hugo Locurcio ba566dff2e
Distinguish editor-originating messages in the editor log
This fades out messages originating from the editor to make messages
printed by the project stand out more.

This also tweaks wording in some editor messages for consistency.
2019-09-20 01:59:02 +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
Rémi Verschelde c3d5c96494
Merge pull request #31921 from bojidar-bg/28978-uninitialized-array-value
Fix uninitialized arrays and dictionaries retaining value
2019-09-19 20:31:12 +02:00
Rémi Verschelde 291f408fcf
Merge pull request #32100 from SaracenOne/gdscript_parent_const_types
Fix const deceleration for inherited scripts above immediate parent
2019-09-19 20:11:37 +02:00
Rémi Verschelde b5f14cc6f7
Merge pull request #31934 from mitchcurtis/28187
Produce an error when a class has the same name as a Singleton
2019-09-19 20:05:41 +02:00
Rémi Verschelde 318ac6ee13
Merge pull request #31142 from mitchcurtis/assert-message
GDScript: add an optional message parameter to assert()
2019-09-19 19:56:05 +02:00
Windy Darian 628f467605 Allow weakref(null) in gdscript
Tiny addition I personally found useful - this allows us to `var my_ref := weakref(null)` for nullable weak ref (with type hint!). When trying to test if `my_ref` is holding valid reference, we can just `if my_ref.get_ref():` instead of `if my_ref and my_ref.get_ref():` everywhere.
2019-09-16 23:15:34 -04:00
Mitch Curtis aa8e3e7b0f GDScript: add an optional message parameter to assert()
Before this patch, assert() only took the condition to assert on:

    assert(item_data)

Now, it can optionally take a string that will be printed upon failure:

    assert(item_data, item_name + " has no item data in ItemDatabase")

This makes it easier to immediately see what the issue is by being
able to write informative failure messages.

Thanks to @wiped1 for sharing their patch, upon which this is based.

Closes #17082
2019-09-11 15:37:11 +02:00
Saracen cf00f35a8e Allow for constant deceleration to be detected inherited scripts above the immediate parent. 2019-09-11 06:19:20 +01:00
Mitch Curtis 8f5ffeeacc Produce an error when a class has the same name as a Singleton
If you somehow end up with a Singleton.gd that looks like this:

	extends Node

	class_name Singleton

	func foo():
	    pass

You will get an error when using it in another file:

	extends Node2D

	func _init():
	    # Parser Error: Non-static function "foo" can only be called from an instance.
	    Singleton.foo()

This error is confusing. This patch ensures that an error on the class_name line will be produced:

    Parse Error: The class "Singleton" conflicts with the AutoLoad singleton of the same name, and is therefore redundant. Remove the class_name declaration to fix this error.

Fixes #28187.
2019-09-06 17:12:43 +02:00
iwek7 617797c47c Adds skip-breakpoints feature 2019-09-03 20:49:09 +02:00
MrCdK 9e9c16c1e5 Try and show all the properties added with _get_property_list() when triggering completion.
Closes https://github.com/godotengine/godot/issues/25097
2019-09-03 14:27:27 +02:00
Bojidar Marinov 3ca7b4ee45
Fix uninitialized arrays and dictionaries retaining value
Fixes #28978
2019-09-03 10:39:04 +03:00
Rémi Verschelde 10b040ab20
Merge pull request #31893 from bojidar-bg/25081-gdscript-index-self
Re-allow indexing on objects and other non-builtin types
2019-09-02 20:25:14 +02:00
Rémi Verschelde 85955c5f25
Merge pull request #31843 from 2shady4u/parserCtrlClick
Solves ctrl+click on functions by ignoring the cursor
2019-09-02 19:56:35 +02:00
Bojidar Marinov e3d05fa42d
Re-allow indexing on "self" and object types in GDScript
Fixes #25081
2019-09-02 20:18:15 +03:00
Rémi Verschelde eb38bc6c0a gdscript: Fix build after #24925
The PR did not use the ScriptCodeCompletionOption system introduced
later on, and somehow this did not generate a merge conflict even
though neighboring code was changed.
2019-09-02 16:31:43 +02:00
Rémi Verschelde 877912b23c
Merge pull request #24925 from Mr-Slurpy/typed-autoload
Added autoloads as a potential type.
2019-09-02 16:05:05 +02:00
Rémi Verschelde d767edb9b3
Merge pull request #21443 from deepmax/ord_function
Add ord() function to return Unicode code point of a string of length one
2019-09-02 15:28:15 +02:00
shaderbeast dbd253d7a2 Solves ctrl+click on functions by ignoring the cursor
Obeyed CLANG format rules


Obeying CLANG format rules attempt 2


Obeying CLANG format rules attempt 3


Clean up


Fixed runaway while loop


Removed int initialization
2019-09-02 13:46:38 +02:00
Rémi Verschelde 65d61d0360 doc: Sync classref with current source 2019-08-29 15:33:52 +02:00
Thomas Karcher 02ed79f7f7
Updated description for "stepify"
Mentioned the possibility to use stepify as a rounding function; +code examples
2019-08-29 14:03:18 +02:00
Rémi Verschelde b97169740e
Merge pull request #31741 from akien-mga/lsp-requires-websocket-jsonrpc
GDScript: Disable LSP if either jsonrpc or websocket are disabled
2019-08-29 08:37:40 +02:00
Rémi Verschelde 7995ce03f3
Merge pull request #31738 from bojidar-bg/31056-class_name-extends
Remove check for class_name and extends order
2019-08-29 08:33:51 +02:00
Masoud Montazeri 5565f5591f Add ord() function to return Unicode code point of a string of length one 2019-08-28 16:14:11 +02:00
Rémi Verschelde b791efdb16
Merge pull request #31737 from bojidar-bg/31455-stack-underflow
Fix yield check in GDScriptFunction
2019-08-28 15:36:08 +02:00
Rémi Verschelde b994124df3 GDScript: Disable LSP if either jsonrpc or websocket are disabled
Follow-up to #29780.
2019-08-28 13:29:37 +02:00
Rémi Verschelde 46ad60385b
Merge pull request #29780 from GodotExplorer/gdscript-lsp
Add Language Server Protocol for GDScript
2019-08-28 13:06:51 +02:00
Bojidar Marinov b70b16a20f
Remove check for class_name and extends order
Closes #31056
2019-08-28 12:05:21 +03:00
Bojidar Marinov 112aa6e367
Fix yield check in GDScriptFunction
Fixes #31455
2019-08-28 11:15:43 +03:00
Rémi Verschelde 185072015f
Merge pull request #31606 from toasteater/fix/nativescript-new-json-return-type
Fix the return type of NativeScript::new in API json
2019-08-28 09:15:40 +02:00
Michael Alexsander Silva Dias a8826ad3b8 Make 'break' and 'continue' be marked as safe 2019-08-27 23:10:33 -03: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
Hugo Locurcio a4794af5df
Improve writing style in GDScript error/warning messages
This uses double quotes everywhere for consistency.
2019-08-23 20:55:50 +02:00
Rémi Verschelde d3153c28f0 Replace last occurrences of 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG'
The last remaining ERR_EXPLAIN call is in FreeType code and makes sense as is
(conditionally defines the error message).

There are a few ERR_EXPLAINC calls for C-strings where String is not included
which can stay as is to avoid adding additional _MSGC macros just for that.

Part of #31244.
2019-08-17 13:31:22 +02:00
Rémi Verschelde 37a16fee05 Export: Remove temp files from cache after export
So far we left most temporary files lying around, so this attempts to
fix that.

I added a helper method to DirAccess to factor out the boilerplate of
creating a DirAccess, checking if the file exists, remove it or print
an error on failure.
2019-08-12 13:31:59 +02:00
geequlim e5b91a15e6 Improve code compeletion for virtual methods with signatures 2019-08-11 14:06:39 +08:00
geequlim 72d11cd173 Add optional goto definition support for native symbols
This action will show help for target symbol in godot editor and bring the godot editor window to foreground
Improved markdown documentation for symbols.
2019-08-11 13:30:15 +08:00
Geequlim 666ed89011 Add generate script api to dictionary support
Expose GDScriptLanguageProtocol singleton and classes for editor plugins (Not visiable in class tree)
Fix minor bug in symbol resolve
2019-08-11 13:30:15 +08:00
Geequlim 9618b0c63e Check client workspace directory is valid
Drop test initialize message sent to client
Remove unused code property for the parser class
2019-08-11 13:30:15 +08:00
Geequlim b2f02317fa Improve symbol resolve for inner classes
Only level one inner classes would be resolved currently but it sould cover most real world use case
Improve documation parseing for const values
Improve documation format for native symbols
2019-08-11 13:30:15 +08:00
Geequlim 76c9e4ceb7 Improved performance for completion and symbol resolvation.
Improved uri and workspace path translatation on windows platform.
The smart resolvation is much faster than builtin's in the server side.
The smart resolve mode is still disabled as default as the clients might be slow with a planty of completion items.
2019-08-11 13:30:15 +08:00
geequlim fa6d6a329c Add optional smart resolve sulotion
The smart resolvaion can guess most symbols but it might be slow so disabled by default users can turn on it in the editor setting
2019-08-11 13:30:15 +08:00
geequlim 37aafaaa9c Add a symbol pool to cache all native symbols and workspackes symbols.
Implement hover
Implement completion documentation resolve
Implement hover documentation
Implement go to definition
2019-08-11 13:30:15 +08:00
geequlim f58560ac36 Add GDScript Language Protocol plugin 2019-08-11 13:30:15 +08:00
Rémi Verschelde 80c7cb6378
Merge pull request #31227 from profan/fix/err-explain-usages
Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in "platform", "modules/gdnative", "modules/gdscript" directories.
2019-08-09 12:28:06 +02: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
Cameron Reikes 2339e85b78 Expression before 'is' may be null 2019-08-09 01:24:03 -07:00
Rémi Verschelde be3b2f3ff9
Merge pull request #31041 from 2shady4u/master
Mark class_name line as safe in editor
2019-08-05 08:05:49 +02:00
shaderbeast 1e6a52b215 Mark class_name line as safe in editor 2019-08-02 20:07:54 +02:00
Kaligule a2c81a7455 Add a reference to pow to the description of exp.
This might be especially usefull since godot script doesn't support ** or ^ as operators, so beginners might search for the exponential function, when what they really need is the pow function.

This is exactly what happened to me and since I couldn't find helpfull information in the documentation I had to look it up online, where I found the answer on a helpfull [reddit thread](https://www.reddit.com/r/godot/comments/3mvwz0/how_do_i_do_exponents_in_godot/).

@akien-mga told me how to reference methods here:
godotengine#30909
2019-07-29 18:17:52 +02:00
Rémi Verschelde 1107799de5
Merge pull request #30849 from bojidar-bg/7898-mixed-indentation
Disallow using of both tabs and spaces for indentation in the same file
2019-07-27 10:48:31 +02:00
Bojidar Marinov f12f3cf726
Disallow using of both tabs and spaces for indentation in the same file
Closes #7898
2019-07-26 21:24:34 +03:00
Rémi Verschelde d844e30614 Inspector: Make default float step configurable
Also allow lifting the decimal step formatting with a hint range step
of 0. A new `range_step_decimals()` is added for this to avoid breaking
compatibility on the general purpose `step_decimals()` (which still
returns 0 for an input step of 0).

Supersedes #25470.
Partial fix for #18251.
2019-07-23 17:31:38 +02:00
Rémi Verschelde 07e289963c doc: Sync classref with current source 2019-07-22 12:27:52 +02:00
Rémi Verschelde 60efd67034
Merge pull request #30693 from Chaosus/lerp_angle
Added lerp_angle built-in function
2019-07-20 13:37:13 +02:00
Rémi Verschelde d15cf7b672
Merge pull request #30576 from qarmin/lgtm_coverage
Changed some code reported by LGTM and Coverity
2019-07-20 12:00:13 +02:00
Chaosus 6694c119d0 Added lerp_angles built-in function
Co-authored-by: Xrayez <https://github.com/Xrayez>
Co-authored-by: DleanJeans <https://github.com/DleanJeans>
2019-07-20 12:59:41 +03:00
qarmin 6cbaf7662f Changed some code showed in LGTM and Coverage 2019-07-20 08:09:57 +02:00
Aaron Franke a60f242982 Add integer posmod and rename default arg names
"posmod" is the integer version of "fposmod". We do not need a "mod" because of the % operator.

I changed the default arg names from "x" and "y" to "a" and "b" because they are not coordinates. I also changed pow's arg names to "base" and "exp". Also, I reorganized the code in the VS built-in funcs switch statement.
2019-07-18 16:33:43 -04:00
Rémi Verschelde 950153757b
Merge pull request #30648 from NilsIrl/useless_casts
Remove useless casts to String
2019-07-18 09:34:55 +02:00
Bojidar Marinov 8336590154
Fix stack underflows when yielding twice
Also, refactor GDScriptFunctionState::_signal_callback, removing some excessive repetition.
Fixes #30269.
2019-07-17 23:48:49 +03:00
Nils ANDRÉ-CHANG 074115338e Remove useless casts to String 2019-07-17 11:31:42 +01:00
Rémi Verschelde 7b1ee28a03
Merge pull request #30567 from NilsIrl/static_func_inside_class
Show static functions inside classes in method list
2019-07-16 08:53:02 +02:00
Nils ANDRÉ-CHANG 9e3455cb1e Show static functions inside classes in method list 2019-07-15 17:16:57 +01:00
Shiqing 206d515783 Fix unreachable code detection in match statements 2019-07-13 19:31:49 +08:00
Hugo Locurcio 28d3a6051c
Use base Color() constructors instead of Color::html()
This results in slightly smaller binaries (-17 KB for an editor binary)
as no strings need to be allocated.
2019-07-08 21:17:10 +02:00
Rémi Verschelde ba211bd58c
Merge pull request #30352 from bojidar-bg/28727-enum-value-check
Fix parsing of enums allowing for juxtaposed identifiers
2019-07-06 20:28:53 +02:00
Bojidar Marinov c43e050145
Fix parsing of enums allowing for juxtaposed identifiers
Fixes #28727
2019-07-05 21:40:40 +03:00
Geequlim ed7ed52151 Parse more informations for code completion 2019-07-04 14:00:14 +08:00
Rémi Verschelde e81ddf1242
Merge pull request #30289 from bojidar-bg/29586-class-name-constant
Fix inheriting from class_name messing up constants
2019-07-03 21:25:20 +02:00
Bojidar Marinov 2ef438c200
Fix inheriting from class_name messing up constants
Fixes #29586
2019-07-03 17:59:29 +03:00
Bojidar Marinov f7de816f8b
Fix parsing of arguments in constant expressions
Fixes #8006
2019-07-03 17:28:50 +03:00
Rémi Verschelde 4d99408d12
Merge pull request #28884 from vnen/yield-resume-stack
Keep GDScript functions in stack while yielding
2019-07-01 16:35:26 +02:00
Rémi Verschelde 6b30f284a0
Merge pull request #29980 from Dentrax/directed-by-qarmin
Fix some editor crashes
2019-07-01 14:59:29 +02:00
Rémi Verschelde b0ce9401ff
Merge pull request #30126 from qarmin/remove_unnecessary_code
Remove unnecessary code and add some error explanations
2019-07-01 14:32:04 +02:00
Furkan Türkal 7d8d337b2c fix some crashes 2019-07-01 14:28:29 +03:00
qarmin 3c154eb93b Remove unnecessary code and add some error explanations 2019-07-01 12:59:42 +02:00
Rémi Verschelde d17eac735c
Merge pull request #29815 from NilsIrl/plus_file_1
Replace ` + "/" + ` with `String::file_add()`
2019-07-01 12:06:35 +02:00
Rémi Verschelde b4aba3ae7c
Merge pull request #30177 from hbina/use_FALLTHROUGH_macro
Applied some of FALLTHROUGH macro usage from #30122
2019-06-29 23:40:08 +02:00
hbina085 9f0c6a6009 Many fallthrough switch cases now have the FALLTHROUGH macro to tell the compiler that this is intended. 2019-06-29 16:08:48 -04:00
Andrii Doroshenko (Xrayez) 7c11a1b162 Add support for creating editor icons per module
The functionality is similar to how `doc_classes` are retrieved per module.
The build system will search for custom icons path defined per module via
`get_icons_path()` method in `config.py` or default icons path.
If such paths don't exist, only the editor's own icons will be built.

Most module icons were moved from editor/icons to respective modules.
2019-06-28 23:42:26 +03:00
Rémi Verschelde 6e03236574
Merge pull request #30134 from Calinou/doc-proofread
Proofread and improve the whole class reference
2019-06-28 12:36:41 +02:00
unknown bd25e8d72a Fixed regression bug caused in #30095 and actually fix the issue it was supposed to fix(#26850) 2019-06-28 14:58:52 +05:30
Hugo Locurcio f7f6115f76
Proofread and improve the whole class reference
- Document a few more properties and methods
- Add more information to many classes
- Fix lots of typos and gramar mistakes
- Use [code] tags for parameters consistently
- Use [b] and [i] tags consistently
- Put "Warning:" and "Note:" on their own line to be more visible,
  and make them always bold
- Tweak formatting in code examples to be more readable
- Use double quotes consistently
- Add more links to third-party technologies
2019-06-27 22:30:19 +02:00
Rémi Verschelde eaaff9da31
Merge pull request #29941 from qarmin/redundant_code_and_others
Remove redundant code, possible NULL pointers and others
2019-06-27 01:05:18 +02:00
unknown a859643f7e Fixed parser treating compound assignment the same as assignment which gave wrong argument usage count 2019-06-26 22:43:08 +05:30
qarmin 4e5310cc60 Some code changed with Clang-Tidy 2019-06-26 15:08:25 +02:00
Chaosus 4c137bebe8 Extends wrapi/wrapf docs 2019-06-25 14:12:37 +03:00
Nils ANDRÉ-CHANG d2833d4f4d Replace + "/" + with String::file_add() 2019-06-23 13:33:50 +01:00
Rémi Verschelde 92277d3a28
Merge pull request #29866 from akien-mga/nothing-that-surrounds-us-is-object-all-is-subject
GDScript: Improve error on Object to Object invalid argument calls
2019-06-19 10:40:51 +02:00
Rémi Verschelde 0764451dc5 doc: Improve docs for Resource* classes
Also move module-specific classes to their own module's `doc_classes`
folder.
2019-06-18 20:07:26 +02:00
Rémi Verschelde d6176db271 Unexpose subclasses of ResourceFormatLoader and -Saver
ResourceFormatLoader and ResourceFormatSaver are meant to be overridden
to add support for different formats in ResourceLoader and ResourceSaver.
Those should be exposed as they can be overridden in plugins.

On the other hand, all predefined subclasses of those two base classes
are only meant to register support for new file and resource types, but
should not and cannot be used directly from script, so they should not
be exposed.

Also unexposed ResourceImporterOGGVorbis (and thus its base class
ResourceImporter) which are editor-only.
2019-06-18 17:56:23 +02:00
Rémi Verschelde 6750e1b3cd GDScript: Improve error on Object to Object invalid argument calls
Fixes #27804.
2019-06-18 11:27:43 +02:00
Rémi Verschelde 971b5160c6
Merge pull request #29306 from qarmin/small_code_fixes
Small fixes to unrechable code, possibly overflows, using NULL pointers
2019-06-12 12:49:21 +02:00
Rémi Verschelde 4043c8a8c9
Merge pull request #29678 from akien-mga/err-macros-semicolon
Fix error macro calls not ending with semicolon
2019-06-11 19:01:26 +02:00
Rémi Verschelde 6d16f2f053 Fix error macro calls not ending with semicolon
It's not necessary, but the vast majority of calls of error macros
do have an ending semicolon, so it's best to be consistent.
Most WARN_DEPRECATED calls did *not* have a semicolon, but there's
no reason for them to be treated differently.
2019-06-11 14:49:34 +02:00
MrCdK 74d336d0f4 Added export hint to 2D and 3D physics and render layers. 2019-06-07 16:30:54 +02:00
qarmin 8245db869f Small fixes to unrechable code, possibly overflows, using NULL pointers 2019-06-03 21:52:50 +02:00
Rémi Verschelde 8cc8383a7f
Merge pull request #29433 from bojidar-bg/29406-dictionary-constant
Properly catch certain errors in Dictionary and Array declarations
2019-06-03 20:53:02 +02:00
Bojidar Marinov b5bbedb45a
Properly catch certain errors in Dictionary declarations
Fixes #29406
2019-06-03 17:29:05 +03:00
Rémi Verschelde b9dc2e7e4d
Merge pull request #28099 from lupoDharkael/fix-completion
Fix code completion not working with class_name
2019-06-03 14:01:07 +02:00
geequlim eed5967c02 Fix GDSCript inner classes be freed after compile 2019-06-02 19:57:33 +08:00
Rémi Verschelde 3c4fab295b
Merge pull request #27789 from Giacom/move_towards
Added move_toward functions for float, Vector2 and Vector3
2019-06-01 12:05:18 +02:00
Rémi Verschelde 36591b1ae8
Merge pull request #28416 from JellyWX/binary-literals
Support for binary literals in GDScript
2019-05-29 08:41:05 +02:00
Giacom c00427add3 Added move_toward functions for float, Vector2 and Vector3 2019-05-28 11:39:35 +01:00
Rémi Verschelde 633af46a66
Merge pull request #27987 from lupoDharkael/classname-duplicate
Prevent using multiple class_name in a class
2019-05-28 11:56:21 +02:00
hilfazer ca1932636f autocomplete for enum values 2019-05-26 09:09:11 +02:00
Geequlim ebcfe28475 Fix parse error when extends from subclass of named classes 2019-05-24 11:56:44 +08:00
Rémi Verschelde 26e0cc7aa3
Merge pull request #29041 from hbina/add_const
add const to methods that return literals
2019-05-21 15:16:41 +02:00
hbina085 f78baa5f93 added a const keyword for a methods that return constant literal... 2019-05-21 02:16:30 -04: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
George Marques 9df1a2442b
Show function name in debugger stack trace
Also show script and line when the instance is gone when resuming from
yield.
2019-05-14 11:39:44 -03:00
George Marques bdc6649b79
Keep GDScript functions in stack while yielding
This prevents GDScript functions from leaving the stack too soon when
they are resuming from yield, allowing the ones expecting it to finish
to know the caller.

Helps debugging cases when you use:
`yield(function_which_yields(), "completed")`
since now it shows the call that resumed that function.
2019-05-14 11:39:40 -03: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
Rémi Verschelde c2251eab51
Merge pull request #28603 from bojidar-bg/24134-typed-array-share
Fix typed arrays and dictionaries getting their values shared
2019-05-03 18:35:57 +02: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
Bojidar Marinov aff9320ff2
Fix typed arrays and dictionaries getting their values shared 2019-05-02 14:00:33 +03:00
Rémi Verschelde ae41e35191
Merge pull request #27676 from qarmin/small_fixes_2
Small fixes to static analyzer bugs
2019-05-01 08:19:04 +02:00
Aaron Franke 620ec4703f
Make "decimal" functions more consistent
In GDScript, rename "decimals" to "step_decimals". In C#, add "StepDecimals", but keep the old functionality in a method called "DecimalCount".
2019-04-30 13:49:17 -04:00
Rémi Verschelde 9dc9434b1b
Merge pull request #24437 from mateusfccp/single_quotes_option
Add settings for single-quotes on completion
2019-04-30 14:58:33 +02:00
Aaron Franke 7f7d97f536
[Core] Expose approximate equality methods to GDScript 2019-04-25 13:20:29 -04:00
jude-lafitteIII d3cc9c0bf1 Support for binary literals in GDScript. Added an error that shows if a point is written in a hex literal. Added highlighting for binary literals in GDScript 2019-04-25 13:44:27 +01:00
Rémi Verschelde a342131eba
Merge pull request #27673 from qarmin/small_fixes
Small fixes, mostly duplicated code
2019-04-22 12:00:34 +02:00
Rémi Verschelde 6af69f851a doc: Drop unused <demos> tag 2019-04-19 11:03:46 +02:00
lupoDharkael 2ad302cec4 Don't allow class_name in built-in scripts 2019-04-17 17:06:21 +02:00
lupoDharkael 145a45fd3f Fix code completion not working with class_name 2019-04-16 22:27:13 +02:00
lupoDharkael c07b49280a Prevent using multiple class_name in a class 2019-04-16 01:41:00 +02:00
lupoDharkael 14078fbb82 GDScript: add variable shadowing warning 2019-04-15 18:19:14 +02:00
Rémi Verschelde e7a1fbe83a
Merge pull request #27863 from bojidar-bg/27460-constant-class-clash
Check subclasses too when checking for name clashes
2019-04-12 11:54:35 +02:00
Rémi Verschelde da65d54649
Merge pull request #27867 from bojidar-bg/27489-as-self-fail
Fix as operator generating opcode 38 errors
2019-04-11 23:23:35 +02:00
George Marques e56f5d5c91
GDScript: Don't allow built-in scripts to use class_name 2019-04-10 18:05:34 -03:00
Rémi Verschelde 07b76c0376
Merge pull request #27170 from timoschwarzer/allow-whitespaces-in-warning-ignore-comments
Allow whitespaces in warning-ignore comments
2019-04-10 18:16:10 +02:00
Bojidar Marinov ece09f9872
Check for subclasses when checking for name clashes
Fixes #27460
2019-04-10 13:19:30 +03:00
Bojidar Marinov f04f127680
Fix as operator generating opcode 38 errors
Closes #27489
Fixup of 466a76ac2c

Additionally, update `GDScriptCompiler` test to use Ref and to include `as` expressions.
2019-04-10 13:18:50 +03:00
Rémi Verschelde c8994b56f9 Style: Apply new changes from clang-format 8.0
It seems to stay compatible with formatting done by clang-format 6.0 and 7.0,
so contributors can keep using those versions for now (they will not undo those
changes).
2019-04-09 17:09:48 +02:00
Rémi Verschelde 918de768a5
Merge pull request #27711 from neikeq/ifdef-clang-tidy
Replace a few #if/#elif with #ifdef and "#elif defined"
2019-04-08 12:24:30 +02:00
qarmin 856a8226a5 Small fixes, mostly dupicated code 2019-04-08 11:03:37 +02:00
Rémi Verschelde 668bf1fd0d
Merge pull request #27710 from Calinou/script-templates-typed-gdscript
Add support for type hints in non-default script editor templates
2019-04-08 10:13:59 +02:00
Rémi Verschelde d211aff777
Merge pull request #27231 from Chaosus/smoothstep
Added smoothstep built-in function
2019-04-08 10:03:42 +02:00
Chaosus 514a3fb96a Added smoothstep built-in function 2019-04-07 14:11:26 +03:00
Ignacio Etcheverry ad2127a3e8 Replace a few #if/#elif with #ifdef and "#elif defined" 2019-04-05 23:41:51 +02:00
Hugo Locurcio 00799fc8c2
Add support for type hints in non-default script editor templates
This also refactors template processing to avoid repetition.

This closes #27074.
2019-04-05 23:19:30 +02:00
Rémi Verschelde fc370b3feb Fix -Wimplicit-fallthrough warnings from GCC 8
Adds `FALLTHROUGH` macro to specify when a fallthrough is intentional.
Can be replaced by `[[fallthrough]]` if/when we switch to C++17.

The warning is now enabled by default for GCC on `extra` warnings level
(part of GCC's `-Wextra`). It's not enabled in Clang's `-Wextra` yet,
but we could enable it manually once we switch to C++11. There's no
equivalent feature in MSVC for now.

Fixes #26135.
2019-04-05 15:14:53 +02:00
qarmin 8460d0678c Small fixes to static analyzer bugs 2019-04-04 22:00:16 +02:00
Rémi Verschelde e3bd84fa57
Merge pull request #27485 from Faless/io/encode_decode_safety_pr
Safer encode/decode variant.
2019-04-01 17:00:40 +02:00
Fabio Alessandrelli 393e62b98a Add object encoding param to serialization methods
Network peers get_var/put_var
File get_var/store_var
GDScript/Mono/VisualScript bytes2var/var2bytes
Add MultiplayerAPI.allow_object_decoding member which deprecates PacketPeer.allow_object_decoding.

Break ABI compatibaility (API compatibility for GDNative).
2019-04-01 15:53:19 +02:00
Rémi Verschelde 39c868171e doc: Bump version to 3.2 2019-04-01 12:33:56 +02:00
Rémi Verschelde 4ec384f9d4
Merge pull request #26097 from danielspaniol/25955-wrong-unreachable-warning-after-returning-from-matchs-wildcard-pattern
Fix: Wrong unreachable warning after returning from match's wildcard pattern #25955
2019-04-01 12:17:17 +02:00
Rémi Verschelde 492153878f
Merge pull request #27128 from bojidar-bg/27111-gdscript-confounding-class
Fix GDScriptCompiler bugging out with identically-named inner class
2019-03-27 16:57:04 +01:00
Timo Schwarzer 7a0dfc04aa
Allow whitespaces in warning-ignore comments 2019-03-17 18:42:59 +01:00
Bojidar Marinov 466a76ac2c
Fix GDScriptCompiler bugging out with identically-named inner class
Fixes #27111
2019-03-16 20:41:16 +02:00
Bojidar Marinov b64f9f03f8
Fix duplicated lines in GDScript bytecode
Fixes #26789
2019-03-14 18:38:07 +02:00
Hugo Locurcio 5a574a4f29
Fix typo in GDScript narrowing conversion warning message
This closes #26790.
2019-03-08 14:28:33 +01:00
Bojidar Marinov 9637e42705
Fix enums coming from other classes without preload
Fix #19704, fix #26001
2019-03-05 23:19:02 +02: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
Rémi Verschelde 425ec6914c
Revert "Forbid implicit type conversion in GDScript" 2019-03-04 12:25:59 +01:00
Rémi Verschelde 7889e9b7ca
Merge pull request #26562 from vnen/gdscript-no-implicit-cast
Forbid implicit type conversion in GDScript
2019-03-04 10:19:00 +01:00
George Marques 67fee40483
GDScript: Fix issue when detecting file class in inner class 2019-03-03 22:53:50 -03:00
George Marques d0b08342b8
GDScript: Forbid implicit type conversion
Since types are not present in release builds, this could cause issues
where a variable does not have the exact defined type.
2019-03-03 22:25:22 -03:00
George Marques b24cb92240
GDScript: Allow for iterator to be rededefined 2019-03-03 21:39:42 -03:00
Juan Linietsky a9fe834a8e
Merge pull request #26547 from vnen/gdscript-dependency-parse
Add a parse mode for GDScript which doesn't load dependencies
2019-03-03 18:00:12 -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
George Marques 9db96d9f81
Merge pull request #26528 from bojidar-bg/26047-gdscript-object-argument
Allow parameters passed to GDScript functions to be nulled
2019-03-03 11:39:25 -03:00
Bojidar Marinov f0efc7521e
Allow parameters passed to GDScript functions to be nulled
Previous version resulted in confusing (but actually right) errors about converting "from Object to Object", since CallError
does not include information about the actual types involved.
2019-03-03 15:24:06 +02:00
Bojidar Marinov f207b2fe0e
Fix GDScript checking for assigning to a constant only in release 2019-03-03 12:36:27 +02: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
Rémi Verschelde 426a6fdc17
Merge pull request #26134 from marxin/fix-Wsign-compare
Fix -Wsign-compare warnings.
2019-02-27 09:22:47 +01:00
marxin e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01:00
Bojidar Marinov db7864c1fd
Fix GDScript exports having the wrong type of default value by converting it
Also, initialize elements of PoolArrays when resizing them in the editor.
Fixes #26066.
2019-02-26 14:58:39 +02:00
George Marques 755c690252
Merge pull request #25018 from AllanDaemon/#24895
Fix support for optional parameters in setters
2019-02-24 10:45:50 -03:00
Rémi Verschelde 726f31e992
Merge pull request #26132 from marxin/fix-Wignored-qualifiers
Fix warnings seen with -Wignored-qualifiers.
2019-02-22 09:55:27 +01:00
Rémi Verschelde 60fe9321ac
Merge pull request #26099 from marxin/fix-Wtype-limits-warnings
Fix all -Wtype-limits warnings.
2019-02-22 09:44:59 +01:00
Juan Linietsky d13ac2a413 Request to use load when cyclic reference is found, closes #26119 2019-02-21 17:27:07 -03:00
marxin c11e7ffd0e Fix warnings seen with -Wignored-qualifiers. 2019-02-21 20:24:29 +01:00
marxin 7de7f0ef17 Fix all -Wtype-limits warnings. 2019-02-21 19:34:35 +01:00
Daniel Spaniol 79176decd5 Require return in all match branches
Before the parser only checked if the catch-all branch has a return in
order to determine if the entire match block has a return.

This code block was assumed to always return.

    match value:
        "test":
            print("test")
        _:
            return

Now as soon as one of the branches has no return, the entire match block
is marked to not have a return.
2019-02-20 21:38:11 +01:00
marxin 8d51618949 Add -Wshadow=local to warnings and fix reported issues.
Fixes #25316.
2019-02-20 19:44:12 +01:00
Rémi Verschelde d35003d92a GDScript: Remove unused switch, case and do CF keywords
They had been reserved for future implementation, but we now have the
`match` CF keyword which does the same and more.

According to @reduz `do` was even added by mistake when copying from
the shader language parser, it was never intended to add support for
`do`... `while` loops, as the syntax would be awkward in GDScript,
and the added sugar is not worth it.

Fixes #25787.
2019-02-20 14:05:08 +01:00
Rémi Verschelde fd60724c3d
Merge pull request #25715 from hpvb/fix-25598
Add a maximum recusion depth to _guess_expression_type
2019-02-16 14:39:57 +01:00
Rémi Verschelde 89ca15693e
Merge pull request #25866 from neikeq/issue-25121
Fix exported property values being lost if base GDScript fails to parse
2019-02-14 09:21:19 +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
Rémi Verschelde 5fc86026ca Fix typos with codespell
Using codespell 1.14.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
doubleclick
lod
nd
numer
que
te
unselect
EOF
$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2019-02-13 09:23:29 +01:00
Rémi Verschelde b7cc2bb1e2 Core: Ensure classes match their header filename
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`
2019-02-12 13:34:25 +01:00
Rémi Verschelde 13c50e8aa5
Merge pull request #25481 from hpvb/fix-ubsan-asan-reports
Fix many asan and ubsan reported issues
2019-02-12 12:21:01 +01:00
Rémi Verschelde e40395669c
Merge pull request #25550 from DualMatrix/fix-25357
Fixed Null appearing inside export variables with type hints and no default value
2019-02-12 12:01:22 +01:00
Rémi Verschelde 6c243326bd
Merge pull request #25650 from willnationsdev/script-icon
Fix script class icons looking for paths at runtime
2019-02-09 12:22:51 +01:00
Hein-Pieter van Braam e937e74b69 Add a maximum recusion depth to _guess_expression_type
When a recursive declaration ends up in a GDScript file the
_guess_expression_type function would start looping and eventually run
out of stack space.

We now cap recusion for this function to 100 frames.

This fixes #25598
2019-02-08 22:39:08 +01:00
Will Nations c4ff433b17 Fix script class icon filepath lookups at runtime. 2019-02-06 16:17:56 -06:00
DualMatrix ff508dfede Fixed Null appearing inside export variables with type hints and no default value
The default value of the type is now used to initialise it.

export(int) A

Will now have A be 0 istead of Null even though it still showed as 0 before in the inspector, fixes #25357
2019-02-01 21:18:14 +01:00