@@ -170,43 +170,45 @@ impl Field {
170
170
}
171
171
}
172
172
173
- // Look for a parent with the field name (that is also a field)
174
- let mut gp = None ;
175
- if let Some ( parent) = & node. parent {
176
- if let Some ( parent) = parent. node ( & graph) {
177
- if ( parent. name . as_ref ( ) == field_name || field_name == SUPER_KEYWORD . as_ref ( ) ) && parent. is_field ( ) {
178
- if let Some ( grand) = & parent. parent {
179
- if grand. node_exists ( & graph) {
180
- gp = Some ( ( grand. clone ( ) , parent. name . clone ( ) ) ) ;
173
+ if created. is_none ( ) {
174
+ // Look for a parent with the field name (that is also a field)
175
+ let mut gp = None ;
176
+ if let Some ( parent) = & node. parent {
177
+ if let Some ( parent) = parent. node ( & graph) {
178
+ if ( parent. name . as_ref ( ) == field_name || field_name == SUPER_KEYWORD . as_ref ( ) ) && parent. is_field ( ) {
179
+ if let Some ( grand) = & parent. parent {
180
+ if grand. node_exists ( & graph) {
181
+ gp = Some ( ( grand. clone ( ) , parent. name . clone ( ) ) ) ;
182
+ }
181
183
}
182
184
}
183
185
}
184
186
}
185
- }
186
- if let Some ( ( gp, field_name) ) = gp {
187
- return Self :: field ( graph, & gp, field_name. as_ref ( ) ) ;
188
- }
187
+ if let Some ( ( gp, field_name) ) = gp {
188
+ return Self :: field ( graph, & gp, field_name. as_ref ( ) ) ;
189
+ }
189
190
190
- // Is this node the thing?
191
- if ( node. name . as_ref ( ) == field_name || field_name == SELF_KEYWORD . as_ref ( ) ) && node. is_field ( ) {
192
- if let Some ( parent) = & node. parent {
193
- if parent. node_exists ( graph) {
194
- self_parent = Some ( parent. clone ( ) ) ;
195
- self_name = Some ( node. name . clone ( ) ) ;
191
+ // Is this node the thing?
192
+ if ( node. name . as_ref ( ) == field_name || field_name == SELF_KEYWORD . as_ref ( ) ) && node. is_field ( ) {
193
+ if let Some ( parent) = & node. parent {
194
+ if parent. node_exists ( graph) {
195
+ self_parent = Some ( parent. clone ( ) ) ;
196
+ self_name = Some ( node. name . clone ( ) ) ;
197
+ }
196
198
}
197
199
}
198
200
}
199
201
}
200
- if let Some ( parent) = self_parent {
201
- if let Some ( name) = self_name {
202
- return Self :: field ( graph, & parent, name. as_ref ( ) ) ;
203
- }
204
- }
205
202
if let Some ( field) = created {
206
203
if let Some ( dref) = graph. insert_stof_data ( node, field_name, Box :: new ( field) , None ) {
207
204
return Some ( dref) ;
208
205
}
209
206
}
207
+ if let Some ( parent) = self_parent {
208
+ if let Some ( name) = self_name {
209
+ return Self :: field ( graph, & parent, name. as_ref ( ) ) ;
210
+ }
211
+ }
210
212
None
211
213
}
212
214
0 commit comments