mirror of
https://github.com/godotengine/godot.git
synced 2026-01-03 18:11:19 +03:00
Style: Replaces uses of 0/NULL by nullptr (C++11)
Using clang-tidy's `modernize-use-nullptr`. https://clang.llvm.org/extra/clang-tidy/checks/modernize-use-nullptr.html
This commit is contained in:
@@ -322,7 +322,7 @@ void ExtendGDScriptParser::parse_function_symbol(const GDScriptParser::FunctionN
|
||||
int default_value_idx = i - (p_func->arguments.size() - p_func->default_values.size());
|
||||
if (default_value_idx >= 0) {
|
||||
const GDScriptParser::ConstantNode *const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(p_func->default_values[default_value_idx]);
|
||||
if (const_node == NULL) {
|
||||
if (const_node == nullptr) {
|
||||
const GDScriptParser::OperatorNode *operator_node = dynamic_cast<const GDScriptParser::OperatorNode *>(p_func->default_values[default_value_idx]);
|
||||
if (operator_node) {
|
||||
const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(operator_node->next);
|
||||
@@ -512,7 +512,7 @@ String ExtendGDScriptParser::get_uri() const {
|
||||
}
|
||||
|
||||
const lsp::DocumentSymbol *ExtendGDScriptParser::search_symbol_defined_at_line(int p_line, const lsp::DocumentSymbol &p_parent) const {
|
||||
const lsp::DocumentSymbol *ret = NULL;
|
||||
const lsp::DocumentSymbol *ret = nullptr;
|
||||
if (p_line < p_parent.range.start.line) {
|
||||
return ret;
|
||||
} else if (p_parent.range.start.line == p_line) {
|
||||
@@ -594,7 +594,7 @@ const lsp::DocumentSymbol *ExtendGDScriptParser::get_member_symbol(const String
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const List<lsp::DocumentLink> &ExtendGDScriptParser::get_document_links() const {
|
||||
@@ -603,7 +603,7 @@ const List<lsp::DocumentLink> &ExtendGDScriptParser::get_document_links() const
|
||||
|
||||
const Array &ExtendGDScriptParser::get_member_completions() {
|
||||
if (member_completions.empty()) {
|
||||
const String *name = members.next(NULL);
|
||||
const String *name = members.next(nullptr);
|
||||
while (name) {
|
||||
const lsp::DocumentSymbol *symbol = members.get(*name);
|
||||
lsp::CompletionItem item = symbol->make_completion_item();
|
||||
@@ -613,10 +613,10 @@ const Array &ExtendGDScriptParser::get_member_completions() {
|
||||
name = members.next(name);
|
||||
}
|
||||
|
||||
const String *_class = inner_classes.next(NULL);
|
||||
const String *_class = inner_classes.next(nullptr);
|
||||
while (_class) {
|
||||
const ClassMembers *inner_class = inner_classes.getptr(*_class);
|
||||
const String *member_name = inner_class->next(NULL);
|
||||
const String *member_name = inner_class->next(nullptr);
|
||||
while (member_name) {
|
||||
const lsp::DocumentSymbol *symbol = inner_class->get(*member_name);
|
||||
lsp::CompletionItem item = symbol->make_completion_item();
|
||||
@@ -647,7 +647,7 @@ Dictionary ExtendGDScriptParser::dump_function_api(const GDScriptParser::Functio
|
||||
int default_value_idx = i - (p_func->arguments.size() - p_func->default_values.size());
|
||||
if (default_value_idx >= 0) {
|
||||
const GDScriptParser::ConstantNode *const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(p_func->default_values[default_value_idx]);
|
||||
if (const_node == NULL) {
|
||||
if (const_node == nullptr) {
|
||||
const GDScriptParser::OperatorNode *operator_node = dynamic_cast<const GDScriptParser::OperatorNode *>(p_func->default_values[default_value_idx]);
|
||||
if (operator_node) {
|
||||
const_node = dynamic_cast<const GDScriptParser::ConstantNode *>(operator_node->next);
|
||||
@@ -775,7 +775,7 @@ Error ExtendGDScriptParser::parse(const String &p_code, const String &p_path) {
|
||||
path = p_path;
|
||||
lines = p_code.split("\n");
|
||||
|
||||
Error err = GDScriptParser::parse(p_code, p_path.get_base_dir(), false, p_path, false, NULL, false);
|
||||
Error err = GDScriptParser::parse(p_code, p_path.get_base_dir(), false, p_path, false, nullptr, false);
|
||||
update_diagnostics();
|
||||
update_symbols();
|
||||
update_document_links(p_code);
|
||||
|
||||
@@ -35,7 +35,7 @@
|
||||
#include "editor/editor_log.h"
|
||||
#include "editor/editor_node.h"
|
||||
|
||||
GDScriptLanguageProtocol *GDScriptLanguageProtocol::singleton = NULL;
|
||||
GDScriptLanguageProtocol *GDScriptLanguageProtocol::singleton = nullptr;
|
||||
|
||||
Error GDScriptLanguageProtocol::LSPeer::handle_data() {
|
||||
int read = 0;
|
||||
@@ -190,7 +190,7 @@ Dictionary GDScriptLanguageProtocol::initialize(const Dictionary &p_params) {
|
||||
ERR_FAIL_COND_V_MSG(!clients.has(latest_client_id), ret.to_json(),
|
||||
vformat("GDScriptLanguageProtocol: Can't initialize invalid peer '%d'.", latest_client_id));
|
||||
Ref<LSPeer> peer = clients.get(latest_client_id);
|
||||
if (peer != NULL) {
|
||||
if (peer != nullptr) {
|
||||
String msg = JSON::print(request);
|
||||
msg = format_output(msg);
|
||||
(*peer)->res_queue.push_back(msg.utf8());
|
||||
@@ -227,26 +227,26 @@ void GDScriptLanguageProtocol::poll() {
|
||||
if (server->is_connection_available()) {
|
||||
on_client_connected();
|
||||
}
|
||||
const int *id = NULL;
|
||||
const int *id = nullptr;
|
||||
while ((id = clients.next(id))) {
|
||||
Ref<LSPeer> peer = clients.get(*id);
|
||||
StreamPeerTCP::Status status = peer->connection->get_status();
|
||||
if (status == StreamPeerTCP::STATUS_NONE || status == StreamPeerTCP::STATUS_ERROR) {
|
||||
on_client_disconnected(*id);
|
||||
id = NULL;
|
||||
id = nullptr;
|
||||
} else {
|
||||
if (peer->connection->get_available_bytes() > 0) {
|
||||
latest_client_id = *id;
|
||||
Error err = peer->handle_data();
|
||||
if (err != OK && err != ERR_BUSY) {
|
||||
on_client_disconnected(*id);
|
||||
id = NULL;
|
||||
id = nullptr;
|
||||
}
|
||||
}
|
||||
Error err = peer->send_data();
|
||||
if (err != OK && err != ERR_BUSY) {
|
||||
on_client_disconnected(*id);
|
||||
id = NULL;
|
||||
id = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -257,7 +257,7 @@ Error GDScriptLanguageProtocol::start(int p_port, const IP_Address &p_bind_ip) {
|
||||
}
|
||||
|
||||
void GDScriptLanguageProtocol::stop() {
|
||||
const int *id = NULL;
|
||||
const int *id = nullptr;
|
||||
while ((id = clients.next(id))) {
|
||||
Ref<LSPeer> peer = clients.get(*id);
|
||||
peer->connection->disconnect_from_host();
|
||||
@@ -274,7 +274,7 @@ void GDScriptLanguageProtocol::notify_client(const String &p_method, const Varia
|
||||
}
|
||||
ERR_FAIL_COND(!clients.has(p_client_id));
|
||||
Ref<LSPeer> peer = clients.get(p_client_id);
|
||||
ERR_FAIL_COND(peer == NULL);
|
||||
ERR_FAIL_COND(peer == nullptr);
|
||||
|
||||
Dictionary message = make_notification(p_method, p_params);
|
||||
String msg = JSON::print(message);
|
||||
|
||||
@@ -88,11 +88,11 @@ void GDScriptTextDocument::initialize() {
|
||||
if (GDScriptLanguageProtocol::get_singleton()->is_smart_resolve_enabled()) {
|
||||
const HashMap<StringName, ClassMembers> &native_members = GDScriptLanguageProtocol::get_singleton()->get_workspace()->native_members;
|
||||
|
||||
const StringName *class_ptr = native_members.next(NULL);
|
||||
const StringName *class_ptr = native_members.next(nullptr);
|
||||
while (class_ptr) {
|
||||
const ClassMembers &members = native_members.get(*class_ptr);
|
||||
|
||||
const String *name = members.next(NULL);
|
||||
const String *name = members.next(nullptr);
|
||||
while (name) {
|
||||
const lsp::DocumentSymbol *symbol = members.get(*name);
|
||||
lsp::CompletionItem item = symbol->make_completion_item();
|
||||
@@ -216,7 +216,7 @@ Dictionary GDScriptTextDocument::resolve(const Dictionary &p_params) {
|
||||
lsp::CompletionParams params;
|
||||
Variant data = p_params["data"];
|
||||
|
||||
const lsp::DocumentSymbol *symbol = NULL;
|
||||
const lsp::DocumentSymbol *symbol = nullptr;
|
||||
|
||||
if (data.get_type() == Variant::DICTIONARY) {
|
||||
params.load(p_params["data"]);
|
||||
|
||||
@@ -104,7 +104,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::get_native_symbol(const String &p_
|
||||
class_name = ClassDB::get_parent_class(class_name);
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
const lsp::DocumentSymbol *GDScriptWorkspace::get_script_symbol(const String &p_path) const {
|
||||
@@ -112,7 +112,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::get_script_symbol(const String &p_
|
||||
if (S) {
|
||||
return &(S->get()->get_symbols());
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GDScriptWorkspace::reload_all_workspace_scripts() {
|
||||
@@ -163,7 +163,7 @@ ExtendGDScriptParser *GDScriptWorkspace::get_parse_successed_script(const String
|
||||
if (S) {
|
||||
return S->get();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
ExtendGDScriptParser *GDScriptWorkspace::get_parse_result(const String &p_path) {
|
||||
@@ -175,7 +175,7 @@ ExtendGDScriptParser *GDScriptWorkspace::get_parse_result(const String &p_path)
|
||||
if (S) {
|
||||
return S->get();
|
||||
}
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Array GDScriptWorkspace::symbol(const Dictionary &p_params) {
|
||||
@@ -410,7 +410,7 @@ void GDScriptWorkspace::_get_owners(EditorFileSystemDirectory *efsd, String p_pa
|
||||
}
|
||||
|
||||
Node *GDScriptWorkspace::_get_owner_scene_node(String p_path) {
|
||||
Node *owner_scene_node = NULL;
|
||||
Node *owner_scene_node = nullptr;
|
||||
List<String> owners;
|
||||
|
||||
_get_owners(EditorFileSystem::get_singleton()->get_filesystem(), p_path, owners);
|
||||
@@ -444,7 +444,7 @@ void GDScriptWorkspace::completion(const lsp::CompletionParams &p_params, List<S
|
||||
}
|
||||
|
||||
const lsp::DocumentSymbol *GDScriptWorkspace::resolve_symbol(const lsp::TextDocumentPositionParams &p_doc_pos, const String &p_symbol_name, bool p_func_requred) {
|
||||
const lsp::DocumentSymbol *symbol = NULL;
|
||||
const lsp::DocumentSymbol *symbol = nullptr;
|
||||
|
||||
String path = get_file_path(p_doc_pos.textDocument.uri);
|
||||
if (const ExtendGDScriptParser *parser = get_parse_result(path)) {
|
||||
@@ -468,7 +468,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::resolve_symbol(const lsp::TextDocu
|
||||
|
||||
} else {
|
||||
ScriptLanguage::LookupResult ret;
|
||||
if (OK == GDScriptLanguage::get_singleton()->lookup_code(parser->get_text_for_lookup_symbol(pos, symbol_identifier, p_func_requred), symbol_identifier, path, NULL, ret)) {
|
||||
if (OK == GDScriptLanguage::get_singleton()->lookup_code(parser->get_text_for_lookup_symbol(pos, symbol_identifier, p_func_requred), symbol_identifier, path, nullptr, ret)) {
|
||||
if (ret.type == ScriptLanguage::LookupResult::RESULT_SCRIPT_LOCATION) {
|
||||
String target_script_path = path;
|
||||
if (!ret.script.is_null()) {
|
||||
@@ -503,7 +503,7 @@ void GDScriptWorkspace::resolve_related_symbols(const lsp::TextDocumentPositionP
|
||||
Vector2i offset;
|
||||
symbol_identifier = parser->get_identifier_under_position(p_doc_pos.position, offset);
|
||||
|
||||
const StringName *class_ptr = native_members.next(NULL);
|
||||
const StringName *class_ptr = native_members.next(nullptr);
|
||||
while (class_ptr) {
|
||||
const ClassMembers &members = native_members.get(*class_ptr);
|
||||
if (const lsp::DocumentSymbol *const *symbol = members.getptr(symbol_identifier)) {
|
||||
@@ -520,7 +520,7 @@ void GDScriptWorkspace::resolve_related_symbols(const lsp::TextDocumentPositionP
|
||||
}
|
||||
|
||||
const HashMap<String, ClassMembers> &inner_classes = script->get_inner_classes();
|
||||
const String *_class = inner_classes.next(NULL);
|
||||
const String *_class = inner_classes.next(nullptr);
|
||||
while (_class) {
|
||||
const ClassMembers *inner_class = inner_classes.getptr(*_class);
|
||||
if (const lsp::DocumentSymbol *const *symbol = inner_class->getptr(symbol_identifier)) {
|
||||
@@ -547,7 +547,7 @@ const lsp::DocumentSymbol *GDScriptWorkspace::resolve_native_symbol(const lsp::N
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
void GDScriptWorkspace::resolve_document_links(const String &p_uri, List<lsp::DocumentLink> &r_list) {
|
||||
|
||||
@@ -155,7 +155,7 @@ struct LocationLink {
|
||||
* Used as the underlined span for mouse interaction. Defaults to the word range at
|
||||
* the mouse position.
|
||||
*/
|
||||
Range *originSelectionRange = NULL;
|
||||
Range *originSelectionRange = nullptr;
|
||||
|
||||
/**
|
||||
* The target resource identifier of this link.
|
||||
@@ -1802,8 +1802,8 @@ struct InitializeResult {
|
||||
|
||||
struct GodotNativeClassInfo {
|
||||
String name;
|
||||
const DocData::ClassDoc *class_doc = NULL;
|
||||
const ClassDB::ClassInfo *class_info = NULL;
|
||||
const DocData::ClassDoc *class_doc = nullptr;
|
||||
const ClassDB::ClassInfo *class_info = nullptr;
|
||||
|
||||
Dictionary to_json() {
|
||||
Dictionary dict;
|
||||
|
||||
Reference in New Issue
Block a user