Commit Graph

65 Commits

Author SHA1 Message Date
abfc528439 Merge pull request #43890 from vnen/gdscript-builtin-functions-refactor
GDScript: Refactor builtin functions
2020-12-15 20:51:38 +01:00
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
4c232e4222 Fix subtracting colors and quats 2020-12-03 14:22:12 +01:00
d1231be1c8 Merge pull request #41095 from ThakeeNathees/GDScript-Documentation
GDScript(2.0) Documentation generation system
2020-12-02 14:15:38 +01:00
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
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
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
f0613a91be GDScript range function typecheck bug fixed
Fix: #43586
2020-11-27 18:23:35 +05:30
ed2f84735b Merge pull request #43895 from vnen/gdscript-operators-fix
GDScript: Improve handling of operators
2020-11-26 21:19:31 +01:00
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
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
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
c7b6a7adcc GDScript: Refactor builtin functions
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.
2020-11-26 12:05:42 -03:00
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
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
221a2a1742 Refactored variant constructor logic 2020-11-09 08:54:43 -03:00
127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
05de7ce6ca Refactored variant setters/getters
-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
2020-11-07 15:16:15 -03:00
bd13e82080 Merge pull request #41516 from Lunatoid/allow-object-new
Fixed ParseError when calling Object.new()
2020-11-03 13:08:48 +01:00
96884ef41e Merge pull request #41983 from ThakeeNathees/array-const-folding-bug-fix
Array/Dictionary Nodes no more reduced to array/dictionary variant
2020-10-20 15:43:07 -03:00
3e78963bb9 Fix typos with codespell
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
```
2020-09-18 13:44:25 +02:00
3886a2f9f6 Array/Dictinoary no more reduced to array/dictionary variant
Fix: #41377
Fix: #20436
Fix: #41953
2020-09-11 19:46:20 +05:30
2410016638 Merge pull request #41709 from ThakeeNathees/dictionary-indexing-bug-fix
Fixed parser error when indexing a dictionary.
2020-09-08 21:38:14 +02:00
89489a3cac GDScript: parameter infer type bug fix
Fix: #41772
2020-09-06 13:26:52 +05:30
4fc14e8e11 fixed parser error when indexing a dictionary.
Fix: #41707
2020-09-03 18:04:54 +05:30
07053d0c6a Fixed ParseError when calling Object.new()
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.
2020-09-02 00:11:58 +02:00
745ca3059d Change GDScript compiler to use codegen abstraction 2020-09-01 14:36:22 -03:00
a889084864 GDScript: Don't mark function parameters as constant
They can be reassigned as if it were a local variable.
2020-09-01 09:26:28 -03:00
c8e10aa20b GDScript: Properly set class inheritance for global classes 2020-09-01 09:26:28 -03:00
f8fa5e4738 GDScript: Fix analysis of singleton dependencies
Sometimes a singleton might depend on another before they are fully
compiled so we can't rely on globals in this case.
2020-09-01 09:26:28 -03:00
1ddb9b1a52 GDScript: Don't try to parse constant scripts that aren't valid
Since it's likely that they won't parse correctly.
2020-09-01 09:26:27 -03:00
b2b45987d0 GDScript: Show error when there's an inheritance cycle 2020-08-26 16:01:08 -03:00
8ccf88a206 GDScript: Fix issues when deriving from other scripts 2020-08-26 14:50:27 -03:00
ca90c9c9a9 GDScript: Properly resolve external inner classes from preload
This gets the correct parser and class node when resolving from a full
GDScript reference.
2020-08-23 12:55:27 -03:00
58f5c2bab6 Merge pull request #41238 from MarianoGnu/gdscript-export-resource
Fix GdScript Analyzier not detecting Resource subclass correctly
2020-08-23 11:04:52 -03:00
a880f590e4 GDScript: Make subscript access be properly type checked 2020-08-19 14:35:26 -03:00
cd3f51c67c GDScript: Check duplicate keys in dictionaries and enums 2020-08-19 11:14:16 -03:00
f9ad0b30fa GDScript: Allow preload() to be used with constant expressions 2020-08-19 10:45:00 -03:00
35176247af GDScript: Allow enum values to be set to constant expressions
Also allow them to access previous values wihout referencing the enum.
2020-08-18 17:44:20 -03:00
99d4ea8c79 GDScript: Allow supertype objects to be assigned to a subtype variable
It allows `get_node()` to be used with typed variables

This is marked as unsafe to warn the user.
2020-08-18 15:12:51 -03:00
8bc9b3a2ae GDScript: Allow implicit type conversion when constructing variants
Incidentally fix error message when no valid constructor is found which
was missing an end parenthesis.
2020-08-18 13:12:18 -03:00
f374021d52 GDSript: Prevent crash when completing unary operators 2020-08-17 20:49:04 -03:00
d45e1befe3 GDScript: Fix wrong argument check for formatting operator 2020-08-17 19:49:54 -03:00
a8c01df647 Fix GdScript Analyzier not detecting Resource subclass correctly 2020-08-13 19:46:57 -03:00
9413446b2d Merge pull request #41104 from vnen/gdscript-assignment-tidy
Tidy up assignment operator check
2020-08-12 08:54:48 -03:00
cf05486d8e Merge pull request #41055 from snichols/null-callee-fix
Fix crash with null callee
2020-08-11 15:15:43 +02:00
69c81309cc Merge pull request #40673 from ThakeeNathees/gdscript-op-eval-validation
GDScript operator evaluation validation bug fix
2020-08-08 10:52:40 -03:00
1f14068727 Merge pull request #40951 from bruvzg/gds_cleanup
[GDScript] Add static HashMap cleanup.
2020-08-08 10:44:57 -03:00
3aef60591b GDScript: Tidy up assignment operator check
The operator is already gathered by the parser, no need to do it again
in the analyzer.
2020-08-08 10:37:51 -03:00
38c7d080e8 GDScript: unsafe arithmetic assignment bug fix
Fix: #41051
2020-08-06 11:12:26 +05:30