summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_analyzer.cpp
Commit message (Collapse)AuthorAgeFilesLines
* GDScript: Fix crash when base of an attribute is invalidGeorge Marques2021-04-281-0/+6
| | | | | | | In attribute expressions (`a.b`) it's possible that the base has an incorrect syntax and thus become a nullptr expression in the tree. This commit add the check for this case to fail gracefully instead of crashing.
* GDScript: Implement lambdas compilation and runtimeGeorge Marques2021-04-281-7/+28
|
* GDScript: Add lambdas to the type analyzerGeorge Marques2021-04-281-13/+71
| | | | | - Lambdas are always callables (no specific signature match). - Captures from the current context are evaluated.
* GDScript: Add lambda syntax parsingGeorge Marques2021-04-281-0/+4
| | | | | | | | | | | Lambda syntax is the same as a the function syntax (using the same `func` keyword) except that the name is optional and it can be embedded anywhere an expression is expected. E.g.: func _ready(): var my_lambda = func(x): print(x) my_lambda.call("hello")
* GDScript: Fix resolution of dictionary keysGeorge Marques2021-04-231-20/+4
| | | | | | There was a mixup between String and StringName keys. Now they're clearly separated. This also means you have to consider which type you're using for the dictionary keys and how you are accessing them.
* Merge pull request #47131 from vnen/gdscript-export-fixRémi Verschelde2021-03-301-71/+35
|\ | | | | Fix a few issues with @export in GDScript
| * Move GDSript annotation application after type-checkingGeorge Marques2021-03-301-71/+35
| | | | | | | | | | | | This ensures that annotations that rely on the datatype (such as @export) can validated it timely, allowing compound expressions instead of only literal values.
* | GDScript: Fix array type check on constantsGeorge Marques2021-03-301-2/+2
|/ | | | | They mistakenly pointing to the wrong union member (variable instead of constant).
* Add typed arrays to GDScriptGeorge Marques2021-03-291-24/+195
| | | | | | | | - 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.
* Merge pull request #43176 from mateosss/crash-uninit-constRémi Verschelde2021-01-111-13/+15
|\ | | | | Fix crash by adding nullcheck for uninitialized constants
| * Fix crash by adding nullcheck for uninitialized constantsMateo de Mayo2020-10-291-13/+15
| |
* | Merge pull request #44719 from ThakeeNathees/assert-argument-bug-fixedRémi Verschelde2021-01-111-1/+4
|\ \ | | | | | | GDScript assert message parsing bug fixed
| * | GDScript assert message parsing bug fixedThakee Nathees2020-12-271-1/+4
| | | | | | | | | | | | Fix: #43540
* | | Merge pull request #44672 from ThakeeNathees/array-dict-const-fold-bug-fixRémi Verschelde2021-01-111-0/+2
|\ \ \ | | | | | | | | Array/Dictionary marked as not safe to const fold
| * | | Array/Dictionary marked as not safe to const foldThakee Nathees2020-12-251-0/+2
| | | | | | | | | | | | | | | | Fix: #44459
* | | | Merge pull request #44889 from ThakeeNathees/builtin-invalid-call-crash-fixRémi Verschelde2021-01-111-2/+2
|\ \ \ \ | | | | | | | | | | GDScript invalid method call on built-in crash fix
| * | | | GDScript builtin invalid function call crash fixThakee Nathees2021-01-031-2/+2
| | |/ / | |/| | | | | | | | | | Fix: #44852
* | | | Update copyright statements to 2021Rémi Verschelde2021-01-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 🎆
* | | | Rename empty() to is_empty()Marcel Admiraal2020-12-281-7/+7
|/ / /
* | | Merge pull request #43890 from vnen/gdscript-builtin-functions-refactorRémi Verschelde2020-12-151-10/+85
|\ \ \ | | | | | | | | GDScript: Refactor builtin functions
| * | | GDScript: Refactor builtin functionsGeorge Marques2020-11-261-10/+85
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | They are now called "utility functions" to avoid confusion with methods of builtin types, and be consistent with the naming in Variant. Core utility functions are now available in GDScript. The ones missing in core are added specifically to GDScript as helpers for convenience. Some functions were remove when there are better ways to do, reducing redundancy and cleaning up the global scope.
* | | | Merge pull request #44011 from KoBeWi/red_roses_minus_blue_violetsRémi Verschelde2020-12-031-1/+1
|\ \ \ \ | |_|/ / |/| | | Fix subtracting colors and quats
| * | | Fix subtracting colors and quatsTomasz Chabora2020-12-031-1/+1
| | | |
* | | | Merge pull request #41095 from ThakeeNathees/GDScript-DocumentationRémi Verschelde2020-12-021-1/+6
|\ \ \ \ | |/ / / |/| | | GDScript(2.0) Documentation generation system
| * | | Documentation generation for GDScriptThakee Nathees2020-11-291-1/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - ClassDoc added to GDScript and property reflection data were extracted from parse tree - GDScript comments are collected from tokenizer for documentation and applied to the ClassDoc by the GDScript compiler - private docs were excluded (name with underscore prefix and doesn't have any doc comments) - default values (of non exported vars), arguments are extraced from the parser - Integrated with GDScript 2.0 and new enums were added. - merge conflicts fixed
* | | | GDScript: Don't construct ref values in compilerGeorge Marques2020-11-301-1/+21
|/ / / | | | | | | | | | | | | | | | Values that are passed by reference are not suited for being constructed at compile time because in this case they would be shared across all the construction statements.
* | | Merge pull request #43914 from ThakeeNathees/range-argument-type-bug-fixRémi Verschelde2020-11-271-6/+8
|\ \ \ | | | | | | | | GDScript: range function type check bug fixed
| * | | GDScript range function typecheck bug fixedThakee Nathees2020-11-271-6/+8
| | | | | | | | | | | | | | | | Fix: #43586
* | | | Merge pull request #43895 from vnen/gdscript-operators-fixRémi Verschelde2020-11-261-65/+15
|\ \ \ \ | | | | | | | | | | GDScript: Improve handling of operators
| * | | | GDScript: Improve handling of operatorsGeorge Marques2020-11-261-65/+15
| | |/ / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | - 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.
* | | | GDScript: Don't clear depended parsers too soonGeorge Marques2020-11-261-1/+0
| | | | | | | | | | | | | | | | | | | | It can wait until the analyzer itself is destructed, otherwise other phases might be using freed parsers.
* | | | GDScript: Give an error if dependency can't be parsedGeorge Marques2020-11-261-3/+11
|/ / / | | | | | | | | | Otherwise this may lead to a crash when the dependency is not present.
* / / GDScript: Fix range() being treated as array when optimized outGeorge Marques2020-11-251-6/+10
|/ / | | | | | | | | | | | | The call of range() in a for loop is optimized to use int or vectors, to avoid allocating an array, however the type was set as array still. With the new typed VM this is an issue as the type mismatch the actual value, resulting in wrong instructions to be selected.
* | Variant: Rename Type::_RID to Type::RIDRémi Verschelde2020-11-091-2/+2
| | | | | | | | | | | | | | | | The underscore prefix was used to avoid the conflict between the `RID` class name and the matching enum value in `Variant::Type`. This can be fixed differently by prefixing uses of the `RID` class in `Variant` with the scope resolution operator, as done already for `AABB`.
* | Refactored variant constructor logicreduz2020-11-091-5/+8
| |
* | Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-4/+4
| | | | | | | | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* | Refactored variant setters/gettersreduz2020-11-071-1/+1
| | | | | | | | | | | | -Discern between named, indexed and keyed -Get direct access to functions for typed GDScript and GDNative bindings -Small changes to some classes in order to work with the new setget binder
* | Merge pull request #41516 from Lunatoid/allow-object-newRémi Verschelde2020-11-031-3/+5
|\ \ | |/ |/| Fixed ParseError when calling Object.new()
| * Fixed ParseError when calling Object.new()Lunatoid2020-09-021-3/+5
| | | | | | | | | | | | Fixes #41462 where calling Object.new() in GDScript gave an error. I fixed it by adding exclusion when checking if the name is a builtin type to exclude objects with a comment detailing why.
* | Merge pull request #41983 from ThakeeNathees/array-const-folding-bug-fixGeorge Marques2020-10-201-26/+51
|\ \ | | | | | | Array/Dictionary Nodes no more reduced to array/dictionary variant
| * | Array/Dictinoary no more reduced to array/dictionary variantThakee Nathees2020-09-111-26/+51
| | | | | | | | | | | | | | | | | | Fix: #41377 Fix: #20436 Fix: #41953
* | | Fix typos with codespellRémi Verschelde2020-09-181-1/+1
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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 ```
* | Merge pull request #41709 from ThakeeNathees/dictionary-indexing-bug-fixRémi Verschelde2020-09-081-9/+23
|\ \ | | | | | | Fixed parser error when indexing a dictionary.
| * | fixed parser error when indexing a dictionary.Thakee Nathees2020-09-031-9/+23
| |/ | | | | | | Fix: #41707
* / GDScript: parameter infer type bug fixThakee Nathees2020-09-061-5/+9
|/ | | | Fix: #41772
* Change GDScript compiler to use codegen abstractionGeorge Marques2020-09-011-0/+5
|
* GDScript: Don't mark function parameters as constantGeorge Marques2020-09-011-0/+1
| | | | They can be reassigned as if it were a local variable.
* GDScript: Properly set class inheritance for global classesGeorge Marques2020-09-011-0/+1
|
* GDScript: Fix analysis of singleton dependenciesGeorge Marques2020-09-011-0/+24
| | | | | Sometimes a singleton might depend on another before they are fully compiled so we can't rely on globals in this case.
* GDScript: Don't try to parse constant scripts that aren't validGeorge Marques2020-09-011-41/+48
| | | | Since it's likely that they won't parse correctly.