@@ -12,7 +12,7 @@ use plc_ast::{
1212 ast:: {
1313 self , flatten_expression_list, Allocation , Assignment , AstFactory , AstId , AstNode , AstStatement ,
1414 BinaryExpression , CompilationUnit , DataType , DataTypeDeclaration , DirectAccessType , Identifier ,
15- Interface , JumpStatement , Operator , Pou , ReferenceAccess , ReferenceExpr , TypeNature ,
15+ Interface , JumpStatement , Operator , Pou , PouType , ReferenceAccess , ReferenceExpr , TypeNature ,
1616 UserTypeDeclaration , Variable ,
1717 } ,
1818 control_statements:: { AstControlStatement , ReturnStatement } ,
@@ -1579,15 +1579,22 @@ impl<'i> TypeAnnotator<'i> {
15791579 } ;
15801580 if resolved_names. insert ( Dependency :: Datatype ( datatype. get_name ( ) . to_string ( ) ) ) {
15811581 match datatype. get_type_information ( ) {
1582- DataTypeInformation :: Struct { members, .. } => {
1582+ DataTypeInformation :: Struct { members, source , .. } => {
15831583 for member in members {
15841584 resolved_names =
15851585 self . get_datatype_dependencies ( member. get_type_name ( ) , resolved_names) ;
15861586 }
1587+
1588+ if let StructSource :: Pou ( PouType :: Method { parent, .. } ) = source {
1589+ resolved_names = self . get_datatype_dependencies ( parent, resolved_names) ;
1590+ }
1591+
15871592 resolved_names
15881593 }
15891594 DataTypeInformation :: Array { inner_type_name, .. }
15901595 | DataTypeInformation :: Pointer { inner_type_name, .. } => {
1596+ resolved_names
1597+ . insert ( Dependency :: Datatype ( datatype. get_type_information ( ) . get_name ( ) . to_string ( ) ) ) ;
15911598 self . get_datatype_dependencies ( inner_type_name, resolved_names)
15921599 }
15931600 _ => {
0 commit comments