Skip to content

Commit 4cb9e52

Browse files
committed
Fixed function types in function return types.
1 parent b08b219 commit 4cb9e52

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

External/Plugins/ASCompletion/Model/ASFileParser.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1432,6 +1432,7 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
14321432
else if (c1 == '(')
14331433
{
14341434
if (!inValue && context == FlagType.Variable && curToken.Text != "catch" && (!haXe || curToken.Text != "for"))
1435+
{
14351436
if (haXe && curMember != null && valueLength == 0)
14361437
{
14371438
if (!foundColon && !inType) // Haxe properties
@@ -1447,6 +1448,7 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
14471448
}
14481449
}
14491450
else context = 0;
1451+
}
14501452

14511453
// beginning of method parameters
14521454
if (context == FlagType.Function)
@@ -1547,6 +1549,7 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
15471549
context = 0;
15481550
if (inEnum) context = FlagType.Enum;
15491551
else if (inTypedef) context = FlagType.TypeDef;
1552+
else context = FlagType.Variable;
15501553
modifiers = 0;
15511554
inParams = false;
15521555
curMember = curMethod;

Tests/External/Plugins/ASCompletion.Tests/Model/ASFileParserTests.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1139,6 +1139,7 @@ public void ParseFile_FunctionTypesWithSubTypes()
11391139
Assert.AreEqual("functionTypesWithSubTypes", member.Name);
11401140
Assert.AreEqual(FlagType.Function, member.Flags & FlagType.Function);
11411141
Assert.AreEqual(3, member.Parameters.Count);
1142+
Assert.AreEqual("((Dynamic->Dynamic)->Int)->Int", member.Type);
11421143
var arg = member.Parameters[0];
11431144
Assert.AreEqual("functionTypeArg", arg.Name);
11441145
Assert.AreEqual("(Dynamic->Dynamic)->Dynamic", arg.Type);
@@ -1162,7 +1163,7 @@ public void ParseFile_FunctionTypesWithSubTypes()
11621163
Assert.AreEqual(3, member.LineFrom);
11631164
Assert.AreEqual(3, member.LineTo);
11641165
Assert.AreEqual(FlagType.Variable, member.Flags & FlagType.Variable);
1165-
Assert.AreEqual("((Dynamic->Dynamic)->Int->)Int", member.Type);
1166+
Assert.AreEqual("((Dynamic->Dynamic)->Int)->Int", member.Type);
11661167

11671168
member = model.Members[3];
11681169
Assert.AreEqual("functionType3", member.Name);
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
public function functionTypesWithSubTypes(functionTypeArg:(Dynamic->Dynamic)->Dynamic, functionTypeArg2:(Dynamic->Dynamic)->(Int->Int) = null, test2:String):((Dynamic->Dynamic)->Int->)Int
1+
public function functionTypesWithSubTypes(functionTypeArg:(Dynamic->Dynamic)->Dynamic, functionTypeArg2:(Dynamic->Dynamic)->(Int->Int) = null, test2:String):((Dynamic->Dynamic)->Int)->Int
22
{
33
var functionType:(Dynamic->Dynamic)->Dynamic;
4-
var functionType2:((Dynamic->Dynamic)->Int->)Int;
4+
var functionType2:((Dynamic->Dynamic)->Int)->Int;
55
var functionType3:(Dynamic->Dynamic)->(Int->Int);
66
}

0 commit comments

Comments
 (0)