Commit graph

1399 commits

Author SHA1 Message Date
Rémi Verschelde ea7dd1be36
Merge pull request #43328 from gvekan/better-keyword-completion
Add bracket or space to some keyword completions
2020-12-03 17:14:32 +01:00
Rémi Verschelde 9c30c83aee
Merge pull request #44011 from KoBeWi/red_roses_minus_blue_violets
Fix subtracting colors and quats
2020-12-03 14:44:52 +01:00
Tomasz Chabora 4c232e4222 Fix subtracting colors and quats 2020-12-03 14:22:12 +01:00
Rémi Verschelde 9a0610c1ff
Merge pull request #43959 from dalexeev/gds-doc
Several edits to the GDScript docs
2020-12-03 13:32:32 +01:00
Gustav dff3875ae3 Add bracket or space to some keyword completions 2020-12-03 09:44:42 +01:00
Rémi Verschelde d1231be1c8
Merge pull request #41095 from ThakeeNathees/GDScript-Documentation
GDScript(2.0) Documentation generation system
2020-12-02 14:15:38 +01:00
George Marques 0019aa940e
Merge pull request #41773 from ThakeeNathees/default-argument-override-buf-fix
GDScript default argument override bug fix
2020-12-02 09:54:47 -03:00
Thakee Nathees 42bfa16996 Refactor DocData into core and editor (DocTools) parts 2020-12-02 00:48:39 +05:30
Danil Alexeev bf96056ad0 Several edits to the GDScript docs 2020-12-01 16:05:10 +03:00
Rémi Verschelde 04bef80b42
Merge pull request #43992 from vnen/variant-internal-object-set
Fix VariantInternal initialization and setting of object
2020-11-30 20:22:15 +01:00
Rémi Verschelde 8f3dde18f1
Merge pull request #43504 from AndreaCatania/gds_fix_2
Implement proper error print, Fixes a crash when no error messages are generated by the analyser.
2020-11-30 19:10:38 +01:00
George Marques 029fd88adb
Fix VariantInternal initialization and setting of object
- Initialize Object pointer to nullptr so it's not used by mistake.
- When setting an Object check if it's a reference so refcounting works
  as intended.
2020-11-30 14:49:52 -03:00
George Marques a604e72dc9
GDScript: Don't construct ref values in compiler
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.
2020-11-30 09:42:22 -03:00
Thakee Nathees d0e7d9b62f Documentation generation for GDScript
- 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
2020-11-29 19:45:36 +05:30
Thakee Nathees d42b305377 GDScript default argument override bug fix
Fix: #41766
2020-11-28 20:42:57 +05:30
AndreaCatania 40403b02fb Implement proper error print, Fixes a crash when no error messages are generated by the analyser. 2020-11-28 13:47:52 +01:00
Rémi Verschelde d395f70828
Merge pull request #43500 from AndreaCatania/gds_fixes
Fixes crash when parse_expression returns nullptr.
2020-11-27 16:37:45 +01:00
Rémi Verschelde 9f9b269d32
Merge pull request #43914 from ThakeeNathees/range-argument-type-bug-fix
GDScript: range function type check bug fixed
2020-11-27 15:08:02 +01:00
George Marques cf7a6be1db
Merge pull request #43226 from mateosss/unreachable-prop-crash
Fix crash due to unreachable code in properties
2020-11-27 11:03:20 -03:00
Thakee Nathees f0613a91be GDScript range function typecheck bug fixed
Fix: #43586
2020-11-27 18:23:35 +05:30
George Marques fbb806fd68
Unregister GDScriptFunctionState class
This is not user accessible anymore so it does not need to be show in
documentation.
2020-11-26 21:39:54 -03:00
Rémi Verschelde ed2f84735b
Merge pull request #43895 from vnen/gdscript-operators-fix
GDScript: Improve handling of operators
2020-11-26 21:19:31 +01:00
Rémi Verschelde e5ff2d0ffd
Merge pull request #43894 from vnen/gdscript-some-fixes
Some GDScript fixes
2020-11-26 18:56:42 +01:00
George Marques 0cb185927c
GDScript: Improve handling of operators
- 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-26 14:41:55 -03:00
George Marques 627ca7f30e
GDScript: Don't clear depended parsers too soon
It can wait until the analyzer itself is destructed, otherwise other
phases might be using freed parsers.
2020-11-26 14:14:29 -03:00
George Marques 817fb3d702
GDScript: Give an error if dependency can't be parsed
Otherwise this may lead to a crash when the dependency is not present.
2020-11-26 12:27:48 -03:00
Jordan Schidlowsky afa15c5f15 fixes crash for OPCODE_CAST_TO_NATIVE opcode in gdscript disassemlber 2020-11-25 16:26:32 -06:00
Rémi Verschelde fc28de64c4
Merge pull request #43856 from vnen/gdscript-some-fixes
A couple of GDScript fixes
2020-11-25 17:13:41 +01:00
George Marques ed3d8f31df
GDScript: Fix return of cast expression on compilation
It was mistakenly returning the source instead of the result.
2020-11-25 11:37:51 -03:00
George Marques fb3dc2670a
GDScript: Fix range() being treated as array when optimized out
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.
2020-11-25 11:35:07 -03:00
George Marques 2e528ef382
GDScript: Fix mishandling of stack pointers
- Replace the for loop temporaries by locals. They cause conflicts with
  the stack when being popped, while locals are properly handled in the
  scope.
- Change the interface for the codegen so the for loop list doesn't live
  through the whole block if it's a temporary.
- Keep track of the actual amount of local variables in the stack. Using
  the size of the map is misleading in cases where multiple locals have
  the same name (which is allowed when there's no shadowing).
- Added a few debug checks for temporaries, to avoid them being wrongly
  manipulated in the future. They should not live more than a line of
  code.
- Rearrange some of compiler code to make sure the temporaries don't
  live across blocks.
2020-11-25 11:24:13 -03:00
George Marques 5518e2a68e
GDScript: Add faster instruction for validated constructor
Only for built-in types.
2020-11-21 13:30:17 -03:00
George Marques e0dca3c6b6
GDScript: Add typed iterate instructions 2020-11-21 13:24:50 -03:00
George Marques 52ab64db69
GDScript: Add faster call instructions for builtin methods
Methods from builtin types can be called by using the function pointer
when the argument and base types are known at compile time.
2020-11-21 13:24:50 -03:00
George Marques d8b22097f2
GDScript: Add faster call instructions for native methods 2020-11-21 13:24:50 -03:00
George Marques 5aeb390cd7
GDScript: Add speficic set/get instructions
When the base type is known at compile-time, we can get a direct
function pointer that is faster than the regular set/get paths.
2020-11-21 13:24:49 -03:00
George Marques 1ad5c926dc
GDScript: Add faster operator for known types
It now uses the direct operator function pointer, which increases
performance in evaluation.
2020-11-21 13:24:49 -03:00
George Marques c707d6fe71
GDScript: Gather instructions arguments beforehand
Almost all instructions need variant arguments. With this change they
are loaded in an array before each instruction call. This makes the
addressing code be localized to less places, improving compilation
overhead and binary size by a small margin.

This should not affect performance.
2020-11-21 13:24:49 -03:00
George Marques b6519d0d03
GDScript: Split Function code into multiple files
To improve organization and reduce the size of compilation units.
2020-11-21 13:24:49 -03:00
Aaron Franke 02161aad5a
Remove empty lines around braces with the formatting script 2020-11-16 23:38:11 -05:00
Andrea Catania 98daa0af6b Fixes crash when returns . 2020-11-13 15:09:52 +01:00
George Marques 8bcd345782
GDScript: Fix native class not set with inheritance 2020-11-13 10:35:24 -03:00
reduz 635d33dc6c Refactor variant built-in methods yet again.
* Using C-style function pointers now, InternalMethod is gone.
* This ensures much better performance in typed code.
* Renamed builtin_funcs to utility_funcs, to avoid naming confusion
2020-11-11 16:36:36 -03:00
Aaron Franke ee79fc627c
Minor clamp and float fixes 2020-11-10 14:30:07 -05:00
Gustav 0ddd4097a6 Fix completion for built-in load function 2020-11-10 12:00:08 +01:00
Rémi Verschelde 68067b8d97
Merge pull request #43423 from Calinou/doc-assert-avoid-side-effects
Clarify that code in `assert()` should avoid side effects
2020-11-10 11:31:28 +01:00
Rémi Verschelde 0f249f5c0a
Variant: Sync docs with new constructors, fixups after #43403
Change DocData comparators for MethodDoc and ArgumentDoc to get a better
ordering of constructors.
2020-11-09 23:39:53 +01:00
Hugo Locurcio d6c7073bd7
Clarify that code in assert() should avoid side effects 2020-11-09 21:48:24 +01:00
Rémi Verschelde 9d2e8f2f27
Variant: Rename Type::_RID to Type::RID
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`.
2020-11-09 16:29:04 +01:00
reduz 221a2a1742 Refactored variant constructor logic 2020-11-09 08:54:43 -03:00