Skip to content

Commit bd8d115

Browse files
committed
refactor(semantic/cfg): remove unused types. (#3677)
1 parent 7a58fec commit bd8d115

File tree

2 files changed

+3
-104
lines changed

2 files changed

+3
-104
lines changed

crates/oxc_semantic/src/control_flow/mod.rs

-99
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,6 @@ mod dot;
33

44
use itertools::Itertools;
55
use oxc_ast::AstKind;
6-
use oxc_span::CompactStr;
7-
use oxc_syntax::operator::{
8-
AssignmentOperator, BinaryOperator, LogicalOperator, UnaryOperator, UpdateOperator,
9-
};
106
use petgraph::{
117
stable_graph::NodeIndex,
128
visit::{depth_first_search, Control, DfsEvent, EdgeRef},
@@ -20,101 +16,6 @@ pub use dot::{DebugDot, DebugDotContext, DisplayDot};
2016

2117
pub type BasicBlockId = NodeIndex;
2218

23-
#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash)]
24-
pub enum Register {
25-
Index(u32),
26-
Return,
27-
}
28-
29-
#[derive(Debug, Clone)]
30-
pub enum ObjectPropertyAccessBy {
31-
PrivateProperty(CompactStr),
32-
Property(CompactStr),
33-
Expression(Register),
34-
}
35-
36-
#[derive(Debug, Clone)]
37-
pub struct CollectionAssignmentValue {
38-
pub id: AstNodeId,
39-
pub elements: Vec<Register>,
40-
pub spreads: Vec<usize>,
41-
pub collection_type: CollectionType,
42-
}
43-
44-
#[derive(Debug, Clone)]
45-
pub struct CalleeWithArgumentsAssignmentValue {
46-
pub id: AstNodeId,
47-
pub callee: Register,
48-
pub arguments: Vec<Register>,
49-
pub spreads: Vec<usize>,
50-
pub call_type: CallType,
51-
}
52-
53-
#[derive(Debug, Clone)]
54-
pub struct ObjectPropertyAccessAssignmentValue {
55-
pub id: AstNodeId,
56-
pub access_on: Register,
57-
pub access_by: ObjectPropertyAccessBy,
58-
pub optional: bool,
59-
}
60-
61-
#[derive(Debug, Clone)]
62-
pub struct BinaryAssignmentValue {
63-
pub id: AstNodeId,
64-
pub a: Register,
65-
pub b: Register,
66-
pub operator: BinaryOp,
67-
}
68-
69-
#[derive(Debug, Clone)]
70-
pub struct UpdateAssignmentValue {
71-
pub id: AstNodeId,
72-
pub expr: Register,
73-
pub op: UpdateOperator,
74-
pub prefix: bool,
75-
}
76-
77-
#[derive(Debug, Clone)]
78-
pub struct UnaryExpressioneAssignmentValue(pub AstNodeId, pub UnaryOperator, pub Register);
79-
80-
#[derive(Debug, Clone)]
81-
pub enum AssignmentValue {
82-
ImplicitUndefined,
83-
NotImplicitUndefined,
84-
}
85-
86-
#[derive(Debug, Clone)]
87-
pub enum BinaryOp {
88-
BinaryOperator(BinaryOperator),
89-
LogicalOperator(LogicalOperator),
90-
AssignmentOperator(AssignmentOperator),
91-
}
92-
93-
#[derive(Debug, Clone)]
94-
pub enum CollectionType {
95-
Array,
96-
// Note: we do not currently track object names in objects.
97-
Object,
98-
JSXElement,
99-
JSXFragment,
100-
// doesn't use spreads
101-
Class,
102-
TemplateLiteral,
103-
}
104-
105-
#[derive(Debug, Clone)]
106-
pub enum CallType {
107-
New,
108-
CallExpression,
109-
// the callee is the yielded value, arguments are always empty
110-
// spreads are always empty
111-
Yield,
112-
// spreads are always empty
113-
TaggedTemplate,
114-
// spreads are always empty
115-
Import,
116-
}
117-
11819
#[derive(Debug)]
11920
pub struct BasicBlock {
12021
pub instructions: Vec<Instruction>,

crates/oxc_semantic/src/lib.rs

+3-5
Original file line numberDiff line numberDiff line change
@@ -32,11 +32,9 @@ use rustc_hash::FxHashSet;
3232

3333
pub use crate::{
3434
control_flow::{
35-
AssignmentValue, BasicBlock, BasicBlockId, BinaryAssignmentValue, BinaryOp, CallType,
36-
CalleeWithArgumentsAssignmentValue, CollectionAssignmentValue, ControlFlowGraph, DebugDot,
37-
DebugDotContext, DisplayDot, EdgeType, ErrorEdgeKind, Instruction, InstructionKind,
38-
LabeledInstruction, ObjectPropertyAccessAssignmentValue, Register, ReturnInstructionKind,
39-
UnaryExpressioneAssignmentValue, UpdateAssignmentValue,
35+
BasicBlock, BasicBlockId, ControlFlowGraph, DebugDot, DebugDotContext, DisplayDot,
36+
EdgeType, ErrorEdgeKind, Instruction, InstructionKind, LabeledInstruction,
37+
ReturnInstructionKind,
4038
},
4139
node::{AstNode, AstNodeId, AstNodes},
4240
reference::{Reference, ReferenceFlag, ReferenceId},

0 commit comments

Comments
 (0)