Partially implement async generators

This commit is contained in:
coolreader18 2020-01-05 00:17:45 -06:00 committed by Noah
parent e9ff68c850
commit d5b9e6b93a
2 changed files with 60 additions and 3 deletions

View file

@ -54,6 +54,9 @@ pub enum CompileErrorType {
InvalidContinue,
InvalidReturn,
InvalidYield,
InvalidYieldFrom,
InvalidAwait,
AsyncYieldFrom,
}
impl CompileError {
@ -96,6 +99,9 @@ impl fmt::Display for CompileError {
CompileErrorType::InvalidContinue => "'continue' outside loop".to_owned(),
CompileErrorType::InvalidReturn => "'return' outside function".to_owned(),
CompileErrorType::InvalidYield => "'yield' outside function".to_owned(),
CompileErrorType::InvalidYieldFrom => "'yield from' outside function".to_owned(),
CompileErrorType::InvalidAwait => "'await' outside async function".to_owned(),
CompileErrorType::AsyncYieldFrom => "'yield from' inside async function".to_owned(),
};
if let Some(statement) = &self.statement {