-
Notifications
You must be signed in to change notification settings - Fork 197
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Grant Wuerker
committed
Feb 6, 2024
1 parent
bfc2a7d
commit a2bc54c
Showing
4 changed files
with
18 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,18 @@ | ||
use std::rc::Rc; | ||
|
||
use hir::hir_def::TypeId; | ||
use hir::hir_def::{Const, TypeId}; | ||
|
||
use crate::{ | ||
ir::{Constant, ConstantId}, | ||
ir::{Const, ConstId}, | ||
MirDb, | ||
}; | ||
|
||
#[salsa::tracked] | ||
pub fn mir_lowered_constant(db: &dyn MirDb, analyzer_const: hir::hir_def::Const) -> ConstantId { | ||
// let name = analyzer_const.name(db.upcast()); | ||
// let value = analyzer_const.constant_value(db.upcast()).unwrap(); | ||
// let ty = analyzer_const.typ(db.upcast()).unwrap(); | ||
// let module_id = analyzer_const.module(db.upcast()); | ||
// let span = analyzer_const.span(db.upcast()); | ||
// let id = analyzer_const.node_id(db.upcast()); | ||
pub fn mir_lowered_constant(db: &dyn MirDb, hir_const: Const) -> ConstId { | ||
let value = hir_const.constant_value(db.as_hir_db()).unwrap(); | ||
|
||
// let ty = db.mir_lowered_type(ty); | ||
|
||
// let constant = Constant { | ||
// name, | ||
// value: value.into(), | ||
// ty, | ||
// module_id, | ||
// }; | ||
|
||
// db.mir_intern_const(constant.into()) | ||
panic!() | ||
} | ||
|
||
impl ConstantId { | ||
// pub fn data(self, db: &dyn MirDb) -> Rc<Constant> { | ||
// db.lookup_mir_intern_const(self) | ||
// } | ||
|
||
pub fn ty(self, db: &dyn MirDb) -> TypeId { | ||
self.data(db).ty | ||
let constant = Const { | ||
value: value.into(), | ||
origin: hir_const, | ||
} | ||
} |