Commit graph

739 commits

Author SHA1 Message Date
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
George Marques 9db96d9f81
Merge pull request #26528 from bojidar-bg/26047-gdscript-object-argument
Allow parameters passed to GDScript functions to be nulled
2019-03-03 11:39:25 -03:00
Bojidar Marinov f0efc7521e
Allow parameters passed to GDScript functions to be nulled
Previous version resulted in confusing (but actually right) errors about converting "from Object to Object", since CallError
does not include information about the actual types involved.
2019-03-03 15:24:06 +02:00
Bojidar Marinov f207b2fe0e
Fix GDScript checking for assigning to a constant only in release 2019-03-03 12:36:27 +02:00
Rémi Verschelde f2003b1a7e
Merge pull request #26034 from QbieShay/issue_25596
Inheriting from virtual class no longer causes the engine to crash.
2019-02-28 11:00:20 +01:00
QbieShay 8f22c2684f Inheriting from virtual class no longer causes the engine to crash, it prints an error instead.
Co-authored-by: Hein-Pieter van Braam <hp@tmm.cx>
2019-02-27 20:42:20 +01:00
Rémi Verschelde 426a6fdc17
Merge pull request #26134 from marxin/fix-Wsign-compare
Fix -Wsign-compare warnings.
2019-02-27 09:22:47 +01:00
marxin e5f665c718 Fix -Wsign-compare warnings.
I decided to modify code in a defensive way. Ideally functions
like size() or length() should return an unsigned type.
2019-02-27 07:45:57 +01: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
Rémi Verschelde 726f31e992
Merge pull request #26132 from marxin/fix-Wignored-qualifiers
Fix warnings seen with -Wignored-qualifiers.
2019-02-22 09:55:27 +01:00
Rémi Verschelde 60fe9321ac
Merge pull request #26099 from marxin/fix-Wtype-limits-warnings
Fix all -Wtype-limits warnings.
2019-02-22 09:44:59 +01:00
Juan Linietsky d13ac2a413 Request to use load when cyclic reference is found, closes #26119 2019-02-21 17:27:07 -03:00
marxin c11e7ffd0e Fix warnings seen with -Wignored-qualifiers. 2019-02-21 20:24:29 +01:00
marxin 7de7f0ef17 Fix all -Wtype-limits warnings. 2019-02-21 19:34:35 +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 d35003d92a GDScript: Remove unused switch, case and do CF keywords
They had been reserved for future implementation, but we now have the
`match` CF keyword which does the same and more.

According to @reduz `do` was even added by mistake when copying from
the shader language parser, it was never intended to add support for
`do`... `while` loops, as the syntax would be awkward in GDScript,
and the added sugar is not worth it.

Fixes #25787.
2019-02-20 14:05:08 +01:00
Rémi Verschelde fd60724c3d
Merge pull request #25715 from hpvb/fix-25598
Add a maximum recusion depth to _guess_expression_type
2019-02-16 14:39:57 +01:00
Rémi Verschelde 89ca15693e
Merge pull request #25866 from neikeq/issue-25121
Fix exported property values being lost if base GDScript fails to parse
2019-02-14 09:21:19 +01:00
Ignacio Etcheverry 2f8d1a321a Fix exported property values being lost if base GDScript fails to parse 2019-02-14 02:36:19 +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 b7cc2bb1e2 Core: Ensure classes match their header filename
Also drop some unused files.

Renamed:
- `core/dvector.h` -> `pool_vector.h`
- `core/io/resource_import.h` -> `resource_importer.h`
- `core/sort.h` -> `sort_array.h`
- `core/string_db.h` -> `string_name.h`

Dropped:
- `core/allocators.h`
- `core/os/shell.h`
- `core/variant_construct_string.cpp`
2019-02-12 13:34:25 +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
Hein-Pieter van Braam e937e74b69 Add a maximum recusion depth to _guess_expression_type
When a recursive declaration ends up in a GDScript file the
_guess_expression_type function would start looping and eventually run
out of stack space.

We now cap recusion for this function to 100 frames.

This fixes #25598
2019-02-08 22:39:08 +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
Bojidar Marinov d2e43475b5
Fix wrong error messages for invalid arguments when calling functions through call
Fixes #25505
2019-01-31 17:02:18 +02: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
Juan Linietsky 6504b88547 Ensure get script method list also checks base classes, fixes #23384 2019-01-25 10:09:44 -03: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 f4546fc0cd GDScript: don't allow calling non-static function from script 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
Rémi Verschelde d024979e84 GDScript: Fix return value of "lerp" builtin
Fixes #25082, fixes #24709.
2019-01-18 10:47:04 +01: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 30f02dd421 GDScript compiler: check if subclass exists before comparison
Otherwise these checks might trigger the insertion of an empty value,
leading to crashes.
2019-01-17 14:38:28 -02: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 31433ae8e4 GDScript: check for underscore prefix when type-checking
Some classes are represented internally with an underscore prefix, so we
need to make sure we match this representation when type-checking,
otherwise the check might fail on a valid scenario.
2019-01-15 19:50:48 -02: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