summaryrefslogtreecommitdiffstats
path: root/modules/gdscript/gdscript_compiler.cpp
Commit message (Collapse)AuthorAgeFilesLines
* Merge pull request #38067 from ThakeeNathees/elif-error-line-fixedRémi Verschelde2020-06-171-0/+4
|\ | | | | GDScript debugger incorrect error line fixed
| * GDScript debugger incorrect error line fixedThakee Nathees2020-06-171-0/+4
| | | | | | | | | | if the first line of an else or an elif throws a runtime error the debugger shows incorrect line number.
* | Style: Enforce braces around if blocks and loopsRémi Verschelde2020-05-141-98/+195
| | | | | | | | | | Using clang-tidy's `readability-braces-around-statements`. https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
* | Style: Enforce separation line between function definitionsRémi Verschelde2020-05-141-0/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | I couldn't find a tool that enforces it, so I went the manual route: ``` find -name "thirdparty" -prune \ -o -name "*.cpp" -o -name "*.h" -o -name "*.m" -o -name "*.mm" \ -o -name "*.glsl" > files perl -0777 -pi -e 's/\n}\n([^#])/\n}\n\n\1/g' $(cat files) misc/scripts/fix_style.sh -c ``` This adds a newline after all `}` on the first column, unless they are followed by `#` (typically `#endif`). This leads to having lots of places with two lines between function/class definitions, but clang-format then fixes it as we enforce max one line of separation. This doesn't fix potential occurrences of function definitions which are indented (e.g. for a helper class defined in a .cpp), but it's better than nothing. Also can't be made to run easily on CI/hooks so we'll have to be careful with new code. Part of #33027.
* | Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocksRémi Verschelde2020-05-141-108/+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-10/+30
| | | | | | | | Part of #33027.
* | Style: clang-format: Disable AllowShortIfStatementsOnASingleLineRémi Verschelde2020-05-101-21/+42
|/ | | | | | | Part of #33027, also discussed in #29848. Enforcing the use of brackets even on single line statements would be preferred, but `clang-format` doesn't have this functionality yet.
* Replace NULL with nullptrlupoDharkael2020-04-021-14/+14
|
* Style: Set clang-format Standard to Cpp11Rémi Verschelde2020-03-171-1/+1
| | | | | | | | | | For us, it practically only changes the fact that `A<A<int>>` is now used instead of the C++03 compatible `A<A<int> >`. Note: clang-format 10+ changed the `Standard` arguments to fully specified `c++11`, `c++14`, etc. versions, but we can't use `c++17` now if we want to preserve compatibility with clang-format 8 and 9. `Cpp11` is still supported as deprecated alias for `Latest`.
* Refactor ScriptDebugger.Fabio Alessandrelli2020-03-081-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | EngineDebugger is the new interface to access the debugger. It tries to be as agnostic as possible on the data that various subsystems can expose. It allows 2 types of interactions: - Profilers: A subsystem can register a profiler, assigning it a unique name. That name can be used to activate the profiler or add data to it. The registered profiler can be composed of up to 3 functions: - Toggle: called when the profiler is activated/deactivated. - Add: called whenever data is added to the debugger (via `EngineDebugger::profiler_add_frame_data`) - Tick: called every frame (during idle), receives frame times. - Captures: (Only relevant in remote debugger for now) A subsystem can register a capture, assigning it a unique name. When receiving a message, the remote debugger will check if it starts with `[prefix]:` and call the associated capture with name `prefix`. Port MultiplayerAPI, Servers, Scripts, Visual, Performance to the new profiler system. Port SceneDebugger and RemoteDebugger to the new capture system. The LocalDebugger also uses the new profiler system for scripts profiling.
* Reworked signal connection system, added support for Callable and Signal ↵Juan Linietsky2020-02-201-2/+2
| | | | objects and made them default.
* Keep a weak reference to orphan subclasses to reuse on class reloadChibiDenDen2020-01-151-2/+8
|
* Add fully_qualified_name for GDScript classDani Frank2020-01-141-0/+4
|
* GDScript: Don't re-evaluate index on assigment with operationGeorge Marques2020-01-091-7/+9
| | | | | | | Pass the calculated index from the stack and use the same to get and set the value. This avoids a function with side effects being evaluated twice when using indexing in an assignment with operation statement (e.g. a[function()] += 1).
* 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.
* GDScript: Fix type conversion in assignment with operationGeorge Marques2019-12-131-1/+1
|
* Merge pull request #32150 from luzpaz/typosRémi Verschelde2019-09-201-1/+1
|\ | | | | Fix misc. source comment typos
| * Fix misc. source comment typosluz.paz2019-09-191-1/+1
| | | | | | Found using `codespell -q 3 -S ./thirdparty,*.po -L ang,ba,cas,dof,doubleclick,fave,hist,leapyear,lod,nd,numer,ois,paket,seeked,sinc,switchs,te,uint -D ~/Projects/codespell/codespell_lib/data/dictionary.txt `
* | GDScript: add an optional message parameter to assert()Mitch Curtis2019-09-111-0/+8
|/ | | | | | | | | | | | | | | | | Before this patch, assert() only took the condition to assert on: assert(item_data) Now, it can optionally take a string that will be printed upon failure: assert(item_data, item_name + " has no item data in ItemDatabase") This makes it easier to immediately see what the issue is by being able to write informative failure messages. Thanks to @wiped1 for sharing their patch, upon which this is based. Closes #17082
* Replace 'ERR_EXPLAIN' with 'ERR_FAIL_*_MSG' in "platform", ↵Robin Hübner2019-08-091-4/+2
| | | | "modules/gdnative", "modules/gdscript" directories.
* Remove unnecessary code and add some error explanationsqarmin2019-07-011-2/+0
|
* Some code changed with Clang-Tidyqarmin2019-06-261-1/+1
|
* Fix GDSCript inner classes be freed after compilegeequlim2019-06-021-4/+4
|
* Fix `as` operator generating opcode 38 errorsBojidar Marinov2019-04-101-5/+18
| | | | | | | Closes #27489 Fixup of 466a76ac2c7c6634ed1d78fde4ac011e2e70b710 Additionally, update `GDScriptCompiler` test to use Ref and to include `as` expressions.
* Merge pull request #27128 from bojidar-bg/27111-gdscript-confounding-classRémi Verschelde2019-03-271-124/+66
|\ | | | | Fix GDScriptCompiler bugging out with identically-named inner class
| * Fix GDScriptCompiler bugging out with identically-named inner classBojidar Marinov2019-03-161-124/+66
| | | | | | | | Fixes #27111
* | Fix duplicated lines in GDScript bytecodeBojidar Marinov2019-03-141-5/+0
|/ | | | Fixes #26789
* Add -Wshadow=local to warnings and fix reported issues.marxin2019-02-201-27/+27
| | | | Fixes #25316.
* GDScript: Remove unused `switch`, `case` and `do` CF keywordsRémi Verschelde2019-02-201-3/+0
| | | | | | | | | | | | They had been reserved for future implementation, but we now have the `match` CF keyword which does the same and more. According to @reduz `do` was even added by mistake when copying from the shader language parser, it was never intended to add support for `do`... `while` loops, as the syntax would be awkward in GDScript, and the added sugar is not worth it. Fixes #25787.
* GDScript compiler: check if subclass exists before comparisonGeorge Marques2019-01-171-2/+2
| | | | | Otherwise these checks might trigger the insertion of an empty value, leading to crashes.
* Update copyright statements to 2019Rémi Verschelde2019-01-011-2/+2
| | | | Happy new year to the wonderful Godot community!
* Fix many errors found by PVS-StudioAaron Franke2018-11-281-1/+1
| | | Fix errors 2, 3, 4, 6, 8, 9, 11, 12, 13, 14, and 15.
* Revert "Fix crash on signal/resume to dangling target"Pedro J. Estébanez2018-11-241-10/+10
| | | | This reverts commit 54bdc1e1f6a7fb85a5b193c9b8ecf0dcf06949e6.
* Fix crash on signal/resume to dangling targetPedro J. Estébanez2018-10-171-10/+10
| | | | Fixes #22443.
* GDScript: Fix stack address test in compilerGeorge Marques2018-09-191-8/+8
|
* Misc. typosluz.paz2018-09-121-1/+1
| | | Found via `codespell -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"`
* Merge pull request #21449 from vnen/gdscript-builtin-isRémi Verschelde2018-08-271-0/+19
|\ | | | | Allow `is` operator to test built-in types
| * GDScript: Allow `is` operator to test built-in typesGeorge Marques2018-08-261-0/+19
| |
* | Fixes several resource leaks in ...Crazy-P2018-08-261-0/+9
|/ | | | | | | | - gdscript - gdscript_compiler - regex - android/export - gles3/rasterizer (scene and storage)
* Make some debug prints verbose-only, remove othersRémi Verschelde2018-08-241-4/+0
|
* GDSCript: Fix cyclic class dependency detectionGeorge Marques2018-08-211-2/+4
|
* GDScript: Fix main script detectionGeorge Marques2018-07-251-4/+4
|
* Reduce unnecessary COW on Vector by make writing explicitHein-Pieter van Braam2018-07-261-18/+18
| | | | | | | | | | | | | | | | | | | | | | | This commit makes operator[] on Vector const and adds a write proxy to it. From now on writes to Vectors need to happen through the .write proxy. So for instance: Vector<int> vec; vec.push_back(10); std::cout << vec[0] << std::endl; vec.write[0] = 20; Failing to use the .write proxy will cause a compilation error. In addition COWable datatypes can now embed a CowData pointer to their data. This means that String, CharString, and VMap no longer use or derive from Vector. _ALWAYS_INLINE_ and _FORCE_INLINE_ are now equivalent for debug and non-debug builds. This is a lot faster for Vector in the editor and while running tests. The reason why this difference used to exist is because force-inlined methods used to give a bad debugging experience. After extensive testing with modern compilers this is no longer the case.
* Use type information to enable GDScript introspectionGeorge Marques2018-07-201-39/+61
| | | | | This makes the Script API provide accurate information when requesting property or method info.
* Add typed instructions to GDScriptGeorge Marques2018-07-201-6/+165
| | | | | | | - Typed assignment (built-in, native, and script). - Cast (built-in conversion; native and script checks). - Check type of functions arguments on call. - Check type of members on set.
* Add static type checks in the parserGeorge Marques2018-07-201-13/+6
| | | | | | | | | | | | - Resolve types for all identifiers. - Error when identifier is not found. - Match return type and error when not returning a value when it should. - Check unreachable code (code after sure return). - Match argument count and types for function calls. - Determine if return type of function call matches the assignment. - Do static type check with match statement when possible. - Use type hints to determine export type. - Check compatibility between type hint and explicit export type.
* Move inheritance resolution to the parserGeorge Marques2018-07-201-227/+113
|
* Add typing syntaxGeorge Marques2018-07-201-0/+4
|
* Style: Format code with clang-format 6.0.1Rémi Verschelde2018-07-181-1/+1
|
* Global class names (and GDScript support for it)Juan Linietsky2018-07-151-0/+35
|