Implemented some more native methods
This commit is contained in:
parent
272a34b7cd
commit
aba29af0a3
5 changed files with 198 additions and 6 deletions
|
@ -854,6 +854,24 @@ impl Into<String> for &AbstractTypeDescription {
|
|||
|
||||
impl AbstractTypeDescription {
|
||||
|
||||
pub fn storage_size(&self) -> u8 {
|
||||
match self.array_level {
|
||||
0 => match self.kind {
|
||||
AbstractTypeKind::Void() => 0,
|
||||
AbstractTypeKind::Byte() => 1,
|
||||
AbstractTypeKind::Char() => 2,
|
||||
AbstractTypeKind::Double() => 8,
|
||||
AbstractTypeKind::Float() => 4,
|
||||
AbstractTypeKind::Int() => 4,
|
||||
AbstractTypeKind::Long() => 8,
|
||||
AbstractTypeKind::Short() => 2,
|
||||
AbstractTypeKind::Boolean() => 1,
|
||||
AbstractTypeKind::Classname(_) => 8
|
||||
}
|
||||
_ => 8
|
||||
}
|
||||
}
|
||||
|
||||
pub fn super_component(&self) -> Self {
|
||||
AbstractTypeDescription {
|
||||
array_level: 0,
|
||||
|
@ -927,6 +945,14 @@ impl AbstractTypeDescription {
|
|||
kind: AbstractTypeKind::Classname(name.to_string()),
|
||||
}
|
||||
}
|
||||
|
||||
pub fn extract_class_name(&self) -> &String {
|
||||
match self.kind {
|
||||
AbstractTypeKind::Classname(ref name) => name,
|
||||
_ => unreachable!()
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
#[derive(Debug, Eq, PartialEq)]
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue