Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
be6d8d7
commit f77b2d7
Showing
54 changed files
with
974 additions
and
1,299 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Binary file not shown.
Binary file not shown.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
File renamed without changes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
|
||
extends Reference | ||
|
||
const TypesBuilder = preload('../Types/TypesBuilder.gd') | ||
const BaseType = preload('../Types/BaseType.gd') | ||
|
||
|
||
enum ARGASSIG \ | ||
{ | ||
CANCELED = 2 | ||
} | ||
|
||
|
||
# @var string | ||
var _name | ||
|
||
# @var BaseType | ||
var _type | ||
|
||
# @var Variant | ||
var value = null setget setValue, getValue | ||
|
||
|
||
# @param string|null name | ||
# @param BaseType type | ||
func _init(name, type): | ||
_name = name | ||
_type = type | ||
|
||
|
||
# @param Variant inValue | ||
func setValue(inValue): # int | ||
return _type.check(inValue) | ||
|
||
|
||
func getValue(): # Variant | ||
return _type.get() | ||
|
||
|
||
func toString(): # string | ||
var result = '' | ||
|
||
if _name: | ||
result += _name + ':' | ||
|
||
result += _type.getName() | ||
|
||
return result | ||
|
||
|
||
# @param string|null name | ||
# @param int|BaseType type | ||
static func build(name, type = 0): # Argument|int | ||
# Define arument type | ||
if !(typeof(type) == TYPE_OBJECT and type is BaseType): | ||
type = TypesBuilder.build(type if typeof(type) == TYPE_INT else 0) | ||
|
||
if typeof(type) == TYPE_INT: | ||
return FAILED | ||
|
||
return new(name, type) | ||
|
||
|
||
# @param Array args | ||
static func buildAll(args): # Array<Argument>|int | ||
var builtArgs = [] | ||
|
||
var tArg | ||
for arg in args: | ||
match typeof(arg): | ||
TYPE_ARRAY: tArg = build(arg[0], arg[1] if arg.size() > 1 else 0) | ||
TYPE_STRING: tArg = build(arg) | ||
TYPE_OBJECT, TYPE_INT: tArg = build(null, arg) | ||
|
||
if typeof(tArg) == TYPE_INT: | ||
return FAILED | ||
|
||
builtArgs.append(tArg) | ||
|
||
return builtArgs |
Oops, something went wrong.