Thakee Nathees
72aa9ce7fc
range() with non-numeric const argument crash fix
...
(cherry picked from commit 3e10392d48
)
2020-05-13 16:08:33 +02:00
Thakee Nathees
55b4e0c44a
parser error for static func access non-static variables
...
Fix : #38408
(cherry picked from commit ce978517e0
)
2020-05-11 11:01:13 +02:00
Thakee Nathees
22053ed75f
GDScript class var type resolve bug fixed
...
Fix : #37545
(cherry picked from commit e67eb5ca36
)
2020-05-11 10:50:46 +02:00
Thakee Nathees
6b0cfc87af
more clearer unexpected statement end error messages
...
(cherry picked from commit 5758d87f09
)
2020-05-11 10:50:46 +02:00
Thakee Nathees
7111aa0688
pass keyword inside a class implemented
...
(cherry picked from commit 63ce1fc438
)
2020-05-11 10:50:46 +02:00
janglee
d16abbdee4
Improved go-to definition (Ctrl + Click)
...
Co-Authored-By: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
(cherry picked from commit be7a353c70
)
2020-05-11 09:33:21 +05:30
Steven Schoen
40125c7cce
Mention offending function name in "Indented block expected" error
...
(cherry picked from commit e6e5ba32cd
)
2020-05-04 16:10:22 +02:00
Tom Evans
2859ceec6f
Fix for marking assert lines as safe bug
...
Calling _reduce_node_type from GDScriptParser::_parse_block for assert
was using a current class with a scope that didn't include all
functions. Now calling in GDScriptParser::_check_block_types uses the
right class type. We also now check the assert node message. The assert
line was added to the set_errors associated with assert, since before
the error would be reported on the next line
(cherry picked from commit bd081df519
)
2020-05-01 10:56:58 +02:00
Thakee Nathees
1a4530e84c
export var type reduce() implemented
...
(cherry picked from commit cd487201c6
)
2020-05-01 10:56:58 +02:00
Tom Evans
3bd5fc2e5e
Mark assert lines as safe in gdscript
...
Now calling _reduce_node_type with debugging enabled to determine
if assert line is safe. Part of doing this required the assert line
to be stored away. Now the AssertNode line is being correctly set.
Newlines are now marked safe always
(cherry picked from commit 8dc8833782
)
2020-04-27 10:10:20 +02:00
Thakee Nathees
95f6bdfa78
GDScript class name existance check enhanced
...
(cherry picked from commit 62280c3d47
)
2020-04-23 11:10:51 +02:00
Thakee Nathees
12c776dba3
line unsafe for indexing with known base type & unkown identifier
...
(cherry picked from commit 0780ad2800
)
2020-04-23 11:10:28 +02:00
Stoofin
243711e77f
Pattern bind counts as assignment
...
Fixes #34697
(cherry picked from commit 44281f233d
)
2020-04-23 11:10:06 +02:00
Thakee Nathees
3658f7127e
`:=` fails on some nodes fix : #37357
...
(cherry picked from commit bdd7048cb5
)
2020-04-16 11:46:23 +02:00
Thakee Nathees
df87601c88
Fix for loop range bug: #37358
...
(cherry picked from commit 0b5bad78c0
)
2020-04-06 20:58:21 +02:00
Thakee Nathees
5798c8135f
logic error in gdscript_parser.cpp for-loop-range
...
there was a logic error in for loop range argument that
check if all of the argument were constants, fixed
(cherry picked from commit bcbcf0f1ea
)
2020-03-25 09:45:47 +01:00
Thakee Nathees
40b53bc29a
duplicate arguments in a function handled
...
(cherry picked from commit 5424b626f9
)
2020-03-25 09:44:51 +01:00
Rémi Verschelde
36e11d1c34
Merge pull request #35412 from DaividFrank/check_overriding_self
...
Disabled re-assigning 'self'
2020-01-22 20:47:52 +01:00
DaividFrank
badabdf8b9
GDScript: Added checks in assign operations to disable re-assigning 'self'
2020-01-22 19:00:54 +02:00
Dani Frank
8f5e424c66
Fix subclass finding in extend statement for sub-sub classes
...
lookup was always done on top level script instead of advancing to subclass each time.
this commit changes the lookup to always be at last found subclass
2020-01-18 11:55:27 +02:00
Bojidar Marinov
19ce2d5159
Fix slight problems related to default values of exported typed arrays
2020-01-16 14:50:29 +02:00
George Marques
1d129f9bec
GDScript: Check function arguments on release too
...
Needed because otherwise the certain type operations (such as type
casting) used as a function argument might become unresolved on release,
causing a compilation failure.
Fix #28680
2020-01-13 15:58:53 -03:00
George Marques
e6060706ca
GDScript: Type match on assignment only if operators have type
...
This ensures that a value without type won't be wrongly assigned to a
typed variable when the types mismatch.
2020-01-13 08:51:24 -03:00
George Marques
4c20d9407d
GDScript: Forbid using "script" as member name
...
Avoids the user breaking things by creating a "script" variable with
something else, effectively overwriting the "script" slot on Object.
2020-01-10 19:43:33 -03:00
George Marques
76678b2609
GDScript: Fix type name on error message for function parameters
2020-01-09 15:50:06 -03:00
George Marques
1aef8bfeb1
GDScript: Fix resolution of default parameter values
...
Fix #26556
2020-01-09 15:42:31 -03:00
Rémi Verschelde
e97e951741
Merge pull request #34948 from vnen/gdscript-copy-constructor
...
GDScript: Allow copy constructor for built-in types
2020-01-09 13:42:10 +01:00
George Marques
41ed905c1a
GDScript: Allow copy constructor for built-in types
...
Those are implicitly defined in Variant.
2020-01-09 09:03:09 -03:00
George Marques
7d4fc79eb3
Add GDScript warning for standalone expression
...
This makes the error message clearer as it might be used to call
functions with side effects.
2020-01-09 08:30:14 -03:00
George Marques
e7b7dc57fc
GDScript: set assign operation on local var made by match
...
This is needed in a all local variables with assigment to properly set
the typed operation.
Fix #34928
2020-01-08 19:28:07 -03:00
Rémi Verschelde
c456d87ee6
Merge pull request #34918 from vnen/gdscript-assign-op
...
GDScript: enable type checks on release mode
2020-01-08 18:22:38 +01:00
George Marques
d26414f9fe
GDScript: enable type checks on release mode
...
Also make builtin GDScript functions report return type as Variant in
release so type is converted when needed.
2020-01-08 12:38:18 -03:00
George Marques
899f7999b4
GDScript: properly set type of local variable initialization
...
Properly sets the type of the identifier for the local variable
that is stored in the assignment operation. This makes sure that the
compiler is aware of typing for local variables when they are
initialized with the declaration.
2020-01-08 11:36:50 -03:00
Bojidar Marinov
b93b7aca74
Allow the usage of newlines in export hints
...
Fixes #34689
2020-01-02 18:03:11 +02:00
Rémi Verschelde
a7f49ac9a1
Update copyright statements to 2020
...
Happy new year to the wonderful Godot community!
We're starting a new decade with a well-established, non-profit, free
and open source game engine, and tons of further improvements in the
pipeline from hundreds of contributors.
Godot will keep getting better, and we're looking forward to all the
games that the community will keep developing and releasing with it.
2020-01-01 11:16:22 +01:00
George Marques
475d7f0e52
GDScript: Fix type conversion in assignment with operation
2019-12-13 12:51:08 -03:00
Rémi Verschelde
f326913f4d
Merge pull request #34067 from bojidar-bg/32370-retype-message
...
Make error when accidentially redeclaring a variable's type clearer
2019-12-04 06:52:22 +01:00
Bojidar Marinov
79c26344e8
Make error when accidentially redeclaring a variable's type clearer
...
Fixes #32370
2019-12-02 22:26:05 +02:00
lupoDharkael
9254961297
Parser: Check all the arguments of the ternary operator
2019-11-15 01:29:18 +01:00
mashumafi
d7137a6b72
Add setting to exclude addons from script warnings
2019-11-07 23:01:22 -05:00
Rémi Verschelde
c43c3747cf
Merge pull request #32808 from bojidar-bg/30937-less-strict-mixed-spacing
...
Allow mixed tabs and spaces when indentation does not depend on tab size
2019-10-25 23:16:04 +02:00
Bojidar Marinov
afbde3314a
Allow mixed tabs and spaces when indentation does not depend on tab size
...
(hopefully) Closes #30937 , fixes #32612
2019-10-25 14:54:57 +03:00
Rémi Verschelde
8228b93fcd
Merge pull request #32919 from vnen/gdscript-unused-args
...
Fix wrong counting of function argument usage
2019-10-22 14:15:58 +02:00
George Marques
05465b9693
GDScript: Add _ prefix on class name in type compatibility check
...
This makes sure that the classes internally represented with an
underscore (_) prefix, such as singletons, are still properly checked
for inheritance in the ClassDB.
2019-10-19 13:45:52 -03:00
George Marques
bb20e420af
Fix wrong counting of function argument usage
...
There's no need to subtract 1 from the assignment usages because it's
not incremented anywhere else.
Also put back the assignment with operators because they should not
count as usage if the argument is on the left side.
2019-10-19 10:59:57 -03:00
qarmin
616ab4fac2
Small fixes to redundand code, copy paste bugs
2019-10-14 11:40:55 +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
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
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