@@ -243,19 +243,25 @@ E_LOOKUP_ACCESS_FUNCTION_DEF(file)
243243 String8 member_name = rhs -> string ;
244244 if (str8_match (member_name , str8_lit ("size" ), 0 ))
245245 {
246- result .irtree_and_type .root = e_irtree_const_u (arena , accel -> props .size );
246+ E_Space space = e_space_make (E_SpaceKind_FileSystem );
247+ space .u64_0 = e_id_from_string (accel -> file_path );
248+ result .irtree_and_type .root = e_irtree_set_space (arena , space , e_irtree_const_u (arena , accel -> props .size ));
247249 result .irtree_and_type .type_key = e_type_key_basic (E_TypeKind_U64 );
248250 result .irtree_and_type .mode = E_Mode_Value ;
249251 }
250252 else if (str8_match (member_name , str8_lit ("last_modified_time" ), 0 ))
251253 {
252- result .irtree_and_type .root = e_irtree_const_u (arena , accel -> props .modified );
254+ E_Space space = e_space_make (E_SpaceKind_FileSystem );
255+ space .u64_0 = e_id_from_string (accel -> file_path );
256+ result .irtree_and_type .root = e_irtree_set_space (arena , space , e_irtree_const_u (arena , accel -> props .modified ));
253257 result .irtree_and_type .type_key = e_type_key_basic (E_TypeKind_U64 );
254258 result .irtree_and_type .mode = E_Mode_Value ;
255259 }
256260 else if (str8_match (member_name , str8_lit ("creation_time" ), 0 ))
257261 {
258- result .irtree_and_type .root = e_irtree_const_u (arena , accel -> props .created );
262+ E_Space space = e_space_make (E_SpaceKind_FileSystem );
263+ space .u64_0 = e_id_from_string (accel -> file_path );
264+ result .irtree_and_type .root = e_irtree_set_space (arena , space , e_irtree_const_u (arena , accel -> props .created ));
259265 result .irtree_and_type .type_key = e_type_key_basic (E_TypeKind_U64 );
260266 result .irtree_and_type .mode = E_Mode_Value ;
261267 }
@@ -2223,32 +2229,24 @@ E_IRGEN_FUNCTION_DEF(default)
22232229 //- rjf: leaf file paths
22242230 case E_ExprKind_LeafFilePath :
22252231 {
2226- FileProperties props = os_properties_from_file_path (expr -> string );
2232+ Temp scratch = scratch_begin (& arena , 1 );
2233+ String8 file_path = path_normalized_from_string (scratch .arena , expr -> string );
2234+ FileProperties props = os_properties_from_file_path (file_path );
22272235 if (props .flags & FilePropertyFlag_IsFolder )
22282236 {
22292237 E_Space space = e_space_make (E_SpaceKind_FileSystem );
2230- result .root = e_irtree_set_space (arena , space , e_irtree_const_u (arena , e_id_from_string (expr -> string )));
2238+ result .root = e_irtree_set_space (arena , space , e_irtree_const_u (arena , e_id_from_string (file_path )));
22312239 result .type_key = e_type_key_cons (.kind = E_TypeKind_Set , .name = str8_lit ("folder" ));
22322240 result .mode = E_Mode_Value ;
22332241 }
22342242 else
22352243 {
22362244 E_Space space = e_space_make (E_SpaceKind_FileSystem );
2237- result .root = e_irtree_set_space (arena , space , e_irtree_const_u (arena , e_id_from_string (expr -> string )));
2245+ result .root = e_irtree_set_space (arena , space , e_irtree_const_u (arena , e_id_from_string (file_path )));
22382246 result .type_key = e_type_key_cons (.kind = E_TypeKind_Set , .name = str8_lit ("file" ));
22392247 result .mode = E_Mode_Value ;
2240- #if 0
2241- U128 key = fs_key_from_path_range (expr -> string , r1u64 (0 , max_U64 ));
2242- E_Space space = {E_SpaceKind_HashStoreKey , .u128 = key };
2243- U64 size = props .size ;
2244- E_IRNode * base_offset = e_irtree_const_u (arena , 0 );
2245- base_offset -> space = space ;
2246- result .root = base_offset ;
2247- result .root -> string = push_str8_copy (arena , expr -> string );
2248- result .type_key = e_type_key_cons_array (e_type_key_basic (E_TypeKind_U8 ), size );
2249- result .mode = E_Mode_Offset ;
2250- #endif
22512248 }
2249+ scratch_end (scratch );
22522250 }break ;
22532251
22542252 //- rjf: types
@@ -2268,54 +2266,6 @@ E_IRGEN_FUNCTION_DEF(default)
22682266 e_msgf (arena , & result .msgs , E_MsgKind_MalformedInput , expr -> location , "Type expression not expected." );
22692267 }break ;
22702268
2271- //- rjf: textual line slicing
2272- case E_ExprKind_Line :
2273- {
2274- E_Expr * lhs = expr -> first ;
2275- E_Expr * rhs = expr -> last ;
2276- E_IRTreeAndType lhs_irtree = e_irtree_and_type_from_expr (arena , lhs );
2277- U64 line_num = rhs -> value .u64 ;
2278- B32 space_is_good = 1 ;
2279- E_Space space = {0 };
2280- if (lhs_irtree .root -> op != E_IRExtKind_SetSpace )
2281- {
2282- space_is_good = 0 ;
2283- e_msgf (arena , & result .msgs , E_MsgKind_MalformedInput , lhs -> location , "Cannot take a line from a non-file." );
2284- }
2285- else
2286- {
2287- MemoryCopy (& space , & lhs_irtree .root -> value , sizeof (space ));
2288- }
2289- B32 line_num_is_good = 1 ;
2290- if (rhs -> kind != E_ExprKind_LeafU64 )
2291- {
2292- line_num_is_good = 0 ;
2293- e_msgf (arena , & result .msgs , E_MsgKind_MalformedInput , rhs -> location , "Line number must be specified as a constant number." );
2294- }
2295- if (space_is_good && line_num_is_good )
2296- {
2297- TXT_Scope * txt_scope = txt_scope_open ();
2298- U128 key = space .u128 ;
2299- U128 hash = {0 };
2300- TXT_TextInfo text_info = txt_text_info_from_key_lang (txt_scope , key , TXT_LangKind_Null , & hash );
2301- if (1 <= line_num && line_num <= text_info .lines_count )
2302- {
2303- Rng1U64 line_range = text_info .lines_ranges [line_num - 1 ];
2304- U64 line_size = dim_1u64 (line_range );
2305- E_IRNode * line_offset = e_irtree_const_u (arena , line_range .min );
2306- result .root = line_offset ;
2307- result .root -> space = space ;
2308- result .type_key = e_type_key_cons_array (e_type_key_basic (E_TypeKind_U8 ), line_size );
2309- result .mode = E_Mode_Offset ;
2310- }
2311- else
2312- {
2313- e_msgf (arena , & result .msgs , E_MsgKind_MalformedInput , rhs -> location , "Line %I64u is out of bounds." , line_num );
2314- }
2315- txt_scope_close (txt_scope );
2316- }
2317- }break ;
2318-
23192269 //- rjf: definitions
23202270 case E_ExprKind_Define :
23212271 {
0 commit comments