Fix code guards

This commit is contained in:
Ayaz Hafiz 2023-03-23 11:53:43 -05:00
parent 5069d926bb
commit db3698c33c
No known key found for this signature in database
GPG key ID: 0E2A37416A25EF58
2 changed files with 8 additions and 0 deletions

View file

@ -20,10 +20,13 @@ use super::wrap_in_decode_custom_decode_with;
/// Implements decoding of a record. For example, for
///
/// ```text
/// {first: a, second: b}
/// ```
///
/// we'd like to generate an impl like
///
/// ```roc
/// decoder : Decoder {first: a, second: b} fmt | a has Decoding, b has Decoding, fmt has DecoderFormatting
/// decoder =
/// initialState : {f0: Result a [NoField], f1: Result b [NoField]}
@ -52,6 +55,7 @@ use super::wrap_in_decode_custom_decode_with;
/// Err NoField -> Err TooShort
///
/// Decode.custom \bytes, fmt -> Decode.decodeWith bytes (Decode.record initialState stepField finalizer) fmt
/// ```
pub(crate) fn decoder(
env: &mut Env,
_def_symbol: Symbol,

View file

@ -21,10 +21,13 @@ use super::wrap_in_decode_custom_decode_with;
/// Implements decoding of a tuple. For example, for
///
/// ```text
/// (a, b)
/// ```
///
/// we'd like to generate an impl like
///
/// ```roc
/// decoder : Decoder (a, b) fmt | a has Decoding, b has Decoding, fmt has DecoderFormatting
/// decoder =
/// initialState : {e0: Result a [NoElem], e1: Result b [NoElem]}
@ -53,6 +56,7 @@ use super::wrap_in_decode_custom_decode_with;
/// Err NoElem -> Err TooShort
///
/// Decode.custom \bytes, fmt -> Decode.decodeWith bytes (Decode.tuple initialState stepElem finalizer) fmt
/// ```
pub(crate) fn decoder(env: &mut Env, _def_symbol: Symbol, arity: u32) -> (Expr, Variable) {
// The decoded type of each index in the tuple, e.g. (a, b).
let mut index_vars = Vec::with_capacity(arity as _);