summaryrefslogtreecommitdiff
path: root/modules/gdscript/gdscript_analyzer.h
AgeCommit message (Collapse)Author
2023-02-20Merge pull request #73590 from vnen/gdscript-global-scope-enumsRémi Verschelde
Make global scope enums accessible as types in GDScript
2023-02-19Make global scope enums accessible as types in GDScriptGeorge Marques
Add functions to CoreConstant so enums can be properly deduced. Also add the enums in release builds to make consistent with ClassDB enums and avoid differences in script compilation between debug and release.
2023-02-17GDScript: Rework type checkDmitrii Maganov
2023-02-10Clean up ProjectConverter3To4 architecture, move renames map to separate fileRémi Verschelde
This allows properly limiting what features depend on the RegEx module (doing the actual conversion) and what features only require the renames data (GDScript suggestions). Also better excludes the conversion command line options when actually disabling deprecated code. Fixes #73029.
2023-02-05Merge pull request #72608 from vnen/gdscript-warning-default-errorYuri Sizov
GDScript: Add warnings that are set to error by default (take 2)
2023-02-02GDScript: Add warnings that are set to error by defaultGeorge Marques
- Adds a list of default levels for all warning so they can be set individually. - Add warnings set by default to error for: - Using `get_node()` without `@onready`. - Using `@onready` together with `@export`. - Inferring a static type with a Variant value. - Overriding a native engine method. - Adjust how annotations to ignore warnings are treated so they also apply to method parameters. - Clean up a bit how ignored warnings are set. There were two sets but only one was actually being used. - Set all warnings to the `WARN` level for tests, so they they can be properly tested. - Fix enum types in native methods signatures being set to `int`. - Fix native enums being treated as Dictionary by mistake. - Make name of native enum types use the class they are defined in, not the direct super class of the script. This ensures they are always equal even when coming from different sources. - Fix error for signature mismatch that was only showing the first default argument as having a default. Now it shows for all.
2023-02-02GDScript: Improve usability of setter chainsGeorge Marques
- Consider PackedArrays non-shared since they are copied on C++/script boundaries. - Add error messages in the analyzer when assigning to read-only properties. - Add specific error message at runtime when assignment fails because the property is read-only.
2023-02-01Revert "GDScript: Add warnings that are set to error by default"Rémi Verschelde
This reverts commit a166833bfa23a21a7bff196a85a20b014e7c1396. This caused multiple regressions. Needs to be redone with more testing before merge. Fixes #72501.
2023-02-01GDScript: Add warnings that are set to error by defaultGeorge Marques
- Adds a list of default levels for all warning so they can be set individually. - Add warnings set by default to error for: - Using `get_node()` without `@onready`. - Using `@onready` together with `@export`. - Inferring a static type with a Variant value. - Overriding a native engine method. - Adjust how annotations to ignore warnings are treated so they also apply to method parameters. - Clean up a bit how ignored warnings are set. There were two sets but only one was actually being used. - Set all warnings to the `WARN` level for tests, so they they can be properly tested. - Fix enum types in native methods signatures being set to `int`. - Fix native enums being treated as Dictionary by mistake. - Make name of native enum types use the class they are defined in, not the direct super class of the script. This ensures they are always equal even when coming from different sources. - Fix error for signature mismatch that was only showing the first default argument as having a default. Now it shows for all.
2023-01-31Merge pull request #57520 from jordigcs/gd-rename-mapRémi Verschelde
Add hint for identifiers renamed from 3.x to 4.0
2023-01-31GDScript: Fix issues with typed arraysDmitrii Maganov
2023-01-29GDScript: Fix constant conversionsDmitrii Maganov
2023-01-25Merge pull request #71120 from jordigcs/ternaryGeorge Marques
Closes https://github.com/godotengine/godot/issues/71065
2023-01-24Add hint for identifiers renamed since Godot 3jordi
2023-01-19Allow standalone ternary expressionsjordi
2023-01-12GDScript: Fix some issues with assignments that involve untyped thingsDmitrii Maganov
2023-01-12GDScript: Fix getting type from PropertyInfo for Variant argumentsDmitrii Maganov
2023-01-09Fix GDScript base and outer classes, signals and functions lookup orderAdam Scott
- Add outer class lookup test - Add signal lookup test Co-authored-by: Dmitrii Maganov <vonagam@gmail.com>
2023-01-09Merge pull request #71051 from vonagam/consts-are-deep-startRémi Verschelde
GDScript: Begin making constants deep, not shallow or flat
2023-01-09Assorted enum and native type fixesocean (they/them)
2023-01-08GDScript: Begin making constants deep, not shallow or flatDmitrii Maganov
2023-01-06GDScript: Fix typing of lambda functionsDmitrii Maganov
2023-01-06Unify typing of variables, constants and parameters in GDScriptDmitrii Maganov
2023-01-05One Copyright Update to rule them allRémi Verschelde
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".
2022-12-14GDScript: Allow out of order member resolutionrune-scape
2022-12-10Fix constant base typing in extended GDScript classAdam Scott
2022-11-17Fix ability to overload "script" variableocean (they/them)
2022-10-13Implement RETURN_VALUE_DISCARDED warning in GDscriptclayjohn
2022-05-20Add a new HashSet templatereduz
* Intended to replace RBSet in most cases. * Optimized for iteration speed
2022-05-16Replace most uses of Map by HashMapreduz
* Map is unnecessary and inefficient in almost every case. * Replaced by the new HashMap. * Renamed Map to RBMap and Set to RBSet for cases that still make sense (order matters) but use is discouraged. There were very few cases where replacing by HashMap was undesired because keeping the key order was intended. I tried to keep those (as RBMap) as much as possible, but might have missed some. Review appreciated!
2022-04-24GDScript: Allow using self in lambdasGeorge Marques
2022-03-06GDScript: Check if method signature matches the parentGeorge Marques
To guarantee polymorphism, a method signature must be compatible with the parent. This checks if: 1. Return type is the same. 2. The subclass method takes at least the same amount of parameters. 3. The matching parameters have the same type. 4. If the subclass takes more parameters, all of the extra ones have a default value. 5. If the superclass has default values, so must have the subclass. There's a few test cases to ensure this holds up.
2022-02-03GDScript: Consolidate behavior for assigning enum typesGeorge Marques
This makes sure that assigning values to enum-typed variables are consistent. Same enum is always valid, different enum is always invalid (without casting) and assigning `int` creates a warning if there is no casting. There are new test cases to ensure this behavior doesn't break in the future.
2022-01-03Update copyright statements to 2022Rémi Verschelde
Happy new year to the wonderful Godot community!
2021-10-14GDScript: Remove error when coroutine is called without awaitGeorge Marques
In the case the call happens as a statement, since the return value isn't used in this case.
2021-09-02Check for GDScript member and class naming conflicts in a variety of conditions.SaracenOne
2021-08-18GDScript: Fix issue when calling `new()` on its ownGeorge Marques
2021-06-11Rename Reference to RefCountedPedro J. Estébanez
2021-04-28GDScript: Implement lambdas compilation and runtimeGeorge Marques
2021-04-28GDScript: Add lambdas to the type analyzerGeorge Marques
- Lambdas are always callables (no specific signature match). - Captures from the current context are evaluated.
2021-03-30Move GDSript annotation application after type-checkingGeorge Marques
This ensures that annotations that rely on the datatype (such as @export) can validated it timely, allowing compound expressions instead of only literal values.
2021-03-29Add typed arrays to GDScriptGeorge Marques
- Use `Array[type]` for type-hints. e.g.: `var array: Array[int] = [1, 2, 3]` - Array literals are typed if their storage is typed (variable asssignment of as argument in function all). Otherwise they are untyped.
2021-01-01Update copyright statements to 2021Rémi Verschelde
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 🎆
2020-11-26Merge pull request #43895 from vnen/gdscript-operators-fixRémi Verschelde
GDScript: Improve handling of operators
2020-11-26GDScript: Improve handling of operatorsGeorge Marques
- Use the new functions in Variant to determine the validity and resulting type of operators. - Split the operator function in codegen between binary and unary, since the unary ones have now a special requirement of having the second argument to be the NIL type when requesting info.
2020-11-26GDScript: Give an error if dependency can't be parsedGeorge Marques
Otherwise this may lead to a crash when the dependency is not present.
2020-11-07Reorganized core/ directory, it was too fatty alreadyreduz
-Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
2020-09-11Array/Dictinoary no more reduced to array/dictionary variantThakee Nathees
Fix: #41377 Fix: #20436 Fix: #41953
2020-09-06GDScript: parameter infer type bug fixThakee Nathees
Fix: #41772
2020-09-01GDScript: Don't try to parse constant scripts that aren't validGeorge Marques
Since it's likely that they won't parse correctly.