@@ -7,28 +7,28 @@ use crate::analyser::diagnostics::DiagnosticKind::{
77} ;
88use crate :: analyser:: diagnostics:: { Diagnose , DiagnosticKind , Reporter } ;
99use code0_definition_reader:: parser:: Parser ;
10- use code0_definition_reader:: reader:: { MetaType , ParsableDefinition , Reader } ;
10+ use code0_definition_reader:: reader:: { Meta , MetaType , Reader } ;
1111use tucana:: shared:: data_type_identifier:: Type ;
1212use tucana:: shared:: definition_data_type_rule:: Config ;
1313use tucana:: shared:: { DataTypeIdentifier , DefinitionDataType , FlowType , RuntimeFunctionDefinition } ;
1414
1515#[ derive( Clone ) ]
1616pub struct AnalysableDataType {
17- pub original_definition : ParsableDefinition ,
17+ pub original_definition : Meta ,
1818 pub definition_data_type : DefinitionDataType ,
1919 pub id : i16 ,
2020}
2121
2222#[ derive( Clone ) ]
2323pub struct AnalysableFlowType {
24- pub original_definition : ParsableDefinition ,
24+ pub original_definition : Meta ,
2525 pub flow_type : FlowType ,
2626 pub id : i16 ,
2727}
2828
2929#[ derive( Clone ) ]
3030pub struct AnalysableFunction {
31- pub original_definition : ParsableDefinition ,
31+ pub original_definition : Meta ,
3232 pub function : RuntimeFunctionDefinition ,
3333 pub id : i16 ,
3434}
@@ -55,89 +55,83 @@ impl Analyser {
5555 let mut collected_flow_types: Vec < AnalysableFlowType > = vec ! [ ] ;
5656 let mut collected_functions: Vec < AnalysableFunction > = vec ! [ ] ;
5757
58- for features in reader. meta {
59- match features . r#type {
58+ for definition in reader. meta {
59+ match definition . r#type {
6060 MetaType :: FlowType => {
61- for p_flow_type in & features. data {
62- current_index += 1 ;
63- match serde_json:: from_str :: < FlowType > (
64- p_flow_type. definition_string . as_str ( ) ,
65- ) {
66- Ok ( flow_type) => collected_flow_types. push ( AnalysableFlowType {
67- original_definition : p_flow_type. clone ( ) ,
68- flow_type,
69- id : current_index,
70- } ) ,
71- Err ( err) => {
72- let name = Parser :: extract_identifier (
73- p_flow_type. definition_string . as_str ( ) ,
74- MetaType :: FlowType ,
75- ) ;
76- let diagnose = Diagnose :: new (
77- name,
78- p_flow_type. clone ( ) ,
79- DiagnosticKind :: DeserializationError {
80- description : err. to_string ( ) ,
81- } ,
82- ) ;
83- reporter. add_report ( diagnose) ;
84- }
61+ current_index += 1 ;
62+ match serde_json:: from_str :: < FlowType > (
63+ definition. definition_string . as_str ( ) ,
64+ ) {
65+ Ok ( flow_type) => collected_flow_types. push ( AnalysableFlowType {
66+ original_definition : definition. clone ( ) ,
67+ flow_type,
68+ id : current_index,
69+ } ) ,
70+ Err ( err) => {
71+ let name = Parser :: extract_identifier (
72+ definition. definition_string . as_str ( ) ,
73+ MetaType :: FlowType ,
74+ ) ;
75+ let diagnose = Diagnose :: new (
76+ name,
77+ definition. clone ( ) ,
78+ DiagnosticKind :: DeserializationError {
79+ description : err. to_string ( ) ,
80+ } ,
81+ ) ;
82+ reporter. add_report ( diagnose) ;
8583 }
8684 }
8785 }
8886 MetaType :: DataType => {
89- for p_data_type in & features. data {
90- current_index += 1 ;
91- match serde_json:: from_str :: < DefinitionDataType > (
92- p_data_type. definition_string . as_str ( ) ,
93- ) {
94- Ok ( data_type) => collected_data_types. push ( AnalysableDataType {
95- original_definition : p_data_type. clone ( ) ,
96- definition_data_type : data_type,
97- id : current_index,
98- } ) ,
99- Err ( err) => {
100- let name = Parser :: extract_identifier (
101- p_data_type. definition_string . as_str ( ) ,
102- MetaType :: DataType ,
103- ) ;
104- let diagnose = Diagnose :: new (
105- name,
106- p_data_type. clone ( ) ,
107- DiagnosticKind :: DeserializationError {
108- description : err. to_string ( ) ,
109- } ,
110- ) ;
111- reporter. add_report ( diagnose) ;
112- }
87+ current_index += 1 ;
88+ match serde_json:: from_str :: < DefinitionDataType > (
89+ definition. definition_string . as_str ( ) ,
90+ ) {
91+ Ok ( data_type) => collected_data_types. push ( AnalysableDataType {
92+ original_definition : definition. clone ( ) ,
93+ definition_data_type : data_type,
94+ id : current_index,
95+ } ) ,
96+ Err ( err) => {
97+ let name = Parser :: extract_identifier (
98+ definition. definition_string . as_str ( ) ,
99+ MetaType :: DataType ,
100+ ) ;
101+ let diagnose = Diagnose :: new (
102+ name,
103+ definition. clone ( ) ,
104+ DiagnosticKind :: DeserializationError {
105+ description : err. to_string ( ) ,
106+ } ,
107+ ) ;
108+ reporter. add_report ( diagnose) ;
113109 }
114110 }
115111 }
116112 MetaType :: RuntimeFunction => {
117- for p_function in & features. data {
118- current_index += 1 ;
119- match serde_json:: from_str :: < RuntimeFunctionDefinition > (
120- p_function. definition_string . as_str ( ) ,
121- ) {
122- Ok ( function) => collected_functions. push ( AnalysableFunction {
123- original_definition : p_function. clone ( ) ,
124- function,
125- id : current_index,
126- } ) ,
127- Err ( err) => {
128- let name = Parser :: extract_identifier (
129- p_function. definition_string . as_str ( ) ,
130- MetaType :: RuntimeFunction ,
131- ) ;
132- let diagnose = Diagnose :: new (
133- name,
134- p_function. clone ( ) ,
135- DiagnosticKind :: DeserializationError {
136- description : err. to_string ( ) ,
137- } ,
138- ) ;
139- reporter. add_report ( diagnose) ;
140- }
113+ current_index += 1 ;
114+ match serde_json:: from_str :: < RuntimeFunctionDefinition > (
115+ definition. definition_string . as_str ( ) ,
116+ ) {
117+ Ok ( function) => collected_functions. push ( AnalysableFunction {
118+ original_definition : definition. clone ( ) ,
119+ function,
120+ id : current_index,
121+ } ) ,
122+ Err ( err) => {
123+ let name = Parser :: extract_identifier (
124+ definition. definition_string . as_str ( ) ,
125+ MetaType :: RuntimeFunction ,
126+ ) ;
127+ let diagnose = Diagnose :: new (
128+ name,
129+ definition. clone ( ) ,
130+ DiagnosticKind :: DeserializationError {
131+ description : err. to_string ( ) ,
132+ } ,
133+ ) ;
134+ reporter. add_report ( diagnose) ;
141135 }
142136 }
143137 }
@@ -674,7 +668,7 @@ impl Analyser {
674668 fn handle_function_data_type_identifier (
675669 & mut self ,
676670 name : String ,
677- original : ParsableDefinition ,
671+ original : Meta ,
678672 identifier : DataTypeIdentifier ,
679673 ) -> Vec < String > {
680674 let mut result: Vec < String > = vec ! [ ] ;
0 commit comments