Commit graph

125 commits

Author SHA1 Message Date
Rémi Verschelde
490aef9369 Merge pull request #10581 from hpvb/fix-gcc6+
Make cast_to a static member of Object.
2017-08-25 08:37:38 +02:00
Juan Linietsky
b1c0e45b03 Implemented, The Amazing Zylann Hack (tm), fixes #10603 2017-08-25 00:34:32 -03:00
Hein-Pieter van Braam
cacced7e50 Convert Object::cast_to() to the static version
Currently we rely on some undefined behavior when Object->cast_to() gets
called with a Null pointer. This used to work fine with GCC < 6 but
newer versions of GCC remove all codepaths in which the this pointer is
Null. However, the non-static cast_to() was supposed to be null safe.

This patch makes cast_to() Null safe and removes the now redundant Null
checks where they existed.

It is explained in this article: https://www.viva64.com/en/b/0226/
2017-08-24 23:08:24 +02:00
Juan Linietsky
36e0a72c77 -Code completion for enumerations
-Disabled GDNative and GDNativeScript so build compiles again
2017-08-24 00:06:56 -03:00
Karroffel
57654d4b95 support enums and nested constants in match statement
The initial version of the pattern matcher in GDScript does not
allow matching on nested identifiers, only one identifiers available
in the current scope.

With the introduction of enums to GDScript that's a huge missing
feature. This commit makes the parser accept indexed constants and
variables to properly support enums.
2017-08-22 17:45:05 +02:00
Wilson E. Alvarez
738d2ab969 Removed unnecessary assignments 2017-08-21 15:15:55 -04:00
Juan Linietsky
95f10c620d push variable later when created, to avoid self-referencing as a valid case, closes #6111 2017-08-08 11:44:49 -03:00
Bojidar Marinov
a5fb82c28c
Fix $a/b being parsed as division 2017-07-26 18:51:03 +03:00
Karroffel
5319098aef fix a regression (GDScript) from e00630b
This removes `not` from the variable safe list of
keywords.
Before that this was a valid expression:
    self.!(some_arg)

The other fix is just a forgotten boolean negation.
2017-07-25 20:01:19 +02:00
Bojidar Marinov
1936e1d2be
Make GDScript allow some keywords as identifiers
Fixes #8085
Added some comments around the use of is_token_literal, as discussed.
2017-07-23 23:34:31 +03:00
Bojidar Marinov
26a51c3c0b
Reimplement for..in range() so that it always results in ints
Fixes #8278, fixup of bfef8de1bc
2017-06-22 20:41:52 +03:00
Andreas Haas
015d36d18b
GDScript: Use "is" keyword for type checking.
Replaces the `extends` keyword with `is` in the context of testing for type compatibility.
`extends` is still used for declaring class inheritance.

Example:

```gdscript
extends Node2D

func _input(ev):
	if ev is InputEventKey:
		print("yay, key event")
```
2017-05-27 10:59:59 +02:00
Bojidar Marinov
837a667225
Fix #8674, and rename a few things for clarity 2017-05-08 22:39:27 +03:00
mbalint12
71978685f9 Added autocomplete for file paths in the script editor 2017-04-18 17:22:01 +02:00
Bojidar Marinov
7cc561fe0e
Fixup #8123, seems like I forgot a few things
Should close #8315
Please test, I'm still unsure I did it correctly...
2017-04-08 19:42:37 +03:00
Rémi Verschelde
df61dc4b2b Add "Godot Engine contributors" copyright line 2017-04-08 00:11:42 +02:00
curtisxk38
d35fab7382 Fix typo in Parser Error message 2017-04-05 23:11:05 -04:00
Rémi Verschelde
495710c3d6 Merge pull request #8123 from bojidar-bg/gdscript-inline-block-indent
Make inline blocks in GDScript more (or less) pythonic
2017-03-24 22:52:09 +01:00
Rémi Verschelde
debeee56f7 Fix typos in source code using codespell
From https://github.com/lucasdemarchi/codespell
2017-03-24 21:45:31 +01:00
Bojidar Marinov
18ab88b3f1
Make inline blocks in GDScript more pythonic
Fixes #8001
2017-03-23 20:07:02 +02:00
Rémi Verschelde
5dbf1809c6 A Whole New World (clang-format edition)
I can show you the code
Pretty, with proper whitespace
Tell me, coder, now when did
You last write readable code?

I can open your eyes
Make you see your bad indent
Force you to respect the style
The core devs agreed upon

A whole new world
A new fantastic code format
A de facto standard
With some sugar
Enforced with clang-format

A whole new world
A dazzling style we all dreamed of
And when we read it through
It's crystal clear
That now we're in a whole new world of code
2017-03-05 16:44:50 +01:00
Saracen
5e938f0001 Inf and NaN support added to GDScript. 2017-02-28 21:52:33 +00:00
Rémi Verschelde
a78c314b0e Merge pull request #7809 from hpvb/fix-6798
Allow preload to accept a const string.
2017-02-26 20:12:36 +01:00
Hein-Pieter van Braam
3e5743ca36 Allow preload to accept a const string.
In preload() parsing this code will lookup the identifier in the local
constant database. If the identifier corresponds to a string constant
it is used as the path for preload().

Currently this does not work for global constants, only constants
declared in the same class as the preload is happening. We can implement
a full fix too. Maybe we can use this PR to discuss the possibilities.

This (partially) fixes #6798
2017-02-16 14:29:18 +01:00
Juan Linietsky
d7fd86d51a -begin of export work, not done yet
-fixes to make scenes exported from godot 2.x work
2017-02-15 08:30:32 -03:00
lonesurvivor
c71a6c6d71 Fix parsing bug which causes range(variable) to crash the engine
problem was a segmentation fault caused by trying to access Vector constants[0] which isn't there if op->arguments.size() is not bigger than one.

- the changed OR condition didn't make sense (always true), should be AND
- changes the "constant" variable to be false per default and gets set to true when there is actually something pushed to "constants"
2017-02-04 20:57:39 +01:00
karroffel
c24c739da5 made _ a special token in GDScript 2017-01-20 09:26:55 +01:00
Rémi Verschelde
2a0ddc1e89 Style: Various fixes to play nice with clang-format 2017-01-16 08:49:52 +01:00
Rémi Verschelde
e0faf8a51b Style: Cosmetic fixes to play nice with clang-format 2017-01-15 16:42:17 +01:00
James Mintram
dab73c701a Compile error when duplicate key in dictionery literal #7034 2017-01-14 22:08:49 +01:00
Juan Linietsky
4261880c94 Merge pull request #6845 from karroffel/master
Adds pattern matching to GDScript
2017-01-14 17:08:10 -03:00
Juan Linietsky
7924f08a6a Merge pull request #4918 from jjay/f/error_on_redefine
Redefine var results in an error
2017-01-14 17:07:08 -03:00
Rémi Verschelde
93ab45b6b5 Style: Fix whole-line commented code
They do not play well with clang-format which aligns the `//` part
with the rest of the code block, thus producing badly indented commented code.
2017-01-14 14:52:23 +01:00
Juan Linietsky
bfef8de1bc More efficient iteration syntax, and range() is converted behind the scenes to it. 2017-01-11 20:10:23 -03:00
Rémi Verschelde
42802ab9dc Merge pull request #6930 from bojidar-bg/gdscript-export-array-hint
Allow typing hints for Array class (in GDScript and Inspector)
2017-01-11 14:46:38 +01:00
Juan Linietsky
e6583117df Both Array and Dictionary are always in shared mode (removed copy on write). 2017-01-11 08:54:17 -03:00
Karroffel
e781a7e07e pattern matcher: Implemented backend
changed comments
2017-01-11 04:40:28 +01:00
Karroffel
d445f0639f pattern matcher: Implemented transformations 2017-01-11 04:40:11 +01:00
Karroffel
f8a7c46273 pattern matching: implemented parser 2017-01-11 04:39:55 +01:00
Juan Linietsky
4338c90163 It is now possible to name layers of different kinds! 2017-01-10 22:20:57 -03:00
Juan Linietsky
8963ca3d17 Fix code completion for new getnode syntax 2017-01-08 03:01:52 -03:00
Juan Linietsky
8b912d1115 -Fix bugs related to PoolVector crashes
-Added ability to request nodes using $Name in GDScript :)
2017-01-08 02:04:53 -03:00
Juan Linietsky
118eed485e ObjectTypeDB was renamed to ClassDB. Types are meant to be more generic to Variant.
All usages of "type" to refer to classes were renamed to "class"
ClassDB has been exposed to GDScript.
OBJ_TYPE() macro is now GDCLASS()
2017-01-02 23:03:46 -03:00
Rémi Verschelde
dcc4ee21c1 Revert expression reduction from #7390
Fixes #7412.
2017-01-02 20:01:27 +01:00
Rémi Verschelde
caddbbe174 Merge pull request #7390 from bojidar-bg/gdscript-assign-error
Disallow assignment to constants and expressions
2017-01-02 15:54:43 +01:00
Rémi Verschelde
c7bc44d5ad Welcome in 2017, dear changelog reader!
That year should bring the long-awaited OpenGL ES 3.0 compatible renderer
with state-of-the-art rendering techniques tuned to work as low as middle
end handheld devices - without compromising with the possibilities given
for higher end desktop games of course. Great times ahead for the Godot
community and the gamers that will play our games!
2017-01-01 22:03:33 +01:00
Bojidar Marinov
0b077162a3
Disallow assignment to constants and expressions
Fixes #6221, fixes #6824
2016-12-29 12:31:19 +02:00
Rémi Verschelde
7751a933a9 Merge pull request #6802 from henriquelalves/master
Added small modification on gdscript parser to allow users insert '+' before variables
2016-11-11 10:55:26 +01:00
Bojidar Marinov
074bcb2a7b
Make GDScript parser ignore floating strings in class definition
Fixes #1320
2016-11-03 12:26:38 +02:00
Bojidar Marinov
713f1451b9
Allow typing hints for Array class (in GDScript and Inspector/ArrayPropertyEdit)
Closes #3586, by implementing the `1b` variation mentioned there.
2016-10-26 14:38:41 +03:00