summaryrefslogtreecommitdiffstats
path: root/modules/mono/editor/script_class_parser.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Add C# source generator for a new ScriptPath attributeIgnacio Etcheverry2021-03-061-753/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This source generator adds a newly introduced attribute, `ScriptPath` to all classes that: - Are top-level classes (not inner/nested). - Have the `partial` modifier. - Inherit `Godot.Object`. - The class name matches the file name. A build error is thrown if the generator finds a class that meets these conditions but is not declared `partial`, unless the class is annotated with the `DisableGodotGenerators` attribute. We also generate an `AssemblyHasScripts` assembly attribute which Godot uses to get all the script classes in the assembly, eliminating the need for Godot to search them. We can also avoid searching in assemblies that don't have this attribute. This will be good for performance in the future once we support multiple assemblies with Godot script classes. This is an example of what the generated code looks like: ``` using Godot; namespace Foo { [ScriptPathAttribute("res://Player.cs")] // Multiple partial declarations are allowed [ScriptPathAttribute("res://Foo/Player.cs")] partial class Player {} } [assembly:AssemblyHasScripts(new System.Type[] { typeof(Foo.Player) })] ``` The new attributes replace script metadata which we were generating by determining the namespace of script classes with a very simple parser. This fixes several issues with the old approach related to parser errors and conditional compilation. It also makes the task part of the MSBuild project build, rather than a separate step executed by the Godot editor.
* CI: Update to clang-format 11 and apply ternary operator changesRémi Verschelde2021-01-121-2/+2
|
* 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 🎆
* Reorganized core/ directory, it was too fatty alreadyreduz2020-11-071-1/+1
| | | | | | -Removed FuncRef, since Callable makes it obsolete -Removed int_types.h as its obsolete in c++11+ -Changed color names code
* [Complex Test Layouts] Change `String` to use UTF-32 encoding on all platforms.bruvzg2020-09-031-4/+4
|
* Make all String float conversion methods be 64-bitAaron Franke2020-07-271-1/+1
|
* Mono/C#: Fix several clang-tidy warnings and cleanupIgnacio Etcheverry2020-07-051-17/+34
|
* Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-9/+0
| | | | | | | | | | | | | | Which means that reduz' beloved style which we all became used to will now be changed automatically to remove the first empty line. This makes us lean closer to 1TBS (the one true brace style) instead of hybridating it with some Allman-inspired spacing. There's still the case of braces around single-statement blocks that needs to be addressed (but clang-format can't help with that, but clang-tidy may if we agree about it). Part of #33027.
* Style: clang-format: Disable AllowShortCaseLabelsOnASingleLineRémi Verschelde2020-05-101-5/+15
| | | | Part of #33027.
* Fix C# preprocessor infinite loop and incorrect parsing of `#if!`Ignacio Etcheverry2020-01-241-10/+9
|
* Add dummy preprocessor for the C# script class parserIgnacio Etcheverry2020-01-211-0/+81
| | | | No attempts are made at conditional compilation. The main if branch is always assumed to be true.
* Mono/C#: Fix error when parsing nested genericsIgnacio Etcheverry2020-01-201-2/+4
| | | | Also fixed the editor not including the parse error message in the error.
* Update copyright statements to 2020Rémi Verschelde2020-01-011-2/+2
| | | | | | | | | | | Happy new year to the wonderful Godot community! We're starting a new decade with a well-established, non-profit, free and open source game engine, and tons of further improvements in the pipeline from hundreds of contributors. Godot will keep getting better, and we're looking forward to all the games that the community will keep developing and releasing with it.
* Mono/C#: Fix class parser incorrectly handling nested namespacesIgnacio Etcheverry2019-12-131-2/+2
| | | | It would incorrectly error thinking the nested namespace is being declared inside a struct/class. This was because of an incorrect nesting level being used for classes and structs.
* Mono/C#: Fix class parser bug with 'where T : struct'Ignacio Etcheverry2019-12-131-38/+15
| | | | The struct decl parsing was outdated. Make both struct decl and class declparsing share the same code.
* Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in 'modules/mono'Ignacio Etcheverry2019-08-091-9/+9
| | | | | | And 'CRASH_*_MSG' as well. Also make error messages puntuation and quotation more consistent.
* Fix parsing of generic type declarations in C# source files.Sebastian Hartte2019-03-201-0/+14
|
* C#: Fix parsing of class full name when the base has genericsIgnacio Etcheverry2019-03-011-14/+11
| | | | Also we no longer ignore base classes with generics, since we don't really care about that.
* Fix -Wsuggest-attribute=format warnings.marxin2019-02-271-1/+1
|
* Add -Wshadow=local to warnings and fix reported issues.marxin2019-02-201-3/+3
| | | | Fixes #25316.
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* Fix missing/malformed license headersRémi Verschelde2019-01-011-0/+30
|
* Parse C# generics and type constraints correctlyCarter Anderson2018-11-241-4/+97
|
* Fix C# parsing the full name of base typesIgnacio Etcheverry2018-10-281-40/+96
| | | | Previously it would fail if the type name included its namespace.
* Parse C# script namespace and classIgnacio Etcheverry2018-10-251-0/+486
- Added a very simple parser that can extract the namespace and class name of a C# script.