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
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
Bojidar Marinov
ece09f9872
Check for subclasses when checking for name clashes
...
Fixes #27460
2019-04-10 13:19:30 +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
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
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
Bojidar Marinov
b64f9f03f8
Fix duplicated lines in GDScript bytecode
...
Fixes #26789
2019-03-14 18:38:07 +02:00
Bojidar Marinov
9637e42705
Fix enums coming from other classes without preload
...
Fix #19704 , fix #26001
2019-03-05 23:19:02 +02: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
Bojidar Marinov
f207b2fe0e
Fix GDScript checking for assigning to a constant only in release
2019-03-03 12:36:27 +02: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
Juan Linietsky
d13ac2a413
Request to use load when cyclic reference is found, closes #26119
2019-02-21 17:27:07 -03: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
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
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
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
Hein-Pieter van Braam
d308eb091a
Fix many asan and ubsan reported issues
...
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
2019-01-30 06:43:56 +01:00
George Marques
587c1c90cf
GDScript: do second pass of parsing on release
...
Some construct (like match) actually depends on the second pass. This
adds some extra checks to not perform specific type-checks on release
since not all type information is available.
2019-01-23 18:45:33 -02:00
George Marques
8464cce857
GDScript: fix default value for autoexported typed vars
2019-01-23 18:06:58 -02:00
George Marques
f439397126
GDScript: read constants from parent scripts
...
This is needed to create export variables from enums defined in a parent
class.
2019-01-23 17:42:06 -02:00
George Marques
ba13aae9af
GDScript: allow local classes to be used as types
2019-01-23 17:42:06 -02:00
Allan Daemon
465842d8ea
Fix #24895 (support for optional parameters in setters)
2019-01-23 14:01:49 -02:00
Hein-Pieter van Braam
f958ba5abc
Merge pull request #25069 from vnen/gdscript-fixes
...
A bit more of GDScript fixes
2019-01-17 18:54:42 +01:00
George Marques
ced9fcafd4
GDScript: clarify error message about cycles
...
They may happen with any cyclic dependency, not only with inheritance.
2019-01-16 16:39:44 -02:00
George Marques
20e6ff263a
GDScript: fix type-check of indexed values
2019-01-16 16:02:56 -02:00
Rémi Verschelde
b910b22d74
Merge pull request #25001 from jlahman/gdscript-export-var-fix
...
Fixes export PackedScene "reset to default" throwing errors
2019-01-16 13:17:53 +01:00
jlahman
6661ceadcc
Fixes export PackedScene "reset to default" throwing errors
...
When exporting variables from a gdscript, default values of uninitialized variables would never be set. This caused the default value to be Variant::NIL, and when a user tried to reset the variable through the editor, an error would be thrown because too few arguments would be counted(end of argument list for calls are detected by NIL values).
Fixed by simply setting default value to an empty variant of the proper type in gdscript parser.
2019-01-15 22:20:36 -05:00
George Marques
4f72c6be8a
GDScript: consider constructors as always existing
...
There's always a constructor, even if implicit, especially for native
types.
Also don't check for signature match on function call, since this
information is not available in release builds.
2019-01-15 19:15:19 -02:00
George Marques
b0c3a3f2da
GDScript: allow objects to be keys of dictionaries
...
The engine allows this already, so the parser should not fail in this
case.
2019-01-15 18:18:03 -02:00
George Marques
573fab7447
GDScript: don't check types on release builds
...
A lot of information is missing on release, and the checks might take a
performance hit. Also, having GDScript more lenient on release is
usually desirable.
2019-01-15 17:02:15 -02:00
Daniel Eliasinski
c719cbee69
Added autoloads as a potential type.
2019-01-11 16:28:13 -05:00
Rémi Verschelde
b16c309f82
Update copyright statements to 2019
...
Happy new year to the wonderful Godot community!
2019-01-01 12:58:10 +01:00
George Marques
74a3bf72f0
Fix type-compatibilty check in GDScript
...
Objects and PoolArrays are properly tested for conversion.
2018-12-07 23:53:45 -02:00
Rémi Verschelde
1c169413ff
Merge pull request #23740 from ttencate/unused_argument_22139
...
Prevent unused_argument warning when passing arg to parent constructor
2018-11-23 01:07:22 +01:00
George Marques
3d2d04afd4
Check for valid values when checking for class members
...
- Check if GDScript was compiled correctly before checking its functions
and properties.
- Check if native class name is actually set before looking for it in
the ClassDB.
2018-11-17 23:23:40 -02:00
Thomas ten Cate
4a530433d4
Prevent unused_argument warning when passing arg to parent constructor
...
This requires creating the FunctionNode object a bit sooner, and setting
it as the current_function while parsing the parent constructor call
arguments.
Note that the return type has not yet been parsed at this point, but
that doesn't seem to be a problem.
Fixes #22139
2018-11-16 10:46:05 +01:00
George Marques
7f6f9abb2f
Make enum values not be script constants if enum is named
...
Anonymous enums still creates script constants.
Also add a check to see if name used for enum is already defined.
2018-11-11 01:42:20 -02:00
Kanabenki
30d473689c
Add missing flag for exported enum
2018-11-06 10:00:56 +01:00