Start using 'symbol' in favor of 'name' or 'label'
Signed-off-by: Alek Ratzloff <alekratz@gmail.com>
This commit is contained in:
@@ -9,11 +9,13 @@ pub enum AssembleError {
|
|||||||
#[snafu(display("IO error: {}", source))]
|
#[snafu(display("IO error: {}", source))]
|
||||||
Io { source: io::Error },
|
Io { source: io::Error },
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
#[snafu(display("duplicate symbol name: {}", name))]
|
#[snafu(display("duplicate symbol name: {}", name))]
|
||||||
DuplicateName { name: String },
|
DuplicateSymbol { name: String },
|
||||||
|
|
||||||
#[snafu(display("duplicate exported symbol name: {}", name))]
|
#[snafu(display("duplicate exported symbol name: {}", name))]
|
||||||
DuplicateExportName { name: String },
|
DuplicateExportSymbol { name: String },
|
||||||
}
|
}
|
||||||
|
|
||||||
pub type Result<T, E = AssembleError> = std::result::Result<T, E>;
|
pub type Result<T, E = AssembleError> = std::result::Result<T, E>;
|
||||||
|
|||||||
@@ -49,7 +49,7 @@ impl<'a> Assemble<'a> {
|
|||||||
let export_keys = exports.keys().collect::<HashSet<&String>>();
|
let export_keys = exports.keys().collect::<HashSet<&String>>();
|
||||||
let global_keys = self.symbols.globals().keys().collect::<HashSet<&String>>();
|
let global_keys = self.symbols.globals().keys().collect::<HashSet<&String>>();
|
||||||
if let Some(key) = export_keys.intersection(&global_keys).next() {
|
if let Some(key) = export_keys.intersection(&global_keys).next() {
|
||||||
return Err(AssembleError::DuplicateExportName {
|
return Err(AssembleError::DuplicateExportSymbol {
|
||||||
name: key.to_string(),
|
name: key.to_string(),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -134,7 +134,7 @@ impl<'a> Assemble<'a> {
|
|||||||
}
|
}
|
||||||
Line::LabelDef(label) => {
|
Line::LabelDef(label) => {
|
||||||
if labels.contains_key(label) {
|
if labels.contains_key(label) {
|
||||||
return Err(AssembleError::DuplicateName {
|
return Err(AssembleError::DuplicateSymbol {
|
||||||
name: label.to_string(),
|
name: label.to_string(),
|
||||||
});
|
});
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
Reference in New Issue
Block a user