Skip to content

Commit

Permalink
Various code improvements
Browse files Browse the repository at this point in the history
  • Loading branch information
marcauberer committed Jan 2, 2023
1 parent 794a936 commit ae95a0c
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ Use this command to run it:
```

#### Re-build Spice
To re-build Spice there is also a batch/shell script to help you with that. Use the following command to run it:
There is also a batch/shell script to rebuild Spice. Use the following command to run it:

**Linux:** <br>
```sh
Expand Down
2 changes: 1 addition & 1 deletion media/test-project/os-test.spice
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
f<int> main() {
int test = 123;
int& testRef = test;
assert &test == &testRef;
assert test == testRef;
}

/*ext<byte*> malloc(long);
Expand Down
3 changes: 2 additions & 1 deletion src/ast/ASTBuilder.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -950,7 +950,8 @@ std::any ASTBuilder::visitAssertStmt(SpiceParser::AssertStmtContext *ctx) {
antlr4::ParserRuleContext *rule;
if (rule = dynamic_cast<SpiceParser::AssignExprContext *>(subTree); rule != nullptr) { // AssignExpr
currentNode = assertStmtNode->createChild<AssignExprNode>(CodeLoc(rule->start, filePath));
assertStmtNode->expressionString = rule->getText();
antlr4::misc::Interval interval(rule->start->getStartIndex(), rule->stop->getStopIndex());
assertStmtNode->expressionString = inputStream->getText(interval);
} else
assert(dynamic_cast<antlr4::tree::TerminalNode *>(subTree)); // Fail if we did not get a terminal

Expand Down
4 changes: 2 additions & 2 deletions src/typechecker/OpRuleManager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ SymbolType OpRuleManager::getEqualResultType(const ASTNode *node, const SymbolTy
// Allow 'pointer == pointer' straight away
if (lhs.isPointer() && rhs.isPointer())
return SymbolType(TY_BOOL);
// Allow 'pointer == byte' straight away
// Allow 'pointer == int' straight away
if (lhs.isPointer() && rhs.is(TY_INT))
return SymbolType(TY_BOOL);
// Check primitive type combinations
Expand All @@ -119,7 +119,7 @@ SymbolType OpRuleManager::getNotEqualResultType(const ASTNode *node, const Symbo
// Allow 'pointer != pointer' straight away
if (lhs.isPointer() && rhs.isPointer())
return SymbolType(TY_BOOL);
// Allow 'pointer != byte' straight away
// Allow 'pointer != int' straight away
if (lhs.isPointer() && rhs.is(TY_INT))
return SymbolType(TY_BOOL);
// Check primitive type combinations
Expand Down

0 comments on commit ae95a0c

Please sign in to comment.