Commit graph

722 commits

Author SHA1 Message Date
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
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
George Marques 4d1551dbb5 GDScript autocomplete: don't carry values when guessing from is
Guessing the type from an `is` operator should no be considered an
assigment. This would cause crashes in certain scenarios.
2019-01-15 16:03:56 -02:00
Rémi Verschelde 658296856c
Merge pull request #24877 from neikeq/issue-24280
Fix properties being lost when reloading placeholder GDScript instance
2019-01-10 18:02:57 +01:00
Rémi Verschelde 899ad484e3
Merge pull request #24883 from akien-mga/resourceformat-unregister
Consistency in resource format saver/loader de-registration
2019-01-10 14:25:09 +01:00
Andrii Doroshenko (Xrayez) c0cc032799 Fix broken encrypted scripts during export
Use temporary cache directory instead of editor settings directory
in order to resolve encrypted file access needed for encrypting scripts
on all platforms.
2019-01-10 13:53:12 +02:00
Rémi Verschelde e5f1d19352 Consistency in resource format saver/loader de-registration
Some used 'is_valid()' checks, others not. Validity is already checked in 'unref()',
and 'remove_resource_format_*()' has an ERR_FAIL condition on 'is_null()' already
(which shouldn't happen since we're only unregistering things that we previously
registered.

Also add missing GDCLASS statement in ResourceFormatLoaderVideoStreamGDNative,
missed in #20552 which was last amended before #19501 was merged.
2019-01-10 12:45:57 +01:00
Ignacio Etcheverry ea85ff0dc2 Fix properties being lost when reloading placeholder GDScript instance
During reloading in `GDScriptLanguage::reload_all_scripts` a placeholder instance that must remain so is replaced with a new placeholder instance. The state is then restored by calling `ScriptInstance::set` for each property. This does not work if the script is missing the properties due to build/parse failing.
The fix for such cases is to call `placeholder_set_fallback` instead of `set` on the script instance.

I took this chance to move the `build_failed` flag from `PlaceHolderScriptInstance` to `Script`. That improves the code a lot. I also renamed it to `placeholder_fallback_enabled` which is a much better name (`build_failed` could lead to misunderstandings).
2019-01-10 01:58:50 +01:00
Timo Schwarzer 56000929fd
Fix code completion on nodes in current scene 2019-01-05 23:17:02 +01:00
Rémi Verschelde 1ba0b2bc0b
Merge pull request #24741 from timoschwarzer/24697-fix-autocomplete-segfault-in-inner-classes
Fix segfault when trying to autocomplete in inner classes
2019-01-04 19:41:24 +01:00
Rémi Verschelde 5809be9641
Merge pull request #24582 from Xrayez/script-encrypt
Bring back script encryption in export preset
2019-01-04 16:34:38 +01:00
Timo Schwarzer d77643562b
Fix segfault when trying to autocomplete in inner classes
Fixes #24697
2019-01-03 15:51:34 +01: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
Andrii Doroshenko (Xrayez) ba13a2bc05 Bring back script encryption in export preset
Retrieved working implementation from 2.1 branch and adapted to
existing export preset system.

Added Script tab in export preset to export script as raw text,
compiled, or encrypted (same as in 2.1). The script encryption key is
visually validated. The script export mode and the key is saved per
per preset in `export_presets.cfg`, so it makes sense to ignore this
file in version control system.

Each custom exporting procedure can retrieve an export preset set
during project exporting. Refactored project export dialog a bit to
allow easier code comprehension.
2018-12-24 17:16:14 +02:00
Rémi Verschelde 9df7ed59fb
Merge pull request #19501 from Zylann/custom_loaders
Added basic support for custom resource savers and loaders
2018-12-16 14:26:56 +01:00
Marc Gilleron 065e2670af Added basic support for custom resource savers and loaders 2018-12-15 05:34:53 +00:00
Rémi Verschelde 17c3c64a80 i18n: Sync translation template with current source
Also French translation update and misc fixes to source strings.
2018-12-13 14:47:24 +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 19f2a188bb
Merge pull request #22934 from SeleckyErik/issue-11457
GDscript function str2var now returns null on invalid input
2018-12-07 15:43:47 +01:00