|
14 | 14 | //! |
15 | 15 | //! When changing any of these types, make sure that the OpenAPI generator types do not degenerate |
16 | 16 | //! into any of these cases. |
| 17 | +#![expect( |
| 18 | + dead_code, |
| 19 | + reason = "https://linear.app/hash/issue/BE-537/hashql-remove-old-backend-wire-up-hashql-in-the-api" |
| 20 | +)] |
17 | 21 | use alloc::borrow::Cow; |
18 | 22 | use core::{cmp, ops::Range}; |
19 | 23 |
|
@@ -41,23 +45,17 @@ use hash_graph_store::{ |
41 | 45 | }; |
42 | 46 | use hashql_ast::error::AstDiagnosticCategory; |
43 | 47 | use hashql_core::{ |
44 | | - collections::fast_hash_map_with_capacity, |
45 | 48 | heap::Heap, |
46 | | - module::ModuleRegistry, |
47 | 49 | span::{SpanId, SpanTable}, |
48 | | - r#type::environment::Environment, |
49 | 50 | }; |
50 | 51 | use hashql_diagnostics::{ |
51 | | - DiagnosticIssues, Failure, Severity, Status, StatusExt as _, Success, |
| 52 | + DiagnosticIssues, Failure, Severity, Status, Success, |
52 | 53 | category::{DiagnosticCategory, canonical_category_id}, |
53 | 54 | diagnostic::render::{Format, RenderOptions}, |
54 | 55 | source::{DiagnosticSpan, Source, SourceId, Sources}, |
55 | 56 | }; |
56 | | -use hashql_eval::{ |
57 | | - error::EvalDiagnosticCategory, |
58 | | - graph::{error::GraphCompilerDiagnosticCategory, read::FilterSlice}, |
59 | | -}; |
60 | | -use hashql_hir::{error::HirDiagnosticCategory, visit::Visitor as _}; |
| 57 | +use hashql_eval::error::EvalDiagnosticCategory; |
| 58 | +use hashql_hir::error::HirDiagnosticCategory; |
61 | 59 | use hashql_syntax_jexpr::{error::JExprDiagnosticCategory, span::Span}; |
62 | 60 | use http::StatusCode; |
63 | 61 | use serde::Deserialize; |
@@ -330,89 +328,11 @@ pub enum EntityQuery<'q> { |
330 | 328 |
|
331 | 329 | impl<'q> EntityQuery<'q> { |
332 | 330 | fn compile_query<'heap>( |
333 | | - heap: &'heap Heap, |
334 | | - spans: &mut SpanTable<Span>, |
335 | | - query: &RawJsonValue, |
| 331 | + _: &'heap Heap, |
| 332 | + _: &mut SpanTable<Span>, |
| 333 | + _: &RawJsonValue, |
336 | 334 | ) -> Status<Filter<'heap, Entity>, HashQLDiagnosticCategory, SpanId> { |
337 | | - // Parse the query |
338 | | - let mut parser = hashql_syntax_jexpr::Parser::new(heap, spans); |
339 | | - let mut ast = parser |
340 | | - .parse_expr(query.get().as_bytes()) |
341 | | - .map_err(|diagnostic| { |
342 | | - Failure::new(diagnostic.map_category(HashQLDiagnosticCategory::JExpr)) |
343 | | - })?; |
344 | | - |
345 | | - let mut env = Environment::new(heap); |
346 | | - let modules = ModuleRegistry::new(&env); |
347 | | - |
348 | | - // Lower the AST |
349 | | - let Success { |
350 | | - value: types, |
351 | | - advisories, |
352 | | - } = hashql_ast::lowering::lower(heap.intern_symbol("main"), &mut ast, &env, &modules) |
353 | | - .map_category(|category| { |
354 | | - HashQLDiagnosticCategory::Ast(AstDiagnosticCategory::Lowering(category)) |
355 | | - })?; |
356 | | - |
357 | | - let interner = hashql_hir::intern::Interner::new(heap); |
358 | | - let mut context = hashql_hir::context::HirContext::new(&interner, &modules); |
359 | | - |
360 | | - // Reify the HIR from the AST |
361 | | - let Success { |
362 | | - value: hir, |
363 | | - advisories, |
364 | | - } = hashql_hir::node::NodeData::from_ast(ast, &mut context, &types) |
365 | | - .map_category(|category| { |
366 | | - HashQLDiagnosticCategory::Hir(HirDiagnosticCategory::Reification(category)) |
367 | | - }) |
368 | | - .with_diagnostics(advisories)?; |
369 | | - |
370 | | - // Lower the HIR |
371 | | - let Success { |
372 | | - value: hir, |
373 | | - advisories, |
374 | | - } = hashql_hir::lower::lower(hir, &types, &mut env, &mut context) |
375 | | - .map_category(|category| { |
376 | | - HashQLDiagnosticCategory::Hir(HirDiagnosticCategory::Lowering(category)) |
377 | | - }) |
378 | | - .with_diagnostics(advisories)?; |
379 | | - |
380 | | - // Evaluate the HIR |
381 | | - // TODO: https://linear.app/hash/issue/BE-41/hashql-expose-input-in-graph-api |
382 | | - let inputs = fast_hash_map_with_capacity(0); |
383 | | - let mut compiler = hashql_eval::graph::read::GraphReadCompiler::new(heap, &inputs); |
384 | | - |
385 | | - compiler.visit_node(hir); |
386 | | - |
387 | | - let Success { |
388 | | - value: result, |
389 | | - advisories, |
390 | | - } = compiler |
391 | | - .finish() |
392 | | - .map_category(|category| { |
393 | | - HashQLDiagnosticCategory::Eval(EvalDiagnosticCategory::Graph( |
394 | | - GraphCompilerDiagnosticCategory::Read(category), |
395 | | - )) |
396 | | - }) |
397 | | - .with_diagnostics(advisories)?; |
398 | | - |
399 | | - let output = result.output.get(&hir.id).expect("TODO"); |
400 | | - |
401 | | - // Compile the Filter into one |
402 | | - let filters = match output { |
403 | | - FilterSlice::Entity { range } => result.filters.entity(range.clone()), |
404 | | - }; |
405 | | - |
406 | | - let filter = match filters { |
407 | | - [] => Filter::All(Vec::new()), |
408 | | - [filter] => filter.clone(), |
409 | | - _ => Filter::All(filters.to_vec()), |
410 | | - }; |
411 | | - |
412 | | - Ok(Success { |
413 | | - value: filter, |
414 | | - advisories, |
415 | | - }) |
| 335 | + unimplemented!("https://linear.app/hash/issue/BE-537/hashql-remove-old-backend-wire-up-hashql-in-the-api") |
416 | 336 | } |
417 | 337 |
|
418 | 338 | /// Compiles a query into an executable entity filter. |
|
0 commit comments