Commit Graph

232 Commits

Author SHA1 Message Date
95a1400a2a Replace NULL with nullptr 2020-04-02 13:38:00 +02:00
0b5bad78c0 Fix for loop range bug: #37358 2020-03-28 02:20:58 +05:30
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
7bf6e5f773 Fix various typos
Found via `codespell`
2020-03-11 13:59:18 -04:00
cdbf033290 Merge pull request #36704 from ThakeeNathees/gdscript-duplicate-args-fix
GDScript duplicate arguments bug fixed
2020-03-10 13:10:00 +01:00
57ab10ccf3 Merge pull request #36767 from ThakeeNathees/class-pass-fix
fix: Classes can't have pass
2020-03-10 13:08:27 +01:00
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
5424b626f9 duplicate arguments in a function handled 2020-03-06 20:23:58 +05:30
63ce1fc438 pass keyword inside a class implemented 2020-03-05 16:19:06 +05:30
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
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
69c95f4b4c Reworked signal connection system, added support for Callable and Signal objects and made them default. 2020-02-20 08:24:50 +01:00
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
54ac8eaba6 Remove more deprecated methods and code 2020-02-13 12:37:45 +01:00
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
36e11d1c34 Merge pull request #35412 from DaividFrank/check_overriding_self
Disabled re-assigning 'self'
2020-01-22 20:47:52 +01:00
badabdf8b9 GDScript: Added checks in assign operations to disable re-assigning 'self' 2020-01-22 19:00:54 +02:00
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
19ce2d5159 Fix slight problems related to default values of exported typed arrays 2020-01-16 14:50:29 +02:00
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
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
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
76678b2609 GDScript: Fix type name on error message for function parameters 2020-01-09 15:50:06 -03:00
1aef8bfeb1 GDScript: Fix resolution of default parameter values
Fix #26556
2020-01-09 15:42:31 -03:00
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
41ed905c1a GDScript: Allow copy constructor for built-in types
Those are implicitly defined in Variant.
2020-01-09 09:03:09 -03:00
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
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
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
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
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
b93b7aca74 Allow the usage of newlines in export hints
Fixes #34689
2020-01-02 18:03:11 +02:00
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
475d7f0e52 GDScript: Fix type conversion in assignment with operation 2019-12-13 12:51:08 -03:00
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
79c26344e8 Make error when accidentially redeclaring a variable's type clearer
Fixes #32370
2019-12-02 22:26:05 +02:00
9254961297 Parser: Check all the arguments of the ternary operator 2019-11-15 01:29:18 +01:00
d7137a6b72 Add setting to exclude addons from script warnings 2019-11-07 23:01:22 -05:00
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
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
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
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
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
616ab4fac2 Small fixes to redundand code, copy paste bugs 2019-10-14 11:40:55 +02:00
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
50be65bf43 Changed some code found by Clang Tidy and Coverity 2019-09-22 18:45:08 +02:00
fdc2463a1b Merge pull request #32150 from luzpaz/typos
Fix misc. source comment typos
2019-09-20 17:09:05 +02:00
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
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
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