Skip to content

Commit

Permalink
Use std::string instead of std::string_view in AST nodes
Browse files Browse the repository at this point in the history
Summary: The current code only works in practice because the lexer is kept alive. Ideally, the AST should be standalone and not depend on the lifetime of the tokens.

Differential Revision: D68676749

fbshipit-source-id: 9992037a3f07f079660c0e20b9035328e1aac175
  • Loading branch information
praihan authored and facebook-github-bot committed Jan 27, 2025
1 parent 3f9bb72 commit a1eeb91
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion third-party/thrift/src/thrift/compiler/whisker/ast.h
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ struct expression {
*
* Using std::map for stable ordering when printing the AST.
*/
std::map<std::string_view, named_argument> named_arguments;
std::map<std::string, named_argument> named_arguments;

/**
* The name of the function call lookup as seen in the source code.
Expand Down
2 changes: 1 addition & 1 deletion third-party/thrift/src/thrift/compiler/whisker/parser.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,7 @@ class parser {
if (parse_result expr = parse_expression(scan.make_fresh())) {
return {
named_argument_entry{
id.string_value(),
std::string(id.string_value()),
function_call::named_argument{
make_identifier(id),
std::make_unique<expression>(
Expand Down

0 comments on commit a1eeb91

Please sign in to comment.