ast and imports a bit

This commit is contained in:
damirka 2021-03-31 18:58:29 +03:00
parent 41600d0261
commit ed8ff4468c
2 changed files with 1 additions and 35 deletions

View File

@ -26,18 +26,6 @@ use std::fmt;
pub struct ArrayDimensions(pub Vec<PositiveNumber>);
impl ArrayDimensions {
///
/// Creates a new `PositiveNumber` from the given `usize` and `Span`.
/// Appends the new `PositiveNumber` to the array dimensions.
///
pub fn push_usize(&mut self, number: usize) {
let positive_number = PositiveNumber {
value: number.to_string().into(),
};
self.0.push(positive_number)
}
///
/// Appends a vector of array dimensions to the self array dimensions.
///

View File

@ -15,15 +15,12 @@
// along with the Leo library. If not, see <https://www.gnu.org/licenses/>.
use leo_asg::AsgConvertError;
use leo_ast::{FormattedError, Identifier, LeoError, Span};
use leo_parser::{DeprecatedError, SyntaxError};
use leo_parser::SyntaxError;
use std::{io, path::Path};
#[derive(Debug, Error)]
pub enum ImportParserError {
#[error("{}", _0)]
DeprecatedError(#[from] DeprecatedError),
#[error("{}", _0)]
Error(#[from] FormattedError),
@ -40,7 +37,6 @@ impl Into<AsgConvertError> for ImportParserError {
match self {
ImportParserError::Error(x) => AsgConvertError::ImportError(x),
ImportParserError::SyntaxError(x) => x.into(),
ImportParserError::DeprecatedError(x) => AsgConvertError::SyntaxError(SyntaxError::DeprecatedError(x)),
ImportParserError::AsgConvertError(x) => x,
}
}
@ -66,15 +62,6 @@ impl ImportParserError {
Self::new_from_span(message, span)
}
///
/// A core package name has been imported twice.
///
pub fn duplicate_core_package(identifier: Identifier) -> Self {
let message = format!("Duplicate core_package import `{}`.", identifier.name);
Self::new_from_span(message, &identifier.span)
}
///
/// Failed to convert a file path into an os string.
///
@ -106,15 +93,6 @@ impl ImportParserError {
Self::new_from_span(message, span)
}
///
/// Failed to import all symbols at a package path.
///
pub fn star(path: &Path, span: &Span) -> Self {
let message = format!("Cannot import `*` from path `{:?}`.", path);
Self::new_from_span(message, span)
}
///
/// Failed to find a library file for the current package.
///