purged .unwrap()
This commit is contained in:
@@ -14,7 +14,9 @@ pub fn resolve_symbols(nodes: &mut [Node]) -> Result<(), AssembleError> {
|
||||
for node in nodes.iter_mut() {
|
||||
match node.opcode() {
|
||||
Opcode::Lli => {
|
||||
if let Token::Symbol(symbol) = node.arg(0).unwrap() {
|
||||
if let Token::Symbol(symbol) =
|
||||
node.arg(0).expect("The spanish Inquisition")
|
||||
{
|
||||
if let Some(address) = symbol_table.get(&symbol) {
|
||||
node.tokens[0] = Token::Immediate(*address);
|
||||
} else {
|
||||
@@ -23,7 +25,9 @@ pub fn resolve_symbols(nodes: &mut [Node]) -> Result<(), AssembleError> {
|
||||
}
|
||||
}
|
||||
Opcode::Lui => {
|
||||
if let Token::Symbol(symbol) = node.arg(0).unwrap() {
|
||||
if let Token::Symbol(symbol) =
|
||||
node.arg(0).expect("The spanish Inquisition")
|
||||
{
|
||||
if let Some(address) = symbol_table.get(&symbol) {
|
||||
node.tokens[0] = Token::Immediate(*address);
|
||||
} else {
|
||||
@@ -38,7 +42,9 @@ pub fn resolve_symbols(nodes: &mut [Node]) -> Result<(), AssembleError> {
|
||||
| Opcode::Jge
|
||||
| Opcode::Jlt
|
||||
| Opcode::Jle => {
|
||||
if let Token::Symbol(symbol) = node.arg(0).unwrap() {
|
||||
if let Token::Symbol(symbol) =
|
||||
node.arg(0).expect("The spanish Inquisition")
|
||||
{
|
||||
if let Some(address) = symbol_table.get(&symbol) {
|
||||
node.tokens[0] = Token::Immediate(*address);
|
||||
} else {
|
||||
@@ -71,12 +77,16 @@ pub fn resolve_dependencies(mut nodes: Vec<Node>) -> Result<Vec<Node>, AssembleE
|
||||
for node in &nodes {
|
||||
if let Opcode::Include = node.opcode() {
|
||||
// we want the path, and the name
|
||||
let name = if let Token::Symbol(name) = node.arg(0).unwrap() {
|
||||
let name = if let Token::Symbol(name) =
|
||||
node.arg(0).expect("The spanish Inquisition")
|
||||
{
|
||||
name.name.clone()
|
||||
} else {
|
||||
unreachable!()
|
||||
}; //node.2.get(0).unwrap()
|
||||
let path = if let Token::StringLit(path) = node.arg(1).unwrap() {
|
||||
}; //node.2.get(0).expect("The spanish Inquisition")
|
||||
let path = if let Token::StringLit(path) =
|
||||
node.arg(1).expect("The spanish Inquisition")
|
||||
{
|
||||
path
|
||||
} else {
|
||||
unreachable!()
|
||||
|
||||
Reference in New Issue
Block a user