Commit graph

435 commits

Author SHA1 Message Date
Marcel Admiraal
5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
Thakee Nathees
ebade0e454 GDScript assert message parsing bug fixed
Fix: #43540
2020-12-27 13:13:50 +05:30
Rémi Verschelde
abfc528439
Merge pull request #43890 from vnen/gdscript-builtin-functions-refactor
GDScript: Refactor builtin functions
2020-12-15 20:51:38 +01:00
Thakee Nathees
42bfa16996 Refactor DocData into core and editor (DocTools) parts 2020-12-02 00:48:39 +05:30
Thakee Nathees
d0e7d9b62f Documentation generation for GDScript
- ClassDoc added to GDScript and property reflection data were extracted
from parse tree

- GDScript comments are collected from tokenizer for documentation and
applied to the ClassDoc by the GDScript compiler

- private docs were excluded (name with underscore prefix and doesn't
have any doc comments)

- default values (of non exported vars), arguments are extraced from the
parser

- Integrated with GDScript 2.0 and new enums were added.

- merge conflicts fixed
2020-11-29 19:45:36 +05:30
Rémi Verschelde
d395f70828
Merge pull request #43500 from AndreaCatania/gds_fixes
Fixes crash when parse_expression returns nullptr.
2020-11-27 16:37:45 +01:00
George Marques
cf7a6be1db
Merge pull request #43226 from mateosss/unreachable-prop-crash
Fix crash due to unreachable code in properties
2020-11-27 11:03:20 -03:00
George Marques
c7b6a7adcc
GDScript: Refactor builtin functions
They are now called "utility functions" to avoid confusion with methods
of builtin types, and be consistent with the naming in Variant.

Core utility functions are now available in GDScript. The ones missing
in core are added specifically to GDScript as helpers for convenience.

Some functions were remove when there are better ways to do, reducing
redundancy and cleaning up the global scope.
2020-11-26 12:05:42 -03:00
Andrea Catania
98daa0af6b Fixes crash when returns . 2020-11-13 15:09:52 +01:00
Gustav
0ddd4097a6 Fix completion for built-in load function 2020-11-10 12:00:08 +01:00
Rémi Verschelde
9d2e8f2f27
Variant: Rename Type::_RID to Type::RID
The underscore prefix was used to avoid the conflict between the `RID` class
name and the matching enum value in `Variant::Type`.

This can be fixed differently by prefixing uses of the `RID` class in `Variant`
with the scope resolution operator, as done already for `AABB`.
2020-11-09 16:29:04 +01:00
reduz
221a2a1742 Refactored variant constructor logic 2020-11-09 08:54:43 -03:00
reduz
127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Mateo de Mayo
531958b2f0 Fix crash due to unreachable code in properties 2020-10-30 22:21:50 -03:00
strank
409af31b55 Add a "not in" operator to GDScript. 2020-09-21 17:53:54 -04:00
Rémi Verschelde
3e78963bb9
Fix typos with codespell
Using codespell 1.17.1.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
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
```
2020-09-18 13:44:25 +02:00
Thakee Nathees
e4d5393ecf GDScript export array/dictionary type infer bug fix
Fix : #41980
2020-09-13 19:36:20 +05:30
bruvzg
80b8eff6aa
[Complex Test Layouts] Change String to use UTF-32 encoding on all platforms. 2020-09-03 19:56:24 +03:00
George Marques
745ca3059d
Change GDScript compiler to use codegen abstraction 2020-09-01 14:36:22 -03:00
George Marques
edb4caf24e
GDScript: Allow "extends" to be used inside inner class 2020-09-01 09:26:27 -03:00
George Marques
34dc689ad4
GDScript: Allow "self" to be used in class level 2020-09-01 09:26:27 -03:00
George Marques
5033d5c71c
GDScript: Fix crash when parsing properties 2020-08-26 16:08:19 -03:00
George Marques
8ccf88a206
GDScript: Fix issues when deriving from other scripts 2020-08-26 14:50:27 -03:00
George Marques
846856728b
GDScript: Show error when function return type is missing 2020-08-19 14:09:45 -03:00
George Marques
15b16ec0ce
GDScript: Fix signal parameters not respecting commas 2020-08-19 11:32:48 -03:00
George Marques
cd3f51c67c
GDScript: Check duplicate keys in dictionaries and enums 2020-08-19 11:14:16 -03:00
George Marques
f9ad0b30fa
GDScript: Allow preload() to be used with constant expressions 2020-08-19 10:45:00 -03:00
George Marques
a52e457ada
GDScript: Allow keywords to be used in $ notation 2020-08-19 10:19:05 -03:00
George Marques
35176247af
GDScript: Allow enum values to be set to constant expressions
Also allow them to access previous values wihout referencing the enum.
2020-08-18 17:44:20 -03:00
George Marques
0f9923e67f
GDScript: Allow empty files to be valid scripts 2020-08-17 21:32:49 -03:00
George Marques
3abb3c0d6e
GDScript: Fix crash when superclass file is non-existent
Incidentally, allow EOF to be an end of statement.
2020-08-17 21:30:39 -03:00
George Marques
d06ce2f11e
GDScript: Fix editor crash when writing @tool annotation 2020-08-17 21:02:49 -03:00
George Marques
9413446b2d
Merge pull request #41104 from vnen/gdscript-assignment-tidy
Tidy up assignment operator check
2020-08-12 08:54:48 -03:00
Rémi Verschelde
cf05486d8e
Merge pull request #41055 from snichols/null-callee-fix
Fix crash with null callee
2020-08-11 15:15:43 +02:00
George Marques
3aef60591b
GDScript: Tidy up assignment operator check
The operator is already gathered by the parser, no need to do it again
in the analyzer.
2020-08-08 10:37:51 -03:00
Stephen Nichols
fbd07bf3bf Adding error message for empty grouping expression 2020-08-05 14:42:33 -05:00
Stephen Nichols
8a13be50ab Fixing null callee crash. 2020-08-05 14:41:46 -05:00
bruvzg
ee973f5b90
[GDScript] Add static HashMap cleanup. 2020-08-01 22:08:12 +03:00
George Marques
a0f54cb95e
Wrap up GDScript 2.0 base implementation 2020-07-22 11:07:51 -03:00
George Marques
aa09b4f85d
Reintroduce code completion 2020-07-20 11:38:40 -03:00
George Marques
b6a2628c48
Reenable GDScript LSP server 2020-07-20 11:38:40 -03:00
George Marques
dadfcd8aba
Added support for enums to be used as types in GDScript 2020-07-20 11:38:40 -03:00
George Marques
95c0909290
Add warning checks in GDScript analyzer
Reenable checking those when validating code.
2020-07-20 11:38:40 -03:00
George Marques
9a76ab8b6a
Add new GDScript type checker 2020-07-20 11:38:40 -03:00
George Marques
17cd6347ba
Add better local variable detection in GDScript parser
Also store Variant operator to avoid needing to do it repeatedly in
later compiling stages.
2020-07-20 11:38:39 -03:00
George Marques
886732ac2b
Add support for properties 2020-07-20 11:38:39 -03:00
George Marques
5d6e853806
New GDScript tokenizer and parser
Sometimes to fix something you have to break it first.

This get GDScript mostly working with the new tokenizer and parser but
a lot of things isn't working yet. It compiles and it's usable, and that
should be enough for now.

Don't worry: other huge commits will come after this.
2020-07-20 11:38:39 -03:00
Thakee Nathees
023b3f2786 Fix: editor crash on super constructor called
Fix: #39909
2020-07-04 16:06:07 +05:30
Rémi Verschelde
697897cc61
Merge pull request #39275 from ThakeeNathees/shadowed-warning-for-loop-counter
Added shadowed var warning for `for` loop counter
2020-06-16 15:51:31 +02:00
Rémi Verschelde
6cefb8d368
Merge pull request #39314 from ThakeeNathees/debugger-incorrect-line-fix
GDScript debugger stepping to incorrect line fix
2020-06-16 09:26:49 +02:00
Rémi Verschelde
36f6103026
Merge pull request #39301 from Calinou/fix-argument-parameter-confusion
Tweak the GDScript error message about passed argument type mismatch
2020-06-05 11:33:53 +02:00
Thakee Nathees
fc89c5c76d Debugger stepping to incorrect line fix
Fix: #39296
2020-06-05 12:15:37 +05:30
Hugo Locurcio
30053de182
Tweak the GDScript error message about passed argument type mismatch
This makes it less confusing.

This closes https://github.com/godotengine/godot-proposals/issues/670.
2020-06-04 22:31:37 +02:00
Thakee Nathees
e153772de2 predefined var check for for loop counter 2020-06-04 10:37:22 +05:30
Thakee Nathees
54835a5302 shodowed var warning for for loop counter
Fix: #39268
2020-06-04 10:28:09 +05:30
Rémi Verschelde
78e223569b
Merge pull request #33689 from jbuck3/signal-error
Trigger an error when trying to define a preexisting signal in GDScript
2020-05-21 11:01:23 +02:00
Tan Wang Leng
7b1423a61e gdscript_parser: Fix "unreachable code" false positive for loops
Depending on the conditional statements of the 'for' and 'while' loops,
their body may not even execute once. For example:

    func a():
        var arr = []
        for i in arr:
            return i
        # can be reached, but analysis says cannot
        return -1

    func b():
        var should_loop = false
        while should_loop:
           return 1
        # can be reached, but analysis says cannot
        return 0

The parser will complain that the statements after the comment cannot
be reached, but it is clearly possible for our scenario. This is
because the parser falsely assumes that the loop body will always
execute at least once.

Fix the code to remove this assumption for both of those loops.
2020-05-16 20:02:55 +08:00
Thakee Nathees
c076a2b7e9 break, continue outside of a loop, match statement handled 2020-05-15 03:16:50 +05:30
Rémi Verschelde
00949f0c5f
Merge pull request #38738 from akien-mga/cause-we-never-go-out-of-style
Style: Remove new line at block start, enforce line between functions, enforce braces in if and loop blocks
2020-05-14 23:09:03 +02:00
Rémi Verschelde
0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde
5046f666a1
Merge pull request #38610 from ThakeeNathees/infer-type-null-error
set parser error when infer type is null
2020-05-14 21:50:48 +02:00
Rémi Verschelde
07bc4e2f96 Style: Enforce separation line between function definitions
I couldn't find a tool that enforces it, so I went the manual route:
```
find -name "thirdparty" -prune \
  -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \
  -o -name "*.glsl" > files
perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files)
misc/scripts/fix_style.sh -c
```

This adds a newline after all `}` on the first column, unless they
are followed by `#` (typically `#endif`). This leads to having lots
of places with two lines between function/class definitions, but
clang-format then fixes it as we enforce max one line of separation.

This doesn't fix potential occurrences of function definitions which
are indented (e.g. for a helper class defined in a .cpp), but it's
better than nothing. Also can't be made to run easily on CI/hooks so
we'll have to be careful with new code.

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
963a27f8a2
Merge pull request #38611 from ThakeeNathees/shadow-var-warning-bug-fix
shadowed var warning in nested block bug fix
2020-05-14 16:48:56 +02:00
Thakee Nathees
687b1941b4 set parser error when infer type is null 2020-05-13 22:12:23 +05:30
Rémi Verschelde
e7c9d81876
Merge pull request #38609 from ThakeeNathees/range-crash-with-non-numeric-const-fix
range() with non-numeric const argument crash fix
2020-05-13 15:42:29 +02:00
Rémi Verschelde
dc649684be
Merge pull request #38708 from ThakeeNathees/init-assign-type-parser-bug-fix
regression: var declaration type info parser bug fix
2020-05-13 15:41:28 +02:00
Thakee Nathees
e7f056dfac regression: static func can't access const fix 2020-05-13 06:07:22 +05:30
Thakee Nathees
e5d735851d regression: var declaration type info parser bug fix 2020-05-13 05:58:27 +05:30
Rémi Verschelde
69de7ce38c Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine
Part of #33027.
2020-05-10 13:13:54 +02:00
Rémi Verschelde
e956e80c1f Style: clang-format: Disable AllowShortIfStatementsOnASingleLine
Part of #33027, also discussed in #29848.

Enforcing the use of brackets even on single line statements would be
preferred, but `clang-format` doesn't have this functionality yet.
2020-05-10 13:12:16 +02:00
Rémi Verschelde
a128dd97d6
Merge pull request #37020 from aaronfranke/range
Allow using integer vectors for iteration and make range() use them
2020-05-10 13:11:07 +02:00
Thakee Nathees
79eee93b9a shadowed var warning in nested block bug fix
Fix: #38552
2020-05-10 10:54:23 +05:30
Thakee Nathees
3e10392d48 range() with non-numeric const argument crash fix 2020-05-10 10:07:23 +05:30
Thakee Nathees
5758d87f09 more clearer unexpected statement end error messages 2020-05-10 02:35:27 +05:30
Rémi Verschelde
cf0953fefa
Merge pull request #37598 from ThakeeNathees/GDScript-type-resolve-bug-fix
GDScript class var type resolve bug fixed
2020-05-09 21:59:26 +02:00
Rémi Verschelde
c04cdc2bf1
Merge pull request #38412 from ThakeeNathees/static-func-var-access
parser error for static func access non-static variables
2020-05-09 21:32:28 +02:00
Aaron Franke
cf4482e8c4
Change get_completion_identifier_is_function to return a bool
A minor bugfix
2020-05-09 13:45:00 -04:00
Aaron Franke
f7b50992b5
Allow using integer vectors for iteration and make range() use them 2020-05-09 13:43:35 -04:00
Rémi Verschelde
4d50f747d5
Merge pull request #37293 from Janglee123/ctrl-click-improvements
Improved go-to definition (Ctrl + Click)
2020-05-05 16:49:15 +02:00
janglee
be7a353c70 Improved go-to definition (Ctrl + Click)
Co-Authored-By: Bojidar Marinov <bojidar.marinov.bg@gmail.com>
2020-05-05 10:46:12 +05:30
Thakee Nathees
ce978517e0 parser error for static func access non-static variables
Fix: #38408
2020-05-03 11:45:11 +05:30
Steven Schoen
e6e5ba32cd Mention offending function name in "Indented block expected" error 2020-05-02 17:10:34 -07:00
Tom Evans
bd081df519 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
2020-04-27 20:25:54 -05:00
Rémi Verschelde
f61587b158
Merge pull request #36927 from ThakeeNathees/export-var-type-reduce-implimented
Fix: export var type reduce() implemented
2020-04-27 17:01:04 +02:00
Thakee Nathees
cd487201c6 export var type reduce() implemented 2020-04-27 19:26:57 +05:30
Rémi Verschelde
39f77f95b8
Merge pull request #37265 from BigRed-118/mark_assert_safe
Mark assert lines as safe in gdscript
2020-04-24 17:24:45 +02:00
Rémi Verschelde
514fb5fa8a
Merge pull request #37232 from ThakeeNathees/load()-autocomplete-imlpemented
autocomplete for load() function implemented
2020-04-24 17:24:23 +02:00
Rémi Verschelde
f914276951
Merge pull request #37537 from ThakeeNathees/const-parsing-datatype-bug-fix
GDScript: Fix type inference for const reference to global class
2020-04-21 23:04:46 +02:00
Rémi Verschelde
9716204555
Merge pull request #37712 from stoofin/pattern-bind-warning
Fix unassigned variable warnings for match bindings
2020-04-21 23:04:16 +02:00
Rémi Verschelde
4f03e302a7
Merge pull request #38041 from ThakeeNathees/class-name-check-enhance
GDScript class name existance check enhanced
2020-04-21 16:19:53 +02:00
Rémi Verschelde
a5a9bf6a19
Merge pull request #37955 from ThakeeNathees/lin-unsafe-base-know-index-unkonwn
Line marked unsafe when base known and index unkonwn
2020-04-21 16:19:34 +02:00
Rémi Verschelde
2cd952bd84 Fix handling of PROPERTY_USAGE_SUBGROUP in DocData and editor
Subgroups were added in #37678 but not properly handled everywhere
where PROPERTY_USAGE_GROUP is.
2020-04-20 17:13:06 +02:00
Thakee Nathees
62280c3d47 GDScript class name existance check enhanced 2020-04-20 16:20:36 +05:30
Thakee Nathees
0780ad2800 line unsafe for indexing with known base type & unkown identifier 2020-04-17 16:52:22 +05:30
Rémi Verschelde
67f7ba2645
Merge pull request #37395 from ThakeeNathees/collon-equal-parser-bug-fix
`:=` fails on some nodes fix: #37357
2020-04-10 12:36:44 +02:00
Stoofin
44281f233d Pattern bind counts as assignment
Fixes #34697
2020-04-09 05:01:40 -07:00
Thakee Nathees
e67eb5ca36 GDScript class var type resolve bug fixed
Fix: #37545
2020-04-05 08:35:24 +05:30
Thakee Nathees
029b34da40 GDScript: Fix type inference for const reference to global class
Fixes #37529.
2020-04-03 12:43:52 +05:30
lupoDharkael
95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
Thakee Nathees
bdd7048cb5 := fails on some nodes fix: #37357 2020-03-29 16:01:54 +05:30
Thakee Nathees
0b5bad78c0 Fix for loop range bug: #37358 2020-03-28 02:20:58 +05:30
Tom Evans
8dc8833782 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
2020-03-25 08:42:04 -05:00
Thakee Nathees
d2664a0ff1 autocomplete for load() function implemented 2020-03-22 22:21:34 +05:30
Rémi Verschelde
cb282c6ef0 Style: Set clang-format Standard to Cpp11
For us, it practically only changes the fact that `A<A<int>>` is now
used instead of the C++03 compatible `A<A<int> >`.

Note: clang-format 10+ changed the `Standard` arguments to fully
specified `c++11`, `c++14`, etc. versions, but we can't use `c++17`
now if we want to preserve compatibility with clang-format 8 and 9.
`Cpp11` is still supported as deprecated alias for `Latest`.
2020-03-17 07:36:24 +01:00
luz.paz
7bf6e5f773 Fix various typos
Found via `codespell`
2020-03-11 13:59:18 -04:00
Rémi Verschelde
cdbf033290
Merge pull request #36704 from ThakeeNathees/gdscript-duplicate-args-fix
GDScript duplicate arguments bug fixed
2020-03-10 13:10:00 +01:00
Rémi Verschelde
57ab10ccf3
Merge pull request #36767 from ThakeeNathees/class-pass-fix
fix: Classes can't have pass
2020-03-10 13:08:27 +01:00
Thakee Nathees
bcbcf0f1ea 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
2020-03-06 23:14:21 +05:30
Thakee Nathees
5424b626f9 duplicate arguments in a function handled 2020-03-06 20:23:58 +05:30
Thakee Nathees
63ce1fc438 pass keyword inside a class implemented 2020-03-05 16:19:06 +05:30
Juan Linietsky
33b5c57199 Variant: Added 64-bit packed arrays, renamed Variant::REAL to FLOAT.
- Renames PackedIntArray to PackedInt32Array.
- Renames PackedFloatArray to PackedFloat32Array.
- Adds PackedInt64Array and PackedFloat64Array.
- Renames Variant::REAL to Variant::FLOAT for consistency.

Packed arrays are for storing large amount of data and creating stuff like
meshes, buffers. textures, etc. Forcing them to be 64 is a huge waste of
memory. That said, many users requested the ability to have 64 bits packed
arrays for their games, so this is just an optional added type.

For Variant, the float datatype is always 64 bits, and exposed as `float`.

We still have `real_t` which is the datatype that can change from 32 to 64
bits depending on a compile flag (not entirely working right now, but that's
the idea). It affects math related datatypes and code only.

Neither Variant nor PackedArray make use of real_t, which is only intended
for math precision, so the term is removed from there to keep only float.
2020-02-25 12:55:53 +01:00
Rémi Verschelde
2cf6ac6c50 Replace FALLTHROUGH macro by C++17 [[fallthrough]]
This attribute is now part of the standard we target so we no longer
need compiler-specific hacks.

Also enables -Wimplicit-fallthrough for Clang now that we can properly
support it. It's already on by default for GCC's -Wextra.

Fixes new warnings raised by Clang's -Wimplicit-fallthrough.
2020-02-23 00:52:50 +01:00
Juan Linietsky
69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
Juan Linietsky
3205a92ad8 PoolVector is gone, replaced by Vector
Typed `PoolTypeArray` types are now renamed `PackedTypeArray` and are
sugar for `Vector<Type>`.
2020-02-18 10:10:36 +01:00
Rémi Verschelde
54ac8eaba6 Remove more deprecated methods and code 2020-02-13 12:37:45 +01:00
Rémi Verschelde
1f39a2d3e6 Remove deprecated sync and slave networking keywords
Those keywords were deprecated for 3.1 in #22087.

Also fix token name for `TK_REMOTE`, should be "remote" like the keyword.
2020-02-13 08:59:36 +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
James Buck
9e44739324 Trigger an error when trying to define a preexisting signal in GDScript
A class can't have multiple signals with the same name, but previously users
would not be alerted to a conflict while editing the script where it occurred.
Now a helpful error will appear in the editor during script parsing.
2019-11-25 13:40:03 -06: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