mirror of
https://github.com/ddidderr/wuffs.git
synced 2026-11-23 16:52:18 +01:00
Drop args- and this-related facts after ? call
This commit is contained in:
1 parent
b3cc3c53ad
commit
2dfe222681
3 files changed
+19
-12
No files matched your search
+15
-8
@@ -195,6 +195,14 @@ func invert(tm *t.Map, n *a.Expr) (*a.Expr, error) {
|
|||||||
return o, nil
|
return o, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func updateFactsForSuspension(x *a.Expr) (*a.Expr, error) {
|
||||||
|
if x.Mentions(exprArgs) || x.Mentions(exprThis) {
|
||||||
|
return nil, nil
|
||||||
|
}
|
||||||
|
// TODO: drop any facts involving ptr-typed local variables?
|
||||||
|
return x, nil
|
||||||
|
}
|
||||||
|
|
||||||
func (q *checker) bcheckBlock(block []*a.Node) error {
|
func (q *checker) bcheckBlock(block []*a.Node) error {
|
||||||
unreachable := false
|
unreachable := false
|
||||||
for _, o := range block {
|
for _, o := range block {
|
||||||
@@ -213,16 +221,9 @@ func (q *checker) bcheckBlock(block []*a.Node) error {
|
|||||||
// No-op.
|
// No-op.
|
||||||
case a.KRet:
|
case a.KRet:
|
||||||
if o.AsRet().Keyword() == t.IDYield {
|
if o.AsRet().Keyword() == t.IDYield {
|
||||||
// Drop any facts involving args or this.
|
if err := q.facts.update(updateFactsForSuspension); err != nil {
|
||||||
if err := q.facts.update(func(x *a.Expr) (*a.Expr, error) {
|
|
||||||
if x.Mentions(exprArgs) || x.Mentions(exprThis) {
|
|
||||||
return nil, nil
|
|
||||||
}
|
|
||||||
return x, nil
|
|
||||||
}); err != nil {
|
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// TODO: drop any facts involving ptr-typed local variables?
|
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -423,6 +424,12 @@ func (q *checker) bcheckAssignment(lhs *a.Expr, op t.ID, rhs *a.Expr) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if rhs.Effect().Coroutine() && (op != t.IDEqQuestion) {
|
||||||
|
if err := q.facts.update(updateFactsForSuspension); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if lhs == nil {
|
if lhs == nil {
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18535,8 +18535,8 @@ wuffs_deflate__decoder__decode_blocks(
|
|||||||
uint32_t t_0 = *iop_a_src++;
|
uint32_t t_0 = *iop_a_src++;
|
||||||
v_b0 = t_0;
|
v_b0 = t_0;
|
||||||
}
|
}
|
||||||
self->private_impl.f_bits |= (v_b0 << self->private_impl.f_n_bits);
|
self->private_impl.f_bits |= (v_b0 << (self->private_impl.f_n_bits & 3));
|
||||||
self->private_impl.f_n_bits += 8;
|
self->private_impl.f_n_bits = ((self->private_impl.f_n_bits & 3) + 8);
|
||||||
}
|
}
|
||||||
v_final = (self->private_impl.f_bits & 1);
|
v_final = (self->private_impl.f_bits & 1);
|
||||||
v_type = ((self->private_impl.f_bits >> 1) & 3);
|
v_type = ((self->private_impl.f_bits >> 1) & 3);
|
||||||
|
|||||||
@@ -228,8 +228,8 @@ pri func decoder.decode_blocks?(dst: base.io_writer, src: base.io_reader) {
|
|||||||
post this.n_bits >= 3,
|
post this.n_bits >= 3,
|
||||||
{
|
{
|
||||||
b0 = args.src.read_u8_as_u32?()
|
b0 = args.src.read_u8_as_u32?()
|
||||||
this.bits |= b0 << this.n_bits
|
this.bits |= b0 << (this.n_bits & 3)
|
||||||
this.n_bits += 8
|
this.n_bits = (this.n_bits & 3) + 8
|
||||||
} endwhile
|
} endwhile
|
||||||
final = this.bits & 0x01
|
final = this.bits & 0x01
|
||||||
type = (this.bits >> 1) & 0x03
|
type = (this.bits >> 1) & 0x03
|
||||||
|
|||||||
Reference in new issue
Block a user