From f69bc6cdb10aab2d1b202668cb7ecbcc0ddf33f2 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Fri, 7 Jul 2017 14:30:26 -0700 Subject: Fully parse function bodies, even in "rewriter" mode This is in anticipation of needing to have more complete knowledge to be able to handle user code that `import`s library functionality. The big picture of this change is just to remove the `UnparsedStmt` class that was used to hold the bodies of user functions as opaque token streams, and thus to let the full parser and compiler loose on that code. That is the easy part, of course, and the hard part is all the fixes that this requires in the rest of the compielr to make this even remotely work. Subsequent commit address a lot of other issues, so this particular commit mostly represents work-in-progress. One detail is that this change puts a conditional around nearly every diagnostic message in `check.cpp` to suppress thing when in rewriter mode. I have yet to check how that works out if there are errors in anything we actually need to understand for the purposes of generating reflection data. --- source/slang/lower.cpp | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-) (limited to 'source/slang/lower.cpp') diff --git a/source/slang/lower.cpp b/source/slang/lower.cpp index b90573495..c154c96c8 100644 --- a/source/slang/lower.cpp +++ b/source/slang/lower.cpp @@ -451,6 +451,7 @@ struct LoweringVisitor lowerExprCommon(loweredExpr, expr); loweredExpr->BaseExpression = loweredBase; loweredExpr->declRef = loweredDeclRef; + loweredExpr->name = expr->name; return loweredExpr; } @@ -687,16 +688,6 @@ struct LoweringVisitor addStmt(loweredStmt); } - void visitUnparsedStmt(UnparsedStmt* stmt) - { - RefPtr loweredStmt = new UnparsedStmt(); - lowerStmtFields(loweredStmt, stmt); - - loweredStmt->tokens = stmt->tokens; - - addStmt(loweredStmt); - } - void visitCaseStmt(CaseStmt* stmt) { RefPtr loweredStmt = new CaseStmt(); -- cgit v1.2.3