@@ -6,11 +6,8 @@ use std::{
66use indexmap:: IndexMap ;
77use ltk_hash:: fnv1a;
88use ltk_meta:: {
9- value:: {
10- ContainerValue , EmbeddedValue , HashValue , MapValue , OptionalValue , StringValue ,
11- UnorderedContainerValue , Vector2Value , Vector3Value ,
12- } ,
13- BinPropertyKind , PropertyValueEnum ,
9+ property:: { values, NoMeta } ,
10+ PropertyKind , PropertyValueEnum ,
1411} ;
1512
1613use crate :: {
@@ -494,8 +491,7 @@ pub fn resolve_value(
494491 tree : & Cst ,
495492 kind_hint : Option < BinPropertyKind > ,
496493) -> Result < Option < Spanned < PropertyValueEnum > > , Diagnostic > {
497- use ltk_meta:: value:: * ;
498- use BinPropertyKind as K ;
494+ use PropertyKind as K ;
499495 use PropertyValueEnum as P ;
500496
501497 // dbg!(tree, kind_hint);
@@ -540,12 +536,14 @@ pub fn resolve_value(
540536 }
541537 } ;
542538 match kind_hint {
543- K :: Struct => P :: Struct ( StructValue {
539+ K :: Struct => P :: Struct ( values :: Struct {
544540 class_hash,
541+ meta : NoMeta ,
545542 properties : Default :: default ( ) ,
546543 } ) ,
547- K :: Embedded => P :: Embedded ( EmbeddedValue ( StructValue {
544+ K :: Embedded => P :: Embedded ( values :: Embedded ( values :: Struct {
548545 class_hash,
546+ meta : NoMeta ,
549547 properties : Default :: default ( ) ,
550548 } ) ) ,
551549 other => {
@@ -698,7 +696,8 @@ pub fn resolve_entry(
698696 } ;
699697
700698 Ok ( IrEntry {
701- key : PropertyValueEnum :: String ( StringValue ( ctx. text [ key. span ] . into ( ) ) ) . with_span ( key. span ) ,
699+ key : PropertyValueEnum :: String ( values:: String ( ctx. text [ key. span ] . into ( ) ) )
700+ . with_span ( key. span ) ,
702701 value,
703702 } )
704703}
@@ -711,26 +710,28 @@ impl TypeChecker<'_> {
711710 fn merge_ir ( & mut self , mut parent : IrItem , child : IrItem ) -> IrItem {
712711 match & mut parent. value_mut ( ) . inner {
713712 PropertyValueEnum :: Container ( list)
714- | PropertyValueEnum :: UnorderedContainer ( UnorderedContainerValue ( list) ) => {
713+ | PropertyValueEnum :: UnorderedContainer ( values :: UnorderedContainer ( list) ) => {
715714 match child {
716715 IrItem :: ListItem ( IrListItem ( value) ) => {
717- let value = match list. item_kind == value. kind ( ) {
718- true => value. inner , // FIXME: span info inside all containers??
719- false => {
716+ let span = value. span ; // FIXME: span info inside all containers
717+
718+ match list. push ( value. inner ) {
719+ Ok ( _) => { }
720+ Err ( ltk_meta:: Error :: MismatchedContainerTypes { expected, got } ) => {
720721 self . ctx . diagnostics . push (
721722 TypeMismatch {
722- span : value . span ,
723- expected : RitoType :: simple ( list. item_kind ) ,
723+ span,
724+ expected : RitoType :: simple ( list. item_kind ( ) ) ,
724725 expected_span : None , // TODO: would be nice here
725726 got : RitoType :: simple ( value. kind ( ) ) . into ( ) ,
726727 }
727728 . unwrap ( ) ,
728729 ) ;
729- list. item_kind . default_value ( )
730730 }
731- } ;
732-
733- list. items . push ( value) ;
731+ Err ( e) => {
732+ todo ! ( "handle unexpected error" ) ;
733+ }
734+ }
734735 }
735736 IrItem :: Entry ( IrEntry { key, value } ) => {
736737 eprintln ! ( "list item must be list item" ) ;
@@ -739,15 +740,15 @@ impl TypeChecker<'_> {
739740 }
740741 }
741742 PropertyValueEnum :: Struct ( struct_val)
742- | PropertyValueEnum :: Embedded ( EmbeddedValue ( struct_val) ) => {
743+ | PropertyValueEnum :: Embedded ( values :: Embedded ( struct_val) ) => {
743744 let IrItem :: Entry ( IrEntry { key, value } ) = child else {
744745 eprintln ! ( "struct item must be entry" ) ;
745746 return parent;
746747 } ;
747748
748749 let key = match key. inner {
749- PropertyValueEnum :: String ( StringValue ( str) ) => fnv1a:: hash_lower ( & str) ,
750- PropertyValueEnum :: Hash ( HashValue ( hash) ) => hash,
750+ PropertyValueEnum :: String ( values :: String ( str) ) => fnv1a:: hash_lower ( & str) ,
751+ PropertyValueEnum :: Hash ( values :: Hash ( hash) ) => hash,
751752 other => {
752753 eprintln ! ( "{other:?} not valid hash" ) ;
753754 return parent;
@@ -768,19 +769,19 @@ impl TypeChecker<'_> {
768769 eprintln ! ( "map item must be entry" ) ;
769770 return parent;
770771 } ;
771- let value = match map_value. value_kind == value. kind ( ) {
772+ let value = match map_value. value_kind ( ) == value. kind ( ) {
772773 true => value. inner , // FIXME: span info inside all containers??
773774 false => {
774775 self . ctx . diagnostics . push (
775776 TypeMismatch {
776777 span : value. span ,
777- expected : RitoType :: simple ( map_value. value_kind ) ,
778+ expected : RitoType :: simple ( map_value. value_kind ( ) ) ,
778779 expected_span : None , // TODO: would be nice here
779780 got : RitoType :: simple ( value. kind ( ) ) . into ( ) ,
780781 }
781782 . unwrap ( ) ,
782783 ) ;
783- map_value. value_kind . default_value ( )
784+ map_value. value_kind ( ) . default_value ( )
784785 }
785786 } ;
786787 map_value
0 commit comments