Skip to content

Commit 1022eb9

Browse files
committed
fix: fixed some errors
1 parent a3420cf commit 1022eb9

5 files changed

Lines changed: 13 additions & 11 deletions

File tree

compiler/astoir_hir_lowering/src/enums.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ pub fn lower_ast_enum(
4747
} = node.kind.clone()
4848
{
4949
let mut container =
50-
RawEnumTypeContainer::new(context.global_scope.entries.len(), type_params);
50+
RawEnumTypeContainer::new(context.global_scope.scope.entries.len(), type_params);
5151

5252
for entry in entries {
5353
lower_ast_enum_entry(context, entry, &mut container)?;

compiler/astoir_hir_lowering/src/structs.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -120,13 +120,13 @@ pub fn lower_ast_struct_declaration(
120120
&ASTTreeNodeKind::StructFieldMember { .. } => {
121121
lower_ast_struct_member(context, member, &mut container)?;
122122

123-
context.global_scope.entries[ind].entry_type =
123+
context.global_scope.scope.entries[ind].entry_type =
124124
GlobalStorageEntryType::Type(RawType::Struct(layout, container.clone()));
125125
}
126126
&ASTTreeNodeKind::FunctionDeclaration { .. } => {
127127
let body = lower_ast_struct_function_decl(context, member, &mut container)?;
128128

129-
context.global_scope.entries[ind].entry_type =
129+
context.global_scope.scope.entries[ind].entry_type =
130130
GlobalStorageEntryType::Type(RawType::Struct(layout, container.clone()));
131131

132132
func_impls.push(body);

compiler/astoir_hir_lowering/src/types.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ pub fn lower_ast_type<K: DiagnosticSpanOrigin>(
3737
t = container.get_entry(HashedString::new(specifier.unwrap()))?
3838
}
3939

40-
if t.get_type_params_count(&context.global_scope, origin)? != type_params.len() {
40+
if t.get_type_params_count(&context.global_scope.scope, origin)? != type_params.len() {
4141
return Err(make_diff_type_specifiers(
4242
origin,
4343
&type_params.len(),
44-
&t.get_type_params_count(&context.global_scope, origin)?,
44+
&t.get_type_params_count(&context.global_scope.scope, origin)?,
4545
)
4646
.into());
4747
}
@@ -59,6 +59,7 @@ pub fn lower_ast_type<K: DiagnosticSpanOrigin>(
5959

6060
if context
6161
.global_scope
62+
.scope
6263
.value_to_ind
6364
.contains_key(&GlobalStorageEntryType::Type(lower.clone()))
6465
{
@@ -74,7 +75,7 @@ pub fn lower_ast_type<K: DiagnosticSpanOrigin>(
7475
};
7576

7677
return Ok(Type::Generic(
77-
context.global_scope.entries[ind].as_type_unsafe(),
78+
context.global_scope.scope.entries[ind].as_type_unsafe(),
7879
vec![],
7980
vec![],
8081
));

compiler/astoir_hir_lowering/src/uses.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -179,11 +179,11 @@ pub fn lower_ast_type_use_statement<K: DiagnosticSpanOrigin>(
179179
t = container.get_entry(HashedString::new(specifier.unwrap()))?
180180
}
181181

182-
if t.get_type_params_count(&context.global_scope, origin)? != type_params.len() {
182+
if t.get_type_params_count(&context.global_scope.scope, origin)? != type_params.len() {
183183
return Err(make_diff_type_specifiers(
184184
origin,
185185
&type_params.len(),
186-
&t.get_type_params_count(&context.global_scope, origin)?,
186+
&t.get_type_params_count(&context.global_scope.scope, origin)?,
187187
)
188188
.into());
189189
}
@@ -201,6 +201,7 @@ pub fn lower_ast_type_use_statement<K: DiagnosticSpanOrigin>(
201201

202202
if context
203203
.global_scope
204+
.scope
204205
.value_to_ind
205206
.contains_key(&GlobalStorageEntryType::Type(lower.clone()))
206207
{
@@ -218,7 +219,7 @@ pub fn lower_ast_type_use_statement<K: DiagnosticSpanOrigin>(
218219
};
219220

220221
return Ok(Type::Generic(
221-
context.global_scope.entries[ind].as_type_unsafe(),
222+
context.global_scope.scope.entries[ind].as_type_unsafe(),
222223
vec![],
223224
vec![],
224225
));

compiler/astoir_hir_lowering/src/values.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ pub(crate) fn lower_ast_lru_base(
3737
let ind: usize;
3838

3939
if let Some(curr_type_val) = curr_type {
40-
let res = match curr_type_val.get_function(&context.global_scope, func.hash) {
40+
let res = match curr_type_val.get_function(&context.global_scope.scope, func.hash) {
4141
Ok(v) => v,
4242
Err(_) => {
4343
return Err(
@@ -108,7 +108,7 @@ pub(crate) fn lower_ast_lru_base(
108108
let ind: usize;
109109

110110
if let Some(curr_type_val) = curr_type {
111-
let res = match curr_type_val.get_field(&context.global_scope, str.hash) {
111+
let res = match curr_type_val.get_field(&context.global_scope.scope, str.hash) {
112112
Ok(v) => v,
113113
Err(_) => {
114114
return Err(

0 commit comments

Comments
 (0)