-
Notifications
You must be signed in to change notification settings - Fork 0
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
Robert-M-Lucas
committed
Jul 28, 2024
1 parent
111296d
commit b0f9ba0
Showing
12 changed files
with
152 additions
and
89 deletions.
There are no files selected for viewing
4 changes: 4 additions & 0 deletions
4
.idea/shelf/Uncommitted_changes_before_Update_at_27_07_2024__23_06__Changes_.xml
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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
Binary file not shown.
Binary file not shown.
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,2 +1,3 @@ | ||
pub mod utils; | ||
pub mod heap; | ||
pub mod heap; | ||
pub mod null; |
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 |
---|---|---|
@@ -0,0 +1,41 @@ | ||
use crate::root::builtin::{BuiltinInlineFunction, InlineFunctionGenerator}; | ||
use crate::root::name_resolver::resolve_function_signatures::FunctionSignature; | ||
use crate::root::parser::parse_parameters::SelfType; | ||
use crate::root::shared::common::{FunctionID, LocalAddress, TypeID}; | ||
|
||
pub struct NullFunction { | ||
id: FunctionID, | ||
parent_type: TypeID | ||
} | ||
|
||
impl BuiltinInlineFunction for NullFunction { | ||
fn id(&self) -> FunctionID { | ||
self.id | ||
} | ||
|
||
fn name(&self) -> &'static str { | ||
"null" | ||
} | ||
|
||
fn signature(&self) -> FunctionSignature { | ||
FunctionSignature::new(SelfType::None, vec![], Some(self.parent_type.with_indirection(1))) | ||
} | ||
|
||
fn inline(&self) -> InlineFunctionGenerator { | ||
|_, return_into: Option<LocalAddress>, _, _| -> String { | ||
let return_into = return_into.unwrap(); | ||
format!(" mov qword {return_into}, 0\n") | ||
} | ||
} | ||
|
||
fn parent_type(&self) -> Option<TypeID> { | ||
Some(self.parent_type) | ||
} | ||
} | ||
|
||
pub fn null_function(t: TypeID, f: FunctionID) -> NullFunction { | ||
NullFunction { | ||
id: f, | ||
parent_type: t, | ||
} | ||
} |
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