mirror of
https://github.com/roc-lang/roc.git
synced 2025-09-14 07:45:04 +00:00
Fix code guards
This commit is contained in:
parent
5069d926bb
commit
db3698c33c
2 changed files with 8 additions and 0 deletions
|
@ -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,
|
||||
|
|
|
@ -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 _);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue