Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Haxe][FileParser] Added test for #2381 #2383

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
6 changes: 6 additions & 0 deletions External/Plugins/HaXeContext/Model/FileParser.cs
Expand Up @@ -793,6 +793,7 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
&& curClass.Flags is var f && (f & FlagType.Extern) == 0 && (f & FlagType.TypeDef) == 0 && (f & FlagType.Interface) == 0)
{
inFunction = true;
inType = false;
i -= 2;
continue;
}
Expand Down Expand Up @@ -1014,6 +1015,11 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
{
context = 0;
}
else if (curMember != null && (curMember.Flags & FlagType.Function) != 0 && length == 0 && !foundColon)
{
inType = false;
braceCount++;
}
else braceCount++; // ignore block
}
// end of block
Expand Down
Expand Up @@ -789,6 +789,7 @@
<EmbeddedResource Include="Test Files\parser\Issue2377_2.hx" />
<EmbeddedResource Include="Test Files\completion\BeforeOnCharAndReplaceTextIssue2358_1.hx" />
<EmbeddedResource Include="Test Files\parser\Issue2381_1.hx" />
<EmbeddedResource Include="Test Files\parser\Issue2381_2.hx" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
</Project>
10 changes: 10 additions & 0 deletions Tests/External/Plugins/HaxeContext.Tests/Model/FileParserTests.cs
Expand Up @@ -333,6 +333,16 @@ static IEnumerable<TestCaseData> Issue2381TestCases
})
.SetName("Issue 2381. Case 1")
.SetDescription("https://github.com/fdorg/flashdevelop/issues/2381");
yield return new TestCaseData("Issue2381_2")
.Returns(new List<MemberModel>
{
new MemberModel("foo", "String->String", FlagType.Access | FlagType.Dynamic | FlagType.Getter | FlagType.Setter, Visibility.Public),
new MemberModel("get_foo", "String->String", FlagType.Dynamic | FlagType.Function, Visibility.Private),
new MemberModel("set_foo", "String->String", FlagType.Dynamic | FlagType.Function, Visibility.Private),
new MemberModel("checkLength", "Bool", FlagType.Dynamic | FlagType.Function, Visibility.Private),
})
.SetName("Issue 2381. Case 2")
.SetDescription("https://github.com/fdorg/flashdevelop/issues/2381");
}
}

Expand Down
@@ -0,0 +1,16 @@
package;
class Foo2381_1 {
@:isVar public var foo(get, set):String->String;

function get_foo():String->String {
return foo;
}

function set_foo(value:String->String):String->String {
return foo = value;
}

function checkLength(length:Int):Bool {
return length <= 0x7FFFFFFF;
}
}