32 lines
650 B
Rust
32 lines
650 B
Rust
use crate::source_range::SourceRange;
|
|
use crate::type_info::TypeInfo;
|
|
|
|
pub struct DoubleLiteral {
|
|
value: f64,
|
|
source_range: SourceRange,
|
|
type_info: &'static TypeInfo,
|
|
}
|
|
|
|
impl DoubleLiteral {
|
|
pub fn new(value: f64, source_range: SourceRange) -> Self {
|
|
const TYPE_INFO: TypeInfo = TypeInfo::Double;
|
|
Self {
|
|
value,
|
|
source_range,
|
|
type_info: &TYPE_INFO,
|
|
}
|
|
}
|
|
|
|
pub fn value(&self) -> f64 {
|
|
self.value
|
|
}
|
|
|
|
pub fn type_info(&self) -> &TypeInfo {
|
|
&self.type_info
|
|
}
|
|
|
|
pub fn source_range(&self) -> &SourceRange {
|
|
&self.source_range
|
|
}
|
|
}
|