Implement nominal class and interface types across declarations and calls
Build / AerScript (push) Successful in 37s
Build / AerScript (push) Successful in 37s
This commit is contained in:
+17
-2
@@ -376,6 +376,9 @@ static sxi32 ExprAssembleClosure(ph7_gen_state *pGen, SyToken **ppCur, SyToken *
|
||||
/* Jump the data type keyword */
|
||||
nLine = pIn->nLine;
|
||||
pIn++;
|
||||
if(pIn < pEnd && &pIn[1] < pEnd && (pIn->nType & PH7_TK_OSB) && (pIn[1].nType & PH7_TK_CSB)) {
|
||||
pIn += 2;
|
||||
}
|
||||
if(pIn < pEnd && (pIn->nType & (PH7_TK_ID | PH7_TK_KEYWORD))) {
|
||||
pIn++;
|
||||
}
|
||||
@@ -479,9 +482,21 @@ static sxi32 ExprExtractNode(ph7_gen_state *pGen, ph7_expr_node **ppNode) {
|
||||
PH7_GenCompileError(pGen, E_ERROR, pNode->pStart->nLine, "Syntax error: Missing closing braces '}'");
|
||||
}
|
||||
pNode->xCode = PH7_CompileArray;
|
||||
} else if(pCur->nType & PH7_TK_KEYWORD) {
|
||||
} else if(pCur->nType & (PH7_TK_KEYWORD | PH7_TK_ID)) {
|
||||
sxu32 nKeyword = (sxu32)SX_PTR_TO_INT(pCur->pUserData);
|
||||
if(pCur[1].nType & PH7_TK_LPAREN && (nKeyword & PH7_KEYWORD_TYPEDEF)) {
|
||||
SyToken *pArgs = &pCur[1], *pAfter = 0;
|
||||
sxi32 bClosure = FALSE;
|
||||
if(pArgs < pGen->pEnd && &pArgs[1] < pGen->pEnd && (pArgs->nType & PH7_TK_OSB) && (pArgs[1].nType & PH7_TK_CSB)) {
|
||||
pArgs += 2;
|
||||
}
|
||||
if(pArgs < pGen->pEnd && (pArgs->nType & PH7_TK_LPAREN)) {
|
||||
PH7_DelimitNestedTokens(&pArgs[1], pGen->pEnd, PH7_TK_LPAREN, PH7_TK_RPAREN, &pAfter);
|
||||
if(pAfter < pGen->pEnd && &pAfter[1] < pGen->pEnd) {
|
||||
bClosure = (pAfter[1].nType & PH7_TK_OCB) ||
|
||||
((pAfter[1].nType & PH7_TK_KEYWORD) && SX_PTR_TO_INT(pAfter[1].pUserData) == PH7_KEYWORD_USING);
|
||||
}
|
||||
}
|
||||
if(bClosure || ((pCur->nType & PH7_TK_KEYWORD) && pArgs < pGen->pEnd && (pArgs->nType & PH7_TK_LPAREN) && (nKeyword & PH7_KEYWORD_TYPEDEF))) {
|
||||
/* Anonymous function */
|
||||
if(&pCur[1] >= pGen->pEnd) {
|
||||
/* Assume a literal */
|
||||
|
||||
Reference in New Issue
Block a user