Commit graph

188 commits

Author SHA1 Message Date
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
qarmin 50be65bf43 Changed some code found by Clang Tidy and Coverity 2019-09-22 18:45:08 +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
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
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
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 877912b23c
Merge pull request #24925 from Mr-Slurpy/typed-autoload
Added autoloads as a potential type.
2019-09-02 16:05:05 +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 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
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
Michael Alexsander Silva Dias a8826ad3b8 Make 'break' and 'continue' be marked as safe 2019-08-27 23:10:33 -03: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
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
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
qarmin 6cbaf7662f Changed some code showed in LGTM and Coverage 2019-07-20 08:09:57 +02:00
Shiqing 206d515783 Fix unreachable code detection in match statements 2019-07-13 19:31:49 +08: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
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 d17eac735c
Merge pull request #29815 from NilsIrl/plus_file_1
Replace ` + "/" + ` with `String::file_add()`
2019-07-01 12:06:35 +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
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
Nils ANDRÉ-CHANG d2833d4f4d Replace + "/" + with String::file_add() 2019-06-23 13:33:50 +01: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