Commit graph

290 commits

Author SHA1 Message Date
Rémi Verschelde
f37ff9e254
Merge pull request #79123 from dalexeev/3.x-gds-prevent-native-class-shadowing
[3.x] GDScript: Prevent native class shadowing
2024-01-05 11:06:31 +01:00
Jason Knight
4285c44b47 Far faster and more efficient method of checking if an identifer refers an autoload. 2023-10-23 12:13:12 -06:00
Danil Alexeev
3d98247678
[3.x] GDScript: Prevent native class shadowing 2023-07-06 20:32:30 +03:00
lawnjelly
ef914dac31 GDScriptParser - don't use index operator on linked list
Index operators are super slow with linked lists. This came up in profiling the parsing, iterating sequentially using iterator is much faster.
2023-03-11 17:05:12 +00:00
Rémi Verschelde
1426cd3b3a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".

Backported from #70885.
2023-01-10 15:26:54 +01:00
ray90514
7afbd5904e
Fix Script editor completion doesn't suggest members of a script for type hints 2022-12-12 13:36:32 +01:00
smix8
d955d4a1c1 Fix GDScript export hint for Navigation2D layer names 2022-10-04 10:32:57 +02:00
Kirill Diduk
5bcc3d476c Fix parsing inner class declaration when "pass" keyword is on the same line
Implement a special case for allowing "pass" keyword in one-liner class
declaration, to be consistent with Python style.

```
class TestClass: pass
```

This commit fixes #56703
2022-06-21 10:04:26 +02:00
smix8
8bd7c6188b [3.5] Update NavigationServer backport
Backports features and bugfixes from current Godot 4.0 to 3.5 and brings functions and codebase of both version largely in sync to make tutorials more compatible and future backports easier.
2022-06-14 05:55:14 +02:00
Haoyu Qiu
acf9870397 Fix incorrect usage for some export variables 2022-04-29 20:12:47 +08:00
George Marques
663978e8ba
GDScript: Properly check type info in release builds
This makes sure native methods and properties have the actual type
checked to compare for compatibility and inference.
2022-04-01 18:20:37 -03:00
George Marques
f2166ba92f
GDScript: Don't coerce default values to the export hint type
This behavior is inconsistent with non tools builds and can create
issues. Instead, a warning is emitted if there's a type mismatch. If the
type can't be converted, an error is shown instead.

For the editor it gives a converted value to avoid issues with the
property editor, which expects the correct type.
2022-03-02 12:26:17 -03:00
George Marques
a3fe028809
GDScript: Infer variable types on release
Otherwise this creates an inconsistency between debug and release
builds, potentially leading to crashes.
2022-02-09 09:07:18 -03:00
Rémi Verschelde
a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
Rémi Verschelde
bd828c4d81
Merge pull request #54227 from akien-mga/3.x-gdscript-multiline-indexing 2021-11-08 15:03:24 +01:00
Rémi Verschelde
42d385b312
clang-format: Disable alignment of operands, too unreliable
Sets `AlignOperands` to `DontAlign`.

`clang-format` developers seem to mostly care about space-based indentation and
every other version of clang-format breaks the bad mismatch of tabs and spaces
that it seems to use for operand alignment. So it's better without, so that it
respects our two-tabs `ContinuationIndentWidth`.
2021-10-28 13:23:38 +02:00
Rémi Verschelde
92664f03a9
GDScript: Support multiline indexing with []
Fixes #35417.
2021-10-25 15:50:59 +02:00
Yuri Sizov
b6b65e08d1 Remove redundant String operation from GDScript enum exports 2021-10-11 02:12:30 +03:00
Rafał Mikrut
1558f4a599 Speedup parsing big GDScript files 2021-10-07 07:39:56 +02:00
Rémi Verschelde
3f05c388a1
Merge pull request #52521 from kdiduk/52499-preload-parsing-error-when-newline-encountered 2021-10-06 10:13:19 +02:00
Kirill Diduk
835143b7bd #52499 Fix parsing 'preload': increase/decrease parenthesis count 2021-10-06 09:35:21 +02:00
Francois Belair
3754759e26 Fix extends parsing breaking if it has the cursor 2021-10-01 11:31:05 -04:00
Rémi Verschelde
1de8f31448
CI: Upgrade Emscripten to 2.0.25
That's the version used by current containers for Godot 3.4.

Fixes a couple stray warnings that new Emscripten/LLVM catches.
2021-08-18 11:13:34 +02:00
Rémi Verschelde
6355877c0d
Merge pull request #47863 from mphe/same_line_warning_ignore
Allow warning-ignore in the same line as the respective warning
2021-05-18 15:08:00 +02:00
Rémi Verschelde
140350d767
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
2021-05-05 15:02:01 +02:00
Rémi Verschelde
a828398655
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`.
https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
2021-05-04 16:30:23 +02:00
Rémi Verschelde
b5e1e05ef2
Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks 2021-05-04 14:45:16 +02:00
Rémi Verschelde
64a63e0861
Style: clang-format: Disable AllowShortCaseLabelsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
3d15f04668
Style: clang-format: Disable AllowShortIfStatementsOnASingleLine 2021-05-04 14:45:15 +02:00
Rémi Verschelde
6e600cb3f0
Style: Set clang-format Standard to c++14 2021-05-04 14:45:15 +02:00
Marvin Ewald
3715ea268f Allow warning-ignore in same line 2021-04-13 13:55:33 +02:00
Rémi Verschelde
49646383f1
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆

(cherry picked from commit b5334d14f7)
2021-01-13 16:17:06 +01:00
Mateo de Mayo
edb79e584a Fix misleading editor message when redeclaring variables 2020-10-22 18:32:34 -03:00
Haoyu Qiu
82900e54ea Fixes crash after using enums in export variables 2020-10-20 18:41:41 +08:00
Thakee Nathees
a69c3cace2 GDScript signal lines marked as safe
Fix: #33927
2020-10-01 17:01:11 +05:30
Rémi Verschelde
bca2633f93
Merge pull request #41931 from RandomShaper/fix_gdscript_leaks_3.2
Fix leaks in GDScript (3.2)
2020-09-24 08:33:04 +02:00
Rémi Verschelde
c8859f0463
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 14:09:51 +02:00
Pedro J. Estébanez
a0969662cd Prevent cyclic reference between script and its members 2020-09-09 13:51:53 +02:00
Thakee Nathees
d04d329a1f autocompletion inside comments bug fixed
Fix: #41438
2020-08-23 23:01:54 +05:30
Thakee Nathees
d53f5b55ec Auto completion enhanced for extends and class level identifier 2020-08-17 12:54:01 +05:30
Francois Belair
e3f16a83dc Fix line num of enums reported as the line before 2020-08-08 11:52:25 -04:00
Thakee Nathees
9ce1fe59ea Fix: editor crash on super constructor called
Fix: #39909
(cherry picked from commit 023b3f2786)
2020-07-06 16:47:44 +02:00
Thakee Nathees
fc92f83c30 Debugger stepping to incorrect line fix
Fix: #39296
(cherry picked from commit fc89c5c76d)
2020-06-18 11:29:28 +02:00
Thakee Nathees
931a927a40 shodowed var warning for for loop counter
Fix: #39268
(cherry picked from commit 54835a5302)
2020-06-18 10:51:45 +02:00
Rémi Verschelde
1cf8652945
Merge pull request #39263 from ThakeeNathees/is-operation-fail
[3.2] Fix `is` operation fail on get_script()
2020-06-16 16:28:43 +02:00
Hugo Locurcio
aeb5513bab 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.

(cherry picked from commit 30053de182)
2020-06-05 12:50:55 +02:00
Thakee Nathees
837cba7567 predefined var check for for loop counter
(cherry picked from commit e153772de2)
2020-06-05 12:45:12 +02:00
Thakee Nathees
8f795cb38e Fix is operation fail on get_script()
Fix: #39244
2020-06-03 21:04:48 +05:30
George Marques
a0983637cf
GDScript: Allow get_script() to be considered a type 2020-06-03 10:48:43 -03:00
Tan Wang Leng
48a2fd7a3d 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.

(cherry picked from commit 7b1423a61e)
2020-05-25 16:31:07 +02:00