Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit7138710

Browse files
authored
Merge pull request#1010 from schungx/master
Fix bug
2 parents0daa796 +eccc8d8 commit7138710

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

‎src/optimizer.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1034,7 +1034,7 @@ fn optimize_expr(expr: &mut Expr, state: &mut OptimizerState, _chaining: bool) {
10341034
*expr =Expr::CharConstant(s.chars().nth(usize::try_from(*i).unwrap()).unwrap(),*pos);
10351035
}
10361036
// string[-int]
1037-
(Expr::StringConstant(s, pos),Expr::IntegerConstant(i, ..))if usize::try_from(i.unsigned_abs()).map(|x| x <= s.chars().count()).unwrap_or(false) =>{
1037+
(Expr::StringConstant(s, pos),Expr::IntegerConstant(i, ..))if*i <0 &&usize::try_from(i.unsigned_abs()).map(|x| x <= s.chars().count()).unwrap_or(false) =>{
10381038
// String literal indexing - get the character
10391039
state.set_dirty();
10401040
*expr =Expr::CharConstant(s.chars().rev().nth(usize::try_from(i.unsigned_abs()).unwrap() -1).unwrap(),*pos);

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp