Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit3daec5a

Browse files
committed
Remove unused code
1 parentaca4508 commit3daec5a

File tree

2 files changed

+0
-117
lines changed

2 files changed

+0
-117
lines changed

‎compiler/core/src/opcodes.rs‎

Lines changed: 0 additions & 34 deletions
Some generated files are not rendered by default. Learn more aboutcustomizing how changed files appear on GitHub.

‎scripts/gen_opcodes.py‎

Lines changed: 0 additions & 83 deletions
Original file line numberDiff line numberDiff line change
@@ -50,61 +50,6 @@ def _var_size(var):
5050
StackOffset.push=lambdaself,item:self.pushed.append(_var_size(item))
5151

5252

53-
defgroup_ranges(it:"Iterable[int]")->"Iterator[range]":
54-
"""
55-
Group consecutive numbers into ranges.
56-
57-
Parameters
58-
----------
59-
it : Iterable[int]
60-
Numbers to group into ranges.
61-
62-
Notes
63-
-----
64-
Numbers in `it` must be sorted in ascending order.
65-
66-
Examples
67-
--------
68-
>>> nums = [0, 1, 2, 3, 17, 18, 42, 50, 51]
69-
>>> list(group_ranges(nums))
70-
[range(0, 4), range(17, 19), range(42, 43), range(50, 52)]
71-
"""
72-
nums=list(it)
73-
start=prev=nums[0]
74-
fornuminnums[1:]+ [None]:
75-
ifnumisNoneornum!=prev+1:
76-
yieldrange(start,prev+1)
77-
start=num
78-
prev=num
79-
80-
81-
deffmt_ranges(ids:"Iterable[range]",*,min_length:int=3)->str:
82-
"""
83-
Get valid opcode ranges in Rust's `match` syntax.
84-
85-
Parameters
86-
----------
87-
ids : Iterable[range]
88-
Ranges to be formatted.
89-
min_length : int, default 3
90-
Minimum range length, if a range is less than this it will be expanded.
91-
92-
Examples
93-
--------
94-
>>> ids = [range(10, 11), range(20, 22), range(30, 33)]
95-
96-
>>> fmt_ranges(ids)
97-
10 | 20 | 21 | 30..=32
98-
99-
>>> fmt_ranges(ids, min_length=2)
100-
10 | 20..=21 | 30..=32
101-
"""
102-
return" | ".join(
103-
" | ".join(r)iflen(r)<min_lengthelsef"{r.start}..={r.stop-1}"
104-
forrinids
105-
)
106-
107-
10853
defenum_variant_name(name:str)->str:
10954
returnname.title().replace("_","")
11055

@@ -154,34 +99,6 @@ def rust_code(self) -> str:
15499
}}
155100
""".strip()
156101

157-
@property
158-
deffn_new_unchecked(self)->str:
159-
returnf"""
160-
/// Creates a new `{self.enum_name}` without checking the value is a valid opcode ID.
161-
///
162-
/// # Safety
163-
///
164-
/// The caller must ensure that `id` satisfies `{self.enum_name}::is_valid(id)`.
165-
#[must_use]
166-
pub const unsafe fn new_unchecked(id:{self.typ}) -> Self {{
167-
// SAFETY: caller responsibility
168-
unsafe {{ std::mem::transmute::<{self.typ}, Self>(id) }}
169-
}}
170-
"""
171-
172-
@property
173-
deffn_is_valid(self)->str:
174-
valid_ranges=fmt_ranges(
175-
group_ranges(sorted(self._analysis.opmap[inst.name]forinstinself))
176-
)
177-
returnf"""
178-
/// Whether the given ID matches one of the opcode IDs.
179-
#[must_use]
180-
pub const fn is_valid(id:{self.typ}) -> bool {{
181-
matches!(id,{valid_ranges})
182-
}}
183-
"""
184-
185102
defbuild_has_attr_fn(self,fn_attr:str,prop_attr:str,doc_flag:str):
186103
matches="|".join(
187104
f"Self::{inst.name}"forinstinselfifgetattr(inst.properties,prop_attr)

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp