Integrate ParseError to compiler-core::Error

This commit is contained in:
Jeong YunWon 2022-08-22 09:07:15 +09:00
parent 9d6ab72d79
commit 9d67b944cf
6 changed files with 69 additions and 32 deletions

View file

@ -2,6 +2,7 @@ use rustpython_codegen::{compile, symboltable};
use rustpython_compiler_core::CodeObject;
use rustpython_parser::{
ast::{fold::Fold, ConstantOptimizer, Location},
error::ParseErrorType,
parser,
};
use std::fmt;
@ -48,6 +49,7 @@ impl CompileError {
}
}
fn from_parse(error: rustpython_parser::error::ParseError, source: &str) -> Self {
let error: rustpython_compiler_core::Error<ParseErrorType> = error.into();
Self {
error: error.error.into(),
location: error.location,