Skip to content

Commit

Permalink
[records][primitives] Add support for immutable argument to `make-rec…
Browse files Browse the repository at this point in the history
…ord` builtin [#68]
  • Loading branch information
cipriancraciun committed Jun 14, 2018
1 parent b842846 commit 2f32d71
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
2 changes: 1 addition & 1 deletion sources/languages_builtins.rs
Original file line number Diff line number Diff line change
Expand Up @@ -366,7 +366,7 @@ pub fn generate_definitions () -> (Outcome<StdVec<(Symbol, Value)>>) {
#[ cfg ( feature = "vonuvoli_builtins_records" ) ]
("make-record", RecordPrimitiveV::RecordBuild.into ()),
#[ cfg ( feature = "vonuvoli_builtins_records" ) ]
("make-record*", RecordPrimitive2::RecordBuildC.into ()),
("make-record*", RecordPrimitiveV::RecordBuildC.into ()),
#[ cfg ( feature = "vonuvoli_builtins_records" ) ]
("record-ref", RecordPrimitiveV::RecordGet.into ()),
#[ cfg ( feature = "vonuvoli_builtins_records" ) ]
Expand Down
19 changes: 19 additions & 0 deletions sources/primitives_records.rs
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,7 @@ pub enum RecordPrimitive3 {
RecordSet,

RecordBuild,
RecordBuildC,

}

Expand Down Expand Up @@ -201,6 +202,7 @@ pub enum RecordPrimitiveV {
RecordGet,

RecordBuild,
RecordBuildC,

#[ cfg ( feature = "vonuvoli_values_array" ) ]
RecordToArray,
Expand Down Expand Up @@ -386,6 +388,9 @@ pub fn record_primitive_3_evaluate (primitive : RecordPrimitive3, input_1 : &Val
RecordPrimitive3::RecordBuild =>
return record_build_2 (try_as_record_kind_ref! (input_1), None, input_2, input_3, None),

RecordPrimitive3::RecordBuildC =>
return record_build (try_as_record_kind_ref! (input_1), None, input_2, Some (try_as_boolean_ref! (input_3) .value ())),

}
}

Expand Down Expand Up @@ -462,6 +467,8 @@ pub fn record_primitive_v_alternative_0 (primitive : RecordPrimitiveV) -> (Optio
None,
RecordPrimitiveV::RecordBuild =>
None,
RecordPrimitiveV::RecordBuildC =>
None,
#[ cfg ( feature = "vonuvoli_values_array" ) ]
RecordPrimitiveV::RecordToArray =>
None,
Expand Down Expand Up @@ -509,6 +516,8 @@ pub fn record_primitive_v_alternative_1 (primitive : RecordPrimitiveV) -> (Optio
None,
RecordPrimitiveV::RecordBuild =>
Some (RecordPrimitive1::RecordBuild),
RecordPrimitiveV::RecordBuildC =>
None,
#[ cfg ( feature = "vonuvoli_values_array" ) ]
RecordPrimitiveV::RecordToArray =>
Some (RecordPrimitive1::RecordToArray),
Expand Down Expand Up @@ -556,6 +565,8 @@ pub fn record_primitive_v_alternative_2 (primitive : RecordPrimitiveV) -> (Optio
None,
RecordPrimitiveV::RecordBuild =>
Some (RecordPrimitive2::RecordBuild),
RecordPrimitiveV::RecordBuildC =>
Some (RecordPrimitive2::RecordBuildC),
#[ cfg ( feature = "vonuvoli_values_array" ) ]
RecordPrimitiveV::RecordToArray =>
Some (RecordPrimitive2::RecordToArray),
Expand Down Expand Up @@ -603,6 +614,8 @@ pub fn record_primitive_v_alternative_3 (primitive : RecordPrimitiveV) -> (Optio
Some (RecordPrimitive3::RecordSet),
RecordPrimitiveV::RecordBuild =>
Some (RecordPrimitive3::RecordBuild),
RecordPrimitiveV::RecordBuildC =>
Some (RecordPrimitive3::RecordBuildC),
#[ cfg ( feature = "vonuvoli_values_array" ) ]
RecordPrimitiveV::RecordToArray =>
None,
Expand Down Expand Up @@ -650,6 +663,8 @@ pub fn record_primitive_v_alternative_4 (primitive : RecordPrimitiveV) -> (Optio
Some (RecordPrimitive4::RecordSet),
RecordPrimitiveV::RecordBuild =>
Some (RecordPrimitive4::RecordBuild),
RecordPrimitiveV::RecordBuildC =>
None,
#[ cfg ( feature = "vonuvoli_values_array" ) ]
RecordPrimitiveV::RecordToArray =>
None,
Expand Down Expand Up @@ -697,6 +712,8 @@ pub fn record_primitive_v_alternative_5 (primitive : RecordPrimitiveV) -> (Optio
None,
RecordPrimitiveV::RecordBuild =>
Some (RecordPrimitive5::RecordBuild),
RecordPrimitiveV::RecordBuildC =>
None,
#[ cfg ( feature = "vonuvoli_values_array" ) ]
RecordPrimitiveV::RecordToArray =>
None,
Expand Down Expand Up @@ -744,6 +761,8 @@ pub fn record_primitive_v_alternative_n (primitive : RecordPrimitiveV) -> (Optio
None,
RecordPrimitiveV::RecordBuild =>
Some (RecordPrimitiveN::RecordBuild),
RecordPrimitiveV::RecordBuildC =>
None,
#[ cfg ( feature = "vonuvoli_values_array" ) ]
RecordPrimitiveV::RecordToArray =>
None,
Expand Down

0 comments on commit 2f32d71

Please sign in to comment.