Skip to content

support haxe final keyword #2971

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

Open
wants to merge 4 commits into
base: development
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
29 changes: 27 additions & 2 deletions External/Plugins/HaXeContext/Context.cs
Original file line number Diff line number Diff line change
Expand Up @@ -378,10 +378,35 @@ public void SetHaxeEnvironment(string sdkPath)

LoadMetadata();

features.SpecialPostfixOperators = GetCurrentSDKVersion() >= "3.3.0"
var version = GetCurrentSDKVersion();

features.SpecialPostfixOperators = version >= "3.3.0"
? new[] {'!'}
: Array.Empty<char>();

if (version >= "4")
{
features.finalKey = "final";

if (Array.IndexOf(features.codeKeywords, "final") < 0)
{
Array.Resize(ref features.codeKeywords, features.codeKeywords.Length + 1);
features.codeKeywords[features.codeKeywords.Length - 1] = "final";
}

if (Array.IndexOf(features.declKeywords, "final") < 0)
{
Array.Resize(ref features.declKeywords, features.declKeywords.Length + 1);
features.declKeywords[features.declKeywords.Length - 1] = "final";
}
}
else
{
features.finalKey = null;
features.codeKeywords = features.codeKeywords.Where(w => w != "final").ToArray();
features.declKeywords = features.declKeywords.Where(w => w != "final").ToArray();
}

UseGenericsShortNotationChange();
}

Expand Down Expand Up @@ -2633,4 +2658,4 @@ public HaxeCompletionCache(IASContext context, MemberList elements, MemberList o
OtherElements = otherElements;
}
}
}
}
2 changes: 1 addition & 1 deletion External/Plugins/HaXeContext/Model/FileParser.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1678,7 +1678,7 @@ bool EvalToken(bool evalContext, bool evalKeyword)
if (dotIndex > 0) token = token.Substring(dotIndex + 1);

// members
if (token == "var")
if (token == "var" || token == "final")
{
foundKeyword = FlagType.Variable;
}
Expand Down
2 changes: 1 addition & 1 deletion FlashDevelop/Bin/Debug/Settings/Languages/Haxe.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<keyword-classes>
<keyword-class name="haxe-primary-keywords">
abstract break case catch class continue default do else enum extends for in function if implements import
interface new package return switch throw try typedef using var while $type
interface new package return switch throw try typedef using var final while $type
</keyword-class>
<keyword-class name="haxe-secondary-keywords">
null true false
Expand Down