summaryrefslogtreecommitdiffstats
path: root/source
diff options
context:
space:
mode:
authorYong He <yonghe@outlook.com>2017-11-04 20:21:19 -0400
committerYong He <yonghe@outlook.com>2017-11-04 20:21:19 -0400
commit0d250f0d49e9e29d143c5794671669ea025b357e (patch)
treed73a0ea8a7f847c4ff3facbb91b79afbcbfe987b /source
parent6e4ba9bd552923b08cd56b4542b2f29e8df8ca0c (diff)
style fixes
Diffstat (limited to 'source')
-rw-r--r--source/slang/check.cpp3
-rw-r--r--source/slang/parser.cpp17
2 files changed, 12 insertions, 8 deletions
diff --git a/source/slang/check.cpp b/source/slang/check.cpp
index bc3823292..79a4f28cf 100644
--- a/source/slang/check.cpp
+++ b/source/slang/check.cpp
@@ -1972,8 +1972,9 @@ namespace Slang
return;
VisitFunctionDeclaration(functionNode);
- // TODO: This should really onlye set "checked header"
+ // TODO: This should really only set "checked header"
functionNode->SetCheckState(DeclCheckState::Checked);
+
// TODO: should put the checking of the body onto a "work list"
// to avoid recursion here.
if (functionNode->Body)
diff --git a/source/slang/parser.cpp b/source/slang/parser.cpp
index 954496b68..57956485a 100644
--- a/source/slang/parser.cpp
+++ b/source/slang/parser.cpp
@@ -1428,8 +1428,7 @@ namespace Slang
return typeExpr;
}
- static TypeSpec
- parseTypeSpec(Parser* parser)
+ static TypeSpec parseTypeSpec(Parser* parser)
{
TypeSpec typeSpec;
@@ -1462,15 +1461,19 @@ namespace Slang
RefPtr<Expr> typeExpr = basicType;
- while (parser->LookAheadToken(TokenType::OpLess) || parser->LookAheadToken(TokenType::Dot))
+ bool shouldLoop = true;
+ while (shouldLoop)
{
- if (parser->LookAheadToken(TokenType::OpLess))
+ switch (peekTokenType(parser))
{
+ case TokenType::OpLess:
typeExpr = parseGenericApp(parser, typeExpr);
- }
- else
- {
+ break;
+ case TokenType::Dot:
typeExpr = parseMemberType(parser, typeExpr);
+ break;
+ default:
+ shouldLoop = false;
}
}