Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Plugin] [3/9] Rename functions. #4212

Merged
merged 22 commits into from
Apr 3, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions plugin/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -159,14 +159,14 @@ This flowchart represents the high-level logic of our plugin's control flow. It'
flowchart TB
node([ASTnode])
iv([<a href='https://github.com/software-mansion/react-native-reanimated/tree/main/plugin/src/injectVersion.ts'>injectVersion</a><br><i>only once</i>])
pw([<a href='https://github.com/software-mansion/react-native-reanimated/tree/main/plugin/src/processWorklets.ts'>processWorklets</a>])
pw([<a href='https://github.com/software-mansion/react-native-reanimated/tree/main/plugin/src/processForCalleesWorklets.ts'>processForCalleesWorklets</a>])
pwsbw{{should be workletized?}}
pwgwa([get workletizable arguments])
pwn([<a href='https://github.com/software-mansion/react-native-reanimated/tree/main/plugin/src/processIfWorkletNode.ts'>processIfWorkletNode</a>])
pwnsbw{{should be workletized?}}
pgh([<a href='https://github.com/software-mansion/react-native-reanimated/tree/main/plugin/src/processIfGestureHandlerEventCallbackFunctionNode.ts'>processIfGestureHandlerEventCallbackFunctionNode</a>])
pghsbw{{should be workletized?}}
pwf([<a href='https://github.com/software-mansion/react-native-reanimated/tree/main/plugin/src/processWorkletFunction.ts'>processWorkletFunction</a>])
pwf([<a href='https://github.com/software-mansion/react-native-reanimated/tree/main/plugin/src/processIfWorkletFunction.ts'>processIfWorkletFunction</a>])
pwom([<a href='https://github.com/software-mansion/react-native-reanimated/tree/main/plugin/src/processWorkletObjectMethod.ts'>processWorkletObjectMethod</a>])
pisw([<a href='https://github.com/software-mansion/react-native-reanimated/tree/main/plugin/src/processInlineStylesWarning.ts'>processInlineStylesWarning</a>])
node-->|isDirectiveLiteral|iv
Expand Down
44 changes: 22 additions & 22 deletions plugin/build/plugin.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions plugin/build/plugin.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion plugin/src/makeWorklet.ts
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ export function makeWorklet(
);
assert(
!isObjectMethod(funExpression),
"'funExpression' is an 'BbjectMethod'"
"'funExpression' is an 'ObjectMethod'"
);

const statements: Array<
Expand Down
4 changes: 2 additions & 2 deletions plugin/src/plugin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ import {
ArrowFunctionExpression,
DirectiveLiteral,
} from '@babel/types';
import { processForCalleesWorklets } from './processForCalleesWorklets';
import { ReanimatedPluginPass } from './types';
import { processWorklets } from './processWorklets';
import { processIfWorkletNode } from './processIfWorkletNode';
import { processIfGestureHandlerEventCallbackFunctionNode } from './processIfGestureHandlerEventCallbackFunctionNode';
import { processInlineStylesWarning } from './processInlineStylesWarning';
Expand All @@ -32,7 +32,7 @@ module.exports = function (): PluginItem {
},
CallExpression: {
enter(path: NodePath<CallExpression>, state: ReanimatedPluginPass) {
processWorklets(path, state);
processForCalleesWorklets(path, state);
},
},
'FunctionDeclaration|FunctionExpression|ArrowFunctionExpression': {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import {
} from '@babel/types';
import { ReanimatedPluginPass } from './types';
import { processWorkletObjectMethod } from './processWorkletObjectMethod';
import { processWorkletFunction } from './processWorkletFunction';
import { processIfWorkletFunction } from './processIfWorkletFunction';

const functionArgsToWorkletize = new Map([
['useFrameCallback', [0]],
Expand All @@ -35,7 +35,7 @@ const objectHooks = new Set([
'useAnimatedScrollHandler',
]);

export function processWorklets(
export function processForCalleesWorklets(
path: NodePath<CallExpression>,
state: ReanimatedPluginPass
) {
Expand Down Expand Up @@ -68,7 +68,7 @@ export function processWorklets(
const value = property.get('value') as NodePath<
ObjectProperty['value']
>;
processWorkletFunction(
processIfWorkletFunction(
value as NodePath<
FunctionDeclaration | FunctionExpression | ArrowFunctionExpression
>,
Expand All @@ -80,7 +80,7 @@ export function processWorklets(
const indexes = functionArgsToWorkletize.get(name);
if (Array.isArray(indexes)) {
indexes.forEach((index) => {
processWorkletFunction(
processIfWorkletFunction(
path.get(`arguments.${index}`) as NodePath<
FunctionDeclaration | FunctionExpression | ArrowFunctionExpression
>,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ import {
isMemberExpression,
isExpression,
} from '@babel/types';
import { processIfWorkletFunction } from './processIfWorkletFunction';
import { ReanimatedPluginPass } from './types';
import { processWorkletFunction } from './processWorkletFunction';

const gestureHandlerGestureObjects = new Set([
// from https://github.com/software-mansion/react-native-gesture-handler/blob/new-api/src/handlers/gestures/gestureObjects.ts
Expand Down Expand Up @@ -100,7 +100,7 @@ export function processIfGestureHandlerEventCallbackFunctionNode(
isExpression(fun.parent.callee) &&
isGestureObjectEventCallbackMethod(fun.parent.callee)
) {
processWorkletFunction(fun, state);
processIfWorkletFunction(fun, state);
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import { ReanimatedPluginPass } from './types';
import { makeWorklet } from './makeWorklet';

export function processWorkletFunction(
export function processIfWorkletFunction(
fun: NodePath<
FunctionDeclaration | FunctionExpression | ArrowFunctionExpression
>,
Expand Down
4 changes: 2 additions & 2 deletions plugin/src/processIfWorkletNode.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ import {
isBlockStatement,
isDirectiveLiteral,
} from '@babel/types';
import { processIfWorkletFunction } from './processIfWorkletFunction';
import { ReanimatedPluginPass } from './types';
import { processWorkletFunction } from './processWorkletFunction';

export function processIfWorkletNode(
fun: NodePath<
Expand Down Expand Up @@ -36,7 +36,7 @@ export function processIfWorkletNode(
directive.value.value === 'worklet'
)
) {
processWorkletFunction(fun, state);
processIfWorkletFunction(fun, state);
}
}
},
Expand Down