mirror of
https://github.com/erg-lang/erg.git
synced 2025-07-31 08:54:13 +00:00
Follow clippy warnings
This commit is contained in:
parent
9783813ae0
commit
d956c3f61d
34 changed files with 448 additions and 450 deletions
|
@ -32,163 +32,163 @@ use crate::hir::{
|
|||
use AccessKind::*;
|
||||
|
||||
fn is_python_global(name: &str) -> bool {
|
||||
match name {
|
||||
matches!(
|
||||
name,
|
||||
"ArithmeticError"
|
||||
| "AssertionError"
|
||||
| "AttributeError"
|
||||
| "BaseException"
|
||||
| "BlockingIOError"
|
||||
| "BrokenPipeError"
|
||||
| "BufferError"
|
||||
| "BytesWarning"
|
||||
| "ChildProcessError"
|
||||
| "ConnectionAbortedError"
|
||||
| "ConnectionError"
|
||||
| "ConnectionRefusedError"
|
||||
| "ConnectionResetError"
|
||||
| "DeprecationWarning"
|
||||
| "EOFError"
|
||||
| "Ellipsis"
|
||||
| "EncodingWarning"
|
||||
| "EnvironmentError"
|
||||
| "Exception"
|
||||
| "False"
|
||||
| "FileExistsError"
|
||||
| "FileNotFoundError"
|
||||
| "FloatingPointError"
|
||||
| "FutureWarning"
|
||||
| "GeneratorExit"
|
||||
| "IOError"
|
||||
| "ImportError"
|
||||
| "ImportWarning"
|
||||
| "IndentationError"
|
||||
| "IndexError"
|
||||
| "InterruptedError"
|
||||
| "IsADirectoryError"
|
||||
| "KeyError"
|
||||
| "KeyboardInterrupt"
|
||||
| "LookupError"
|
||||
| "MemoryError"
|
||||
| "ModuleNotFoundError"
|
||||
| "NameError"
|
||||
| "None"
|
||||
| "NotADirectoryError"
|
||||
| "NotImplemented"
|
||||
| "NotImplementedError"
|
||||
| "OSError"
|
||||
| "OverflowError"
|
||||
| "PendingDeprecationWarning"
|
||||
| "PermissionError"
|
||||
| "ProcessLookupError"
|
||||
| "RecursionError"
|
||||
| "ReferenceError"
|
||||
| "ResourceWarning"
|
||||
| "RuntimeError"
|
||||
| "RuntimeWarning"
|
||||
| "StopAsyncIteration"
|
||||
| "StopIteration"
|
||||
| "SyntaxError"
|
||||
| "SyntaxWarning"
|
||||
| "SystemError"
|
||||
| "SystemExit"
|
||||
| "TabError"
|
||||
| "TimeoutError"
|
||||
| "True"
|
||||
| "TypeError"
|
||||
| "UnboundLocalError"
|
||||
| "UnicodeDecodeError"
|
||||
| "UnicodeEncodeError"
|
||||
| "UnicodeError"
|
||||
| "UnicodeTranslateError"
|
||||
| "UnicodeWarning"
|
||||
| "UserWarning"
|
||||
| "ValueError"
|
||||
| "Warning"
|
||||
| "WindowsError"
|
||||
| "ZeroDivisionError"
|
||||
| "__build__class__"
|
||||
| "__debug__"
|
||||
| "__doc__"
|
||||
| "__import__"
|
||||
| "__loader__"
|
||||
| "__name__"
|
||||
| "__package__"
|
||||
| "__spec__"
|
||||
| "__annotations__"
|
||||
| "__builtins__"
|
||||
| "abs"
|
||||
| "aiter"
|
||||
| "all"
|
||||
| "any"
|
||||
| "anext"
|
||||
| "ascii"
|
||||
| "bin"
|
||||
| "bool"
|
||||
| "breakpoint"
|
||||
| "bytearray"
|
||||
| "bytes"
|
||||
| "callable"
|
||||
| "chr"
|
||||
| "classmethod"
|
||||
| "compile"
|
||||
| "complex"
|
||||
| "delattr"
|
||||
| "dict"
|
||||
| "dir"
|
||||
| "divmod"
|
||||
| "enumerate"
|
||||
| "eval"
|
||||
| "exec"
|
||||
| "filter"
|
||||
| "float"
|
||||
| "format"
|
||||
| "frozenset"
|
||||
| "getattr"
|
||||
| "globals"
|
||||
| "hasattr"
|
||||
| "hash"
|
||||
| "help"
|
||||
| "hex"
|
||||
| "id"
|
||||
| "input"
|
||||
| "int"
|
||||
| "isinstance"
|
||||
| "issubclass"
|
||||
| "iter"
|
||||
| "len"
|
||||
| "list"
|
||||
| "locals"
|
||||
| "map"
|
||||
| "max"
|
||||
| "memoryview"
|
||||
| "min"
|
||||
| "next"
|
||||
| "object"
|
||||
| "oct"
|
||||
| "open"
|
||||
| "ord"
|
||||
| "pow"
|
||||
| "print"
|
||||
| "property"
|
||||
| "quit"
|
||||
| "range"
|
||||
| "repr"
|
||||
| "reversed"
|
||||
| "round"
|
||||
| "set"
|
||||
| "setattr"
|
||||
| "slice"
|
||||
| "sorted"
|
||||
| "staticmethod"
|
||||
| "str"
|
||||
| "sum"
|
||||
| "super"
|
||||
| "tuple"
|
||||
| "type"
|
||||
| "vars"
|
||||
| "zip" => true,
|
||||
_ => false,
|
||||
}
|
||||
| "AssertionError"
|
||||
| "AttributeError"
|
||||
| "BaseException"
|
||||
| "BlockingIOError"
|
||||
| "BrokenPipeError"
|
||||
| "BufferError"
|
||||
| "BytesWarning"
|
||||
| "ChildProcessError"
|
||||
| "ConnectionAbortedError"
|
||||
| "ConnectionError"
|
||||
| "ConnectionRefusedError"
|
||||
| "ConnectionResetError"
|
||||
| "DeprecationWarning"
|
||||
| "EOFError"
|
||||
| "Ellipsis"
|
||||
| "EncodingWarning"
|
||||
| "EnvironmentError"
|
||||
| "Exception"
|
||||
| "False"
|
||||
| "FileExistsError"
|
||||
| "FileNotFoundError"
|
||||
| "FloatingPointError"
|
||||
| "FutureWarning"
|
||||
| "GeneratorExit"
|
||||
| "IOError"
|
||||
| "ImportError"
|
||||
| "ImportWarning"
|
||||
| "IndentationError"
|
||||
| "IndexError"
|
||||
| "InterruptedError"
|
||||
| "IsADirectoryError"
|
||||
| "KeyError"
|
||||
| "KeyboardInterrupt"
|
||||
| "LookupError"
|
||||
| "MemoryError"
|
||||
| "ModuleNotFoundError"
|
||||
| "NameError"
|
||||
| "None"
|
||||
| "NotADirectoryError"
|
||||
| "NotImplemented"
|
||||
| "NotImplementedError"
|
||||
| "OSError"
|
||||
| "OverflowError"
|
||||
| "PendingDeprecationWarning"
|
||||
| "PermissionError"
|
||||
| "ProcessLookupError"
|
||||
| "RecursionError"
|
||||
| "ReferenceError"
|
||||
| "ResourceWarning"
|
||||
| "RuntimeError"
|
||||
| "RuntimeWarning"
|
||||
| "StopAsyncIteration"
|
||||
| "StopIteration"
|
||||
| "SyntaxError"
|
||||
| "SyntaxWarning"
|
||||
| "SystemError"
|
||||
| "SystemExit"
|
||||
| "TabError"
|
||||
| "TimeoutError"
|
||||
| "True"
|
||||
| "TypeError"
|
||||
| "UnboundLocalError"
|
||||
| "UnicodeDecodeError"
|
||||
| "UnicodeEncodeError"
|
||||
| "UnicodeError"
|
||||
| "UnicodeTranslateError"
|
||||
| "UnicodeWarning"
|
||||
| "UserWarning"
|
||||
| "ValueError"
|
||||
| "Warning"
|
||||
| "WindowsError"
|
||||
| "ZeroDivisionError"
|
||||
| "__build__class__"
|
||||
| "__debug__"
|
||||
| "__doc__"
|
||||
| "__import__"
|
||||
| "__loader__"
|
||||
| "__name__"
|
||||
| "__package__"
|
||||
| "__spec__"
|
||||
| "__annotations__"
|
||||
| "__builtins__"
|
||||
| "abs"
|
||||
| "aiter"
|
||||
| "all"
|
||||
| "any"
|
||||
| "anext"
|
||||
| "ascii"
|
||||
| "bin"
|
||||
| "bool"
|
||||
| "breakpoint"
|
||||
| "bytearray"
|
||||
| "bytes"
|
||||
| "callable"
|
||||
| "chr"
|
||||
| "classmethod"
|
||||
| "compile"
|
||||
| "complex"
|
||||
| "delattr"
|
||||
| "dict"
|
||||
| "dir"
|
||||
| "divmod"
|
||||
| "enumerate"
|
||||
| "eval"
|
||||
| "exec"
|
||||
| "filter"
|
||||
| "float"
|
||||
| "format"
|
||||
| "frozenset"
|
||||
| "getattr"
|
||||
| "globals"
|
||||
| "hasattr"
|
||||
| "hash"
|
||||
| "help"
|
||||
| "hex"
|
||||
| "id"
|
||||
| "input"
|
||||
| "int"
|
||||
| "isinstance"
|
||||
| "issubclass"
|
||||
| "iter"
|
||||
| "len"
|
||||
| "list"
|
||||
| "locals"
|
||||
| "map"
|
||||
| "max"
|
||||
| "memoryview"
|
||||
| "min"
|
||||
| "next"
|
||||
| "object"
|
||||
| "oct"
|
||||
| "open"
|
||||
| "ord"
|
||||
| "pow"
|
||||
| "print"
|
||||
| "property"
|
||||
| "quit"
|
||||
| "range"
|
||||
| "repr"
|
||||
| "reversed"
|
||||
| "round"
|
||||
| "set"
|
||||
| "setattr"
|
||||
| "slice"
|
||||
| "sorted"
|
||||
| "staticmethod"
|
||||
| "str"
|
||||
| "sum"
|
||||
| "super"
|
||||
| "tuple"
|
||||
| "type"
|
||||
| "vars"
|
||||
| "zip"
|
||||
)
|
||||
}
|
||||
|
||||
fn convert_to_python_attr(class: &str, uniq_obj_name: Option<&str>, name: Str) -> Str {
|
||||
|
@ -732,7 +732,7 @@ impl CodeGenerator {
|
|||
self.write_arg(cellvars_len);
|
||||
opcode_flag += 8;
|
||||
}
|
||||
self.emit_load_const(name.clone());
|
||||
self.emit_load_const(name);
|
||||
self.write_instr(MAKE_FUNCTION);
|
||||
self.write_arg(opcode_flag);
|
||||
// stack_dec: <code obj> + <name> -> <function>
|
||||
|
@ -1225,6 +1225,7 @@ impl CodeGenerator {
|
|||
self.write_instr(CALL_FUNCTION);
|
||||
self.write_arg(2);
|
||||
// (1 (subroutine) + argc + kwsc) input objects -> 1 return object
|
||||
#[allow(clippy::identity_op)]
|
||||
self.stack_dec_n((1 + 2 + 0) - 1);
|
||||
let ident = Identifier::private(Str::ever("#rec"));
|
||||
self.emit_store_instr(ident, Name);
|
||||
|
@ -1237,6 +1238,7 @@ impl CodeGenerator {
|
|||
self.write_instr(CALL_FUNCTION);
|
||||
self.write_arg(attrs_len as u8);
|
||||
// (1 (subroutine) + argc + kwsc) input objects -> 1 return object
|
||||
#[allow(clippy::identity_op)]
|
||||
self.stack_dec_n((1 + attrs_len + 0) - 1);
|
||||
}
|
||||
other => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue