Skip to content

Commit

Permalink
remove dbg
Browse files Browse the repository at this point in the history
  • Loading branch information
xunilrj committed Aug 11, 2023
1 parent f474f9d commit c654bea
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 29 deletions.
1 change: 0 additions & 1 deletion sway-core/src/ir_generation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@ pub fn compile_program<'eng>(
include_tests: bool,
engines: &'eng Engines,
) -> Result<Context<'eng>, Vec<CompileError>> {
dbg!(1);
let declaration_engine = engines.de();

let test_fns = match include_tests {
Expand Down
3 changes: 0 additions & 3 deletions sway-core/src/ir_generation/compile.rs
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,6 @@ pub(super) fn compile_function(
is_entry: bool,
test_decl_ref: Option<DeclRefFunction>,
) -> Result<Option<Function>, Vec<CompileError>> {
dbg!(1);
// Currently monomorphization of generics is inlined into main() and the functions with generic
// args are still present in the AST declarations, but they can be ignored.
if !ast_fn_decl.type_parameters.is_empty() {
Expand Down Expand Up @@ -350,7 +349,6 @@ pub(super) fn compile_entry_function(
messages_types_map: &HashMap<TypeId, MessageId>,
test_decl_ref: Option<DeclRefFunction>,
) -> Result<Function, Vec<CompileError>> {
dbg!(1);
let is_entry = true;
compile_function(
engines,
Expand Down Expand Up @@ -406,7 +404,6 @@ fn compile_fn(
messages_types_map: &HashMap<TypeId, MessageId>,
test_decl_ref: Option<DeclRefFunction>,
) -> Result<Function, Vec<CompileError>> {
dbg!(1);
let type_engine = engines.te();
let decl_engine = engines.de();

Expand Down
1 change: 0 additions & 1 deletion sway-core/src/ir_generation/function.rs
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,6 @@ impl<'eng> FnCompiler<'eng> {
md_mgr: &mut MetadataManager,
ast_block: &ty::TyCodeBlock,
) -> Result<Value, Vec<CompileError>> {
dbg!(1);
self.compile_with_new_scope(|fn_compiler| {
let mut errors = vec![];

Expand Down
5 changes: 0 additions & 5 deletions sway-core/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,9 +171,7 @@ fn parse_in_memory(
engines: &Engines,
src: Arc<str>,
) -> Result<(lexed::LexedProgram, parsed::ParseProgram), ErrorEmitted> {
dbg!(1);
let module = sway_parse::parse_file(handler, src, None)?;
dbg!(1);

let (kind, tree) = to_parsed_lang::convert_parse_tree(
&mut to_parsed_lang::Context::default(),
Expand Down Expand Up @@ -529,7 +527,6 @@ pub fn compile_to_asm(
package_name: &str,
metrics: &mut PerformanceData,
) -> Result<CompiledAsm, ErrorEmitted> {
dbg!(1);
let ast_res = compile_to_ast(
handler,
engines,
Expand All @@ -550,7 +547,6 @@ pub fn ast_to_asm(
programs: &Programs,
build_config: &BuildConfig,
) -> Result<CompiledAsm, ErrorEmitted> {
dbg!(1);
let typed_program = match &programs.typed {
Ok(typed_program) => typed_program,
Err(err) => return Err(*err),
Expand All @@ -572,7 +568,6 @@ pub(crate) fn compile_ast_to_ir_to_asm(
program: &ty::TyProgram,
build_config: &BuildConfig,
) -> Result<FinalizedAsm, ErrorEmitted> {
dbg!(1);
// the IR pipeline relies on type information being fully resolved.
// If type information is found to still be generic or unresolved inside of
// IR, this is considered an internal compiler error. To resolve this situation,
Expand Down
18 changes: 0 additions & 18 deletions sway-parse/src/expr/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -178,29 +178,11 @@ fn parse_stmt<'a>(parser: &mut Parser<'a, '_>) -> ParseResult<StmtOrTail<'a>> {
}

// Try a `let` statement.
// |p| {
// p.peek::<LetToken>().is_some() || p.take::<SemicolonToken>().is_some()
// }
println!(
"{:?}",
parser
.debug_tokens()
.iter()
.map(|x| x.span().as_str().to_string())
.collect::<Vec<_>>()
);
match parser.guarded_parse_with_recovery::<LetToken, StatementLet>() {
Ok(None) => {}
Ok(Some(slet)) => return stmt(Statement::Let(slet)),
Err(recovery) => {
let p = recovery.start();
println!(
" {:?}",
p.debug_tokens()
.iter()
.map(|x| x.span().as_str().to_string())
.collect::<Vec<_>>()
);
let (spans, error) = recovery.finish(p);
return stmt(Statement::Error(spans, error));
}
Expand Down
3 changes: 2 additions & 1 deletion test/src/ir_generation/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -251,8 +251,9 @@ pub(super) async fn run(filter_regex: Option<&regex::Regex>, verbose: bool) -> R
// Compile to IR.
let include_tests = true;
let mut ir = compile_program(typed_program, include_tests, &engines)
.unwrap_or_else(|e| {
.unwrap_or_else(|mut e| {
use sway_types::span::Spanned;
let e = e.pop().unwrap();
let span = e.span();
panic!(
"Failed to compile test {}:\nError \"{e}\" at {}:{}\nCode: \"{}\"",
Expand Down

0 comments on commit c654bea

Please sign in to comment.