1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-10 04:22:20 +02:00

Early code generation support

This commit is contained in:
Brian Fiete 2021-01-11 09:41:43 -08:00
parent 0b48a60592
commit 71d4dd0e90
26 changed files with 2422 additions and 1576 deletions

View file

@ -813,6 +813,25 @@ bool BfAstNode::LocationEndEquals(BfAstNode* otherNode)
(GetSrcEnd() == otherNode->GetSrcEnd());
}
String BfAstNode::LocationToString()
{
auto parserData = GetParserData();
if (parserData == NULL)
return String();
String loc;
int line = -1;
int lineChar = -1;
parserData->GetLineCharAtIdx(mSrcStart, line, lineChar);
if (line != -1)
loc += StrFormat("at line %d:%d", line + 1, lineChar + 1);
loc += " in ";
loc += parserData->mFileName;
return loc;
}
void BfAstNode::Add(BfAstNode* bfAstNode)
{
#ifdef BF_AST_HAS_PARENT_MEMBER