summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_analyzer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Fix gdscript analyzer error when instantiating EditorPlugins.baptr2024-07-101-1/+1
| | | | | | | | | | | | | | | | Editor code is not instantiable outside of the editor (https://github.com/godotengine/godot/blob/1d14c054a12dacdc193b589e4afb0ef319ee2aae/core/object/class_db.cpp#L369). This is fine for editor plugins and the like, but the GDScript analyzer balks at it, causing F5 runs to fail: #73525. Instead, we really just want to know if the type is abstract - so add a new ClassDB method to check that and nothing else. Update core/object/class_db.cpp Apply code review comments Co-Authored-By: Bryce <1522777+baptr@users.noreply.github.com>
* GDScript: Fix false positive `CONFUSABLE_CAPTURE_REASSIGNMENT` warningsDanil Alexeev2024-06-281-1/+24
|
* GDScript: Add `CONFUSABLE_CAPTURE_REASSIGNMENT` warningDanil Alexeev2024-06-281-0/+15
|
* Merge pull request #93346 from RandomShaper/gds_cyc_altRémi Verschelde2024-06-261-2/+7
|\ | | | | | | GDScript: Enhance handling of cyclic dependencies
| * GDScript: Enhance handling of cyclic dependenciesPedro J. Estébanez2024-06-261-2/+7
| |
* | Fix editor crash when invalid global class script pathHilderin2024-06-251-0/+3
|/
* Merge pull request #92544 from dalexeev/gds-fix-const-non-metatype-subscriptRémi Verschelde2024-05-301-7/+39
|\ | | | | | | GDScript: Fix subscript resolution on constant non-metatype GDScript base
| * GDScript: Fix subscript resolution on constant non-metatype GDScript baseDanil Alexeev2024-05-301-7/+39
| |
* | GDScript: Do not produce `INFERRED_DECLARATION` on type importDanil Alexeev2024-05-301-1/+6
|/
* GDScript: Fix lambdas capturing non-local variablesDanil Alexeev2024-05-221-4/+17
|
* GDScript: Fix `STANDALONE_EXPRESSION` warning for `preload()`Danil Alexeev2024-05-171-0/+1
|
* Merge pull request #91909 from KoBeWi/have_fun_reviewing_thisRémi Verschelde2024-05-141-1/+0
|\ | | | | | | Use Core/Scene stringnames consistently
| * Use Core/Scene stringnames consistentlykobewi2024-05-131-1/+0
| |
* | Revert "GDScript: Implement get_dependencies()"Rémi Verschelde2024-05-131-14/+1
|/ | | | | | | | | | | | | This reverts commit dc73440f899e6f32de748787e946ad762771fda0. This commit in some form is needed to fix handling of dependencies on export, but as it's also used for import, it's exposing some pre-existing issues which we need to solve first. So reverting for now to give ourselves time to iron this out for a future Godot release. Fixes #91726.
* Add shorthand for using singleton string nameskobewi2024-05-111-2/+2
|
* Reduce and prevent unnecessary random-access to `List`A Thousand Ships2024-05-041-16/+21
| | | | | | | | | Random-access access to `List` when iterating is `O(n^2)` (`O(n)` when accessing a single element) * Removed subscript operator, in favor of a more explicit `get` * Added conversion from `Iterator` to `ConstIterator` * Remade existing operations into other solutions when applicable
* Add PackedVector4Array Variant typeK. S. Ernest (iFire) Lee2024-05-031-5/+11
| | | | | Co-authored-by: A Thousand Ships <96648715+AThousandShips@users.noreply.github.com> Co-authored-by: Rémi Verschelde <rverschelde@gmail.com>
* GDScript: Fix access non-static members in static contextDanil Alexeev2024-05-011-8/+23
|
* Merge pull request #90860 from vnen/gdscript-get-dependenciesRémi Verschelde2024-04-291-1/+14
|\ | | | | | | GDScript: Implement `get_dependencies()`
| * GDScript: Implement get_dependencies()George Marques2024-04-181-1/+14
| | | | | | | | | | | | | | | | | | | | | | | | The parser and analyzer now track the dependencies of the script and return the list when the resource loader ask for them. What is considered a dependency: - Any `preload()` call. - The base script this one extends. - Any identifier, including types, that refers to global scripts. - Any autoload singleton reference.
* | Merge pull request #90552 from vnen/gdscript-constructor-callable-releaseRémi Verschelde2024-04-291-1/+1
|\ \ | | | | | | | | | GDScript: Assume constructor to be accessible from class
| * | GDScript: Assume constructor to be accessible from classGeorge Marques2024-04-111-1/+1
| | | | | | | | | | | | | | | Since the constructor is accessed directly from the class, even if not marked `static`, it can be retrieved as a Callable without an instance.
* | | GDScript: Resolve types from autoload scenesGeorge Marques2024-04-261-3/+22
| | | | | | | | | | | | | | | When the autoload is a scene, it now extracts the script from it and use it to further infer nested types.
* | | Merge pull request #90601 from ↵Rémi Verschelde2024-04-221-44/+25
|\ \ \ | |_|/ |/| | | | | | | | | | | rune-scape/rune-gdscript-dependant-parser-ref-errors GDScript: Fix out of date errors in depended scripts
| * | GDScript: invalidate GDScriptParserRef when reloadingrune-scape2024-04-181-44/+25
| |/
* | Merge pull request #90794 from ↵Rémi Verschelde2024-04-181-1/+1
|\ \ | | | | | | | | | | | | | | | vnen/gdscript-no-unused-constant-warning-with-underscore GDScript: Suppress unused constant warning with underscore
| * | GDScript: Suppress unused constant warning with underscoreGeorge Marques2024-04-181-1/+1
| | | | | | | | | | | | | | | | | | The warning message mentions that local constants prefixed with `_` does not generate the warning. This commit actually implements this warning suppression.
* | | GDScript: Warn when enum variable has no defaultGeorge Marques2024-04-161-0/+12
|/ / | | | | | | | | The default will always be set to `0`, so if it's not a valid value in the enum, the warning is shown.
* / GDScript: Allow casting enum to intGeorge Marques2024-04-121-0/+2
|/ | | | | An enum value is always an integer so the cast is valid. The code here now consider this case to avoid giving an error message.
* Merge pull request #90448 from vnen/gdscript-infer-string-formatRémi Verschelde2024-04-101-0/+5
|\ | | | | | | GDScript: Infer type with string format operator
| * GDScript: Infer type with string format operatorGeorge Marques2024-04-101-0/+5
| | | | | | | | | | | | | | If the left value type is known to be String, assume the format operator (`%`) will return a string, since it works with any type in the right hand side. This is also used by type inference even if the right hand type is unknown at compile time.
* | Merge pull request #90442 from vnen/gdscript-dont-warn-using-default-builtinRémi Verschelde2024-04-101-3/+26
|\ \ | | | | | | | | | GDScript: Don't warn on unassigned for builtin-typed variables
| * | GDScript: Don't warn on unassigned for builtin-typed variablesGeorge Marques2024-04-101-3/+26
| |/ | | | | | | | | | | | | | | | | | | | | If the type of a variable is a built-in Variant type, then it will automatically be assigned a default value based on the type. This means that the explicit initialization may be unnecessary. Thus this commit removes the warning in such case. This also changes the meaning of the unassigned warning to happen when the variable is used before being assigned, not when it has zero assignments.
* | Merge pull request #84043 from dalexeev/gds-fix-unsafe-cast-warningRémi Verschelde2024-04-091-3/+1
|\ \ | |/ |/| | | GDScript: Fix `UNSAFE_CAST` warning
| * GDScript: Fix `UNSAFE_CAST` warningDanil Alexeev2023-10-271-3/+1
| |
* | Don't pass `self` when calling a static function from a non-static contextJamie Hill-Daniel2024-04-041-3/+4
| |
* | GDScript: Fix `@warning_ignore` annotation issuesDanil Alexeev2024-03-121-57/+40
| |
* | GDScript: Adjust STATIC_CALLED_ON_INSTANCE warning to not default to the ↵20kdc2024-03-011-6/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | native type, and to not trigger on self-calls Not defaulting to the native type rationale: Defaulting to the native type is less than useful, as: * There are very few native types that are extensible and have static methods. * Defaulting to the native type does not account for a method being script-defined. While the "real fix" would be to carefully track the source of the method, the get_function_signature method is already complicated enough. This will at least ensure the resulting code should always be valid. Not triggering on self-calls rationale: Found in PR comment https://github.com/godotengine/godot/pull/85918#issuecomment-1935864459 ``` static func example(): pass func example2(): example() # self-call on static function ``` Disabling this warning on self-calls is: * Consistent with other languages * Important for anonymous classes (where the output code is unusable)
* | GDScript: Canonicalize script path in FQCNDanil Alexeev2024-02-261-3/+3
| |
* | Merge pull request #85501 from /remove-packed-scene-cacheRémi Verschelde2024-02-251-9/+2
|\ \
| * | Stop caching packed scenes in GDScript cacheJordyfel2023-11-291-9/+2
| |/
* | GDScript: Fix extension comparison for exported scriptsDanil Alexeev2024-02-151-3/+3
| |
* | Merge pull request #86823 from dalexeev/gds-utility-func-as-callableRémi Verschelde2024-01-301-19/+28
|\ \ | | | | | | | | | GDScript: Allow utility functions to be used as `Callable`
| * | GDScript: Allow utility functions to be used as `Callable`Danil Alexeev2024-01-051-19/+28
| | |
* | | Merge pull request #85224 from HolonProduction/identifier-type-prefer-annotatedYuri Sizov2024-01-241-6/+14
|\ \ \ | | | | | | | | | | | | Prefer identifiers annotated type if assigned type is incompatible to it
| * | | Prefer identifiers annotated type if assigned type is incompatible to itHolonProduction2024-01-171-6/+14
| | | |
* | | | Merge pull request #85215 from HolonProduction/type-from-property-class-nameRémi Verschelde2024-01-181-2/+13
|\ \ \ \ | |/ / / |/| | | | | | | Handle global classes when resolving type from `PropertyInfo`
| * | | Handle global classes when resolving type from `PropertyInfo`HolonProduction2024-01-171-2/+13
| | |/ | |/|
* | | Add const lvalue ref to container parametersMuller-Castro2024-01-051-1/+1
| |/ |/|
* | Merge pull request #82639 from golfinq/gdscript-improve-indexing-errorRémi Verschelde2024-01-041-1/+1
|\ \ | | | | | | | | | GDScript: Improve error messages for invalid indexing