Merge pull request #54348 from akien-mga/3.x-clang-format-dont-align-operands

This commit is contained in:
Rémi Verschelde
2021-10-28 15:43:15 +02:00
committed by GitHub
137 changed files with 960 additions and 1240 deletions

View File

@@ -1782,15 +1782,15 @@ void GDScriptLanguage::get_reserved_words(List<String> *p_words) const {
bool GDScriptLanguage::is_control_flow_keyword(String p_keyword) const {
return p_keyword == "break" ||
p_keyword == "continue" ||
p_keyword == "elif" ||
p_keyword == "else" ||
p_keyword == "if" ||
p_keyword == "for" ||
p_keyword == "match" ||
p_keyword == "pass" ||
p_keyword == "return" ||
p_keyword == "while";
p_keyword == "continue" ||
p_keyword == "elif" ||
p_keyword == "else" ||
p_keyword == "if" ||
p_keyword == "for" ||
p_keyword == "match" ||
p_keyword == "pass" ||
p_keyword == "return" ||
p_keyword == "while";
}
bool GDScriptLanguage::handles_global_class_type(const String &p_type) const {

View File

@@ -745,7 +745,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
} else {
#ifdef DEBUG_ENABLED
err_text = "Trying to assign value of type '" + Variant::get_type_name(src->get_type()) +
"' to a variable of type '" + Variant::get_type_name(var_type) + "'.";
"' to a variable of type '" + Variant::get_type_name(var_type) + "'.";
OPCODE_BREAK;
}
} else {
@@ -768,14 +768,14 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
GD_ERR_BREAK(!nc);
if (src->get_type() != Variant::OBJECT && src->get_type() != Variant::NIL) {
err_text = "Trying to assign value of type '" + Variant::get_type_name(src->get_type()) +
"' to a variable of type '" + nc->get_name() + "'.";
"' to a variable of type '" + nc->get_name() + "'.";
OPCODE_BREAK;
}
Object *src_obj = src->operator Object *();
if (src_obj && !ClassDB::is_parent_class(src_obj->get_class_name(), nc->get_name())) {
err_text = "Trying to assign value of type '" + src_obj->get_class_name() +
"' to a variable of type '" + nc->get_name() + "'.";
"' to a variable of type '" + nc->get_name() + "'.";
OPCODE_BREAK;
}
#endif // DEBUG_ENABLED
@@ -805,7 +805,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
ScriptInstance *scr_inst = src->operator Object *()->get_script_instance();
if (!scr_inst) {
err_text = "Trying to assign value of type '" + src->operator Object *()->get_class_name() +
"' to a variable of type '" + base_type->get_path().get_file() + "'.";
"' to a variable of type '" + base_type->get_path().get_file() + "'.";
OPCODE_BREAK;
}
@@ -822,7 +822,7 @@ Variant GDScriptFunction::call(GDScriptInstance *p_instance, const Variant **p_a
if (!valid) {
err_text = "Trying to assign value of type '" + src->operator Object *()->get_script_instance()->get_script()->get_path().get_file() +
"' to a variable of type '" + base_type->get_path().get_file() + "'.";
"' to a variable of type '" + base_type->get_path().get_file() + "'.";
OPCODE_BREAK;
}
}

View File

@@ -4864,14 +4864,14 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
if (current_class->constant_expressions.has(member.identifier)) {
_set_error("A constant named \"" + String(member.identifier) + "\" already exists in this class (at line: " +
itos(current_class->constant_expressions[member.identifier].expression->line) + ").");
itos(current_class->constant_expressions[member.identifier].expression->line) + ").");
return;
}
for (int i = 0; i < current_class->variables.size(); i++) {
if (current_class->variables[i].identifier == member.identifier) {
_set_error("Variable \"" + String(member.identifier) + "\" already exists in this class (at line: " +
itos(current_class->variables[i].line) + ").");
itos(current_class->variables[i].line) + ").");
return;
}
}
@@ -5123,14 +5123,14 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
if (current_class->constant_expressions.has(const_id)) {
_set_error("Constant \"" + String(const_id) + "\" already exists in this class (at line " +
itos(current_class->constant_expressions[const_id].expression->line) + ").");
itos(current_class->constant_expressions[const_id].expression->line) + ").");
return;
}
for (int i = 0; i < current_class->variables.size(); i++) {
if (current_class->variables[i].identifier == const_id) {
_set_error("A variable named \"" + String(const_id) + "\" already exists in this class (at line " +
itos(current_class->variables[i].line) + ").");
itos(current_class->variables[i].line) + ").");
return;
}
}
@@ -5201,14 +5201,14 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
if (current_class->constant_expressions.has(enum_name)) {
_set_error("A constant named \"" + String(enum_name) + "\" already exists in this class (at line " +
itos(current_class->constant_expressions[enum_name].expression->line) + ").");
itos(current_class->constant_expressions[enum_name].expression->line) + ").");
return;
}
for (int i = 0; i < current_class->variables.size(); i++) {
if (current_class->variables[i].identifier == enum_name) {
_set_error("A variable named \"" + String(enum_name) + "\" already exists in this class (at line " +
itos(current_class->variables[i].line) + ").");
itos(current_class->variables[i].line) + ").");
return;
}
}
@@ -5293,14 +5293,14 @@ void GDScriptParser::_parse_class(ClassNode *p_class) {
} else {
if (current_class->constant_expressions.has(const_id)) {
_set_error("A constant named \"" + String(const_id) + "\" already exists in this class (at line " +
itos(current_class->constant_expressions[const_id].expression->line) + ").");
itos(current_class->constant_expressions[const_id].expression->line) + ").");
return;
}
for (int i = 0; i < current_class->variables.size(); i++) {
if (current_class->variables[i].identifier == const_id) {
_set_error("A variable named \"" + String(const_id) + "\" already exists in this class (at line " +
itos(current_class->variables[i].line) + ").");
itos(current_class->variables[i].line) + ").");
return;
}
}
@@ -5952,8 +5952,8 @@ GDScriptParser::DataType GDScriptParser::_resolve_type(const DataType &p_source,
} else {
base = result.to_string();
}
_set_error("The identifier \"" + String(id) + "\" isn't a valid type (not a script or class), or couldn't be found on base \"" +
base + "\".",
_set_error("The identifier \"" + String(id) +
"\" isn't a valid type (not a script or class), or couldn't be found on base \"" + base + "\".",
p_line);
return DataType();
}
@@ -6449,7 +6449,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
if (!valid) {
_set_error("Invalid cast. Cannot convert from \"" + source_type.to_string() +
"\" to \"" + cn->cast_type.to_string() + "\".",
"\" to \"" + cn->cast_type.to_string() + "\".",
cn->line);
return DataType();
}
@@ -6537,7 +6537,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
if (check_types && !valid) {
_set_error("Invalid operand type (\"" + argument_type.to_string() +
"\") to unary operator \"" + Variant::get_operator_name(var_op) + "\".",
"\") to unary operator \"" + Variant::get_operator_name(var_op) + "\".",
op->line, op->column);
return DataType();
}
@@ -6581,7 +6581,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
if (check_types && !valid) {
_set_error("Invalid operand types (\"" + argument_a_type.to_string() + "\" and \"" +
argument_b_type.to_string() + "\") to operator \"" + Variant::get_operator_name(var_op) + "\".",
argument_b_type.to_string() + "\") to operator \"" + Variant::get_operator_name(var_op) + "\".",
op->line, op->column);
return DataType();
}
@@ -6667,7 +6667,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
result = _type_from_variant(res);
} else if (check_types) {
_set_error("Can't get index \"" + String(member_id->name.operator String()) + "\" on base \"" +
base_type.to_string() + "\".",
base_type.to_string() + "\".",
op->line);
return DataType();
}
@@ -6794,7 +6794,7 @@ GDScriptParser::DataType GDScriptParser::_reduce_node_type(Node *p_node) {
node_type.is_constant = false;
} else if (check_types) {
_set_error("Can't get index \"" + String(cn->value) + "\" on base \"" +
base_type.to_string() + "\".",
base_type.to_string() + "\".",
op->line);
return DataType();
}
@@ -7388,8 +7388,8 @@ GDScriptParser::DataType GDScriptParser::_reduce_function_call_type(const Operat
// Supertypes are acceptable for dynamic compliance
if (!_is_type_compatible(par_type, arg_types[i - arg_diff])) {
_set_error("At \"" + callee_name + "()\" call, argument " + itos(i - arg_diff + 1) + ". The passed argument's type (" +
par_type.to_string() + ") doesn't match the function's expected argument type (" +
arg_types[i - arg_diff].to_string() + ").",
par_type.to_string() + ") doesn't match the function's expected argument type (" +
arg_types[i - arg_diff].to_string() + ").",
p_call->line);
return DataType();
} else {
@@ -7873,7 +7873,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
// Try with implicit conversion
if (v.data_type.kind != DataType::BUILTIN || !_is_type_compatible(v.data_type, expr_type, true)) {
_set_error("The assigned expression's type (" + expr_type.to_string() + ") doesn't match the variable's type (" +
v.data_type.to_string() + ").",
v.data_type.to_string() + ").",
v.line);
return;
}
@@ -7918,7 +7918,7 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
DataType export_type = _type_from_property(v._export);
if (!_is_type_compatible(v.data_type, export_type, true)) {
_set_error("The export hint's type (" + export_type.to_string() + ") doesn't match the variable's type (" +
v.data_type.to_string() + ").",
v.data_type.to_string() + ").",
v.line);
return;
}
@@ -7939,14 +7939,14 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
if (setter->get_required_argument_count() != 1 &&
!(setter->get_required_argument_count() == 0 && setter->default_values.size() > 0)) {
_set_error("The setter function needs to receive exactly 1 argument. See \"" + setter->name +
"()\" definition at line " + itos(setter->line) + ".",
"()\" definition at line " + itos(setter->line) + ".",
v.line);
return;
}
if (!_is_type_compatible(v.data_type, setter->argument_types[0])) {
_set_error("The setter argument's type (" + setter->argument_types[0].to_string() +
") doesn't match the variable's type (" + v.data_type.to_string() + "). See \"" +
setter->name + "()\" definition at line " + itos(setter->line) + ".",
") doesn't match the variable's type (" + v.data_type.to_string() + "). See \"" +
setter->name + "()\" definition at line " + itos(setter->line) + ".",
v.line);
return;
}
@@ -7958,14 +7958,14 @@ void GDScriptParser::_check_class_level_types(ClassNode *p_class) {
if (getter->get_required_argument_count() != 0) {
_set_error("The getter function can't receive arguments. See \"" + getter->name +
"()\" definition at line " + itos(getter->line) + ".",
"()\" definition at line " + itos(getter->line) + ".",
v.line);
return;
}
if (!_is_type_compatible(v.data_type, getter->get_datatype())) {
_set_error("The getter return type (" + getter->get_datatype().to_string() +
") doesn't match the variable's type (" + v.data_type.to_string() +
"). See \"" + getter->name + "()\" definition at line " + itos(getter->line) + ".",
") doesn't match the variable's type (" + v.data_type.to_string() +
"). See \"" + getter->name + "()\" definition at line " + itos(getter->line) + ".",
v.line);
return;
}
@@ -8088,7 +8088,7 @@ void GDScriptParser::_check_function_types(FunctionNode *p_function) {
if (!_is_type_compatible(p_function->argument_types[i], def_type, true)) {
String arg_name = p_function->arguments[i];
_set_error("Value type (" + def_type.to_string() + ") doesn't match the type of argument '" +
arg_name + "' (" + p_function->argument_types[i].to_string() + ").",
arg_name + "' (" + p_function->argument_types[i].to_string() + ").",
p_function->line);
}
}
@@ -8301,7 +8301,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
// Try implicit conversion
if (lv->datatype.kind != DataType::BUILTIN || !_is_type_compatible(lv->datatype, assign_type, true)) {
_set_error("The assigned value type (" + assign_type.to_string() + ") doesn't match the variable's type (" +
lv->datatype.to_string() + ").",
lv->datatype.to_string() + ").",
lv->line);
return;
}
@@ -8407,7 +8407,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
if (check_types && !valid) {
_set_error("Invalid operand types (\"" + lh_type.to_string() + "\" and \"" + arg_type.to_string() +
"\") to assignment operator \"" + Variant::get_operator_name(oper) + "\".",
"\") to assignment operator \"" + Variant::get_operator_name(oper) + "\".",
op->line);
return;
}
@@ -8439,7 +8439,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
// Try implicit conversion
if (lh_type.kind != DataType::BUILTIN || !_is_type_compatible(lh_type, rh_type, true)) {
_set_error("The assigned value's type (" + rh_type.to_string() + ") doesn't match the variable's type (" +
lh_type.to_string() + ").",
lh_type.to_string() + ").",
op->line);
return;
}
@@ -8548,7 +8548,7 @@ void GDScriptParser::_check_block_types(BlockNode *p_block) {
if (!_is_type_compatible(function_type, ret_type)) {
_set_error("The returned value type (" + ret_type.to_string() + ") doesn't match the function return type (" +
function_type.to_string() + ").",
function_type.to_string() + ").",
cf->line, cf->column);
return;
}

View File

@@ -358,21 +358,21 @@ struct Command {
namespace TextDocumentSyncKind {
/**
* Documents should not be synced at all.
*/
* Documents should not be synced at all.
*/
static const int None = 0;
/**
* Documents are synced by always sending the full content
* of the document.
*/
* Documents are synced by always sending the full content
* of the document.
*/
static const int Full = 1;
/**
* Documents are synced by sending the full content on open.
* After that only incremental updates to the document are
* send.
*/
* Documents are synced by sending the full content on open.
* After that only incremental updates to the document are
* send.
*/
static const int Incremental = 2;
}; // namespace TextDocumentSyncKind
@@ -667,20 +667,20 @@ struct TextDocumentContentChangeEvent {
// Use namespace instead of enumeration to follow the LSP specifications
namespace DiagnosticSeverity {
/**
* Reports an error.
*/
* Reports an error.
*/
static const int Error = 1;
/**
* Reports a warning.
*/
* Reports a warning.
*/
static const int Warning = 2;
/**
* Reports an information.
*/
* Reports an information.
*/
static const int Information = 3;
/**
* Reports a hint.
*/
* Reports a hint.
*/
static const int Hint = 4;
}; // namespace DiagnosticSeverity
@@ -871,18 +871,18 @@ static const int TypeParameter = 25;
*/
namespace InsertTextFormat {
/**
* The primary text to be inserted is treated as a plain string.
*/
* The primary text to be inserted is treated as a plain string.
*/
static const int PlainText = 1;
/**
* The primary text to be inserted is treated as a snippet.
*
* A snippet can define tab stops and placeholders with `$1`, `$2`
* and `${3:foo}`. `$0` defines the final tab stop, it defaults to
* the end of the snippet. Placeholders with equal identifiers are linked,
* that is typing in one will update others too.
*/
* The primary text to be inserted is treated as a snippet.
*
* A snippet can define tab stops and placeholders with `$1`, `$2`
* and `${3:foo}`. `$0` defines the final tab stop, it defaults to
* the end of the snippet. Placeholders with equal identifiers are linked,
* that is typing in one will update others too.
*/
static const int Snippet = 2;
}; // namespace InsertTextFormat
@@ -1359,16 +1359,16 @@ struct NativeSymbolInspectParams {
*/
namespace FoldingRangeKind {
/**
* Folding range for a comment
*/
* Folding range for a comment
*/
static const String Comment = "comment";
/**
* Folding range for a imports or includes
*/
* Folding range for a imports or includes
*/
static const String Imports = "imports";
/**
* Folding range for a region (e.g. `#region`)
*/
* Folding range for a region (e.g. `#region`)
*/
static const String Region = "region";
} // namespace FoldingRangeKind
@@ -1419,20 +1419,20 @@ struct FoldingRange {
*/
namespace CompletionTriggerKind {
/**
* Completion was triggered by typing an identifier (24x7 code
* complete), manual invocation (e.g Ctrl+Space) or via API.
*/
* Completion was triggered by typing an identifier (24x7 code
* complete), manual invocation (e.g Ctrl+Space) or via API.
*/
static const int Invoked = 1;
/**
* Completion was triggered by a trigger character specified by
* the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
*/
* Completion was triggered by a trigger character specified by
* the `triggerCharacters` properties of the `CompletionRegistrationOptions`.
*/
static const int TriggerCharacter = 2;
/**
* Completion was re-triggered as the current completion list is incomplete.
*/
* Completion was re-triggered as the current completion list is incomplete.
*/
static const int TriggerForIncompleteCompletions = 3;
} // namespace CompletionTriggerKind
@@ -1441,8 +1441,8 @@ static const int TriggerForIncompleteCompletions = 3;
*/
struct CompletionContext {
/**
* How the completion was triggered.
*/
* How the completion was triggered.
*/
int triggerKind = CompletionTriggerKind::TriggerCharacter;
/**
@@ -1906,7 +1906,7 @@ struct GodotNativeClassInfo {
struct GodotCapabilities {
/**
* Native class list
*/
*/
List<GodotNativeClassInfo> native_classes;
Dictionary to_json() {