Fix parsing nested template types in scripting type inheritance
This commit is contained in:
@@ -552,15 +552,35 @@ namespace Flax.Build.Bindings
|
||||
if (token.Type == TokenType.LeftAngleBracket)
|
||||
{
|
||||
inheritType.GenericArgs = new List<TypeInfo>();
|
||||
while (true)
|
||||
var argStack = new Stack<TypeInfo>();
|
||||
argStack.Push(inheritType);
|
||||
TypeInfo lastArg = null;
|
||||
while (argStack.Count > 0)
|
||||
{
|
||||
token = context.Tokenizer.NextToken();
|
||||
if (token.Type == TokenType.RightAngleBracket)
|
||||
break;
|
||||
{
|
||||
// Go up
|
||||
argStack.Pop();
|
||||
lastArg = argStack.Peek();
|
||||
continue;
|
||||
}
|
||||
if (token.Type == TokenType.Comma)
|
||||
continue;
|
||||
if (token.Type == TokenType.Identifier)
|
||||
inheritType.GenericArgs.Add(new TypeInfo { Type = token.Value });
|
||||
{
|
||||
var arg = new TypeInfo { Type = token.Value };
|
||||
var parent = argStack.Peek();
|
||||
if (parent.GenericArgs == null)
|
||||
parent.GenericArgs = new List<TypeInfo>();
|
||||
parent.GenericArgs.Add(arg);
|
||||
lastArg = arg;
|
||||
}
|
||||
else if (token.Type == TokenType.LeftAngleBracket)
|
||||
{
|
||||
// Go down
|
||||
argStack.Push(lastArg);
|
||||
}
|
||||
else
|
||||
throw new ParseException(ref context, "Incorrect inheritance");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user