@@ -310,7 +310,6 @@ static roleDefinition VUnknownRoles [COUNT_UNKNOWN_ROLE] = {
310
310
};
311
311
312
312
typedef enum {
313
- KIND_NONE = -1 ,
314
313
KIND_FUNCTION ,
315
314
KIND_MODULE ,
316
315
KIND_VARIABLE ,
@@ -1538,7 +1537,7 @@ static void parseFunction (tokenInfo *const token, int scope,
1538
1537
vString * const access , kindType kind )
1539
1538
{
1540
1539
Assert (kind == KIND_FUNCTION || kind == KIND_METHOD ||
1541
- kind == KIND_ALIAS || kind == KIND_NONE );
1540
+ kind == KIND_ALIAS || kind == KIND_GHOST_INDEX );
1542
1541
Assert (kind == KIND_METHOD || isKeyword (token , KEYWORD_fn ));
1543
1542
PARSER_PROLOGUE (kind == KIND_FUNCTION ? "fndef" :
1544
1543
(kind == KIND_METHOD ? "method" :
@@ -1590,7 +1589,7 @@ static void parseFunction (tokenInfo *const token, int scope,
1590
1589
skipToToken (TOKEN_CLOSE_PAREN , NULL );
1591
1590
}
1592
1591
// name
1593
- if ((kind == KIND_NONE && (
1592
+ if ((kind == KIND_GHOST_INDEX && (
1594
1593
isToken (token , TOKEN_IDENT , TOKEN_TYPE ) ||
1595
1594
isKeyword (token , KEYWORD_TYPE ))) ||
1596
1595
(kind == KIND_FUNCTION && (
@@ -1611,7 +1610,7 @@ static void parseFunction (tokenInfo *const token, int scope,
1611
1610
readToken (token );
1612
1611
}
1613
1612
// closure args
1614
- if (kind == KIND_NONE && name == NULL &&
1613
+ if (kind == KIND_GHOST_INDEX && name == NULL &&
1615
1614
isToken (token , TOKEN_OPEN_SQUARE ))
1616
1615
{
1617
1616
vStringPut (argList , '[' );
@@ -1621,7 +1620,7 @@ static void parseFunction (tokenInfo *const token, int scope,
1621
1620
}
1622
1621
// template args
1623
1622
if ((kind == KIND_FUNCTION ||
1624
- (kind == KIND_NONE && name == NULL )) &&
1623
+ (kind == KIND_GHOST_INDEX && name == NULL )) &&
1625
1624
isToken (token , TOKEN_OPEN_SQUARE ))
1626
1625
{
1627
1626
vStringPut (argList , '[' );
@@ -1666,7 +1665,7 @@ static void parseFunction (tokenInfo *const token, int scope,
1666
1665
int newScope = CORK_NIL ;
1667
1666
if (name || kind == KIND_METHOD )
1668
1667
{
1669
- kindType realKind = kind == KIND_NONE ? KIND_FUNCTION : kind ;
1668
+ kindType realKind = kind == KIND_GHOST_INDEX ? KIND_FUNCTION : kind ;
1670
1669
int realScope = name ?
1671
1670
lookupQualifiedName (fnToken , name , scope , NULL ) : scope ;
1672
1671
newScope = makeFnTag (fnToken , name , realKind , realScope ,
@@ -1677,15 +1676,15 @@ static void parseFunction (tokenInfo *const token, int scope,
1677
1676
makeTag (rxToken , NULL , KIND_RECEIVER , newScope );
1678
1677
}
1679
1678
// block
1680
- if ((kind == KIND_NONE && expectToken (token , TOKEN_OPEN_CURLY )) ||
1679
+ if ((kind == KIND_GHOST_INDEX && expectToken (token , TOKEN_OPEN_CURLY )) ||
1681
1680
(kind == KIND_FUNCTION && isToken (token , TOKEN_OPEN_CURLY )))
1682
1681
{
1683
1682
int lineNumber = parseBlock (token , newScope , false);
1684
1683
tagEntryInfo * entry = getEntryInCorkQueue (newScope );
1685
1684
if (entry )
1686
1685
setTagEndLine (entry , lineNumber );
1687
1686
// fncall
1688
- if (kind == KIND_NONE )
1687
+ if (kind == KIND_GHOST_INDEX )
1689
1688
{
1690
1689
readToken (token );
1691
1690
if (isToken (token , TOKEN_OPEN_PAREN ))
@@ -1944,7 +1943,7 @@ static void parseStruct (tokenInfo *const token, vString *const access,
1944
1943
(kind == KIND_STRUCT && isKeyword (token , KEYWORD_struct )) ||
1945
1944
(kind == KIND_INTERFACE && isKeyword (token , KEYWORD_interface )) ||
1946
1945
(kind == KIND_UNION && isKeyword (token , KEYWORD_union )) ||
1947
- (kind == KIND_NONE && isKeyword (token , KEYWORD_struct , KEYWORD_union )));
1946
+ (kind == KIND_GHOST_INDEX && isKeyword (token , KEYWORD_struct , KEYWORD_union )));
1948
1947
PARSER_PROLOGUE (kind == KIND_INTERFACE ? "iface" :
1949
1948
(kind == KIND_UNION ? "union" :
1950
1949
(kind == KIND_STRUCT ? "struct" : "anon" )));
@@ -1956,14 +1955,14 @@ static void parseStruct (tokenInfo *const token, vString *const access,
1956
1955
if ((kind == KIND_STRUCT || kind == KIND_INTERFACE ) && PS -> isBuiltin &&
1957
1956
scope == CORK_NIL && isKeyword (token , KEYWORD_TYPE , KEYWORD_map ))
1958
1957
readToken (token );
1959
- else if ((kind != KIND_NONE && expectToken (token , TOKEN_TYPE )) ||
1960
- (kind == KIND_NONE && isToken (token , TOKEN_TYPE )))
1958
+ else if ((kind != KIND_GHOST_INDEX && expectToken (token , TOKEN_TYPE )) ||
1959
+ (kind == KIND_GHOST_INDEX && isToken (token , TOKEN_TYPE )))
1961
1960
{
1962
1961
parseFullyQualified (token , true);
1963
1962
if (expectToken (token , TOKEN_TYPE , TOKEN_EXTERN ))
1964
1963
{
1965
1964
scope = lookupQualifiedName (token , NULL , scope , false);
1966
- kindType realKind = kind == KIND_NONE ? KIND_STRUCT : kind ;
1965
+ kindType realKind = kind == KIND_GHOST_INDEX ? KIND_STRUCT : kind ;
1967
1966
newScope = makeTagEx (token , NULL , realKind , scope , access );
1968
1967
makeForeignDeclTagMaybe (token , NULL , realKind , scope );
1969
1968
registerEntry (newScope );
@@ -2093,7 +2092,7 @@ static void parseStruct (tokenInfo *const token, vString *const access,
2093
2092
vStringDelete (fieldAccess );
2094
2093
}
2095
2094
2096
- if (kind != KIND_NONE )
2095
+ if (kind != KIND_GHOST_INDEX )
2097
2096
{
2098
2097
tagEntryInfo * entry = getEntryInCorkQueue (newScope );
2099
2098
if (entry )
@@ -2264,7 +2263,7 @@ static bool parseVType (tokenInfo *const token, vString *const capture,
2264
2263
}
2265
2264
else if (isKeyword (token , KEYWORD_struct , KEYWORD_union ))
2266
2265
{
2267
- parseStruct (token , NULL , scope , KIND_NONE );
2266
+ parseStruct (token , NULL , scope , KIND_GHOST_INDEX );
2268
2267
canInit = true;
2269
2268
}
2270
2269
else if (isKeyword (token , KEYWORD_fn ) && !token -> onNewline )
@@ -2663,7 +2662,7 @@ static bool parseExpression (tokenInfo *const token, int scope,
2663
2662
else if (isKeyword (token , KEYWORD_sql ))
2664
2663
parseSql (token , scope );
2665
2664
else if (isKeyword (token , KEYWORD_fn ))
2666
- parseFunction (token , scope , NULL , KIND_NONE );
2665
+ parseFunction (token , scope , NULL , KIND_GHOST_INDEX );
2667
2666
else if (isKeyword (token , KEYWORD_if , KEYWORD_Sif ))
2668
2667
parseIf (token , scope );
2669
2668
else if (isKeyword (token , KEYWORD_match ))
0 commit comments