Skip to content

Commit b08b219

Browse files
committed
Removed unreachable block of code.
Rename haXe to Haxe in comments of ASFileParser. Added support for function types with subtypes.
1 parent ff78e65 commit b08b219

File tree

1 file changed

+22
-33
lines changed

1 file changed

+22
-33
lines changed

External/Plugins/ASCompletion/Model/ASFileParser.cs

Lines changed: 22 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1030,29 +1030,6 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
10301030
continue;
10311031
}
10321032
}
1033-
else if (inValue && (inParams || inType || inConst)
1034-
&& c1 == '/' && valueLength == 0) // lookup native regex
1035-
{
1036-
int itemp = i;
1037-
valueBuffer[valueLength++] = '/';
1038-
while (valueLength < VALUE_BUFFER && i < len)
1039-
{
1040-
c1 = ba[i++];
1041-
if (c1 == '\n' || c1 == '\r')
1042-
{
1043-
valueLength = 0;
1044-
i = itemp;
1045-
break;
1046-
}
1047-
valueBuffer[valueLength++] = c1;
1048-
if (c1 == '\\' && i < len)
1049-
{
1050-
c1 = ba[i++];
1051-
valueBuffer[valueLength++] = c1;
1052-
}
1053-
else if (c1 == '/') break;
1054-
}
1055-
}
10561033
else if ((c1 == ':' || c1 == ',') && paramBraceCount > 0) stopParser = true;
10571034

10581035
// end of value
@@ -1230,7 +1207,7 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
12301207
{
12311208
addChar = true;
12321209
}
1233-
// AS3/haXe generics
1210+
// AS3/Haxe generics
12341211
else if (c1 == '<' && features.hasGenerics)
12351212
{
12361213
if (!inValue && i > 2 && length > 1 && i < len - 3
@@ -1285,6 +1262,10 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
12851262
}
12861263
}
12871264
}
1265+
else if ((c1 == '(' || c1 == ')') && haXe && inType)
1266+
{
1267+
addChar = true;
1268+
}
12881269
else
12891270
{
12901271
evalToken = 2;
@@ -1296,7 +1277,7 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
12961277
{
12971278
addChar = true;
12981279
}
1299-
// conditional haXe parameter
1280+
// conditional Haxe parameter
13001281
else if (c1 == '?' && haXe && inParams && length == 0)
13011282
{
13021283
addChar = true;
@@ -1367,7 +1348,7 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
13671348
braceCount++; // ignore block
13681349
}
13691350
}
1370-
else if (foundColon && haXe && length == 0) // copy haXe anonymous type
1351+
else if (foundColon && haXe && length == 0) // copy Haxe anonymous type
13711352
{
13721353
inValue = true;
13731354
hadValue = false;
@@ -1451,11 +1432,19 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
14511432
else if (c1 == '(')
14521433
{
14531434
if (!inValue && context == FlagType.Variable && curToken.Text != "catch" && (!haXe || curToken.Text != "for"))
1454-
if (haXe && curMember != null && valueLength == 0) // haXe properties
1435+
if (haXe && curMember != null && valueLength == 0)
14551436
{
1456-
curMember.Flags -= FlagType.Variable;
1457-
curMember.Flags |= FlagType.Getter | FlagType.Setter;
1458-
context = FlagType.Function;
1437+
if (!foundColon && !inType) // Haxe properties
1438+
{
1439+
curMember.Flags -= FlagType.Variable;
1440+
curMember.Flags |= FlagType.Getter | FlagType.Setter;
1441+
context = FlagType.Function;
1442+
}
1443+
else // Haxe function types with subtypes
1444+
{
1445+
inType = true;
1446+
addChar = true;
1447+
}
14591448
}
14601449
else context = 0;
14611450

@@ -1603,7 +1592,7 @@ public void ParseSrc(FileModel fileModel, string ba, bool allowBaReExtract)
16031592
}
16041593
}
16051594

1606-
// haXe signatures: T -> T -> T
1595+
// Haxe signatures: T -> T -> T
16071596
else if (haXe && c1 == '-' && curMember != null)
16081597
{
16091598
if (ba[i] == '>' && curMember.Type != null)
@@ -2239,7 +2228,7 @@ private bool EvalToken(bool evalContext, bool evalKeyword, int position)
22392228
}
22402229
else
22412230
{
2242-
//TODO Error: AS3 & haXe classes are qualified by their package declaration
2231+
//TODO Error: AS3 & Haxe classes are qualified by their package declaration
22432232
}
22442233
}
22452234

@@ -2391,7 +2380,7 @@ private bool EvalToken(bool evalContext, bool evalKeyword, int position)
23912380
break;
23922381

23932382
case FlagType.Variable:
2394-
// haXe signatures: T -> T
2383+
// Haxe signatures: T -> T
23952384
if (haXe && curMember != null && curMember.Type != null
23962385
&& curMember.Type.EndsWith("->"))
23972386
{

0 commit comments

Comments
 (0)