feat: hashmap with_capacity
This commit is contained in:
@@ -97,7 +97,7 @@ impl Compile for ir::Thunk {
|
||||
|
||||
impl Compile for ir::Attrs {
|
||||
fn compile(self, comp: &mut Compiler) {
|
||||
comp.push(OpCode::AttrSet);
|
||||
comp.push(OpCode::AttrSet { cap: self.stcs.len() + self.dyns.len() });
|
||||
for stc in self.stcs {
|
||||
stc.1.compile(comp);
|
||||
if !self.rec {
|
||||
@@ -250,17 +250,17 @@ impl Compile for ir::HasAttr {
|
||||
for attr in self.rhs {
|
||||
match attr {
|
||||
ir::Attr::Str(sym) => {
|
||||
comp.push(OpCode::AttrSet);
|
||||
comp.push(OpCode::AttrSet { cap: 0 });
|
||||
comp.push(OpCode::SelectOrDefault { sym })
|
||||
}
|
||||
ir::Attr::Dynamic(dynamic) => {
|
||||
dynamic.compile(comp);
|
||||
comp.push(OpCode::AttrSet);
|
||||
comp.push(OpCode::AttrSet { cap: 0 });
|
||||
comp.push(OpCode::SelectDynamicOrDefault);
|
||||
}
|
||||
ir::Attr::Strs(string) => {
|
||||
string.compile(comp);
|
||||
comp.push(OpCode::AttrSet);
|
||||
comp.push(OpCode::AttrSet { cap: 0 });
|
||||
comp.push(OpCode::SelectDynamicOrDefault);
|
||||
}
|
||||
}
|
||||
@@ -281,17 +281,17 @@ impl Compile for ir::Select {
|
||||
for attr in self.attrpath {
|
||||
match attr {
|
||||
ir::Attr::Str(sym) => {
|
||||
comp.push(OpCode::AttrSet);
|
||||
comp.push(OpCode::AttrSet { cap: 0 });
|
||||
comp.push(OpCode::SelectOrDefault { sym })
|
||||
}
|
||||
ir::Attr::Dynamic(dynamic) => {
|
||||
dynamic.compile(comp);
|
||||
comp.push(OpCode::AttrSet);
|
||||
comp.push(OpCode::AttrSet { cap: 0 });
|
||||
comp.push(OpCode::SelectDynamicOrDefault);
|
||||
}
|
||||
ir::Attr::Strs(string) => {
|
||||
string.compile(comp);
|
||||
comp.push(OpCode::AttrSet);
|
||||
comp.push(OpCode::AttrSet { cap: 0 });
|
||||
comp.push(OpCode::SelectDynamicOrDefault);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user