Update various types to use their own definitions
This commit refactors several modules to use the defined types from `ast::types` and `ast::nodes` directly, rather than using fully qualified paths. This improves code readability and reduces redundancy. Specifically, the following changes were made: - In `analyzer.rs`, `crate::ast::types::Identity` and `crate::ast::types::Purity` are now used directly. - In `binder.rs`, `crate::ast::types::NodeIdentity`, `crate::ast::types::SourceLocation`, `crate::ast::types::RecordLayout`, and `crate::ast::types::Value` are now used directly. - In `macros.rs`, types like `Address`, `VirtualId`, `NodeIdentity`, `SourceLocation`, `StaticType`, and `Purity` are now used directly. - In `optimizer/engine.rs`, `Address<VirtualId>` is now used directly. - In `type_checker.rs`, `BoundPhase`, `Signature`, `Keyword`, and `RecordLayout` are now used directly. - In `environment.rs`, `CompilerScope`, `LocalInfo`, `CapturePass`, `AnalyzedPhase`, `NativeFunction`, and `Closure` are now used directly. - In `nodes.rs`, `RecordLayout`, `Keyword`, `Purity`, and `StaticType` are now used directly. - In `parser.rs`, `SourceLocation` and `NodeIdentity` are now used directly. - In `rtl/math.rs`, `NativeFunction`, `Purity`, `Signature`, `StaticType`, `Value`, `RefCell`, and `Rc` are now used directly. - In `rtl/streams.rs`, `ScalarValue`, `SeriesMember`, `Object`, `PipeFn`, `Value`, `VM`, `RingBuffer`, `RecordSeries`, `SeriesView`, `build_map_stream`, and `build_pipeline_node` are now used directly. - In `rtl/type_registry.rs`, `RecordLayout`, `Keyword`, `Purity`, `Signature`, `StaticType`, and `Value` are now used directly. - In `vm.rs`, `RecordSeries`, `SeriesView`, `build_map_stream`, `build_pipeline_node`, `StreamNode`, `Object`, and `PipeFn` are now used directly. - In `utils/tester.rs`, `TypedNode` is now used directly.
This commit is contained in:
@@ -4,7 +4,7 @@ use crate::ast::nodes::{
|
||||
UpvalueIdx, VirtualId,
|
||||
};
|
||||
use crate::ast::diagnostics::Diagnostics;
|
||||
use crate::ast::types::{Identity, Purity, StaticType};
|
||||
use crate::ast::types::{Identity, NodeIdentity, Purity, RecordLayout, SourceLocation, StaticType, Value};
|
||||
use std::collections::HashMap;
|
||||
use std::rc::Rc;
|
||||
|
||||
@@ -139,7 +139,7 @@ impl Binder {
|
||||
fixed_scope_idx,
|
||||
};
|
||||
binder.functions.push(FunctionCompiler::new(
|
||||
crate::ast::types::NodeIdentity::new(crate::ast::types::SourceLocation {
|
||||
NodeIdentity::new(SourceLocation {
|
||||
line: 0,
|
||||
col: 0,
|
||||
}),
|
||||
@@ -488,10 +488,10 @@ impl Binder {
|
||||
let key_node = self.bind(k, ExprContext::Expression, diag);
|
||||
let val_node = self.bind(v, ExprContext::Expression, diag);
|
||||
|
||||
if let NodeKind::Constant(crate::ast::types::Value::Keyword(kw)) =
|
||||
if let NodeKind::Constant(Value::Keyword(kw)) =
|
||||
&key_node.kind
|
||||
{
|
||||
layout_fields.push((*kw, crate::ast::types::StaticType::Any));
|
||||
layout_fields.push((*kw, StaticType::Any));
|
||||
} else {
|
||||
diag.push_error(
|
||||
format!(
|
||||
@@ -504,7 +504,7 @@ impl Binder {
|
||||
bound_fields.push((Rc::new(key_node), Rc::new(val_node)));
|
||||
}
|
||||
|
||||
let layout = crate::ast::types::RecordLayout::get_or_create(layout_fields);
|
||||
let layout = RecordLayout::get_or_create(layout_fields);
|
||||
|
||||
self.make_node(
|
||||
node.identity.clone(),
|
||||
|
||||
Reference in New Issue
Block a user