13,362 matches across 25 files for func main
snippet_mode: grep · sorted by relevance
.github/workflows/runtime_commit_artifacts.yml YAML 6 matches · showing 5 view file →
6 types: [completed]
7 branches:
8 - main
9 workflow_dispatch:
10 inputs:
· · ·
27env:
28 TZ: /usr/share/zoneinfo/America/Los_Angeles
29 # https://github.com/actions/cache/blob/main/tips-and-workarounds.md#cache-segment-restore-timeout
30 SEGMENT_DOWNLOAD_TIMEOUT_MINS: 1
31
· · ·
209 commit_www_artifacts:
210 needs: [download_artifacts, process_artifacts]
211 if: inputs.force == true || (github.ref == 'refs/heads/main' && needs.process_artifacts.outputs.www_branch_count == '0')
212 runs-on: ubuntu-latest
213 permissions:
· · ·
303 # Used to push a commit to builds/facebook-fbsource
304 contents: write
305 if: inputs.force == true || (github.ref == 'refs/heads/main' && needs.process_artifacts.outputs.fbsource_branch_count == '0')
306 runs-on: ubuntu-latest
307 steps:
· · ·
368 // at this point in the workflow, we're on the compiled
369 // artifact branch (so the scripts don't exist).
370 // We can fix this with a composite action in the main repo.
371 // This script is duplicated above.
372 const fs = require('fs');
+ 1 more matches in this file
CHANGELOG.md MARKDOWN 55 matches · showing 5 view file →
67- Preload `<img>` and `<link>` using hints before they're rendered (@sebmarkbage [#34604](https://github.com/facebook/react/pull/34604))
68- Log error if production elements are rendered during development (@eps1lon [#34189](https://github.com/facebook/react/pull/34189))
69- Fix a bug when returning a Temporary reference (e.g. a Client Reference) from Server Functions (@sebmarkbage [#34084](https://github.com/facebook/react/pull/34084), @denk0403 [#33761](https://github.com/facebook/react/pull/33761))
70- Pass line/column to `filterStackFrame` (@eps1lon [#33707](https://github.com/facebook/react/pull/33707))
71- Support Async Modules in Turbopack Server References (@lubieowoce [#34531](https://github.com/facebook/react/pull/34531))
· · ·
87
88### React
89* Fixed Owner Stacks to work with ES2015 function.name semantics ([#33680](https://github.com/facebook/react/pull/33680) by @hoxyq)
90
91## 19.1.0 (March 28, 2025)
· · ·
152#### React
153
154* Actions: `startTransition` can now accept async functions. Functions passed to `startTransition` are called “Actions”. A given Transition can include one or more Actions which update state in the background and update the UI with one commit. In addition to updating state, Actions can now perform side effects including async requests, and the Action will wait for the work to finish before finishing the Transition. This feature allows Transitions to include side effects like `fetch()` in the pending state, and provides support for error handling, and optimistic updates.
155* `useActionState`: is a new hook to order Actions inside of a Transition with access to the state of the action, and the pending state. It accepts a reducer that can call Actions, and the initial state used for first render. It also accepts an optional string that is used if the action is passed to a form `action` prop to support progressive enhancement in forms.
156* `useOptimistic`: is a new hook to update state while a Transition is in progress. It returns the state, and a set function that can be called inside a transition to “optimistically” update the state to expected final value immediately while the Transition completes in the background. When the transition finishes, the state is updated to the new value.
· · ·
156* `useOptimistic`: is a new hook to update state while a Transition is in progress. It returns the state, and a set function that can be called inside a transition to “optimistically” update the state to expected final value immediately while the Transition completes in the background. When the transition finishes, the state is updated to the new value.
157* `use`: is a new API that allows reading resources in render. In React 19, `use` accepts a promise or Context. If provided a promise, `use` will suspend until a value is resolved. `use` can only be used in render but can be called conditionally.
158* `ref` as a prop: Refs can now be used as props, removing the need for `forwardRef`.
· · ·
175#### React Server Components
176
177* RSC features such as directives, server components, and server functions are now stable. This means libraries that ship with Server Components can now target React 19 as a peer dependency with a react-server export condition for use in frameworks that support the Full-stack React Architecture. The underlying APIs used to implement a React Server Components bundler or framework do not follow semver and may break between minors in React 19.x. See [docs](https://19.react.dev/reference/rsc/server-components) for how to support React Server Components.
178
179### Deprecations
+ 50 more matches in this file
README.md MARKDOWN 3 matches view file →
1# [React](https://react.dev/) &middot; [![GitHub license](https://img.shields.io/badge/license-MIT-blue.svg)](https://github.com/facebook/react/blob/main/LICENSE) [![npm version](https://img.shields.io/npm/v/react.svg?style=flat)](https://www.npmjs.com/package/react) [![(Runtime) Build and Test](https://github.com/facebook/react/actions/workflows/runtime_build_and_test.yml/badge.svg)](https://github.com/facebook/react/actions/workflows/runtime_build_and_test.yml) [![(Compiler) TypeScript](https://github.com/facebook/react/actions/workflows/compiler_typescript.yml/badge.svg?branch=main)](https://github.com/facebook/react/actions/workflows/compiler_typescript.yml) [![PRs Welcome](https://img.shields.io/badge/PRs-welcome-brightgreen.svg)](https://legacy.reactjs.org/docs/how-to-contribute.html#your-first-pull-request)
2
3React is a JavaScript library for building user interfaces.
· · ·
46import { createRoot } from 'react-dom/client';
47
48function HelloMessage({ name }) {
49 return <div>Hello {name}</div>;
50}
· · ·
60## Contributing
61
62The main purpose of this repository is to continue evolving React core, making it faster and easier to use. Development of React happens in the open on GitHub, and we are grateful to the community for contributing bugfixes and improvements. Read below to learn how you can take part in improving React.
63
64### [Code of Conduct](https://code.fb.com/codeofconduct)
compiler/.claude/rules/rust-port.md MARKDOWN 3 matches view file →
9
10- Follow patterns from `compiler/docs/rust-port/rust-port-architecture.md`
11- Use arenas + copyable IDs instead of shared references: `IdentifierId`, `ScopeId`, `FunctionId`, `TypeId`
12- Pass `env: &mut Environment` separately from `func: &mut HirFunction`
13- Use two-phase collect/apply when you can't mutate through stored references
· · ·
12- Pass `env: &mut Environment` separately from `func: &mut HirFunction`
13- Use two-phase collect/apply when you can't mutate through stored references
14- Run `bash compiler/scripts/test-babel-ast.sh` to test AST round-tripping
· · ·
19Before declaring work complete on a plan doc:
20- Re-read the original user prompt to ensure all requested steps are done
21- Check the plan doc for any "Remaining Work" items
22- Verify test-babel-ast.sh passes with the expected fixture count
23- Update the plan doc's status section
compiler/.claude/skills/compiler-orchestrator/SKILL.md MARKDOWN 17 matches · showing 5 view file →
20| 2 | PruneMaybeThrows | hir | Validation: validateContextVariableLValues, validateUseMemo after |
21| 3 | DropManualMemoization | hir | Conditional |
22| 4 | InlineImmediatelyInvokedFunctionExpressions | hir | |
23| 5 | MergeConsecutiveBlocks | hir | |
24| 6 | SSA | hir | |
· · ·
27| 9 | InferTypes | hir | Validation: validateHooksUsage, validateNoCapitalizedCalls after (conditional) |
28| 10 | OptimizePropsMethodCalls | hir | |
29| 11 | AnalyseFunctions | hir | |
30| 12 | InferMutationAliasingEffects | hir | |
31| 13 | OptimizeForSSR | hir | Conditional: outputMode === 'ssr' |
· · ·
38| 20 | MemoizeFbtAndMacroOperandsInSameScope | hir | |
39| -- | outlineJSX | hir | Between #20 and #21, conditional: enableJsxOutlining, no log entry |
40| 21 | NameAnonymousFunctions | hir | Conditional |
41| 22 | OutlineFunctions | hir | Conditional |
42| 23 | AlignMethodCallScopes | hir | |
· · ·
41| 22 | OutlineFunctions | hir | Conditional |
42| 23 | AlignMethodCallScopes | hir | |
43| 24 | AlignObjectMethodScopes | hir | |
· · ·
49| 30 | FlattenScopesWithHooksOrUseHIR | hir | |
50| 31 | PropagateScopeDependenciesHIR | hir | |
51| 32 | BuildReactiveFunction | reactive | |
52| 33 | AssertWellFormedBreakTargets | debug | Validation |
53| 34 | PruneUnusedLabels | reactive | |
+ 12 more matches in this file
compiler/.claude/skills/compiler-port/SKILL.md MARKDOWN 2 matches view file →
41## Step 2: Gather context
42
43Read the following files (all reads happen in main context):
44
451. **Architecture guide**: `compiler/docs/rust-port/rust-port-architecture.md`
· · ·
484. **Rust pipeline**: `compiler/crates/react_compiler/src/entrypoint/pipeline.rs`
495. **Rust HIR types**: Key type files in `compiler/crates/react_compiler_hir/src/` (especially `hir.rs`, `environment.rs`)
506. **Rust reactive types**: For reactive passes, also read `compiler/crates/react_compiler_hir/src/reactive_function.rs`
517. **Target crate**: If the target crate already exists, read its `Cargo.toml`, `src/lib.rs`, and existing files to understand the current structure
52
compiler/.claude/skills/plan-update/SKILL.md MARKDOWN 7 matches · showing 5 view file →
34 `04-constantPropagation.md`, `05-deadCodeElimination.md`, `06-inferTypes.md`
35
363. **Function & Effect Analysis** (passes 07-09):
37 `07-analyseFunctions.md`, `08-inferMutationAliasingEffects.md`, `09-inferMutationAliasingRanges.md`
38
· · ·
37 `07-analyseFunctions.md`, `08-inferMutationAliasingEffects.md`, `09-inferMutationAliasingRanges.md`
38
394. **Reactivity & Scope Variables** (passes 10-14):
· · ·
43 `15-alignReactiveScopesToBlockScopesHIR.md`, `16-mergeOverlappingReactiveScopesHIR.md`, `17-buildReactiveScopeTerminalsHIR.md`, `18-flattenReactiveLoopsHIR.md`, `19-flattenScopesWithHooksOrUseHIR.md`, `20-propagateScopeDependenciesHIR.md`
44
456. **Reactive Function & Transforms** (passes 21-30):
46 `21-buildReactiveFunction.md`, `22-pruneUnusedLabels.md`, `23-pruneNonEscapingScopes.md`, `24-pruneNonReactiveDependencies.md`, `25-pruneUnusedScopes.md`, `26-mergeReactiveScopesThatInvalidateTogether.md`, `27-pruneAlwaysInvalidatingScopes.md`, `28-propagateEarlyReturns.md`, `29-promoteUsedTemporaries.md`, `30-renameVariables.md`
47
· · ·
46 `21-buildReactiveFunction.md`, `22-pruneUnusedLabels.md`, `23-pruneNonEscapingScopes.md`, `24-pruneNonReactiveDependencies.md`, `25-pruneUnusedScopes.md`, `26-mergeReactiveScopesThatInvalidateTogether.md`, `27-pruneAlwaysInvalidatingScopes.md`, `28-propagateEarlyReturns.md`, `29-promoteUsedTemporaries.md`, `30-renameVariables.md`
47
487. **Codegen & Optimization** (passes 31, 34-38):
· · ·
49 `31-codegenReactiveFunction.md`, `34-optimizePropsMethodCalls.md`, `35-optimizeForSSR.md`, `36-outlineJSX.md`, `37-outlineFunctions.md`, `38-memoizeFbtAndMacroOperandsInSameScope.md`
50
518. **Validation Passes** (passes 39-55):
+ 2 more matches in this file
compiler/CLAUDE.md MARKDOWN 19 matches · showing 5 view file →
7When modifying the compiler, you MUST read the documentation about that pass in `compiler/packages/babel-plugin-react-compiler/docs/passes/` to learn more about the role of that pass within the compiler.
8
9- `packages/babel-plugin-react-compiler/` - Main compiler package
10 - `src/HIR/` - High-level Intermediate Representation types and utilities
11 - `src/Inference/` - Effect inference passes (aliasing, mutation, etc.)
· · ·
12 - `src/Validation/` - Validation passes that check for errors
13 - `src/Entrypoint/Pipeline.ts` - Main compilation pipeline with pass ordering
14 - `src/__tests__/fixtures/compiler/` - Test fixtures
15 - `error.todo-*.js` - Unsupported feature, correctly throws Todo error (graceful bailout)
· · ·
104The compiler converts source code to HIR for analysis. Key types in `src/HIR/HIR.ts`:
105
106- **HIRFunction** - A function being compiled
107 - `body.blocks` - Map of BasicBlocks
108 - `context` - Captured variables from outer scope
· · ·
109 - `params` - Function parameters
110 - `returns` - The function's return place
111 - `aliasingEffects` - Effects that describe the function's behavior when called
· · ·
110 - `returns` - The function's return place
111 - `aliasingEffects` - Effects that describe the function's behavior when called
112
+ 14 more matches in this file
compiler/apps/playground/components/Logo.tsx TYPESCRIPT 2 matches view file →
6 */
7
8// https://github.com/reactjs/reactjs.org/blob/main/beta/src/components/Logo.tsx
9
10export default function Logo(props: JSX.IntrinsicElements['svg']): JSX.Element {
· · ·
10export default function Logo(props: JSX.IntrinsicElements['svg']): JSX.Element {
11 return (
12 <svg
compiler/crates/TODO.md MARKDOWN 11 matches · showing 5 view file →
21snapshot at top.)
22
23The 15 remaining SWC e2e failures fall into three groups. Each line names the
24fixture and the failure mode; the group it sits in dictates the appropriate
25fix.
· · ·
26
27### Group A: Fixture maintenance, not Rust bugs
28
29SWC compiles code that TS rejects, or vice versa, in ways where Rust's
· · ·
39 emits a Todo bailout (`[hoisting] EnterSSA: Expected identifier to be
40 defined before being used`) that the Babel path does not.
41- `error.todo-repro-named-function-with-shadowed-local-same-name.js` —
42 Babel errors; SWC compiles.
43- `new-mutability/error.todo-repro-named-function-with-shadowed-local-same-name.js`
· · ·
43- `new-mutability/error.todo-repro-named-function-with-shadowed-local-same-name.js`
44 — same as above with the new mutation-aliasing model enabled.
45- `error.todo-rust-as-expression-assignment-target.tsx` — Babel errors;
· · ·
53
54- `use-no-forget-multiple-with-eslint-suppression.js` — spurious
55 `import { c as _c }` in the TS reference output. Fixed on `main` by
56 [react#36500](https://github.com/facebook/react/pull/36500) (merged).
57 Will pass automatically once `pr-36173` rebases onto `main`; until then
+ 6 more matches in this file
compiler/crates/react_compiler/src/entrypoint/compile_result.rs RUST 11 matches · showing 5 view file →
4use react_compiler_ast::statements::BlockStatement;
5use react_compiler_diagnostics::SourceLocation;
6use react_compiler_hir::ReactFunctionType;
7use serde::Serialize;
8
· · ·
81}
82
83/// Main result type returned by the compile function.
84/// Serialized to JSON and returned to the JS shim.
85#[derive(Debug, Serialize)]
· · ·
86#[serde(tag = "kind", rename_all = "lowercase")]
87pub enum CompileResult {
88 /// Compilation succeeded (or no functions needed compilation).
89 /// `ast` is None if no changes were made to the program.
90 /// The compiled Babel AST is returned by value so in-process Rust consumers
· · ·
218}
219
220/// Codegen output for a single compiled function.
221/// Carries the generated AST fields needed to replace the original function.
222#[derive(Debug, Clone)]
· · ·
221/// Carries the generated AST fields needed to replace the original function.
222#[derive(Debug, Clone)]
223pub struct CodegenFunction {
+ 6 more matches in this file
compiler/crates/react_compiler/src/entrypoint/gating.rs RUST 107 matches · showing 5 view file →
1// Gating rewrite logic for compiled functions.
2//
3// When gating is enabled, the compiled function is wrapped in a conditional:
· · ·
3// When gating is enabled, the compiled function is wrapped in a conditional:
4// `gating() ? optimized_fn : original_fn`
5//
· · ·
6// For function declarations referenced before their declaration, a special
7// hoisting pattern is used (see `insert_additional_function_declaration`).
8//
· · ·
7// hoisting pattern is used (see `insert_additional_function_declaration`).
8//
9// Ported from `Entrypoint/Gating.ts`.
· · ·
19use super::plugin_options::GatingConfig;
20
21/// A compiled function node, can be any function type.
22#[derive(Debug, Clone)]
23pub enum CompiledFunctionNode {
+ 102 more matches in this file
compiler/crates/react_compiler/src/entrypoint/program.rs RUST 378 matches · showing 5 view file →
4// LICENSE file in the root directory of this source tree.
5
6//! Main entrypoint for the React Compiler.
7//!
8//! This module is a port of Program.ts from the TypeScript compiler. It orchestrates
· · ·
11//! 2. Validating restricted imports
12//! 3. Finding program-level suppressions
13//! 4. Discovering functions to compile (components, hooks)
14//! 5. Processing each function through the compilation pipeline
15//! 6. Applying compiled functions back to the AST
· · ·
14//! 5. Processing each function through the compilation pipeline
15//! 6. Applying compiled functions back to the AST
16
· · ·
15//! 6. Applying compiled functions back to the AST
16
17use rustc_hash::{FxHashMap, FxHashSet};
· · ·
40use react_compiler_diagnostics::ErrorCategory;
41use react_compiler_diagnostics::SourceLocation;
42use react_compiler_hir::ReactFunctionType;
43use react_compiler_hir::environment_config::EnvironmentConfig;
44use react_compiler_lowering::FunctionNode;
+ 373 more matches in this file
compiler/crates/react_compiler_diagnostics/src/lib.rs RUST 3 matches view file →
245
246/// Aggregate compiler error - can contain multiple diagnostics.
247/// This is the main error type thrown/returned by the compiler.
248#[derive(Debug, Clone)]
249pub struct CompilerError {
· · ·
380
381/// Allow `?` to convert a `CompilerError` into a `CompilerDiagnostic`
382/// when the enclosing function returns `Result<T, CompilerDiagnostic>`.
383///
384/// This typically happens when `record_error()` returns `Err(CompilerError)`
· · ·
385/// for an Invariant error, and the calling function already returns
386/// `Result<T, CompilerDiagnostic>`. The conversion extracts the first
387/// error detail from the aggregate error.
compiler/crates/react_compiler_hir/src/environment.rs RUST 60 matches · showing 5 view file →
12use crate::globals::{self};
13use crate::object_shape::BUILT_IN_MIXED_READONLY_ID;
14use crate::object_shape::FunctionSignature;
15use crate::object_shape::HookKind;
16use crate::object_shape::HookSignatureBuilder;
· · ·
49 pub types: Vec<Type>,
50 pub scopes: Vec<ReactiveScope>,
51 pub functions: Vec<HirFunction>,
52
53 // Error accumulation
· · ·
54 pub errors: CompilerError,
55
56 // Function type classification (Component, Hook, Other)
57 pub fn_type: ReactFunctionType,
58
· · ·
57 pub fn_type: ReactFunctionType,
58
59 // Output mode (Client, Ssr, Lint)
· · ·
105 default_mutating_hook: Option<Global>,
106
107 // Outlined functions: functions extracted from the component during outlining passes
108 outlined_functions: Vec<OutlinedFunctionEntry>,
109
+ 55 more matches in this file
compiler/crates/react_compiler_inference/src/build_reactive_scope_terminals_hir.rs RUST 24 matches · showing 5 view file →
6//! Builds reactive scope terminals in the HIR.
7//!
8//! Given a function whose reactive scope ranges have been correctly aligned and
9//! merged, this pass rewrites blocks to introduce ReactiveScopeTerminals and
10//! their fallthrough blocks.
· · ·
19use react_compiler_hir::EvaluationOrder;
20use react_compiler_hir::GotoVariant;
21use react_compiler_hir::HirFunction;
22use react_compiler_hir::IdentifierId;
23use react_compiler_hir::ScopeId;
· · ·
35// =============================================================================
36
37/// Collect all unique scopes from places in the function that have non-empty ranges.
38/// Corresponds to TS `getScopes(fn)`.
39fn get_scopes(func: &HirFunction, env: &Environment) -> Vec<ScopeId> {
· · ·
39fn get_scopes(func: &HirFunction, env: &Environment) -> Vec<ScopeId> {
40 let mut scope_ids: FxHashSet<ScopeId> = FxHashSet::default();
41
· · ·
49 };
50
51 for (_block_id, block) in &func.body.blocks {
52 for &instr_id in &block.instructions {
53 let instr = &func.instructions[instr_id.0 as usize];
+ 19 more matches in this file
compiler/crates/react_compiler_inference/src/infer_reactive_places.rs RUST 82 matches · showing 5 view file →
23use react_compiler_hir::visitors;
24use react_compiler_hir::{
25 BlockId, Effect, FunctionId, HirFunction, IdentifierId, InstructionValue, ParamPattern,
26 Terminal, Type,
27};
· · ·
35// =============================================================================
36
37/// Infer which places in a function are reactive.
38///
39/// Corresponds to TS `inferReactivePlaces(fn: HIRFunction): void`.
· · ·
39/// Corresponds to TS `inferReactivePlaces(fn: HIRFunction): void`.
40pub fn infer_reactive_places(
41 func: &mut HirFunction,
· · ·
41 func: &mut HirFunction,
42 env: &mut Environment,
43) -> Result<(), CompilerDiagnostic> {
· · ·
44 let mut aliased_identifiers = find_disjoint_mutable_values(func, env);
45 let mut reactive_map = ReactivityMap::new(&mut aliased_identifiers);
46 let mut stable_sidemap = StableSidemap::new();
+ 77 more matches in this file
compiler/crates/react_compiler_inference/src/memoize_fbt_and_macro_operands_in_same_scope.rs RUST 14 matches · showing 5 view file →
19use react_compiler_hir::visitors;
20use react_compiler_hir::{
21 HirFunction, IdentifierId, InstructionValue, JsxTag, PrimitiveValue, PropertyLiteral, ScopeId,
22};
23
· · ·
95}
96
97/// Main entry point. Returns the set of identifier IDs that are fbt/macro operands.
98pub fn memoize_fbt_and_macro_operands_in_same_scope(
99 func: &HirFunction,
· · ·
99 func: &HirFunction,
100 env: &mut Environment,
101) -> FxHashSet<IdentifierId> {
· · ·
109
110 // Phase 2: Forward data-flow to identify all macro tags
111 let mut macro_tags = populate_macro_tags(func, &macro_kinds);
112
113 // Phase 3: Reverse data-flow to merge arguments of macro invocations
· · ·
114 let macro_values = merge_macro_arguments(func, env, &mut macro_tags, &macro_kinds);
115
116 macro_values
+ 9 more matches in this file
compiler/crates/react_compiler_inference/src/propagate_scope_dependencies_hir.rs RUST 153 matches · showing 5 view file →
20use react_compiler_hir::visitors::{ScopeBlockInfo, ScopeBlockTraversal};
21use react_compiler_hir::{
22 BasicBlock, BlockId, DeclarationId, DependencyPathEntry, EvaluationOrder, FunctionId,
23 GotoVariant, HirFunction, IdentifierId, Instruction, InstructionId, InstructionKind,
24 InstructionValue, MutableRange, ParamPattern, Place, PlaceOrSpread, PropertyLiteral,
· · ·
23 GotoVariant, HirFunction, IdentifierId, Instruction, InstructionId, InstructionKind,
24 InstructionValue, MutableRange, ParamPattern, Place, PlaceOrSpread, PropertyLiteral,
25 ReactFunctionType, ReactiveScopeDependency, ScopeId, Terminal, Type, visitors,
· · ·
25 ReactFunctionType, ReactiveScopeDependency, ScopeId, Terminal, Type, visitors,
26};
27
· · ·
30// =============================================================================
31
32/// Main entry point: propagate scope dependencies through the HIR.
33/// Corresponds to TS `propagateScopeDependenciesHIR(fn)`.
34pub fn propagate_scope_dependencies_hir(func: &mut HirFunction, env: &mut Environment) {
· · ·
34pub fn propagate_scope_dependencies_hir(func: &mut HirFunction, env: &mut Environment) {
35 let used_outside_declaring_scope = find_temporaries_used_outside_declaring_scope(func, env);
36 let temporaries = collect_temporaries_sidemap(func, env, &used_outside_declaring_scope);
+ 148 more matches in this file
compiler/crates/react_compiler_lowering/src/build_hir.rs RUST 246 matches · showing 5 view file →
15use react_compiler_hir::*;
16
17use crate::FunctionNode;
18use crate::find_context_identifiers::find_context_identifiers;
19use crate::hir_builder::HirBuilder;
· · ·
113 Expression::AssignmentExpression(e) => e.base.loc.clone(),
114 Expression::SequenceExpression(e) => e.base.loc.clone(),
115 Expression::ArrowFunctionExpression(e) => e.base.loc.clone(),
116 Expression::FunctionExpression(e) => e.base.loc.clone(),
117 Expression::ObjectExpression(e) => e.base.loc.clone(),
· · ·
116 Expression::FunctionExpression(e) => e.base.loc.clone(),
117 Expression::ObjectExpression(e) => e.base.loc.clone(),
118 Expression::ArrayExpression(e) => e.base.loc.clone(),
· · ·
145fn validate_ts_this_parameter(
146 scope_info: &ScopeInfo,
147 function_scope: ScopeId,
148) -> Result<(), CompilerError> {
149 let Some(scope) = scope_info.scopes.get(function_scope.0 as usize) else {
· · ·
149 let Some(scope) = scope_info.scopes.get(function_scope.0 as usize) else {
150 return Ok(());
151 };
+ 241 more matches in this file
compiler/crates/react_compiler_lowering/src/lib.rs RUST 16 matches · showing 5 view file →
4pub mod identifier_loc_index;
5
6use react_compiler_ast::expressions::ArrowFunctionExpression;
7use react_compiler_ast::expressions::FunctionExpression;
8use react_compiler_ast::statements::FunctionDeclaration;
· · ·
7use react_compiler_ast::expressions::FunctionExpression;
8use react_compiler_ast::statements::FunctionDeclaration;
9use react_compiler_hir::BindingKind;
· · ·
8use react_compiler_ast::statements::FunctionDeclaration;
9use react_compiler_hir::BindingKind;
10
· · ·
23}
24
25/// Represents a reference to a function AST node for lowering.
26/// Analogous to TS's `NodePath<t.Function>` / `BabelFn`.
27pub enum FunctionNode<'a> {
· · ·
26/// Analogous to TS's `NodePath<t.Function>` / `BabelFn`.
27pub enum FunctionNode<'a> {
28 FunctionDeclaration(&'a FunctionDeclaration),
+ 11 more matches in this file
compiler/crates/react_compiler_optimization/src/drop_manual_memoization.rs RUST 42 matches · showing 5 view file →
22use react_compiler_hir::Effect;
23use react_compiler_hir::EvaluationOrder;
24use react_compiler_hir::HirFunction;
25use react_compiler_hir::IdentifierId;
26use react_compiler_hir::IdentifierName;
· · ·
57
58struct IdentifierSidemap {
59 /// Maps identifier id -> InstructionId of FunctionExpression instructions
60 functions: FxHashSet<IdentifierId>,
61 /// Maps identifier id -> ManualMemoCallee for useMemo/useCallback callees
· · ·
60 functions: FxHashSet<IdentifierId>,
61 /// Maps identifier id -> ManualMemoCallee for useMemo/useCallback callees
62 manual_memos: FxHashMap<IdentifierId, ManualMemoCallee>,
· · ·
84
85// =============================================================================
86// Main pass
87// =============================================================================
88
· · ·
90/// with direct invocations/references.
91pub fn drop_manual_memoization(
92 func: &mut HirFunction,
93 env: &mut Environment,
94) -> Result<(), CompilerDiagnostic> {
+ 37 more matches in this file
compiler/crates/react_compiler_optimization/src/outline_functions.rs RUST 52 matches · showing 5 view file →
4// LICENSE file in the root directory of this source tree.
5
6//! Port of OutlineFunctions from TypeScript (`Optimization/OutlineFunctions.ts`).
7//!
8//! Extracts anonymous function expressions that do not close over any local
· · ·
8//! Extracts anonymous function expressions that do not close over any local
9//! variables into top-level outlined functions. The original instruction is
10//! replaced with a `LoadGlobal` referencing the outlined function's generated name.
· · ·
9//! variables into top-level outlined functions. The original instruction is
10//! replaced with a `LoadGlobal` referencing the outlined function's generated name.
11//!
· · ·
10//! replaced with a `LoadGlobal` referencing the outlined function's generated name.
11//!
12//! Conditional on `env.config.enable_function_outlining`.
· · ·
12//! Conditional on `env.config.enable_function_outlining`.
13
14use rustc_hash::FxHashSet;
+ 47 more matches in this file
compiler/crates/react_compiler_optimization/src/outline_jsx.rs RUST 62 matches · showing 5 view file →
6//! Port of OutlineJsx from TypeScript.
7//!
8//! Outlines JSX expressions in callbacks into separate component functions.
9//! This pass is conditional on `env.config.enable_jsx_outlining` (defaults to false).
10
· · ·
14use react_compiler_hir::environment::Environment;
15use react_compiler_hir::{
16 BasicBlock, BlockId, BlockKind, EvaluationOrder, FunctionId, HIR, HirFunction, IdentifierId,
17 IdentifierName, Instruction, InstructionId, InstructionKind, InstructionValue, JsxAttribute,
18 JsxTag, LValuePattern, NonLocalBinding, ObjectPattern, ObjectProperty, ObjectPropertyKey,
· · ·
19 ObjectPropertyOrSpread, ObjectPropertyType, ParamPattern, Pattern, Place, ReactFunctionType,
20 ReturnVariant, Terminal,
21};
· · ·
22
23/// Outline JSX expressions in inner functions into separate outlined components.
24///
25/// Ported from TS `outlineJSX` in `Optimization/OutlineJsx.ts`.
· · ·
26pub fn outline_jsx(func: &mut HirFunction, env: &mut Environment) {
27 let mut outlined_fns: Vec<HirFunction> = Vec::new();
28 outline_jsx_impl(func, env, &mut outlined_fns);
+ 57 more matches in this file
compiler/crates/react_compiler_reactive_scopes/src/build_reactive_function.rs RUST 15 matches · showing 5 view file →
4// LICENSE file in the root directory of this source tree.
5
6//! Converts the HIR CFG into a tree-structured ReactiveFunction.
7//!
8//! Corresponds to `src/ReactiveScopes/BuildReactiveFunction.ts`.
· · ·
8//! Corresponds to `src/ReactiveScopes/BuildReactiveFunction.ts`.
9
10use rustc_hash::FxHashSet;
· · ·
15use react_compiler_hir::environment::Environment;
16use react_compiler_hir::{
17 BasicBlock, BlockId, EvaluationOrder, GotoVariant, HirFunction, InstructionValue, Place,
18 PrunedReactiveScopeBlock, ReactiveBlock, ReactiveFunction, ReactiveInstruction, ReactiveLabel,
19 ReactiveScopeBlock, ReactiveStatement, ReactiveSwitchCase, ReactiveTerminal,
· · ·
18 PrunedReactiveScopeBlock, ReactiveBlock, ReactiveFunction, ReactiveInstruction, ReactiveLabel,
19 ReactiveScopeBlock, ReactiveStatement, ReactiveSwitchCase, ReactiveTerminal,
20 ReactiveTerminalStatement, ReactiveTerminalTargetKind, ReactiveValue, Terminal,
· · ·
21};
22
23/// Convert the HIR CFG into a tree-structured ReactiveFunction.
24pub fn build_reactive_function(
25 hir: &HirFunction,
+ 10 more matches in this file
Search syntax
auth loginboth terms (AND is implicit)
auth OR logineither term
NOT path:vendorexclude matches
"exact phrase"quoted exact match
/func\s+Test/regex
handler~1fuzzy (Levenshtein 1)
file:*_test.gofilename glob
path:pkg/auth/**full path glob
lang:golanguage filter

Search any public repo from your terminal

This page calls POST /api/v1/code_search. Same tool, available over MCP for Claude/Cursor/Copilot.