Commit 56f5bad1 authored by Xavier Thompson's avatar Xavier Thompson

Fix 'line-too-long' code format test errors in Nodes.py, ModuleNode.py and ExprNodes.py

parent de79649d
...@@ -7135,7 +7135,10 @@ class AttributeNode(ExprNode): ...@@ -7135,7 +7135,10 @@ class AttributeNode(ExprNode):
ubcm_entry.is_unbound_cmethod = 1 ubcm_entry.is_unbound_cmethod = 1
ubcm_entry.scope = entry.scope ubcm_entry.scope = entry.scope
if type.is_cpp_class: if type.is_cpp_class:
ubcm_entry.overloaded_alternatives = [Symtab.Entry(entry.name, entry.func_cname, entry.type) for entry in entry.overloaded_alternatives] ubcm_entry.overloaded_alternatives = [
Symtab.Entry(entry.name, entry.func_cname, entry.type)
for entry in entry.overloaded_alternatives
]
self.entry = ubcm_entry self.entry = ubcm_entry
return self.as_name_node(env, ubcm_entry, target=False) return self.as_name_node(env, ubcm_entry, target=False)
elif type.is_enum: elif type.is_enum:
......
...@@ -1072,7 +1072,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1072,7 +1072,9 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
alloc_entry = scope.lookup_here("<alloc>") alloc_entry = scope.lookup_here("<alloc>")
if alloc_entry.is_builtin_cmethod: if alloc_entry.is_builtin_cmethod:
code.putln("// Generating default __alloc__ function (used for __new__ calls)") code.putln("// Generating default __alloc__ function (used for __new__ calls)")
code.putln("static %s { return new %s(); }" % (alloc_entry.type.declaration_code(alloc_entry.cname), type.declaration_code("", deref=1))) code.putln("static %s { return new %s(); }" %
(alloc_entry.type.declaration_code(alloc_entry.cname),
type.declaration_code("", deref=1)))
code.putln("};") code.putln("};")
if type.is_cyp_class: if type.is_cyp_class:
...@@ -1110,11 +1112,17 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1110,11 +1112,17 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("if (%s->%sn <= %s) {" % code.putln("if (%s->%sn <= %s) {" %
(Naming.optional_args_cname, (Naming.optional_args_cname,
Naming.pyrex_prefix, i)) Naming.pyrex_prefix, i))
code.putln("activated_instance = new %s::Activated(%s);" % (entry.type.empty_declaration_code(), ", ".join(activated_class_constructor_optargs_list + activated_class_constructor_defaultargs_list[i:]))) code.putln("activated_instance = new %s::Activated(%s);" %
(entry.type.empty_declaration_code(),
", ".join(activated_class_constructor_optargs_list + activated_class_constructor_defaultargs_list[i:])))
code.putln("} else {") code.putln("} else {")
activated_class_constructor_optargs_list.append("%s->%s" % (Naming.optional_args_cname, dunder_activate_entry.type.opt_arg_cname(arg.name))) activated_class_constructor_optargs_list.append("%s->%s" %
(Naming.optional_args_cname,
dunder_activate_entry.type.opt_arg_cname(arg.name)))
# We're in the final else clause, corresponding to all optional arguments specified) # We're in the final else clause, corresponding to all optional arguments specified)
code.putln("activated_instance = new %s::Activated(%s);" % (entry.type.empty_declaration_code(), ", ".join(activated_class_constructor_optargs_list))) code.putln("activated_instance = new %s::Activated(%s);" %
(entry.type.empty_declaration_code(),
", ".join(activated_class_constructor_optargs_list)))
for _ in dunder_activate_entry.type.args: for _ in dunder_activate_entry.type.args:
code.putln("}") code.putln("}")
code.putln("}") code.putln("}")
...@@ -1146,7 +1154,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1146,7 +1154,10 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
activable_bases_inheritance_list = ["public %s::Activated" % cname for cname in activable_bases_cnames] activable_bases_inheritance_list = ["public %s::Activated" % cname for cname in activable_bases_cnames]
if activable_bases_cnames: if activable_bases_cnames:
base_classes_code = ", ".join(activable_bases_inheritance_list) base_classes_code = ", ".join(activable_bases_inheritance_list)
initialize_code = ", ".join(["%s::Activated(passive_object, active_queue, active_result_constructor)" % cname for cname in activable_bases_cnames]) initialize_code = ", ".join([
"%s::Activated(passive_object, active_queue, active_result_constructor)" % cname
for cname in activable_bases_cnames
])
else: else:
base_classes_code = "public ActhonActivableClass" base_classes_code = "public ActhonActivableClass"
initialize_code = "ActhonActivableClass(active_queue, active_result_constructor)" initialize_code = "ActhonActivableClass(active_queue, active_result_constructor)"
...@@ -1261,7 +1272,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1261,7 +1272,11 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
code.putln("struct %s : public %s {" % (reifying_class_full_name, message_base_type.empty_declaration_code())) code.putln("struct %s : public %s {" % (reifying_class_full_name, message_base_type.empty_declaration_code()))
# Declaring target object & reified method arguments # Declaring target object & reified method arguments
code.putln("%s;" % target_object_code) code.putln("%s;" % target_object_code)
constructor_args_decl_list = [target_object_code, sync_type.declaration_code(sync_arg_name), result_type.declaration_code(result_arg_name)] constructor_args_decl_list = [
target_object_code,
sync_type.declaration_code(sync_arg_name),
result_type.declaration_code(result_arg_name)
]
initialized_args_list = [target_object_cname] initialized_args_list = [target_object_cname]
opt_arg_count = reified_function_entry.type.optional_arg_count opt_arg_count = reified_function_entry.type.optional_arg_count
...@@ -1336,7 +1351,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode): ...@@ -1336,7 +1351,8 @@ class ModuleNode(Nodes.Node, Nodes.BlockNode):
# because the mode is used for direct calls, when the user have the possibility # because the mode is used for direct calls, when the user have the possibility
# to manually lock or let the compiler handle it. # to manually lock or let the compiler handle it.
# Here, the user cannot lock manually, so we're taking the lock automatically. # Here, the user cannot lock manually, so we're taking the lock automatically.
#put_cypclass_op_on_narg_optarg(lambda arg: "Cy_RLOCK" if arg.type.is_const else "Cy_WLOCK", reified_function_entry.type, Naming.optional_args_cname, code) #put_cypclass_op_on_narg_optarg(lambda arg: "Cy_RLOCK" if arg.type.is_const else "Cy_WLOCK",
# reified_function_entry.type, Naming.optional_args_cname, code)
func_type = reified_function_entry.type func_type = reified_function_entry.type
opt_arg_name = Naming.optional_args_cname opt_arg_name = Naming.optional_args_cname
......
...@@ -681,7 +681,9 @@ class CFuncDeclaratorNode(CDeclaratorNode): ...@@ -681,7 +681,9 @@ class CFuncDeclaratorNode(CDeclaratorNode):
for i, arg_node in enumerate(self.args): for i, arg_node in enumerate(self.args):
name_declarator, type = arg_node.analyse( name_declarator, type = arg_node.analyse(
env, nonempty=nonempty, env, nonempty=nonempty,
is_self_arg=(i == 0 and (env.is_c_class_scope or env.is_cpp_class_scope and env.parent_type.is_cyp_class) and 'staticmethod' not in env.directives)) is_self_arg=(i == 0
and (env.is_c_class_scope or env.is_cpp_class_scope and env.parent_type.is_cyp_class)
and 'staticmethod' not in env.directives))
name = name_declarator.name name = name_declarator.name
if name in directive_locals: if name in directive_locals:
type_node = directive_locals[name] type_node = directive_locals[name]
...@@ -1522,7 +1524,8 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode): ...@@ -1522,7 +1524,8 @@ class CppClassNode(CStructOrUnionDefNode, BlockNode):
error(self.pos, "Required template parameters must precede optional template parameters.") error(self.pos, "Required template parameters must precede optional template parameters.")
self.entry = env.declare_cpp_class( self.entry = env.declare_cpp_class(
self.name, None, self.pos, self.cname, self.name, None, self.pos, self.cname,
base_classes=[], visibility=self.visibility, templates=template_types, cypclass=self.cypclass, lock_mode=self.lock_mode, activable=self.activable) base_classes=[], visibility=self.visibility, templates=template_types,
cypclass=self.cypclass, lock_mode=self.lock_mode, activable=self.activable)
def analyse_declarations(self, env): def analyse_declarations(self, env):
if self.templates is None: if self.templates is None:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment