Remove Parser constructors that take a string
... for the content. Everything should be using a `Source::File*` now. Bug: tint:282 Change-Id: I9bebb94995a946a5919ba6503f2b0ee2058f0fb1 Reviewed-on: https://dawn-review.googlesource.com/c/tint/+/31482 Reviewed-by: dan sinclair <dsinclair@chromium.org> Commit-Queue: Ben Clayton <bclayton@google.com>
This commit is contained in:
parent
3d0e273ec3
commit
cd5e4a8083
|
@ -21,13 +21,7 @@ namespace reader {
|
|||
namespace wgsl {
|
||||
|
||||
Parser::Parser(Context* ctx, Source::File const* file)
|
||||
: Reader(ctx), impl_(std::make_unique<ParserImpl>(ctx, file, false)) {}
|
||||
|
||||
Parser::Parser(Context* ctx, const std::string& content)
|
||||
: Reader(ctx),
|
||||
impl_(std::make_unique<ParserImpl>(ctx,
|
||||
new Source::File("", content),
|
||||
true)) {}
|
||||
: Reader(ctx), impl_(std::make_unique<ParserImpl>(ctx, file)) {}
|
||||
|
||||
Parser::~Parser() = default;
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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<Lexer>(file)),
|
||||
file_(file),
|
||||
owns_file_(owns_file) {}
|
||||
ParserImpl::ParserImpl(Context* ctx, Source::File const* file)
|
||||
: ctx_(*ctx), lexer_(std::make_unique<Lexer>(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;
|
||||
|
|
|
@ -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> token_queue_;
|
||||
std::unordered_map<std::string, ast::type::Type*> registered_constructs_;
|
||||
ast::Module module_;
|
||||
|
||||
Source::File const* file_;
|
||||
bool owns_file_;
|
||||
};
|
||||
|
||||
} // namespace wgsl
|
||||
|
|
Loading…
Reference in New Issue