Show More
@@ -2098,7 +2098,6 b' methods = {' | |||||
2098 | "parent": parentspec, |
|
2098 | "parent": parentspec, | |
2099 | "parentpost": p1, |
|
2099 | "parentpost": p1, | |
2100 | "only": only, |
|
2100 | "only": only, | |
2101 | "onlypost": only, |
|
|||
2102 | } |
|
2101 | } | |
2103 |
|
2102 | |||
2104 | def optimize(x, small): |
|
2103 | def optimize(x, small): | |
@@ -2115,6 +2114,8 b' def optimize(x, small):' | |||||
2115 | elif op == 'only': |
|
2114 | elif op == 'only': | |
2116 | return optimize(('func', ('symbol', 'only'), |
|
2115 | return optimize(('func', ('symbol', 'only'), | |
2117 | ('list', x[1], x[2])), small) |
|
2116 | ('list', x[1], x[2])), small) | |
|
2117 | elif op == 'onlypost': | |||
|
2118 | return optimize(('func', ('symbol', 'only'), x[1]), small) | |||
2118 | elif op == 'dagrangepre': |
|
2119 | elif op == 'dagrangepre': | |
2119 | return optimize(('func', ('symbol', 'ancestors'), x[1]), small) |
|
2120 | return optimize(('func', ('symbol', 'ancestors'), x[1]), small) | |
2120 | elif op == 'dagrangepost': |
|
2121 | elif op == 'dagrangepost': |
@@ -533,6 +533,29 b" Test '%' operator" | |||||
533 | 8 |
|
533 | 8 | |
534 | 9 |
|
534 | 9 | |
535 |
|
535 | |||
|
536 | Test opreand of '%' is optimized recursively (issue4670) | |||
|
537 | ||||
|
538 | $ try --optimize '8:9-8%' | |||
|
539 | (onlypost | |||
|
540 | (minus | |||
|
541 | (range | |||
|
542 | ('symbol', '8') | |||
|
543 | ('symbol', '9')) | |||
|
544 | ('symbol', '8'))) | |||
|
545 | * optimized: | |||
|
546 | (func | |||
|
547 | ('symbol', 'only') | |||
|
548 | (and | |||
|
549 | (range | |||
|
550 | ('symbol', '8') | |||
|
551 | ('symbol', '9')) | |||
|
552 | (not | |||
|
553 | ('symbol', '8')))) | |||
|
554 | * set: | |||
|
555 | <baseset+ [8, 9]> | |||
|
556 | 8 | |||
|
557 | 9 | |||
|
558 | ||||
536 | Test the order of operations |
|
559 | Test the order of operations | |
537 |
|
560 | |||
538 | $ log '7 + 9%5 + 2' |
|
561 | $ log '7 + 9%5 + 2' |
General Comments 0
You need to be logged in to leave comments.
Login now