summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_parser.h
Commit message (Collapse)AuthorAgeFilesLines
* GDScript: Support `%` in shorthand for `get_node`George Marques2022-05-271-2/+4
| | | | | | The `%` is used in scene unique nodes. Now `%` can also be used instead of `$` for the shorthand, besides being allowed generally anywhere in the path as the prefix for a node name.
* Add a new HashSet templatereduz2022-05-201-4/+4
| | | | | * Intended to replace RBSet in most cases. * Optimized for iteration speed
* Replace most uses of Map by HashMapreduz2022-05-161-6/+6
| | | | | | | | | | | | * 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!
* Add a new HashMap implementationreduz2022-05-121-1/+1
| | | | | | | | | | | | | | | | | Adds a new, cleaned up, HashMap implementation. * Uses Robin Hood Hashing (https://en.wikipedia.org/wiki/Hash_table#Robin_Hood_hashing). * Keeps elements in a double linked list for simpler, ordered, iteration. * Allows keeping iterators for later use in removal (Unlike Map<>, it does not do much for performance vs keeping the key, but helps replace old code). * Uses a more modern C++ iterator API, deprecates the old one. * Supports custom allocator (in case there is a wish to use a paged one). This class aims to unify all the associative template usage and replace it by this one: * Map<> (whereas key order does not matter, which is 99% of cases) * HashMap<> * OrderedHashMap<> * OAHashMap<>
* Fix incorrect precedence of pow operator in GDScript Yuri Rubinsky2022-05-121-0/+1
|
* Implement exponential operator (**) to GDScript/ExpressionsYuri Roubinsky2022-05-111-0/+2
|
* GDScript: Allow using self in lambdasGeorge Marques2022-04-241-0/+2
|
* Fix some issues found by cppcheck.bruvzg2022-04-061-1/+1
|
* Fix autocompletion of static methods in built-in types in GDScriptYuri Roubinsky2022-03-301-1/+1
|
* GDScript: Consolidate behavior for assigning enum typesGeorge Marques2022-02-031-4/+1
| | | | | | | | | | 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.
* Merge pull request #55715 from nathanfranke/enum-orderedRémi Verschelde2022-01-101-1/+1
|\
| * Use OrderedHashMap for enum_valuesNathan Franke2021-12-161-1/+1
| |
* | Merge pull request #56483 from vnen/gdscript-warning-annotationRémi Verschelde2022-01-051-0/+2
|\ \ | | | | | | Add annotation to ignore warnings
| * | GDScript: Add annotation to ignore warningsGeorge Marques2022-01-041-0/+2
| |/
* / Update copyright statements to 2022Rémi Verschelde2022-01-031-2/+2
|/ | | | Happy new year to the wonderful Godot community!
* Don't return reference on copy assignment operatorsRémi Verschelde2021-11-301-2/+1
| | | | | | | | | | | | | We prefer to prevent using chained assignment (`T a = b = c = T();`) as this can lead to confusing code and subtle bugs. According to https://en.wikipedia.org/wiki/Assignment_operator_(C%2B%2B), C++ allows any arbitrary return type, so this is standard compliant. This could be re-assessed if/when we have an actual need for a behavior more akin to that of the C++ STL, for now this PR simply changes a handful of cases which were inconsistent with the rest of the codebase (`void` return type was already the most common case prior to this commit).
* GDScript: Report property type errorsZuBsPaCe2021-10-081-2/+2
| | | | | | | | | Inline getters & setters are now FunctionNodes. Their names are set in the parser, not in the compiler. GDScript-Analyzer will now run through getter and setter. Also report wrong type or signature errors regarding getset properties. Added GDScript tests for getters and setters. #53102
* Merge pull request #52906 from vnen/gdscript-show-error-on-yieldRémi Verschelde2021-09-211-0/+1
|\
| * GDScript: Show specific error when "yield" is usedGeorge Marques2021-09-211-0/+1
| | | | | | | | | | To help people porting code, it gives a hint to use "await" instead of a generic error.
* | GDScript: Allow classes declaration to be done in single lineGeorge Marques2021-09-211-1/+1
|/ | | | | Incidentally, allow multiple statements in single line functions when using semicolon as a terminator.
* Merge pull request #51671 from RandomShaper/fix_gdscript_crashGeorge Marques2021-09-171-0/+4
|\ | | | | Fix some GDScript bugs
| * Implement iterator variable typing in GDScriptPedro J. Estébanez2021-09-111-0/+4
| |
* | [Net] Move multiplayer to core subdir, split RPCManager.Fabio Alessandrelli2021-09-071-3/+3
|/ | | | | | | | | | | Move multiplayer classes to "core/multiplayer" subdir. Move the RPCConfig and enums (TransferMode, RPCMode) to a separate file (multiplayer.h), and bind them to the global namespace. Move the RPC handling code to its own class (RPCManager). Renames "get_rpc_sender_id" to "get_remote_sender_id".
* Remove underscore hacksMax Hilbrunner2021-08-171-1/+0
| | | | | | Way less cruft. :) Co-authored-by: Ignacio Roldán Etcheverry <neikeq@users.noreply.github.com>
* Use const references where possible for List range iteratorsRémi Verschelde2021-07-251-1/+1
|
* [Net] Single `rpc` annotation. "sync" no longer part of mode.Fabio Alessandrelli2021-07-201-2/+1
| | | | | | | | | | | | | | | | - Move the "sync" property for RPCs to RPCConfig. - Unify GDScript annotations into a single one: - `@rpc(master)` # default - `@rpc(puppet)` - `@rpc(any)` # former `@remote` - Implement three additional `@rpc` options: - The second parameter is the "sync" option (which also calls the function locally when RPCing). One of "sync", "nosync". - The third parameter is the transfer mode (reliable, unreliable, ordered). - The third parameter is the channel (unused for now).
* Rename Reference to RefCountedPedro J. Estébanez2021-06-111-1/+1
|
* GDScript: Use analyzer data to decide assignment conversionGeorge Marques2021-05-261-0/+2
| | | | | | | Since there might be tricky cases in the analyzer (in the case of unsafe lines) which would need to be properly checked again. Instead, this splits the code generator in two functions and use information set by the analyzer to tell which function to use, without a need to re-check.
* GDScript: Implement lambdas compilation and runtimeGeorge Marques2021-04-281-1/+2
|
* GDScript: Add lambdas to the type analyzerGeorge Marques2021-04-281-6/+16
| | | | | - Lambdas are always callables (no specific signature match). - Captures from the current context are evaluated.
* GDScript: Add lambda syntax parsingGeorge Marques2021-04-281-5/+24
| | | | | | | | | | | 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: Allow export of enum variablesGeorge Marques2021-03-301-1/+1
| | | | Also fix the enum type in variables to be integer.
* Move GDSript annotation application after type-checkingGeorge Marques2021-03-301-0/+1
| | | | | | This ensures that annotations that rely on the datatype (such as @export) can validated it timely, allowing compound expressions instead of only literal values.
* Add typed arrays to GDScriptGeorge Marques2021-03-291-2/+58
| | | | | | | | - 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 #41897 from strank/not-in-conditional-doneRémi Verschelde2021-03-021-0/+1
|\ | | | | Add a "not in" operator to GDScript.
| * Add a "not in" operator to GDScript.strank2020-09-211-0/+1
| |
* | Initialize class/struct variables with default values in modules/Rafał Mikrut2021-02-081-3/+3
| |
* | Merge pull request #44719 from ThakeeNathees/assert-argument-bug-fixedRémi Verschelde2021-01-111-1/+1
|\ \ | | | | | | GDScript assert message parsing bug fixed
| * | GDScript assert message parsing bug fixedThakee Nathees2020-12-271-1/+1
| | | | | | | | | | | | Fix: #43540
* | | Merge pull request #45076 from ↵Rémi Verschelde2021-01-111-2/+1
|\ \ \ | | | | | | | | | | | | | | | | ThakeeNathees/gdscript-operator-precedence-bug-fix GDScript operator `+` `-` precedence bug fix
| * | | GDScript operator `+` `-` precedence bug fixThakee Nathees2021-01-101-2/+1
| |/ / | | | | | | | | | Fix: #43265
* / / 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 🎆
* | Merge pull request #43890 from vnen/gdscript-builtin-functions-refactorRémi Verschelde2020-12-151-2/+0
|\ \ | | | | | | GDScript: Refactor builtin functions
| * | GDScript: Refactor builtin functionsGeorge Marques2020-11-261-2/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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.
* | | Refactor DocData into core and editor (DocTools) partsThakee Nathees2020-12-021-1/+1
| | |
* | | Documentation generation for GDScriptThakee Nathees2020-11-291-0/+38
|/ / | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - 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
* / Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-11/+11
|/ | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* Change GDScript compiler to use codegen abstractionGeorge Marques2020-09-011-0/+2
|
* GDScript: Allow enum values to be set to constant expressionsGeorge Marques2020-08-181-1/+4
| | | | Also allow them to access previous values wihout referencing the enum.
* Merge pull request #41055 from snichols/null-callee-fixRémi Verschelde2020-08-111-0/+8
|\ | | | | Fix crash with null callee