File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change @@ -53,11 +53,9 @@ impl Parse<Program> for ProgramParser {
5353 let saved_file_id = ctx. current_file_id ;
5454 ctx. current_filepath = filepath. clone ( ) ;
5555 ctx. imported_filepaths . insert ( filepath. clone ( ) ) ;
56- let file_id = ctx. get_next_file_id ( ) ;
57- ctx. current_file_id = file_id;
58- filepaths. insert ( file_id, filepath. clone ( ) ) ;
59- ctx. current_source_code = ProgramSource :: Filepath ( filepath) . get_content ( & ctx. flags ) . unwrap ( ) ;
60- source_code. insert ( file_id, ctx. current_source_code . clone ( ) ) ;
56+ ctx. current_source_code = ProgramSource :: Filepath ( filepath. clone ( ) )
57+ . get_content ( & ctx. flags )
58+ . unwrap ( ) ;
6159 let subprogram = parse_program_helper ( ctx) ?;
6260 functions. extend ( subprogram. functions ) ;
6361 function_locations. extend ( subprogram. function_locations ) ;
Original file line number Diff line number Diff line change @@ -1322,3 +1322,13 @@ fn test_const_array_element_exponentiation() {
13221322 false ,
13231323 ) ;
13241324}
1325+
1326+ #[ test]
1327+ fn test_num_files ( ) {
1328+ let expected_num_files = 3 ; // program_6.snark imports foo.snark and bar.snark
1329+ let manifest_dir = env ! ( "CARGO_MANIFEST_DIR" ) ;
1330+ let path = format ! ( "{manifest_dir}/tests/program_6.snark" ) ;
1331+ let bytecode = compile_program ( & ProgramSource :: Filepath ( path) ) ;
1332+ assert_eq ! ( bytecode. filepaths. len( ) , expected_num_files) ;
1333+ assert_eq ! ( bytecode. source_code. len( ) , expected_num_files) ;
1334+ }
You can’t perform that action at this time.
0 commit comments