mirror of
https://github.com/SpaceManiac/SpacemanDMM.git
synced 2025-12-23 05:36:47 +00:00
Use Box<str> in Term::InterpString and Call
Reduces sizeof(Term) to 40 (5 pointers). Linux-gnu langserver idle on /tg/station13 is about 464 MiB.
This commit is contained in:
parent
0ebd024795
commit
c5b5fb0ca8
2 changed files with 6 additions and 6 deletions
|
|
@ -847,11 +847,11 @@ pub enum Term {
|
|||
/// A prefab literal (path + vars).
|
||||
Prefab(Box<Prefab>),
|
||||
/// An interpolated string, alternating string/expr/string/expr.
|
||||
InterpString(String, Box<[(Option<Expression>, String)]>),
|
||||
InterpString(Ident2, Box<[(Option<Expression>, Box<str>)]>),
|
||||
|
||||
// Function calls with recursive contents ---------------------------------
|
||||
/// An unscoped function call.
|
||||
Call(Ident, Box<[Expression]>),
|
||||
Call(Ident2, Box<[Expression]>),
|
||||
/// A `.()` call.
|
||||
SelfCall(Box<[Expression]>),
|
||||
/// A `..()` call. If arguments is empty, the proc's arguments are passed.
|
||||
|
|
|
|||
|
|
@ -2043,7 +2043,7 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> {
|
|||
match self.arguments(&[], &i)? {
|
||||
Some(args) => {
|
||||
self.annotate_precise(start..first_token, || Annotation::UnscopedCall(i.clone()));
|
||||
Term::Call(i, args)
|
||||
Term::Call(i.into(), args)
|
||||
},
|
||||
None => {
|
||||
belongs_to.push(i.clone());
|
||||
|
|
@ -2115,16 +2115,16 @@ impl<'ctx, 'an, 'inp> Parser<'ctx, 'an, 'inp> {
|
|||
let expr = self.expression()?;
|
||||
match self.next("']'")? {
|
||||
Token::InterpStringPart(part) => {
|
||||
parts.push((expr, part));
|
||||
parts.push((expr, part.into()));
|
||||
},
|
||||
Token::InterpStringEnd(end) => {
|
||||
parts.push((expr, end));
|
||||
parts.push((expr, end.into()));
|
||||
break;
|
||||
},
|
||||
_ => return self.parse_error(),
|
||||
}
|
||||
}
|
||||
Term::InterpString(begin, parts.into())
|
||||
Term::InterpString(begin.into(), parts.into())
|
||||
},
|
||||
|
||||
other => return self.try_another(other),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue