Skip to content

Commit

Permalink
make compatible with stable rust
Browse files Browse the repository at this point in the history
  • Loading branch information
Maneren committed Aug 3, 2022
1 parent bc9eb92 commit d4fca03
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,9 +47,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v2

- name: Install nightly toolchain
run: rustup default nightly

- name: Install target
run: rustup target add ${{ matrix.target }}

Expand Down
13 changes: 9 additions & 4 deletions src/parse/value.rs
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ pub enum Value {

fn parse_single(ph: &mut ParseHelper) -> ParserResult<Value> {
let token = ph.peek(0);
let value = match token {
let mut value = match token {
Some(TT::Identifier(..) | TT::Dollar) if ph.peek(1) == Some(&TT::LParen) => {
Ok(Value::FunctionCall(function_call::parse_inner(ph)?))
}
Expand Down Expand Up @@ -166,14 +166,19 @@ fn parse_single(ph: &mut ParseHelper) -> ParserResult<Value> {
None => Err(Error::end(ph)),
};

let mut value = value;
while let Ok(val) = &value {
if ph.peek(0) != Some(&TT::LBracket) {
break;
}

while let Ok(val) = &value && ph.peek(0) == Some(&TT::LBracket) {
ph.advance();

let member = parse_single(ph)?;

value = Ok(Value::MemberExpression(Box::new(val.clone()), Box::new(member)));
value = Ok(Value::MemberExpression(
Box::new(val.clone()),
Box::new(member),
));

check_token!(ph, TT::RBracket);

Expand Down

0 comments on commit d4fca03

Please sign in to comment.