1,452 matches across 25 files for error lang:Rust
snippet_mode: auto · sorted by relevance
9use react_compiler_diagnostics::CompilerDiagnostic;
10use react_compiler_diagnostics::CompilerDiagnosticDetail;
11▶use react_compiler_diagnostics::CompilerError;
12use react_compiler_diagnostics::CompilerErrorDetail;
13use react_compiler_diagnostics::ErrorCategory;
· · ·
12▶use react_compiler_diagnostics::CompilerErrorDetail;
13use react_compiler_diagnostics::ErrorCategory;
14use react_compiler_hir::environment::Environment;
· · ·
13▶use react_compiler_diagnostics::ErrorCategory;
14use react_compiler_hir::environment::Environment;
15use react_compiler_hir::*;
· · ·
52/// Serialize an expression to a serde_json::Value for UnsupportedNode's original_node.
53/// Returns None if serialization fails (should not happen for valid AST nodes).
54▶/// This should ONLY be called on error/bail paths — never eagerly before deciding
55/// to create an UnsupportedNode.
56fn serialize_expression(
· · ·
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 {
150 return Ok(());
+ 176 more matches in this file
35use react_compiler_ast::visitor::Visitor;
36use react_compiler_ast::visitor::walk_program_mut;
37▶use react_compiler_diagnostics::CompilerError;
38use react_compiler_diagnostics::CompilerErrorDetail;
39use react_compiler_diagnostics::CompilerErrorOrDiagnostic;
· · ·
38▶use react_compiler_diagnostics::CompilerErrorDetail;
39use react_compiler_diagnostics::CompilerErrorOrDiagnostic;
40use react_compiler_diagnostics::ErrorCategory;
· · ·
39▶use react_compiler_diagnostics::CompilerErrorOrDiagnostic;
40use react_compiler_diagnostics::ErrorCategory;
41use react_compiler_diagnostics::SourceLocation;
· · ·
40▶use react_compiler_diagnostics::ErrorCategory;
41use react_compiler_diagnostics::SourceLocation;
42use react_compiler_hir::ReactFunctionType;
· · ·
47use super::compile_result::CodegenFunction;
48use super::compile_result::CompileResult;
49▶use super::compile_result::CompilerErrorDetailInfo;
50use super::compile_result::CompilerErrorInfo;
51use super::compile_result::CompilerErrorItemInfo;
+ 94 more matches in this file
9//!
10//! This pass uses abstract interpretation to compute effects describing
11▶//! creation, aliasing, mutation, freezing, and error conditions for each
12//! instruction and terminal in the HIR.
13
· · ·
17use react_compiler_diagnostics::CompilerDiagnostic;
18use react_compiler_diagnostics::CompilerDiagnosticDetail;
19▶use react_compiler_diagnostics::ErrorCategory;
20use react_compiler_hir::AliasingEffect;
21use react_compiler_hir::AliasingSignature;
· · ·
170 if iteration_count > 100 {
171 return Err(CompilerDiagnostic::new(
172▶ ErrorCategory::Invariant,
173 "[InferMutationAliasingEffects] Potential infinite loop: \
174 A value, temporary place, or effect was not cached properly",
· · ·
199 .unwrap_or_else(|| "".to_string());
200 // Use usage_loc if available, otherwise fall back to identifier's own loc
201▶ let error_loc = usage_loc.or_else(|| ident_info.and_then(|i| i.loc));
202 // Match TS printPlace format: "<unknown> name$id:type"
203 let type_str = ident_info
· · ·
209 let description = format!("<unknown> {}${}{}", name, uninitialized_id.0, type_str);
210 let diag = CompilerDiagnostic::new(
211▶ ErrorCategory::Invariant,
212 "[InferMutationAliasingEffects] Expected value kind to be initialized",
213 Some(description),
+ 50 more matches in this file
89use react_compiler_diagnostics::CompilerDiagnostic;
90use react_compiler_diagnostics::CompilerDiagnosticDetail;
91▶use react_compiler_diagnostics::CompilerError;
92use react_compiler_diagnostics::CompilerErrorDetail;
93use react_compiler_diagnostics::ErrorCategory;
· · ·
92▶use react_compiler_diagnostics::CompilerErrorDetail;
93use react_compiler_diagnostics::ErrorCategory;
94use react_compiler_diagnostics::SourceLocation as DiagSourceLocation;
· · ·
93▶use react_compiler_diagnostics::ErrorCategory;
94use react_compiler_diagnostics::SourceLocation as DiagSourceLocation;
95use react_compiler_hir::ArrayElement;
· · ·
197 unique_identifiers: FxHashSet<String>,
198 fbt_operands: FxHashSet<IdentifierId>,
199▶) -> Result<CodegenFunction, CompilerError> {
200 let fn_name = func.id.as_deref().unwrap_or("[[ anonymous ]]");
201 let mut cx = Context::new(env, fn_name.to_string(), unique_identifiers, fbt_operands);
· · ·
635 }
636
637▶ fn record_error(&mut self, detail: CompilerErrorDetail) -> Result<(), CompilerError> {
638 self.env.record_error(detail)
639 }
+ 75 more matches in this file
15
16use react_compiler_diagnostics::{
17▶ CompilerDiagnostic, CompilerDiagnosticDetail, CompilerError, CompilerErrorDetail, ErrorCategory,
18};
19use react_compiler_hir::environment::Environment;
· · ·
375 func: &HirFunction,
376 env: &Environment,
377▶) -> Result<CompilerError, CompilerDiagnostic> {
378 let identifiers = &env.identifiers;
379
· · ·
450
451 // Validate all effect sites
452▶ let mut errors = CompilerError::new();
453 let effects_cache: Vec<(IdentifierId, FunctionId, Vec<DepElement>)> = context
454 .effects_cache
· · ·
464 func,
465 env,
466▶ &mut errors,
467 );
468 }
· · ·
469
470▶ Ok(errors)
471}
472
+ 16 more matches in this file
2
3use react_compiler_diagnostics::{
4▶ CompilerDiagnostic, CompilerDiagnosticDetail, ErrorCategory, SourceLocation,
5};
6use react_compiler_hir::environment::Environment;
· · ·
15};
16
17▶const ERROR_DESCRIPTION: &str = "React refs are values that are not needed for rendering. \
18 Refs should only be accessed outside of render, such as in event handlers or effects. \
19 Accessing a ref value (the `current` property) during render can cause your component \
· · ·
363
364fn validate_no_direct_ref_value_access(
365▶ errors: &mut Vec<CompilerDiagnostic>,
366 operand: &Place,
367 env: &Env,
· · ·
370 let ty = destructure(ty);
371 if let RefAccessType::RefValue { loc, .. } = &ty {
372▶ errors.push(
373 CompilerDiagnostic::new(
374 ErrorCategory::Refs,
· · ·
374▶ ErrorCategory::Refs,
375 "Cannot access refs during render",
376 Some(ERROR_DESCRIPTION.to_string()),
+ 84 more matches in this file
11use indexmap::IndexMap;
12use react_compiler_ast::scope::ScopeInfo;
13▶use react_compiler_diagnostics::CompilerError;
14use react_compiler_hir::ReactFunctionType;
15use react_compiler_hir::environment::Environment;
· · ·
20
21use super::compile_result::CodegenFunction;
22▶use super::compile_result::CompilerErrorDetailInfo;
23use super::compile_result::CompilerErrorItemInfo;
24use super::compile_result::DebugLogEntry;
· · ·
23▶use super::compile_result::CompilerErrorItemInfo;
24use super::compile_result::DebugLogEntry;
25use super::compile_result::LoggerPosition;
· · ·
43 env_config: &EnvironmentConfig,
44 context: &mut ProgramContext,
45▶) -> Result<CodegenFunction, CompilerError> {
46 let mut env = Environment::with_config(env_config.clone());
47 env.fn_type = fn_type;
· · ·
69 }
70
71▶ // Check for Invariant errors after lowering, before logging HIR.
72 // In TS, Invariant errors throw from recordError(), aborting lower() before
73 // the HIR entry is logged. The thrown error contains ONLY the Invariant error,
+ 53 more matches in this file
19use indexmap::IndexMap;
20
21▶use react_compiler_diagnostics::{CompilerDiagnostic, ErrorCategory};
22use react_compiler_hir::environment::Environment;
23use react_compiler_hir::type_config::{ValueKind, ValueReason};
· · ·
213 }
214 if let NodeValue::Function { function_id } = &node.value {
215▶ append_function_errors(env, *function_id);
216 }
217 for (&alias, &when) in &node.created_from {
· · ·
246 reason: Option<MutationReason>,
247 env: &mut Environment,
248▶ should_record_errors: bool,
249 ) {
250 #[derive(Clone)]
· · ·
296 if let NodeValue::Function { function_id } = &node.value {
297 if node.transitive.is_none() && node.local.is_none() {
298▶ if should_record_errors {
299 append_function_errors(env, *function_id);
300 }
· · ·
299▶ append_function_errors(env, *function_id);
300 }
301 }
+ 20 more matches in this file
3use react_compiler_diagnostics::{
4 CompilerDiagnostic, CompilerDiagnosticDetail, CompilerSuggestion, CompilerSuggestionOperation,
5▶ ErrorCategory, SourceLocation,
6};
7use react_compiler_hir::environment::Environment;
· · ·
25/// Note: takes `&mut HirFunction` (deviating from the read-only validation convention)
26/// because it sets `has_invalid_deps` on StartMemoize instructions when validation
27▶/// errors are found, so that ValidatePreservedManualMemoization can skip those blocks.
28pub fn validate_exhaustive_dependencies(
29 func: &mut HirFunction,
· · ·
75 )?;
76
77▶ // Set has_invalid_deps on StartMemoize instructions that had validation errors
78 if !callbacks.invalid_memo_ids.is_empty() {
79 for instr in func.instructions.iter_mut() {
· · ·
186 reactive: &'a FxHashSet<IdentifierId>,
187 diagnostics: Vec<CompilerDiagnostic>,
188▶ /// manual_memo_ids that had validation errors (to set has_invalid_deps)
189 invalid_memo_ids: FxHashSet<u32>,
190}
· · ·
873 cb.reactive,
874 sm.deps_loc.unwrap_or(None),
875▶ ErrorCategory::MemoDependencies,
876 "all",
877 identifiers,
+ 14 more matches in this file
2
3use react_compiler_diagnostics::CompilerDiagnostic;
4▶use react_compiler_diagnostics::CompilerError;
5use react_compiler_diagnostics::CompilerErrorDetail;
6use react_compiler_diagnostics::ErrorCategory;
· · ·
5▶use react_compiler_diagnostics::CompilerErrorDetail;
6use react_compiler_diagnostics::ErrorCategory;
7
· · ·
6▶use react_compiler_diagnostics::ErrorCategory;
7
8use crate::default_module_type_provider::default_module_type_provider;
· · ·
51 pub functions: Vec<HirFunction>,
52
53▶ // Error accumulation
54 pub errors: CompilerError,
55
· · ·
54▶ pub errors: CompilerError,
55
56 // Function type classification (Component, Hook, Other)
+ 100 more matches in this file
11
12use react_compiler_diagnostics::{
13▶ CompilerDiagnostic, CompilerDiagnosticDetail, ErrorCategory, SourceLocation,
14};
15use react_compiler_hir::environment::Environment;
· · ·
147 if self.scheduled.contains(&block) {
148 return Err(CompilerDiagnostic::new(
149▶ ErrorCategory::Invariant,
150 format!("Break block is already scheduled: bb{}", block.0),
151 None,
· · ·
159 _ => {
160 return Err(CompilerDiagnostic::new(
161▶ ErrorCategory::Invariant,
162 format!("Unknown target type: {}", target_type),
163 None,
· · ·
181 if self.scheduled.contains(&continue_block) {
182 return Err(CompilerDiagnostic::new(
183▶ ErrorCategory::Invariant,
184 format!(
185 "Continue block is already scheduled: bb{}",
· · ·
214 if last.id() != schedule_id {
215 return Err(CompilerDiagnostic::new(
216▶ ErrorCategory::Invariant,
217 "Can only unschedule the last target".to_string(),
218 None,
+ 24 more matches in this file
6use react_compiler_diagnostics::CompilerDiagnostic;
7use react_compiler_diagnostics::CompilerDiagnosticDetail;
8▶use react_compiler_diagnostics::CompilerError;
9use react_compiler_diagnostics::CompilerErrorDetail;
10use react_compiler_diagnostics::ErrorCategory;
· · ·
9▶use react_compiler_diagnostics::CompilerErrorDetail;
10use react_compiler_diagnostics::ErrorCategory;
11use react_compiler_hir::environment::Environment;
· · ·
10▶use react_compiler_diagnostics::ErrorCategory;
11use react_compiler_hir::environment::Environment;
12use react_compiler_hir::visitors::each_terminal_successor;
· · ·
65pub(crate) fn reserved_identifier_diagnostic(name: &str) -> CompilerDiagnostic {
66 CompilerDiagnostic::new(
67▶ ErrorCategory::Syntax,
68 "Expected a non-reserved identifier name",
69 Some(format!(
· · ·
72 )),
73 )
74▶ .with_detail(CompilerDiagnosticDetail::Error {
75 loc: None, // GeneratedSource in TS
76 message: Some("reserved word".to_string()),
+ 27 more matches in this file
15use indexmap::IndexMap;
16use react_compiler_diagnostics::{
17▶ CompilerDiagnostic, CompilerError, CompilerErrorDetail, ErrorCategory, SourceLocation,
18};
19use react_compiler_hir::dominator::compute_unconditional_blocks;
· · ·
29#[derive(Debug, Clone, Copy, PartialEq, Eq)]
30enum Kind {
31▶ Error,
32 KnownHook,
33 PotentialHook,
· · ·
37
38fn join_kinds(a: Kind, b: Kind) -> Kind {
39▶ if a == Kind::Error || b == Kind::Error {
40 Kind::Error
41 } else if a == Kind::KnownHook || b == Kind::KnownHook {
· · ·
40▶ Kind::Error
41 } else if a == Kind::KnownHook || b == Kind::KnownHook {
42 Kind::KnownHook
· · ·
88 place: &Place,
89 value_kinds: &FxHashMap<IdentifierId, Kind>,
90▶ errors_by_loc: &mut IndexMap<SourceLocation, CompilerErrorDetail, FxBuildHasher>,
91 env: &mut Environment,
92) -> Result<(), CompilerError> {
+ 58 more matches in this file
5 * LICENSE file in the root directory of this source tree.
6 */
7▶use crate::{CompilerDiagnosticDetail, CompilerError, CompilerErrorOrDiagnostic};
8
9const CODEFRAME_LINES_ABOVE: u32 = 2;
· · ·
88
89 if line_diff > 0 {
90▶ // Multi-line error
91 for i in 0..=line_diff {
92 let line_number = i + start_line;
· · ·
108 }
109 } else {
110▶ // Single-line error
111 if start_column == end_column {
112 if start_column != 0 {
· · ·
321use crate::format_category_heading;
322
323▶/// Format a CompilerError into a message string matching the TS compiler's
324/// CompilerError.printErrorMessage() / formatCompilerError() format.
325///
· · ·
324▶/// CompilerError.printErrorMessage() / formatCompilerError() format.
325///
326/// The source parameter is the full source code of the file being compiled.
+ 9 more matches in this file
16
17use react_compiler_diagnostics::{
18▶ CompilerDiagnostic, CompilerDiagnosticDetail, CompilerError, ErrorCategory,
19};
20use react_compiler_hir::dominator::{compute_post_dominator_tree, post_dominator_frontier};
· · ·
30 func: &HirFunction,
31 env: &Environment,
32▶) -> Result<CompilerError, CompilerDiagnostic> {
33 let identifiers = &env.identifiers;
34 let types = &env.types;
· · ·
39 // Map from IdentifierId to the Place where the setState originated
40 let mut set_state_functions: FxHashMap<IdentifierId, SetStateInfo> = FxHashMap::default();
41▶ let mut errors = CompilerError::new();
42
43 for (_block_id, block) in &func.body.blocks {
· · ·
101 if let PlaceOrSpread::Place(arg_place) = first_arg {
102 if let Some(info) = set_state_functions.get(&arg_place.identifier) {
103▶ push_error(&mut errors, info, enable_verbose);
104 }
105 }
· · ·
126 if let PlaceOrSpread::Place(arg_place) = first_arg {
127 if let Some(info) = set_state_functions.get(&arg_place.identifier) {
128▶ push_error(&mut errors, info, enable_verbose);
129 }
130 }
+ 8 more matches in this file
13
14use react_compiler_diagnostics::{
15▶ CompilerDiagnostic, CompilerDiagnosticDetail, ErrorCategory, SourceLocation,
16};
17use react_compiler_hir::environment::Environment;
· · ·
190 ..
191 }) => {
192▶ // TS: CompilerError.invariant(state.manualMemoState == null, ...)
193 if state.manual_memo_state.is_some() {
194 return;
· · ·
219 {
220 let diag = CompilerDiagnostic::new(
221▶ ErrorCategory::PreserveManualMemo,
222 "Existing memoization could not be preserved",
223 Some(
· · ·
226 ),
227 )
228▶ .with_detail(CompilerDiagnosticDetail::Error {
229 loc: place.loc,
230 message: Some(
· · ·
249 }
250
251▶ // TS: CompilerError.invariant(state.manualMemoState.manualMemoId === value.manualMemoId, ...)
252 if state
253 .manual_memo_state
+ 12 more matches in this file
17use react_compiler_diagnostics::CompilerDiagnostic;
18use react_compiler_diagnostics::CompilerDiagnosticDetail;
19▶use react_compiler_diagnostics::ErrorCategory;
20use react_compiler_hir::ArrayElement;
21use react_compiler_hir::DependencyPathEntry;
· · ·
228 if !sidemap.functions.contains(&fn_place.identifier) {
229 let mut diag = CompilerDiagnostic::new(
230▶ ErrorCategory::UseMemo,
231 "Expected the first argument to be an inline function expression",
232 Some("Expected the first argument to be an inline function expression".to_string()),
· · ·
233 )
234▶ .with_detail(CompilerDiagnosticDetail::Error {
235 loc: fn_place.loc.clone(),
236 message: Some(
· · ·
553 env.record_diagnostic(
554 CompilerDiagnostic::new(
555▶ ErrorCategory::UseMemo,
556 format!("Expected a callback function to be passed to {kind_name}"),
557 Some(if kind == ManualMemoKind::UseCallback {
· · ·
561 }),
562 )
563▶ .with_detail(CompilerDiagnosticDetail::Error {
564 loc,
565 message: Some(if kind == ManualMemoKind::UseCallback {
+ 6 more matches in this file
8//! Corresponds to `src/ReactiveScopes/visitors.ts` in the TypeScript compiler.
9
10▶use react_compiler_diagnostics::CompilerError;
11use react_compiler_hir::{
12 EvaluationOrder, FunctionId, InstructionValue, ParamPattern, Place, PrunedReactiveScopeBlock,
· · ·
362 _id: EvaluationOrder,
363 _state: &mut Self::State,
364▶ ) -> Result<(), CompilerError> {
365 Ok(())
366 }
· · ·
371 _place: &Place,
372 _state: &mut Self::State,
373▶ ) -> Result<(), CompilerError> {
374 Ok(())
375 }
· · ·
380 _lvalue: &Place,
381 _state: &mut Self::State,
382▶ ) -> Result<(), CompilerError> {
383 Ok(())
384 }
· · ·
389 value: &mut ReactiveValue,
390 state: &mut Self::State,
391▶ ) -> Result<(), CompilerError> {
392 self.traverse_value(id, value, state)
393 }
+ 17 more matches in this file
11use rustc_hash::{FxHashMap, FxHashSet};
12
13▶use react_compiler_diagnostics::CompilerError;
14use react_compiler_hir::{
15 DeclarationId, DependencyPathEntry, EvaluationOrder, InstructionKind, InstructionValue, Place,
· · ·
34 func: &mut ReactiveFunction,
35 env: &mut Environment,
36▶) -> Result<(), CompilerError> {
37 // Pass 1: find last usage of each declaration
38 let visitor = FindLastUsageVisitor { env: &*env };
· · ·
98 scope: &mut ReactiveScopeBlock,
99 state: &mut Self::State,
100▶ ) -> Result<Transformed<ReactiveStatement>, CompilerError> {
101 let scope_deps = self.env.scopes[scope.scope.0 as usize].dependencies.clone();
102 // Save parent state and recurse with this scope's deps as state
· · ·
122 block: &mut ReactiveBlock,
123 state: &mut Self::State,
124▶ ) -> Result<(), CompilerError> {
125 // Pass 1: traverse nested (scope flattening handled by transform_scope)
126 self.traverse_block(block, state)?;
· · ·
133impl<'a> MergeTransform<'a> {
134 /// Identify and merge consecutive scopes that invalidate together.
135▶ fn merge_scopes_in_block(&mut self, block: &mut ReactiveBlock) -> Result<(), CompilerError> {
136 // Pass 2: identify scopes for merging
137 struct MergedScope {
+ 1 more matches in this file
19
20use react_compiler_diagnostics::{
21▶ CompilerDiagnostic, CompilerDiagnosticDetail, CompilerError, ErrorCategory, SourceLocation,
22};
23use react_compiler_hir::visitors::each_pattern_operand;
· · ·
28use react_compiler_hir::environment::Environment;
29
30▶/// Create an invariant CompilerError (matches TS CompilerError.invariant).
31/// When a loc is provided, creates a CompilerDiagnostic with an error detail item
32/// (matching TS CompilerError.invariant which uses .withDetails()).
· · ·
31▶/// When a loc is provided, creates a CompilerDiagnostic with an error detail item
32/// (matching TS CompilerError.invariant which uses .withDetails()).
33fn invariant_error(reason: &str, description: Option<String>) -> CompilerError {
· · ·
32▶/// (matching TS CompilerError.invariant which uses .withDetails()).
33fn invariant_error(reason: &str, description: Option<String>) -> CompilerError {
34 invariant_error_with_loc(reason, description, None)
· · ·
33▶fn invariant_error(reason: &str, description: Option<String>) -> CompilerError {
34 invariant_error_with_loc(reason, description, None)
35}
+ 16 more matches in this file
7use react_compiler_ast::common::{Comment, CommentData};
8use react_compiler_diagnostics::{
9▶ CompilerDiagnostic, CompilerDiagnosticDetail, CompilerError, CompilerSuggestion,
10 CompilerSuggestionOperation, ErrorCategory,
11};
· · ·
10▶ CompilerSuggestionOperation, ErrorCategory,
11};
12
· · ·
87/// Check if a comment value matches a Flow suppression pattern.
88/// Matches: $FlowFixMe[react-rule, $FlowFixMe_xxx[react-rule,
89▶/// $FlowExpectedError[react-rule, $FlowIssue[react-rule
90fn matches_flow_suppression(value: &str) -> bool {
91 // Find "$Flow" anywhere in the value
· · ·
95 let after_dollar_flow = &value[idx + "$Flow".len()..];
96
97▶ // Match FlowFixMe (with optional word chars), FlowExpectedError, or FlowIssue
98 let after_kind = if after_dollar_flow.starts_with("FixMe") {
99 // Skip "FixMe" + any word characters
· · ·
103 .unwrap_or(rest.len());
104 &rest[word_end..]
105▶ } else if after_dollar_flow.starts_with("ExpectedError") {
106 &after_dollar_flow["ExpectedError".len()..]
107 } else if after_dollar_flow.starts_with("Issue") {
+ 11 more matches in this file
13use react_compiler_ast::visitor::AstWalker;
14use react_compiler_ast::visitor::Visitor;
15▶use react_compiler_diagnostics::CompilerError;
16use react_compiler_diagnostics::CompilerErrorDetail;
17use react_compiler_diagnostics::ErrorCategory;
· · ·
16▶use react_compiler_diagnostics::CompilerErrorDetail;
17use react_compiler_diagnostics::ErrorCategory;
18use react_compiler_diagnostics::Position;
· · ·
17▶use react_compiler_diagnostics::ErrorCategory;
18use react_compiler_diagnostics::Position;
19use react_compiler_diagnostics::SourceLocation;
· · ·
36 function_stack: Vec<ScopeId>,
37 binding_info: FxHashMap<BindingId, BindingInfo>,
38▶ error: Option<CompilerError>,
39}
40
· · ·
139 .copied()
140 .unwrap_or(self.scope_info.program_scope);
141▶ if self.error.is_none() {
142 if let Err(error) = walk_lval_for_reassignment(self, &node.left, current_scope) {
143 self.error = Some(error);
+ 12 more matches in this file
22use react_compiler_ast::statements::{ForInOfLeft, ForInit, Statement, VariableDeclaration};
23use react_compiler_diagnostics::{
24▶ CompilerDiagnostic, CompilerDiagnosticDetail, ErrorCategory, Position as DiagPosition,
25 SourceLocation as DiagSourceLocation,
26};
· · ·
131}
132
133▶// ---- Error reporting ----
134
135fn report_missing_location(env: &mut Environment, loc: &AstSourceLocation, node_type: &str) {
· · ·
137 env.record_diagnostic(
138 CompilerDiagnostic::new(
139▶ ErrorCategory::Todo,
140 "Important source location missing in generated code",
141 Some(format!(
· · ·
146 )),
147 )
148▶ .with_detail(CompilerDiagnosticDetail::Error {
149 loc: Some(diag_loc),
150 message: None,
· · ·
165 env.record_diagnostic(
166 CompilerDiagnostic::new(
167▶ ErrorCategory::Todo,
168 "Important source location has wrong node type in generated code",
169 Some(format!(
+ 1 more matches in this file
2
3use react_compiler_diagnostics::{
4▶ CompilerDiagnostic, CompilerDiagnosticDetail, CompilerError, ErrorCategory, SourceLocation,
5};
6use react_compiler_hir::environment::Environment;
· · ·
16///
17/// Port of ValidateUseMemo.ts.
18▶/// Returns VoidUseMemo errors separately (for logging via logErrors, not as compile errors).
19pub fn validate_use_memo(func: &HirFunction, env: &mut Environment) -> CompilerError {
20 validate_use_memo_impl(
· · ·
19▶pub fn validate_use_memo(func: &HirFunction, env: &mut Environment) -> CompilerError {
20 validate_use_memo_impl(
21 func,
· · ·
22 &env.functions,
23▶ &mut env.errors,
24 env.config.validate_no_void_use_memo,
25 )
· · ·
35 func: &HirFunction,
36 functions: &[HirFunction],
37▶ errors: &mut CompilerError,
38 validate_no_void_use_memo: bool,
39) -> CompilerError {
+ 26 more matches in this file
22use react_compiler_ast::{Program, SourceType};
23use react_compiler_diagnostics::{
24▶ CompilerError, CompilerErrorDetail, ErrorCategory, Position, SourceLocation,
25};
26
· · ·
266
267/// Check for blocklisted import modules.
268▶/// Returns a CompilerError if any blocklisted imports are found.
269pub fn validate_restricted_imports(
270 program: &Program,
· · ·
271 blocklisted: &Option<Vec<String>>,
272▶) -> Option<CompilerError> {
273 let blocklisted = match blocklisted {
274 Some(b) if !b.is_empty() => b,
· · ·
276 };
277 let restricted: FxHashSet<&str> = blocklisted.iter().map(|s| s.as_str()).collect();
278▶ let mut error = CompilerError::new();
279
280 for stmt in &program.body {
· · ·
286 .is_some_and(|v| restricted.contains(v))
287 {
288▶ let mut detail = CompilerErrorDetail::new(
289 ErrorCategory::Todo,
290 "Bailing out due to blocklisted import",
+ 4 more matches in this file