diff --git a/src/reader/wgsl/parser.cc b/src/reader/wgsl/parser.cc index e24066a4b0..323caeae81 100644 --- a/src/reader/wgsl/parser.cc +++ b/src/reader/wgsl/parser.cc @@ -21,13 +21,7 @@ namespace reader { namespace wgsl { Parser::Parser(Context* ctx, Source::File const* file) - : Reader(ctx), impl_(std::make_unique(ctx, file, false)) {} - -Parser::Parser(Context* ctx, const std::string& content) - : Reader(ctx), - impl_(std::make_unique(ctx, - new Source::File("", content), - true)) {} + : Reader(ctx), impl_(std::make_unique(ctx, file)) {} Parser::~Parser() = default; diff --git a/src/reader/wgsl/parser.h b/src/reader/wgsl/parser.h index ff835b8160..ddff63fc3f 100644 --- a/src/reader/wgsl/parser.h +++ b/src/reader/wgsl/parser.h @@ -34,14 +34,6 @@ class Parser : public Reader { /// @param ctx the non-null context object /// @param file the input source file to parse Parser(Context* ctx, Source::File const* file); - - /// Creates a new parser from the given file content. - /// @param ctx the non-null context object - /// @param content the input string to parse - /// TODO(bclayton): Remove this constructor. - /// It purely exists to break up changes into bite sized pieces. - Parser(Context* ctx, const std::string& content); - ~Parser() override; /// Run the parser diff --git a/src/reader/wgsl/parser_impl.cc b/src/reader/wgsl/parser_impl.cc index 174bada62f..eb4322194a 100644 --- a/src/reader/wgsl/parser_impl.cc +++ b/src/reader/wgsl/parser_impl.cc @@ -119,17 +119,10 @@ bool IsFunctionDecoration(Token t) { } // namespace -ParserImpl::ParserImpl(Context* ctx, Source::File const* file, bool owns_file) - : ctx_(*ctx), - lexer_(std::make_unique(file)), - file_(file), - owns_file_(owns_file) {} +ParserImpl::ParserImpl(Context* ctx, Source::File const* file) + : ctx_(*ctx), lexer_(std::make_unique(file)) {} -ParserImpl::~ParserImpl() { - if (owns_file_) { - delete file_; - } -} +ParserImpl::~ParserImpl() = default; void ParserImpl::set_error(const Token& t, const std::string& err) { diag::Diagnostic diagnostic; diff --git a/src/reader/wgsl/parser_impl.h b/src/reader/wgsl/parser_impl.h index 882093aa96..8ea3e6cdd3 100644 --- a/src/reader/wgsl/parser_impl.h +++ b/src/reader/wgsl/parser_impl.h @@ -89,11 +89,7 @@ class ParserImpl { /// Creates a new parser using the given file /// @param ctx the non-null context object /// @param file the input source file to parse - /// @param owns_file if true, the file will be deleted on parser destruction. - /// TODO(bclayton): Remove owns_file. - /// It purely exists to break up changes into bite sized pieces. - ParserImpl(Context* ctx, Source::File const* file, bool owns_file = false); - + ParserImpl(Context* ctx, Source::File const* file); ~ParserImpl(); /// Run the parser @@ -431,9 +427,6 @@ class ParserImpl { std::deque token_queue_; std::unordered_map registered_constructs_; ast::Module module_; - - Source::File const* file_; - bool owns_file_; }; } // namespace wgsl