* {@inheritDoc}
*/
@Override
public RecordValueNode getNodeInstance(Object value, DataConstructor dataConstructor, TypeExpr typeExpr) {
RecordType recordType = typeExpr.rootRecordType();
if (recordType == null) {
// This expression is not a record type, so this provides does not handle it
return null;
}
List<FieldName> fieldNames = recordType.getHasFieldNames();
// value is either a List of ValueNode or null
List<ValueNode> listValue = UnsafeCast.asTypeOf(value, Collections.<ValueNode>emptyList());
if (listValue == null) {
// Create default value nodes for the fields
int arity = fieldNames.size();
listValue = new ArrayList<ValueNode>(arity);
for (int i = 0 ; i < arity; i++) {
TypeExpr argType = recordType.getHasFieldType(fieldNames.get(i));
ValueNode valueNode = getValueNodeBuilderHelper().getValueNodeForTypeExpr(argType);
if (valueNode == null) {
// Cannot create a node represented, thus cannot create this node
return null;
}