mirror of
https://github.com/RGBCube/serenity
synced 2025-05-31 07:38:10 +00:00
Shell+LibCodeComprehension: Start replacing {Deprecated => }String
This starts by switching all AST members to Strings, and dealing with the fallout.
This commit is contained in:
parent
79e4027480
commit
beeb58bd93
12 changed files with 625 additions and 581 deletions
|
@ -78,7 +78,7 @@ Vector<DeprecatedString> const& ShellComprehensionEngine::DocumentData::sourced_
|
|||
auto& filename = entries[1];
|
||||
if (filename->would_execute())
|
||||
return;
|
||||
auto name_list = const_cast<::Shell::AST::Node*>(filename.ptr())->run(nullptr)->resolve_as_list(nullptr);
|
||||
auto name_list = const_cast<::Shell::AST::Node*>(filename.ptr())->run(nullptr)->resolve_as_list(nullptr).release_value_but_fixme_should_propagate_errors();
|
||||
StringBuilder builder;
|
||||
builder.join(' ', name_list);
|
||||
sourced_files.set(builder.to_deprecated_string());
|
||||
|
@ -107,7 +107,7 @@ NonnullRefPtr<::Shell::AST::Node> ShellComprehensionEngine::DocumentData::parse(
|
|||
if (auto node = parser.parse())
|
||||
return node.release_nonnull();
|
||||
|
||||
return ::Shell::AST::make_ref_counted<::Shell::AST::SyntaxError>(::Shell::AST::Position {}, "Unable to parse file");
|
||||
return ::Shell::AST::make_ref_counted<::Shell::AST::SyntaxError>(::Shell::AST::Position {}, String::from_utf8("Unable to parse file"sv).release_value_but_fixme_should_propagate_errors());
|
||||
}
|
||||
|
||||
size_t ShellComprehensionEngine::resolve(ShellComprehensionEngine::DocumentData const& document, const GUI::TextPosition& position)
|
||||
|
@ -184,7 +184,7 @@ Optional<CodeComprehension::ProjectLocation> ShellComprehensionEngine::find_decl
|
|||
auto& declarations = all_declarations();
|
||||
for (auto& entry : declarations) {
|
||||
for (auto& declaration : entry.value) {
|
||||
if (declaration.name == name)
|
||||
if (declaration.name.view() == name)
|
||||
return declaration.position;
|
||||
}
|
||||
}
|
||||
|
@ -209,7 +209,7 @@ void ShellComprehensionEngine::update_declared_symbols(DocumentData const& docum
|
|||
|
||||
DeprecatedString name;
|
||||
if (literal->is_bareword())
|
||||
name = static_ptr_cast<::Shell::AST::BarewordLiteral const>(literal)->text();
|
||||
name = static_ptr_cast<::Shell::AST::BarewordLiteral const>(literal)->text().to_deprecated_string();
|
||||
|
||||
if (!name.is_empty()) {
|
||||
dbgln("Found variable {}", name);
|
||||
|
@ -222,7 +222,7 @@ void ShellComprehensionEngine::update_declared_symbols(DocumentData const& docum
|
|||
void visit(::Shell::AST::FunctionDeclaration const* node) override
|
||||
{
|
||||
dbgln("Found function {}", node->name().name);
|
||||
declarations.append({ node->name().name, { filename, node->position().start_line.line_number, node->position().start_line.line_column }, CodeComprehension::DeclarationType::Function, {} });
|
||||
declarations.append({ node->name().name.to_deprecated_string(), { filename, node->position().start_line.line_number, node->position().start_line.line_column }, CodeComprehension::DeclarationType::Function, {} });
|
||||
}
|
||||
|
||||
DeprecatedString const& filename;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue