From 780a0bcd3724cad77cb65f931f111273776c9ca4 Mon Sep 17 00:00:00 2001 From: Tim Foley Date: Sat, 8 Jul 2017 17:47:31 -0700 Subject: Add back `UnparsedStmt` If the user doesn't use any `import` declarations, there is no reason to parse their code at all, so having the option of falling back to `UnparsedStmt` can potentially save us some headaches down the road. The new rule now is that if you have the "no checking" flag on, *and* the parser hasn't yet seen any `import` declarations, then it still used `UnparsedStmt` to avoid touching function bodies. Otherwise, I go ahead and parse function bodies, and assume I can rewrite any code I can semantically understand. --- source/slang/lower.cpp | 10 ++++++++++ 1 file changed, 10 insertions(+) (limited to 'source/slang/lower.cpp') diff --git a/source/slang/lower.cpp b/source/slang/lower.cpp index 8a4b7a4b1..0d54faf0b 100644 --- a/source/slang/lower.cpp +++ b/source/slang/lower.cpp @@ -688,6 +688,16 @@ 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