Skip to content

Commit

Permalink
Update (base update)
Browse files Browse the repository at this point in the history
[ghstack-poisoned]
  • Loading branch information
mofeiZ committed Sep 26, 2024
1 parent 1030b23 commit cab8a20
Show file tree
Hide file tree
Showing 10 changed files with 172 additions and 167 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ function collectPropertyLoadsInBlocks(
temporaries,
);
const propertyNode = tree.getPropertyLoadNode(property);
const object = propertyNode.fullPath.identifier;
const object = instr.value.object.identifier;
/**
* Since this runs *after* buildReactiveScopeTerminals, identifier mutable ranges
* are not valid with respect to current instruction id numbering.
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@

## Input

```javascript
// @enablePropagateDepsInHIR
const {throwInput} = require('shared-runtime');

function Component(props) {
let x;
try {
const y = [];
y.push(props.y);
throwInput(y);
} catch (e) {
e.push(props.e);
x = e;
}
return x;
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{y: 'foo', e: 'bar'}],
};

```

## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
const { throwInput } = require("shared-runtime");

function Component(props) {
const $ = _c(2);
let x;
if ($[0] !== props) {
try {
const y = [];
y.push(props.y);
throwInput(y);
} catch (t0) {
const e = t0;
e.push(props.e);
x = e;
}
$[0] = props;
$[1] = x;
} else {
x = $[1];
}
return x;
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ y: "foo", e: "bar" }],
};

```
### Eval output
(kind: ok) ["foo","bar"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
// @enablePropagateDepsInHIR
const {throwInput} = require('shared-runtime');

function Component(props) {
let x;
try {
const y = [];
y.push(props.y);
throwInput(y);
} catch (e) {
e.push(props.e);
x = e;
}
return x;
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{y: 'foo', e: 'bar'}],
};
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@

## Input

```javascript
// @enablePropagateDepsInHIR
const {throwInput} = require('shared-runtime');

function Component(props) {
try {
const y = [];
y.push(props.y);
throwInput(y);
} catch (e) {
e.push(props.e);
return e;
}
return null;
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{y: 'foo', e: 'bar'}],
};

```

## Code

```javascript
import { c as _c } from "react/compiler-runtime"; // @enablePropagateDepsInHIR
const { throwInput } = require("shared-runtime");

function Component(props) {
const $ = _c(2);
let t0;
if ($[0] !== props) {
t0 = Symbol.for("react.early_return_sentinel");
bb0: {
try {
const y = [];
y.push(props.y);
throwInput(y);
} catch (t1) {
const e = t1;
e.push(props.e);
t0 = e;
break bb0;
}
}
$[0] = props;
$[1] = t0;
} else {
t0 = $[1];
}
if (t0 !== Symbol.for("react.early_return_sentinel")) {
return t0;
}
return null;
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{ y: "foo", e: "bar" }],
};

```
### Eval output
(kind: ok) ["foo","bar"]
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
// @enablePropagateDepsInHIR
const {throwInput} = require('shared-runtime');

function Component(props) {
try {
const y = [];
y.push(props.y);
throwInput(y);
} catch (e) {
e.push(props.e);
return e;
}
return null;
}

export const FIXTURE_ENTRYPOINT = {
fn: Component,
params: [{y: 'foo', e: 'bar'}],
};
1 change: 0 additions & 1 deletion compiler/packages/snap/src/SproutTodoFilter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -478,7 +478,6 @@ const skipFilter = new Set([
'fbt/bug-fbt-plural-multiple-function-calls',
'fbt/bug-fbt-plural-multiple-mixed-call-tag',
'bug-invalid-hoisting-functionexpr',
'bug-try-catch-maybe-null-dependency',
'original-reactive-scopes-fork/bug-nonmutating-capture-in-unsplittable-memo-block',
'original-reactive-scopes-fork/bug-hoisted-declaration-with-scope',
'bug-codegen-inline-iife',
Expand Down

0 comments on commit cab8a20

Please sign in to comment.