Mercurial > python-compiler.rs
comparison src/ast_convert.rs @ 49:141f1769e1f0
Add ast.Pass.
author | Bastien Orivel <eijebong@bananium.fr> |
---|---|
date | Wed, 08 Jun 2016 17:18:28 +0200 |
parents | 039f85b187f2 |
children | 5edbc24b625f |
comparison
equal
deleted
inserted
replaced
48:039f85b187f2 | 49:141f1769e1f0 |
---|---|
439 let while_type = ast_module.get(py, "While").unwrap(); | 439 let while_type = ast_module.get(py, "While").unwrap(); |
440 let for_type = ast_module.get(py, "For").unwrap(); | 440 let for_type = ast_module.get(py, "For").unwrap(); |
441 let expr_type = ast_module.get(py, "Expr").unwrap(); | 441 let expr_type = ast_module.get(py, "Expr").unwrap(); |
442 let break_type = ast_module.get(py, "Break").unwrap(); | 442 let break_type = ast_module.get(py, "Break").unwrap(); |
443 let delete_type = ast_module.get(py, "Delete").unwrap(); | 443 let delete_type = ast_module.get(py, "Delete").unwrap(); |
444 let pass_type = ast_module.get(py, "Pass").unwrap(); | |
444 | 445 |
445 assert!(is_instance(&ast, &ast_type)); | 446 assert!(is_instance(&ast, &ast_type)); |
446 | 447 |
447 /* | 448 /* |
448 // TODO: implement Hash for PyObject. (trivial) | 449 // TODO: implement Hash for PyObject. (trivial) |
572 stmt::Break | 573 stmt::Break |
573 } else if is_instance(&ast, &delete_type) { | 574 } else if is_instance(&ast, &delete_type) { |
574 let targets = ast.getattr(py, "targets").unwrap(); | 575 let targets = ast.getattr(py, "targets").unwrap(); |
575 let targets = parse_list(py, targets, parse_expr); | 576 let targets = parse_list(py, targets, parse_expr); |
576 stmt::Delete(targets) | 577 stmt::Delete(targets) |
578 } else if is_instance(&ast, &pass_type) { | |
579 stmt::Pass | |
577 } else { | 580 } else { |
578 println!("stmt {}", ast); | 581 println!("stmt {}", ast); |
579 panic!() | 582 panic!() |
580 } | 583 } |
581 } | 584 } |