fix(css/parser): Fix infinite loop about @import and layer (#5919)

This commit is contained in:
Jason 2022-09-21 16:21:04 +08:00 committed by GitHub
parent ce6b0886d1
commit 10cdbed05e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -1868,6 +1868,8 @@ where
let start = self.input.cur_span().lo;
let mut name = vec![];
let entered = is!(self, Ident);
while is!(self, Ident) {
let span = self.input.cur_span();
let token = bump!(self);
@ -1889,6 +1891,11 @@ where
}
}
if !entered {
// if first argument is not ident, without bump! will cause infinite loop
bump!(self);
}
Ok(LayerName {
name,
span: span!(self, start),