diff --git a/src/program_builder.cc b/src/program_builder.cc index ccd27c3e27..0f2c695365 100644 --- a/src/program_builder.cc +++ b/src/program_builder.cc @@ -131,8 +131,8 @@ ast::ConstructorExpression* ProgramBuilder::ConstructValueFilledWith( ProgramBuilder::TypesBuilder::TypesBuilder(ProgramBuilder* pb) : builder(pb) {} -ast::VariableDeclStatement* ProgramBuilder::WrapInStatement(ast::Variable* v) { - return create(v); +ast::Statement* ProgramBuilder::WrapInStatement(ast::Literal* lit) { + return WrapInStatement(create(lit)); } ast::Statement* ProgramBuilder::WrapInStatement(ast::Expression* expr) { @@ -140,6 +140,10 @@ ast::Statement* ProgramBuilder::WrapInStatement(ast::Expression* expr) { return Decl(Var(symbols_.New(), nullptr, ast::StorageClass::kFunction, expr)); } +ast::VariableDeclStatement* ProgramBuilder::WrapInStatement(ast::Variable* v) { + return create(v); +} + ast::Statement* ProgramBuilder::WrapInStatement(ast::Statement* stmt) { return stmt; } diff --git a/src/program_builder.h b/src/program_builder.h index 7e2857892b..5125419af7 100644 --- a/src/program_builder.h +++ b/src/program_builder.h @@ -1405,6 +1405,12 @@ class ProgramBuilder { /// expression has no resolved type. type::Type* TypeOf(ast::Expression* expr) const; + /// Wraps the ast::Literal in a statement. This is used by tests that + /// construct a partial AST and require the Resolver to reach these + /// nodes. + /// @param lit the ast::Literal to be wrapped by an ast::Statement + /// @return the ast::Statement that wraps the ast::Statement + ast::Statement* WrapInStatement(ast::Literal* lit); /// Wraps the ast::Expression in a statement. This is used by tests that /// construct a partial AST and require the Resolver to reach these /// nodes.