Merge branch 'namlessArg-support' of https://github.com/Tryibion/FlaxEngine into Tryibion-namlessArg-support
This commit is contained in:
@@ -178,6 +178,9 @@ public:
|
|||||||
return static_cast<float>(number);
|
return static_cast<float>(number);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Test nameless arguments
|
||||||
|
API_FUNCTION() void TestNamelessArguments(int32, float, bool){}
|
||||||
|
|
||||||
int32 TestInterfaceMethod(const String& str) override
|
int32 TestInterfaceMethod(const String& str) override
|
||||||
{
|
{
|
||||||
return str.Length();
|
return str.Length();
|
||||||
|
|||||||
@@ -390,7 +390,22 @@ namespace Flax.Build.Bindings
|
|||||||
|
|
||||||
// Read parameter type and name
|
// Read parameter type and name
|
||||||
currentParam.Type = ParseType(ref context);
|
currentParam.Type = ParseType(ref context);
|
||||||
currentParam.Name = context.Tokenizer.ExpectToken(TokenType.Identifier).Value;
|
token = context.Tokenizer.NextToken();
|
||||||
|
if (token.Type == TokenType.Identifier)
|
||||||
|
{
|
||||||
|
currentParam.Name = token.Value;
|
||||||
|
}
|
||||||
|
// Support nameless arguments. assume optional usage
|
||||||
|
else
|
||||||
|
{
|
||||||
|
context.Tokenizer.PreviousToken();
|
||||||
|
if (string.IsNullOrEmpty(currentParam.Attributes))
|
||||||
|
currentParam.Attributes = "Optional";
|
||||||
|
else
|
||||||
|
currentParam.Attributes += ", Optional";
|
||||||
|
currentParam.Name = $"namelessArg{parameters.Count}";
|
||||||
|
}
|
||||||
|
|
||||||
if (currentParam.IsOut && (currentParam.Type.IsPtr || currentParam.Type.IsRef) && currentParam.Type.Type.EndsWith("*"))
|
if (currentParam.IsOut && (currentParam.Type.IsPtr || currentParam.Type.IsRef) && currentParam.Type.Type.EndsWith("*"))
|
||||||
{
|
{
|
||||||
// Pointer to value passed as output pointer
|
// Pointer to value passed as output pointer
|
||||||
|
|||||||
Reference in New Issue
Block a user