Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions native/cpp/compiler/CompletionBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -191,11 +191,11 @@ std::vector<CompletionItem> CompletionBuilder::context()
{
if ( is_class_query )
{
for ( auto* user_function : workspace.scope_tree.list_class_methods( query ) )
for ( auto* user_function : workspace.scope_tree->list_class_methods( query ) )
{
results.push_back( CompletionItem{ user_function->name, CompletionItemKind::Method } );
}
for ( auto* assignment_statement : workspace.scope_tree.list_class_members( query ) )
for ( auto* assignment_statement : workspace.scope_tree->list_class_members( query ) )
{
results.push_back(
CompletionItem{ assignment_statement->name, CompletionItemKind::Field } );
Expand All @@ -212,7 +212,7 @@ std::vector<CompletionItem> CompletionBuilder::context()
// are _after_ scoped constants in `ScopeTree::list_constants()`.
std::set<std::string> calling_scope_consts;

for ( auto* constant : workspace.scope_tree.list_constants( query ) )
for ( auto* constant : workspace.scope_tree->list_constants( query ) )
{
if ( !constant->name.scope.global() )
{
Expand All @@ -233,38 +233,38 @@ std::vector<CompletionItem> CompletionBuilder::context()
// Not in an enum, no need to worry about scoping, just add all the constants.
else
{
for ( auto* constant : workspace.scope_tree.list_constants( query ) )
for ( auto* constant : workspace.scope_tree->list_constants( query ) )
{
results.push_back(
CompletionItem{ constant->name.string(), CompletionItemKind::Constant } );
}
}

for ( auto variable : workspace.scope_tree.list_variables( query, position ) )
for ( auto variable : workspace.scope_tree->list_variables( query, position ) )
{
results.push_back(
CompletionItem{ variable->scoped_name().name, CompletionItemKind::Variable } );
}

for ( auto* user_function : workspace.scope_tree.list_user_functions( query, position ) )
for ( auto* user_function : workspace.scope_tree->list_user_functions( query, position ) )
{
results.push_back(
CompletionItem{ user_function->name, user_function->type == UserFunctionType::Constructor
? CompletionItemKind::Constructor
: CompletionItemKind::Function } );
}

for ( auto* module_function : workspace.scope_tree.list_module_functions( query ) )
for ( auto* module_function : workspace.scope_tree->list_module_functions( query ) )
{
results.push_back( CompletionItem{ module_function->name, CompletionItemKind::Function } );
}

for ( auto& scope_name : workspace.scope_tree.list_scopes( query ) )
for ( auto& scope_name : workspace.scope_tree->list_scopes( query ) )
{
results.push_back( CompletionItem{ scope_name, CompletionItemKind::Class } );
}

for ( auto& module_name : workspace.scope_tree.list_modules( query ) )
for ( auto& module_name : workspace.scope_tree->list_modules( query ) )
{
results.push_back( CompletionItem{ module_name, CompletionItemKind::Module } );
}
Expand Down
4 changes: 2 additions & 2 deletions native/cpp/compiler/DefinitionBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ std::optional<Pol::Bscript::Compiler::SourceLocation> DefinitionBuilder::get_cla
std::optional<Pol::Bscript::Compiler::SourceLocation> DefinitionBuilder::get_method(
const std::string& name )
{
auto user_function = workspace.scope_tree.find_class_method(
auto user_function = workspace.scope_tree->find_class_method(
{ calling_scope, current_user_function, ScopeName::None, name } );

if ( user_function )
Expand All @@ -194,7 +194,7 @@ std::optional<Pol::Bscript::Compiler::SourceLocation> DefinitionBuilder::get_met
std::optional<Pol::Bscript::Compiler::SourceLocation> DefinitionBuilder::get_member(
const std::string& name )
{
auto member = workspace.scope_tree.find_class_member(
auto member = workspace.scope_tree->find_class_member(
{ calling_scope, current_user_function, ScopeName::None, name } );

if ( member )
Expand Down
2 changes: 1 addition & 1 deletion native/cpp/compiler/HoverBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -263,7 +263,7 @@ std::optional<HoverResult> HoverBuilder::get_member( const std::string& name )

std::optional<HoverResult> HoverBuilder::get_method( const std::string& name )
{
auto user_function = workspace.scope_tree.find_class_method(
auto user_function = workspace.scope_tree->find_class_method(
{ calling_scope, current_user_function, ScopeName::None, name } );

if ( user_function )
Expand Down
24 changes: 12 additions & 12 deletions native/cpp/compiler/SemanticContextBuilder.h
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ std::optional<T> SemanticContextBuilder<T>::get_class( const std::string& name )
template <typename T>
std::optional<T> SemanticContextBuilder<T>::try_constant( const std::string& name )
{
if ( auto* function_def = workspace.scope_tree.find_constant( name ) )
if ( auto* function_def = workspace.scope_tree->find_constant( name ) )
{
return get_constant( function_def );
}
Expand All @@ -212,7 +212,7 @@ std::optional<T> SemanticContextBuilder<T>::try_constant( const std::string& nam
template <typename T>
std::optional<T> SemanticContextBuilder<T>::try_variable( const std::string& name )
{
if ( auto variable = workspace.scope_tree.find_variable( name, position ) )
if ( auto variable = workspace.scope_tree->find_variable( name, position ) )
{
return get_variable( variable );
}
Expand All @@ -223,7 +223,7 @@ template <typename T>
std::optional<T> SemanticContextBuilder<T>::try_user_function_parameter(
const Pol::Bscript::Compiler::ScopeTreeQuery& query, const std::string& param_name )
{
if ( auto* function_def = workspace.scope_tree.find_user_function( query ) )
if ( auto* function_def = workspace.scope_tree->find_user_function( query ) )
{
for ( const auto& param_ref : function_def->parameters() )
{
Expand Down Expand Up @@ -255,7 +255,7 @@ template <typename T>
std::optional<T> SemanticContextBuilder<T>::try_user_function(
const Pol::Bscript::Compiler::ScopeTreeQuery& query )
{
if ( auto* function_def = workspace.scope_tree.find_user_function( query ) )
if ( auto* function_def = workspace.scope_tree->find_user_function( query ) )
{
return get_user_function( function_def );
}
Expand All @@ -266,7 +266,7 @@ template <typename T>
std::optional<T> SemanticContextBuilder<T>::try_module_function(
const Pol::Bscript::Compiler::ScopeTreeQuery& query )
{
if ( auto* function_def = workspace.scope_tree.find_module_function( query ) )
if ( auto* function_def = workspace.scope_tree->find_module_function( query ) )
{
return get_module_function( function_def );
}
Expand Down Expand Up @@ -353,7 +353,7 @@ std::optional<T> SemanticContextBuilder<T>::context()

name += id->getText();

if ( auto variable = workspace.scope_tree.find_variable( name, position ) )
if ( auto variable = workspace.scope_tree->find_variable( name, position ) )
{
return get_variable( variable );
}
Expand All @@ -368,7 +368,7 @@ std::optional<T> SemanticContextBuilder<T>::context()
if ( contains( id ) )
{
auto name = id->getText();
if ( auto* constant = workspace.scope_tree.find_constant( name ) )
if ( auto* constant = workspace.scope_tree->find_constant( name ) )
{
return get_constant( constant );
}
Expand All @@ -383,7 +383,7 @@ std::optional<T> SemanticContextBuilder<T>::context()
{
if ( contains( id ) )
{
if ( auto* function_def = workspace.scope_tree.find_module_function(
if ( auto* function_def = workspace.scope_tree->find_module_function(
{ calling_scope, current_user_function, Pol::Bscript::Compiler::ScopeName::None,
id->getText() } ) )
{
Expand All @@ -399,7 +399,7 @@ std::optional<T> SemanticContextBuilder<T>::context()
{
if ( contains( id ) )
{
if ( auto* function_def = workspace.scope_tree.find_user_function(
if ( auto* function_def = workspace.scope_tree->find_user_function(
{ calling_scope, current_user_function, Pol::Bscript::Compiler::ScopeName::None,
id->getText() } ) )
{
Expand All @@ -423,7 +423,7 @@ std::optional<T> SemanticContextBuilder<T>::context()
{
if ( auto* parent_id = parent_ctx->IDENTIFIER() )
{
if ( auto* function_def = workspace.scope_tree.find_module_function(
if ( auto* function_def = workspace.scope_tree->find_module_function(
{ calling_scope, current_user_function,
Pol::Bscript::Compiler::ScopeName::None,
parent_id->getSymbol()->getText() } ) )
Expand Down Expand Up @@ -571,7 +571,7 @@ std::optional<T> SemanticContextBuilder<T>::context()
{
auto function_name = parent_id->getText();

if ( auto class_decl = workspace.scope_tree.find_class( calling_scope ) )
if ( auto class_decl = workspace.scope_tree->find_class( calling_scope ) )
{
for ( const auto& uninit_func_ref : class_decl->uninit_functions() )
{
Expand Down Expand Up @@ -604,7 +604,7 @@ std::optional<T> SemanticContextBuilder<T>::context()
{
auto function_name = id->getText();

if ( auto class_decl = workspace.scope_tree.find_class( calling_scope ) )
if ( auto class_decl = workspace.scope_tree->find_class( calling_scope ) )
{
for ( const auto& uninit_func_ref : class_decl->uninit_functions() )
{
Expand Down
6 changes: 3 additions & 3 deletions native/cpp/compiler/SignatureHelpBuilder.cc
Original file line number Diff line number Diff line change
Expand Up @@ -297,15 +297,15 @@ std::optional<SignatureHelp> SignatureHelpBuilder::context()
}
}

if ( auto* module_function = workspace.scope_tree.find_module_function( query ) )
if ( auto* module_function = workspace.scope_tree->find_module_function( query ) )
{
return make_signature_help( _lsp_workspace, module_function->name,
module_function->parameters(), current_param, module_function,
false );
}
else if ( auto* user_function = ( is_object_access_query
? workspace.scope_tree.find_class_method( query )
: workspace.scope_tree.find_user_function( query ) ) )
? workspace.scope_tree->find_class_method( query )
: workspace.scope_tree->find_user_function( query ) ) )
{
bool skip_first_param =
user_function->type == UserFunctionType::Constructor ||
Expand Down
Loading