Commit graph

178 commits

Author SHA1 Message Date
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
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
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
Geequlim ebcfe28475 Fix parse error when extends from subclass of named classes 2019-05-24 11:56:44 +08: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
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
lupoDharkael 2ad302cec4 Don't allow class_name in built-in scripts 2019-04-17 17:06:21 +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
George Marques e56f5d5c91
GDScript: Don't allow built-in scripts to use class_name 2019-04-10 18:05:34 -03:00