@shd101wyy/yo 0.1.32 → 0.1.33
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.github/skills/yo-async-effects/async-effects-recipes.md +2 -2
- package/.github/skills/yo-core-patterns/core-patterns-cheatsheet.md +25 -1
- package/.github/skills/yo-syntax/syntax-cheatsheet.md +4 -1
- package/out/cjs/index.cjs +580 -507
- package/out/cjs/yo-cli.cjs +643 -570
- package/out/cjs/yo-lsp.cjs +651 -578
- package/out/esm/index.mjs +411 -338
- package/out/types/src/codegen/functions/context.d.ts +1 -0
- package/out/types/src/evaluator/types/flowability.d.ts +1 -0
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/collections/hash_map.yo +51 -14
- package/std/prelude.yo +4 -0
package/package.json
CHANGED
|
@@ -573,11 +573,18 @@ impl(
|
|
|
573
573
|
)
|
|
574
574
|
);
|
|
575
575
|
/**
|
|
576
|
-
* Keys iterator -
|
|
576
|
+
* Keys iterator - scans ctrl bytes directly and yields only the keys.
|
|
577
|
+
*
|
|
578
|
+
* NOTE: This held a wrapped `_inner : HashMapIter(K, V)` and delegated
|
|
579
|
+
* `self._inner.next()` — but a method call on a struct FIELD of `ref(self)`
|
|
580
|
+
* advances a COPY of the field, so `_index` never moved and manual
|
|
581
|
+
* `it.next()` loops yielded the first key forever (`for(...)` masked it).
|
|
582
|
+
* Scan directly instead, mirroring `HashMapIterPtr`.
|
|
577
583
|
*/
|
|
578
584
|
HashMapKeys :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
|
|
579
585
|
struct(
|
|
580
|
-
|
|
586
|
+
_map : HashMap(K, V),
|
|
587
|
+
_index : usize
|
|
581
588
|
)
|
|
582
589
|
);
|
|
583
590
|
impl(
|
|
@@ -587,10 +594,23 @@ impl(
|
|
|
587
594
|
Iterator(
|
|
588
595
|
Item : K,
|
|
589
596
|
next : (fn(ref(self) : Self) -> Option(K))(
|
|
590
|
-
|
|
591
|
-
self.
|
|
592
|
-
|
|
593
|
-
|
|
597
|
+
cond(
|
|
598
|
+
(self._map.capacity == usize(0)) =>.None,
|
|
599
|
+
true => {
|
|
600
|
+
ctrl_ptr := self._map.ctrl.unwrap();
|
|
601
|
+
data_ptr := self._map.data.unwrap();
|
|
602
|
+
result := Option(K).None;
|
|
603
|
+
while((self._index < self._map.capacity) && result.is_none(), self._index = (self._index + usize(1)), {
|
|
604
|
+
ctrl_byte := (ctrl_ptr &+ self._index).*;
|
|
605
|
+
cond(
|
|
606
|
+
((ctrl_byte != CTRL_EMPTY) && (ctrl_byte != CTRL_DELETED)) => {
|
|
607
|
+
result =.Some((data_ptr &+ self._index).*.key);
|
|
608
|
+
},
|
|
609
|
+
true => ()
|
|
610
|
+
);
|
|
611
|
+
});
|
|
612
|
+
result
|
|
613
|
+
}
|
|
594
614
|
)
|
|
595
615
|
)
|
|
596
616
|
)
|
|
@@ -600,15 +620,19 @@ impl(
|
|
|
600
620
|
where(K <: (Eq(K), Hash)),
|
|
601
621
|
HashMap(K, V),
|
|
602
622
|
keys : (fn(self : Self) -> HashMapKeys(K, V))(
|
|
603
|
-
HashMapKeys(K, V)(
|
|
623
|
+
HashMapKeys(K, V)(_map : self, _index : usize(0))
|
|
604
624
|
)
|
|
605
625
|
);
|
|
606
626
|
/**
|
|
607
|
-
* Values iterator -
|
|
627
|
+
* Values iterator - scans ctrl bytes directly and yields only the values.
|
|
628
|
+
*
|
|
629
|
+
* NOTE: Same direct-scan structure as `HashMapKeys` — see the note there for
|
|
630
|
+
* why the wrapped-`_inner` delegation form was replaced.
|
|
608
631
|
*/
|
|
609
632
|
HashMapValues :: (fn(comptime(K) : Type, comptime(V) : Type) -> comptime(Type))(
|
|
610
633
|
struct(
|
|
611
|
-
|
|
634
|
+
_map : HashMap(K, V),
|
|
635
|
+
_index : usize
|
|
612
636
|
)
|
|
613
637
|
);
|
|
614
638
|
impl(
|
|
@@ -618,10 +642,23 @@ impl(
|
|
|
618
642
|
Iterator(
|
|
619
643
|
Item : V,
|
|
620
644
|
next : (fn(ref(self) : Self) -> Option(V))(
|
|
621
|
-
|
|
622
|
-
self.
|
|
623
|
-
|
|
624
|
-
|
|
645
|
+
cond(
|
|
646
|
+
(self._map.capacity == usize(0)) =>.None,
|
|
647
|
+
true => {
|
|
648
|
+
ctrl_ptr := self._map.ctrl.unwrap();
|
|
649
|
+
data_ptr := self._map.data.unwrap();
|
|
650
|
+
result := Option(V).None;
|
|
651
|
+
while((self._index < self._map.capacity) && result.is_none(), self._index = (self._index + usize(1)), {
|
|
652
|
+
ctrl_byte := (ctrl_ptr &+ self._index).*;
|
|
653
|
+
cond(
|
|
654
|
+
((ctrl_byte != CTRL_EMPTY) && (ctrl_byte != CTRL_DELETED)) => {
|
|
655
|
+
result =.Some((data_ptr &+ self._index).*.value);
|
|
656
|
+
},
|
|
657
|
+
true => ()
|
|
658
|
+
);
|
|
659
|
+
});
|
|
660
|
+
result
|
|
661
|
+
}
|
|
625
662
|
)
|
|
626
663
|
)
|
|
627
664
|
)
|
|
@@ -631,7 +668,7 @@ impl(
|
|
|
631
668
|
where(K <: (Eq(K), Hash)),
|
|
632
669
|
HashMap(K, V),
|
|
633
670
|
values : (fn(self : Self) -> HashMapValues(K, V))(
|
|
634
|
-
HashMapValues(K, V)(
|
|
671
|
+
HashMapValues(K, V)(_map : self, _index : usize(0))
|
|
635
672
|
)
|
|
636
673
|
);
|
|
637
674
|
impl(
|
package/std/prelude.yo
CHANGED
|
@@ -6813,6 +6813,10 @@ __derive_eq :: (fn(comptime(T) : Type, comptime(ctx) : DeriveContext, comptime(t
|
|
|
6813
6813
|
)
|
|
6814
6814
|
});
|
|
6815
6815
|
derive_rule(Eq, __derive_eq);
|
|
6816
|
+
// `Pragma` (defined near the top) is compared by `==` in the compiler's
|
|
6817
|
+
// memory-safety pragma registry. Derived here, once the `Eq` derive rule
|
|
6818
|
+
// is registered.
|
|
6819
|
+
derive(Pragma, Eq(Pragma));
|
|
6816
6820
|
// --- derive_rule for Clone ---
|
|
6817
6821
|
__derive_clone :: (fn(comptime(T) : Type, comptime(ctx) : DeriveContext, comptime(trait_params) : ComptimeList(Expr)) -> comptime(Expr))({
|
|
6818
6822
|
info :: Type.get_info(T);
|