mirror of
https://github.com/erg-lang/erg.git
synced 2025-09-28 20:14:45 +00:00
fix: ByteArray!
is not defined
This commit is contained in:
parent
22cd07a414
commit
325ab03b24
3 changed files with 22 additions and 22 deletions
|
@ -3222,34 +3222,34 @@ impl Context {
|
||||||
);
|
);
|
||||||
list_mut_.register_trait_methods(list_mut_t.clone(), list_mut_mutable);
|
list_mut_.register_trait_methods(list_mut_t.clone(), list_mut_mutable);
|
||||||
/* ByteArray! */
|
/* ByteArray! */
|
||||||
let bytelist_mut_t = mono(BYTEARRAY);
|
let bytearray_mut_t = mono(MUT_BYTEARRAY);
|
||||||
let mut bytelist_mut = Self::builtin_mono_class(BYTEARRAY, 2);
|
let mut bytearray_mut = Self::builtin_mono_class(MUT_BYTEARRAY, 2);
|
||||||
let t_append = pr_met(
|
let t_append = pr_met(
|
||||||
ref_mut(bytelist_mut_t.clone(), None),
|
ref_mut(bytearray_mut_t.clone(), None),
|
||||||
vec![kw(KW_ELEM, int_interval(IntervalOp::Closed, 0, 255))],
|
vec![kw(KW_ELEM, int_interval(IntervalOp::Closed, 0, 255))],
|
||||||
None,
|
None,
|
||||||
vec![],
|
vec![],
|
||||||
NoneType,
|
NoneType,
|
||||||
);
|
);
|
||||||
bytelist_mut.register_builtin_py_impl(
|
bytearray_mut.register_builtin_py_impl(
|
||||||
PROC_PUSH,
|
PROC_PUSH,
|
||||||
t_append,
|
t_append,
|
||||||
Immutable,
|
Immutable,
|
||||||
Visibility::BUILTIN_PUBLIC,
|
Visibility::BUILTIN_PUBLIC,
|
||||||
Some(FUNC_APPEND),
|
Some(FUNC_APPEND),
|
||||||
);
|
);
|
||||||
let t_copy = fn0_met(ref_(bytelist_mut_t.clone()), bytelist_mut_t.clone());
|
let t_copy = fn0_met(ref_(bytearray_mut_t.clone()), bytearray_mut_t.clone());
|
||||||
let mut bytelist_mut_copy = Self::builtin_methods(Some(mono(COPY)), 2);
|
let mut bytearray_mut_copy = Self::builtin_methods(Some(mono(COPY)), 2);
|
||||||
bytelist_mut_copy.register_builtin_py_impl(
|
bytearray_mut_copy.register_builtin_py_impl(
|
||||||
FUNC_COPY,
|
FUNC_COPY,
|
||||||
t_copy,
|
t_copy,
|
||||||
Immutable,
|
Immutable,
|
||||||
Visibility::BUILTIN_PUBLIC,
|
Visibility::BUILTIN_PUBLIC,
|
||||||
Some(FUNC_COPY),
|
Some(FUNC_COPY),
|
||||||
);
|
);
|
||||||
bytelist_mut.register_trait_methods(bytelist_mut_t.clone(), bytelist_mut_copy);
|
bytearray_mut.register_trait_methods(bytearray_mut_t.clone(), bytearray_mut_copy);
|
||||||
let t_extend = pr_met(
|
let t_extend = pr_met(
|
||||||
ref_mut(bytelist_mut_t.clone(), None),
|
ref_mut(bytearray_mut_t.clone(), None),
|
||||||
vec![kw(
|
vec![kw(
|
||||||
KW_ITERABLE,
|
KW_ITERABLE,
|
||||||
poly(
|
poly(
|
||||||
|
@ -3261,7 +3261,7 @@ impl Context {
|
||||||
vec![],
|
vec![],
|
||||||
NoneType,
|
NoneType,
|
||||||
);
|
);
|
||||||
bytelist_mut.register_builtin_py_impl(
|
bytearray_mut.register_builtin_py_impl(
|
||||||
PROC_EXTEND,
|
PROC_EXTEND,
|
||||||
t_extend,
|
t_extend,
|
||||||
Immutable,
|
Immutable,
|
||||||
|
@ -3269,7 +3269,7 @@ impl Context {
|
||||||
Some(FUNC_EXTEND),
|
Some(FUNC_EXTEND),
|
||||||
);
|
);
|
||||||
let t_insert = pr_met(
|
let t_insert = pr_met(
|
||||||
ref_mut(bytelist_mut_t.clone(), None),
|
ref_mut(bytearray_mut_t.clone(), None),
|
||||||
vec![
|
vec![
|
||||||
kw(KW_INDEX, Nat),
|
kw(KW_INDEX, Nat),
|
||||||
kw(KW_ELEM, int_interval(IntervalOp::Closed, 0, 255)),
|
kw(KW_ELEM, int_interval(IntervalOp::Closed, 0, 255)),
|
||||||
|
@ -3278,7 +3278,7 @@ impl Context {
|
||||||
vec![],
|
vec![],
|
||||||
NoneType,
|
NoneType,
|
||||||
);
|
);
|
||||||
bytelist_mut.register_builtin_py_impl(
|
bytearray_mut.register_builtin_py_impl(
|
||||||
PROC_INSERT,
|
PROC_INSERT,
|
||||||
t_insert,
|
t_insert,
|
||||||
Immutable,
|
Immutable,
|
||||||
|
@ -3286,18 +3286,18 @@ impl Context {
|
||||||
Some(FUNC_INSERT),
|
Some(FUNC_INSERT),
|
||||||
);
|
);
|
||||||
let t_pop = pr0_met(
|
let t_pop = pr0_met(
|
||||||
ref_mut(bytelist_mut_t.clone(), None),
|
ref_mut(bytearray_mut_t.clone(), None),
|
||||||
int_interval(IntervalOp::Closed, 0, 255),
|
int_interval(IntervalOp::Closed, 0, 255),
|
||||||
);
|
);
|
||||||
bytelist_mut.register_builtin_py_impl(
|
bytearray_mut.register_builtin_py_impl(
|
||||||
PROC_POP,
|
PROC_POP,
|
||||||
t_pop,
|
t_pop,
|
||||||
Immutable,
|
Immutable,
|
||||||
Visibility::BUILTIN_PUBLIC,
|
Visibility::BUILTIN_PUBLIC,
|
||||||
Some(FUNC_POP),
|
Some(FUNC_POP),
|
||||||
);
|
);
|
||||||
let t_reverse = pr0_met(ref_mut(bytelist_mut_t.clone(), None), NoneType);
|
let t_reverse = pr0_met(ref_mut(bytearray_mut_t.clone(), None), NoneType);
|
||||||
bytelist_mut.register_builtin_py_impl(
|
bytearray_mut.register_builtin_py_impl(
|
||||||
PROC_REVERSE,
|
PROC_REVERSE,
|
||||||
t_reverse,
|
t_reverse,
|
||||||
Immutable,
|
Immutable,
|
||||||
|
@ -3931,11 +3931,11 @@ impl Context {
|
||||||
self.register_builtin_type(mono(MUT_FILE), file_mut, vis.clone(), Const, Some(FILE));
|
self.register_builtin_type(mono(MUT_FILE), file_mut, vis.clone(), Const, Some(FILE));
|
||||||
self.register_builtin_type(list_mut_t, list_mut_, vis.clone(), Const, Some(LIST));
|
self.register_builtin_type(list_mut_t, list_mut_, vis.clone(), Const, Some(LIST));
|
||||||
self.register_builtin_type(
|
self.register_builtin_type(
|
||||||
bytelist_mut_t,
|
bytearray_mut_t,
|
||||||
bytelist_mut,
|
bytearray_mut,
|
||||||
vis.clone(),
|
vis.clone(),
|
||||||
Const,
|
Const,
|
||||||
Some(BYTEARRAY),
|
Some(FUNC_BYTEARRAY),
|
||||||
);
|
);
|
||||||
self.register_builtin_type(dict_mut_t, dict_mut, vis.clone(), Const, Some(DICT));
|
self.register_builtin_type(dict_mut_t, dict_mut, vis.clone(), Const, Some(DICT));
|
||||||
self.register_builtin_type(set_mut_t, set_mut_, vis.clone(), Const, Some(SET));
|
self.register_builtin_type(set_mut_t, set_mut_, vis.clone(), Const, Some(SET));
|
||||||
|
|
|
@ -70,7 +70,7 @@ impl Context {
|
||||||
let t_bytes_array = no_var_func(
|
let t_bytes_array = no_var_func(
|
||||||
vec![],
|
vec![],
|
||||||
vec![kw(KW_ITERABLE, poly(ITERABLE, vec![ty_tp(Int)]))],
|
vec![kw(KW_ITERABLE, poly(ITERABLE, vec![ty_tp(Int)]))],
|
||||||
mono(BYTEARRAY),
|
mono(MUT_BYTEARRAY),
|
||||||
);
|
);
|
||||||
let t_callable = func1(Obj, Bool);
|
let t_callable = func1(Obj, Bool);
|
||||||
let t_chr = nd_func(
|
let t_chr = nd_func(
|
||||||
|
@ -275,7 +275,7 @@ impl Context {
|
||||||
let t_memoryview = nd_func(
|
let t_memoryview = nd_func(
|
||||||
vec![kw(
|
vec![kw(
|
||||||
KW_OBJ,
|
KW_OBJ,
|
||||||
mono(BYTES) | mono(BYTEARRAY) | mono("array.Array!"),
|
mono(BYTES) | mono(MUT_BYTEARRAY) | mono("array.Array!"),
|
||||||
)],
|
)],
|
||||||
None,
|
None,
|
||||||
mono(MEMORYVIEW),
|
mono(MEMORYVIEW),
|
||||||
|
|
|
@ -141,7 +141,7 @@ const NEVER: &str = "Never";
|
||||||
const OBJ: &str = "Obj";
|
const OBJ: &str = "Obj";
|
||||||
const MUTABLE_OBJ: &str = "Obj!";
|
const MUTABLE_OBJ: &str = "Obj!";
|
||||||
const BYTES: &str = "Bytes";
|
const BYTES: &str = "Bytes";
|
||||||
const BYTEARRAY: &str = "ByteArray!";
|
const MUT_BYTEARRAY: &str = "ByteArray!";
|
||||||
const FLOAT: &str = "Float";
|
const FLOAT: &str = "Float";
|
||||||
const MUT_FLOAT: &str = "Float!";
|
const MUT_FLOAT: &str = "Float!";
|
||||||
const EPSILON: &str = "EPSILON";
|
const EPSILON: &str = "EPSILON";
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue