Commit Graph

1888 Commits

Author SHA1 Message Date
317cd0b19a Refactor some object type checking code with cast_to
Less stringly typed logic, and less String allocations and comparisons.
2022-02-08 10:08:34 +01:00
086256431a [Net] Add type check to GDScriptRPCCallable.
It will print an error when using an RPC defined on an object which does
not extend Node.
2022-02-07 13:39:45 +01:00
994638da4f [Net] Implement GDScript custom RPC callable. 2022-02-07 13:39:10 +01:00
6a56314eab Merge pull request #57748 from fabriceci/rename-script-template-variable 2022-02-07 13:22:23 +01:00
e81ccaf270 rename jump force to jump velocity 2022-02-07 11:46:30 +01:00
a6e280c5de Add some more fixes to visual shader 2022-02-07 11:28:42 +03:00
de45534fed Highlight "namespace" as a GDScript keyword in the syntax highlighter
Like "trait" and "yield", "namespace" is currently not implemented
but is still reserved for future use.
2022-02-04 17:46:13 +01:00
89eb6d372d Merge pull request #57591 from vnen/gdscript-enum-fixes 2022-02-04 13:49:15 +01:00
244db37508 Cleanup and move char functions to the char_utils.h header. 2022-02-04 11:35:01 +02:00
adbe948bda String: Add contains(). 2022-02-04 01:28:02 +05:45
ceafdf347e GDScript: Treat enum values as int and enum types as dictionary
Since enums resolve to a dictionary at runtime, calling dictionary
methods on an enum type is a valid use case. This ensures this is true
by adding test cases. This also makes enum values be treated as ints
when used in operations.
2022-02-03 13:32:34 -03:00
b013c0d544 GDScript: Allow tests to run on release builds
- Fix compilation issues by disabling warnings on release builds. This
  also strips warnings from expected result before the comparison to
  avoid false mismatches.
- Add a `#debug-only` flag to tests. Must be the first line of the test
  script. Those won't run with release builds. Can be used for test
  cases that rely on checks only available on debug builds.
2022-02-03 13:32:33 -03:00
ad6e2e82a9 GDScript: Consolidate behavior for assigning enum types
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.
2022-02-03 13:32:16 -03:00
8e79c5fb8d Add support for the escaped UTF-16 and UTF-32 Unicode characters in the scripts and expressions. 2022-01-30 20:16:04 +02:00
e6caaf4c80 Merge pull request #57205 from TechnoPorg/variant-template-cast
Allow method binds to take Object subclasses as arguments
2022-01-27 23:46:37 +01:00
899cd34426 Merge pull request #57281 from Rubonnek/rename-subsequence 2022-01-27 11:03:13 +01:00
3eb5e0ac50 Rename String::is_subsequence_ofi to String::is_subsequence_ofn 2022-01-26 18:03:56 -05:00
28ac4d8b7d Fix crash with non-constant keys in match statement Dictionary pattern 2022-01-26 04:10:07 +08:00
051ef479c9 Allow method binds to take Object subclasses as arguments
This commit adds a condition to VariantCaster that casts Variants of type OBJECT to any type T, if T is derived from Object.
This change enables a fair bit of code cleanup. First, the Variant implicit cast operators for Node and Control can be removed, which allows for some invalid includes to be removed. Second, helper methods in Tree whose sole purpose was to cast arguments to TreeItem * are no longer necessary.
A few small changes also had to be made to other files, due to the changes cascading down all the includes.
2022-01-25 09:03:36 -07:00
b69b526b7c GDScript cache crashfix. 2022-01-22 17:42:54 -08:00
e1706be25d Merge pull request #57052 from KoBeWi/nosort 2022-01-23 00:27:01 +01:00
b5f524d4c0 Merge pull request #55433 from V-Sekai/prev_operand_nullptr_check
Check for nullptr expression in parse_precedence function
2022-01-22 20:31:45 +01:00
182a36db47 Merge pull request #55214 from Scony/fix-gdscript-crash-2
Fix GDScript parser crash on 'dollar mixed with assignment' expression
2022-01-22 20:30:54 +01:00
f056cb8ebc Don't sort printed Dictionary 2022-01-22 13:45:02 +01:00
7b0ed2aa5e Rename Variant::is_ref() to is_ref_counted() 2022-01-20 18:46:25 +01:00
846c14eee9 Merge pull request #56739 from strank/master
GDScript: Fix parsing default parameter values from function calls
2022-01-17 21:38:01 +01:00
4cfade6212 Merge pull request #55995 from Xwdit/enum_fix
Fix enum int comparison
2022-01-17 20:20:16 +01:00
91909ef801 Merge pull request #55625 from cdemirer/fix-type-guessing-and-gdscript-parser-printing
Fix `--test gdscript-parser` crash
2022-01-17 20:17:02 +01:00
12ab19fa26 Merge pull request #55616 from cdemirer/master
Fix nested ternary-if codegen
2022-01-17 20:16:26 +01:00
fffeecfd68 Improvments for SyntaxHighlighters
- Fix immedate Funcion in lamba highlight
- Highlight signals as one colour
- Highlight node paths as one colour
- Highlight escape chars in strings
2022-01-15 15:39:55 +00:00
3efa6644c4 Merge pull request #55541 from KoBeWi/outcognito_scripts 2022-01-14 21:04:13 +01:00
858bcd5058 Fix various typos
Found via `codespell -q 3 -S ./thirdparty,*.po,./DONORS.md -L ackward,ang,ans,ba,beng,cas,childs,childrens,dof,doubleclick,expct,fave,findn,gird,hist,inh,inout,leapyear,lod,nd,numer,ois,ony,paket,ro,seeked,sinc,switchs,te,uint,varn,vew`
2022-01-13 23:20:01 -05:00
960a26f6c0 GDScript: Fix parsing default parameter values from function calls 2022-01-13 19:28:39 -05:00
f0382530a7 Merge pull request #56268 from KoBeWi/🚗complete_setters 2022-01-13 12:40:48 +01:00
f524ddebd5 Make script type distinguishable by icon 2022-01-13 12:29:05 +01:00
64d8b3aef2 Assign member type when parsing setters to prevent
'Compiler bug: unresolved assign' errors
2022-01-11 11:23:17 +00:00
b3513cffc5 Merge pull request #56326 from NNesh/fix/unknown_default_value_callable
Extended the _make_arguments_hint function to get default values for function arguments in hint
2022-01-10 21:29:13 +01:00
374baff747 Fixed <unknown> text for callable default value for a function arguments hint
Format switch

Added a case for constant subscripts

Fixed default value hinting for the enum type

Removed is_null checking for value

Added a case for dictionary
2022-01-10 23:22:35 +05:00
49482966ec Merge pull request #55715 from nathanfranke/enum-ordered 2022-01-10 17:19:52 +01:00
1989120d3f Merge pull request #56194 from cdemirer/fix-operation-result-type-inference 2022-01-10 17:18:32 +01:00
4acc819f9b Merge pull request #56232 from V-Sekai/invalid_explicit_variant_assign_fix 2022-01-10 17:12:56 +01:00
cc7f634066 Merge pull request #56260 from cdemirer/fix-type-mutation-upon-assignment-with-operation 2022-01-10 17:12:34 +01:00
c8b4fe3b8d Merge pull request #56287 from cdemirer/fix-member-property-only-getter-cant-be-set 2022-01-10 17:12:06 +01:00
1fd5954962 Merge pull request #56288 from cdemirer/fix-member-property-getter-dont-update-subscript-chain-root 2022-01-10 17:10:57 +01:00
8f8c3f4b4c Merge pull request #56342 from NNesh/fix/class-completion 2022-01-10 17:07:08 +01:00
b3d208385f Merge pull request #56409 from cdemirer/fix-unexpected-copying-when-parameter-is-typed 2022-01-10 17:03:47 +01:00
609964848d Fix leak when function returning self type
Leak is caused by cyclic reference
2022-01-10 02:14:48 +08:00
1a1ee43e3e Fixed completion showing for class members 2022-01-08 01:49:18 +05:00
393a44b275 Merge pull request #55213 from Scony/fix-gdscript-crash 2022-01-06 20:54:03 +01:00
c69e0d16bc Fix multiple missing UTF-8 decoding. 2022-01-06 14:35:22 +02:00