• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

Chik-Network / klvm_rs / 9969783315

17 Jul 2024 07:09AM UTC coverage: 91.834% (-2.2%) from 94.072%
9969783315

push

github

Chik-Network
update 0.2.5

1191 of 1284 new or added lines in 29 files covered. (92.76%)

66 existing lines in 11 files now uncovered.

4071 of 4433 relevant lines covered (91.83%)

3553.81 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/src/runtime_dialect.rs
1
use crate::allocator::{Allocator, NodePtr};
2
use crate::chik_dialect::NO_UNKNOWN_OPS;
3
use crate::cost::Cost;
4
use crate::dialect::{Dialect, OperatorSet};
5
use crate::err_utils::err;
6
use crate::f_table::{f_lookup_for_hashmap, FLookup};
7
use crate::more_ops::op_unknown;
8
use crate::reduction::Response;
9
use std::collections::HashMap;
10

11
pub struct RuntimeDialect {
12
    f_lookup: FLookup,
13
    quote_kw: Vec<u8>,
14
    apply_kw: Vec<u8>,
15
    softfork_kw: Vec<u8>,
16
    flags: u32,
17
}
18

19
impl RuntimeDialect {
20
    pub fn new(
×
21
        op_map: HashMap<String, Vec<u8>>,
×
22
        quote_kw: Vec<u8>,
×
23
        apply_kw: Vec<u8>,
×
24
        flags: u32,
×
25
    ) -> RuntimeDialect {
×
26
        RuntimeDialect {
×
27
            f_lookup: f_lookup_for_hashmap(op_map),
×
28
            quote_kw,
×
29
            apply_kw,
×
30
            softfork_kw: vec![36], // softfork opcode
×
31
            flags,
×
32
        }
×
33
    }
×
34
}
35

36
impl Dialect for RuntimeDialect {
37
    fn op(
×
38
        &self,
×
39
        allocator: &mut Allocator,
×
40
        o: NodePtr,
×
41
        argument_list: NodePtr,
×
42
        max_cost: Cost,
×
43
        _extensions: OperatorSet,
×
44
    ) -> Response {
×
NEW
45
        let b = &allocator.atom(o);
×
46
        if b.len() == 1 {
×
47
            if let Some(f) = self.f_lookup[b[0] as usize] {
×
48
                return f(allocator, argument_list, max_cost);
×
49
            }
×
50
        }
×
51
        if (self.flags & NO_UNKNOWN_OPS) != 0 {
×
52
            err(o, "unimplemented operator")
×
53
        } else {
54
            op_unknown(allocator, o, argument_list, max_cost)
×
55
        }
56
    }
×
57

NEW
58
    fn quote_kw(&self) -> &[u8] {
×
NEW
59
        &self.quote_kw
×
60
    }
×
61

NEW
62
    fn apply_kw(&self) -> &[u8] {
×
NEW
63
        &self.apply_kw
×
64
    }
×
65

NEW
66
    fn softfork_kw(&self) -> &[u8] {
×
NEW
67
        &self.softfork_kw
×
UNCOV
68
    }
×
69

70
    fn softfork_extension(&self, _ext: u32) -> OperatorSet {
×
71
        OperatorSet::Default
×
72
    }
×
73

NEW
74
    fn stack_limit(&self) -> usize {
×
NEW
75
        usize::MAX
×
NEW
76
    }
×
77

78
    fn allow_unknown_ops(&self) -> bool {
×
79
        (self.flags & NO_UNKNOWN_OPS) == 0
×
80
    }
×
81
}
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2026 Coveralls, Inc