@shd101wyy/yo 0.1.32 → 0.1.34
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/SKILL.md +1 -1
- package/.github/skills/yo-core-patterns/core-patterns-cheatsheet.md +76 -22
- package/.github/skills/yo-syntax/SKILL.md +1 -1
- package/.github/skills/yo-syntax/syntax-cheatsheet.md +59 -67
- package/out/cjs/index.cjs +662 -574
- package/out/cjs/yo-cli.cjs +803 -715
- package/out/cjs/yo-lsp.cjs +771 -683
- package/out/esm/index.mjs +555 -467
- package/out/types/src/codegen/exprs/comptime-value.d.ts +2 -1
- package/out/types/src/codegen/functions/context.d.ts +1 -0
- package/out/types/src/codegen/types/generation.d.ts +1 -1
- package/out/types/src/codegen/utils/index.d.ts +2 -4
- package/out/types/src/evaluator/exprs/_expr.d.ts +1 -0
- package/out/types/src/evaluator/types/flowability.d.ts +22 -0
- package/out/types/src/expr.d.ts +4 -13
- package/out/types/src/types/creators.d.ts +2 -3
- package/out/types/src/types/definitions.d.ts +2 -3
- package/out/types/src/types/guards.d.ts +2 -2
- package/out/types/src/types/tags.d.ts +2 -2
- package/out/types/src/value-tag.d.ts +0 -1
- package/out/types/src/value.d.ts +2 -11
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/alg/hash.yo +5 -3
- package/std/build.yo +46 -46
- package/std/collections/array_list.yo +73 -66
- package/std/collections/hash_map.yo +53 -95
- package/std/collections/list_view.yo +77 -0
- package/std/crypto/random.yo +5 -5
- package/std/encoding/base64.yo +12 -13
- package/std/encoding/hex.yo +6 -6
- package/std/encoding/json.yo +6 -5
- package/std/encoding/utf16.yo +9 -9
- package/std/env.yo +8 -8
- package/std/fmt/to_string.yo +12 -12
- package/std/http/client.yo +1 -1
- package/std/imm/list.yo +4 -3
- package/std/imm/map.yo +3 -2
- package/std/imm/set.yo +4 -3
- package/std/imm/sorted_map.yo +3 -2
- package/std/imm/sorted_set.yo +4 -3
- package/std/imm/string.yo +12 -5
- package/std/imm/vec.yo +8 -3
- package/std/prelude.yo +178 -401
- package/std/string/string.yo +198 -71
- package/std/url/index.yo +26 -26
- package/out/types/src/evaluator/types/slice.d.ts +0 -8
|
@@ -1,4 +1,5 @@
|
|
|
1
|
+
import type { Type } from "../../types/definitions";
|
|
1
2
|
import type { Expr } from "../../expr";
|
|
2
3
|
import { type Value } from "../../value";
|
|
3
4
|
import { type CodeGenContext } from "../utils";
|
|
4
|
-
export declare function generateComptimeValue(value: Value, context: CodeGenContext, _sourceExpr?: Expr): string;
|
|
5
|
+
export declare function generateComptimeValue(value: Value, context: CodeGenContext, _sourceExpr?: Expr, expectedType?: Type): string;
|
|
@@ -16,6 +16,7 @@ export interface FunctionGenerationContext extends CodeGenContext {
|
|
|
16
16
|
cInclude?: string;
|
|
17
17
|
}>;
|
|
18
18
|
currentFunctionName: string;
|
|
19
|
+
unwindValueCTypes?: Set<string>;
|
|
19
20
|
currentFunctionType?: FunctionType;
|
|
20
21
|
currentClosureCaptures?: string[];
|
|
21
22
|
currentClosureCaptureFrameLevel?: number;
|
|
@@ -2,7 +2,7 @@ import type { EnumType, FunctionType, StructType, TupleType, UnionType } from ".
|
|
|
2
2
|
import { type CodeGenContext } from "../utils";
|
|
3
3
|
export declare function generateTypeDeclarations(context: CodeGenContext): void;
|
|
4
4
|
export declare function generateArrayStructDeclarations(context: CodeGenContext): void;
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function generateStrTypeDeclaration(context: CodeGenContext): void;
|
|
6
6
|
export declare function generateIsoTypeDeclarations(context: CodeGenContext): void;
|
|
7
7
|
export declare function generateClosureDeclaration(functionType: FunctionType, cName: string, captureType: StructType | undefined, context: CodeGenContext): void;
|
|
8
8
|
export declare function generateStructDeclaration(structType: StructType, cName: string, context: CodeGenContext): void;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Emitter } from "../../emitter";
|
|
2
|
-
import { type Environment } from "../../env";
|
|
2
|
+
import { type Environment, type Variable } from "../../env";
|
|
3
3
|
import { type Expr } from "../../expr";
|
|
4
4
|
import type { FunctionValue, FuncValueId } from "../../function-value";
|
|
5
5
|
import type { TargetInfo } from "../../target";
|
|
@@ -24,9 +24,6 @@ export interface CodeGenContext {
|
|
|
24
24
|
childType: string;
|
|
25
25
|
length: number;
|
|
26
26
|
}>;
|
|
27
|
-
sliceStructTypes: Map<string, {
|
|
28
|
-
childType: string;
|
|
29
|
-
}>;
|
|
30
27
|
isoTypes?: Map<string, {
|
|
31
28
|
childTypeCName: string;
|
|
32
29
|
isoType: IsoType;
|
|
@@ -97,5 +94,6 @@ export declare function canOptimizeAsSimpleEnum(enumType: EnumType): boolean;
|
|
|
97
94
|
export declare function getVariableNameForCodegen(variableName: string, env: Environment | undefined): string;
|
|
98
95
|
export declare function getDeferredDupTargetAtomName(dupExpr: Expr): string | undefined;
|
|
99
96
|
export declare function getDeferredDropTargetAtomName(dropExpr: Expr): string | undefined;
|
|
97
|
+
export declare function getDeferredDropTargetVariable(dropExpr: Expr): Variable | undefined;
|
|
100
98
|
export declare function isDeferredDropForClosureCapture(dropExpr: Expr, currentClosureCaptures: readonly string[] | undefined): boolean;
|
|
101
99
|
export declare function findReturnedAsyncBlock(expr: Expr | undefined): Expr | undefined;
|
|
@@ -3,6 +3,7 @@ import { type Expr } from "../../expr";
|
|
|
3
3
|
import type { EvaluatorContext } from "../context";
|
|
4
4
|
export declare function _resetEvalProfiler(): void;
|
|
5
5
|
export declare function _printEvalProfile(): void;
|
|
6
|
+
export declare function setEvaluatorDeadline(deadlineMs: number | undefined): void;
|
|
6
7
|
export declare function _evaluateExpression({ expr, env, context, }: {
|
|
7
8
|
expr: Expr;
|
|
8
9
|
env: Environment;
|
|
@@ -1,6 +1,28 @@
|
|
|
1
1
|
import { type Expr } from "../../expr";
|
|
2
|
+
import { type Environment, type Variable } from "../../env";
|
|
2
3
|
export declare function isFlowableExpr(expr: Expr, options?: {
|
|
3
4
|
allowSameFrameLocal?: boolean;
|
|
4
5
|
allowParameterSource?: boolean;
|
|
5
6
|
allowComptimeSource?: boolean;
|
|
7
|
+
maxLocalFrameLevel?: number;
|
|
6
8
|
}): boolean;
|
|
9
|
+
export declare function aliasGroupRoot(variable: Variable): Variable;
|
|
10
|
+
export declare function findPropertyChainRootAtom(expr: Expr): Expr | undefined;
|
|
11
|
+
export declare function requireRefOwnArgumentExclusivity({ parameters, argExprs, env, }: {
|
|
12
|
+
parameters: {
|
|
13
|
+
label: string;
|
|
14
|
+
isRef?: boolean;
|
|
15
|
+
isOwningTheRcValue: boolean;
|
|
16
|
+
}[];
|
|
17
|
+
argExprs: Expr[];
|
|
18
|
+
env: Environment;
|
|
19
|
+
}): void;
|
|
20
|
+
export declare function requireValidRefArgumentPlaces({ parameters, argExprs, env, }: {
|
|
21
|
+
parameters: {
|
|
22
|
+
label: string;
|
|
23
|
+
isRef?: boolean;
|
|
24
|
+
isCompileTimeOnly: boolean;
|
|
25
|
+
}[];
|
|
26
|
+
argExprs: Expr[];
|
|
27
|
+
env: Environment;
|
|
28
|
+
}): void;
|
package/out/types/src/expr.d.ts
CHANGED
|
@@ -211,21 +211,12 @@ export declare const BuiltinFunctions: {
|
|
|
211
211
|
__yo_address_of: string[];
|
|
212
212
|
__yo_ptr_deref: string[];
|
|
213
213
|
__yo_ptr_set: string[];
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
214
|
+
__yo_str_from_raw_parts: string[];
|
|
215
|
+
__yo_str_len: string[];
|
|
216
|
+
__yo_str_ptr: string[];
|
|
217
|
+
__yo_str_byte: string[];
|
|
217
218
|
__yo_array_index: string[];
|
|
218
|
-
__yo_slice_index: string[];
|
|
219
|
-
__yo_array_index_range: string[];
|
|
220
|
-
__yo_array_index_range_inclusive: string[];
|
|
221
|
-
__yo_slice_index_range: string[];
|
|
222
|
-
__yo_slice_index_range_inclusive: string[];
|
|
223
219
|
__yo_comptime_array_index: string[];
|
|
224
|
-
__yo_comptime_slice_index: string[];
|
|
225
|
-
__yo_comptime_array_index_range: string[];
|
|
226
|
-
__yo_comptime_array_index_range_inclusive: string[];
|
|
227
|
-
__yo_comptime_slice_index_range: string[];
|
|
228
|
-
__yo_comptime_slice_index_range_inclusive: string[];
|
|
229
220
|
__yo_as: string[];
|
|
230
221
|
__yo_expr_is_atom: string[];
|
|
231
222
|
__yo_expr_is_fn_call: string[];
|
|
@@ -3,7 +3,7 @@ import type { EvaluatorContext } from "../evaluator/context";
|
|
|
3
3
|
import type { Expr } from "../expr";
|
|
4
4
|
import type { FunctionValue } from "../function-value";
|
|
5
5
|
import { type Value } from "../value";
|
|
6
|
-
import type { ArrayType, ComptimeListType, DynType, EnumType, FnTraitType, FunctionForallParameter, FunctionParameter, FunctionParameterExprs, FutureEffect, FunctionReturn, FunctionType, FutureTraitType, IsoType, SourceNamespaceType, PtrType,
|
|
6
|
+
import type { ArrayType, ComptimeListType, DynType, EnumType, FnTraitType, FunctionForallParameter, FunctionParameter, FunctionParameterExprs, FutureEffect, FunctionReturn, FunctionType, FutureTraitType, IsoType, SourceNamespaceType, PtrType, StrType, SomeType, StructType, TraitType, TupleType, Type, TypeApplicationType, TypeField, TypeHierarchyType, UnionType, VoidType } from "./definitions";
|
|
7
7
|
export declare function createComptimeIntType(): Type;
|
|
8
8
|
export declare function createComptimeFloatType(): Type;
|
|
9
9
|
export declare function createComptimeStringType(): Type;
|
|
@@ -36,8 +36,7 @@ export declare function createULongLongType(): Type;
|
|
|
36
36
|
export declare function createLongDoubleType(): Type;
|
|
37
37
|
export declare function createType0(baseType?: Type): TypeHierarchyType;
|
|
38
38
|
export declare function createArrayType(childType: Type, length: Value): ArrayType;
|
|
39
|
-
export declare function
|
|
40
|
-
export declare function createStrType(env: Environment): Type;
|
|
39
|
+
export declare function createStrType(_env?: Environment): StrType;
|
|
41
40
|
export declare function createVoidType(): VoidType;
|
|
42
41
|
export declare function createTupleType(fields: TypeField[]): TupleType;
|
|
43
42
|
export declare function createStructType(env: Environment, isReferenceSemantics?: boolean, isNewtype?: boolean, isAtomicRc?: boolean): StructType;
|
|
@@ -68,9 +68,8 @@ export interface ArrayType extends Type {
|
|
|
68
68
|
length: Value;
|
|
69
69
|
trait: TraitType;
|
|
70
70
|
}
|
|
71
|
-
export interface
|
|
72
|
-
tag: TypeTag.
|
|
73
|
-
childType: Type;
|
|
71
|
+
export interface StrType extends Type {
|
|
72
|
+
tag: TypeTag.Str;
|
|
74
73
|
trait: TraitType;
|
|
75
74
|
}
|
|
76
75
|
export interface VoidType extends Type {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FunctionValue } from "../function-value";
|
|
2
|
-
import type { ArrayType, ComptimeListType, ConcreteTraitType, DynType, EnumType, FnTraitType, FunctionType, FutureTraitType, IsoType, SourceNamespaceType, PtrType,
|
|
2
|
+
import type { ArrayType, ComptimeListType, ConcreteTraitType, DynType, EnumType, FnTraitType, FunctionType, FutureTraitType, IsoType, SourceNamespaceType, PtrType, StrType, SomeType, StructType, TraitType, TupleType, Type, TypeApplicationType, TypeHierarchyType, UnionType, VoidType } from "./definitions";
|
|
3
3
|
export declare function isPrimitiveType(type: Type): boolean;
|
|
4
4
|
export declare function isUnitType(type?: Type): boolean;
|
|
5
5
|
export declare function isComptimeIntType(type?: Type): boolean;
|
|
@@ -22,7 +22,7 @@ export declare function isF32Type(type?: Type): boolean;
|
|
|
22
22
|
export declare function isF64Type(type?: Type): boolean;
|
|
23
23
|
export declare function isExprType(type?: Type): boolean;
|
|
24
24
|
export declare function isArrayType(type?: Type): type is ArrayType;
|
|
25
|
-
export declare function
|
|
25
|
+
export declare function isStrType(type?: Type): type is StrType;
|
|
26
26
|
export declare function isTupleType(type?: Type): type is TupleType;
|
|
27
27
|
export declare function isUnionType(type?: Type): type is UnionType;
|
|
28
28
|
export declare function isEnumType(type?: Type): type is EnumType;
|
|
@@ -15,7 +15,7 @@ export declare enum TypeTag {
|
|
|
15
15
|
F64 = "f64",
|
|
16
16
|
ComptimeInt = "comptime_int",
|
|
17
17
|
ComptimeFloat = "comptime_float",
|
|
18
|
-
ComptimeString = "
|
|
18
|
+
ComptimeString = "comptime_str",
|
|
19
19
|
Char = "char",
|
|
20
20
|
Short = "short",
|
|
21
21
|
UShort = "ushort",
|
|
@@ -35,7 +35,7 @@ export declare enum TypeTag {
|
|
|
35
35
|
Union = "Union",
|
|
36
36
|
Function = "Function",
|
|
37
37
|
SomeType = "SomeType",
|
|
38
|
-
|
|
38
|
+
Str = "str",
|
|
39
39
|
Trait = "Trait",
|
|
40
40
|
Ptr = "Ptr",
|
|
41
41
|
Iso = "Iso",
|
package/out/types/src/value.d.ts
CHANGED
|
@@ -3,7 +3,7 @@ import { type EvaluatorContext } from "./evaluator/context";
|
|
|
3
3
|
import { type Expr } from "./expr";
|
|
4
4
|
import type { FunctionValue } from "./function-value";
|
|
5
5
|
import type { TypeValue } from "./type-value";
|
|
6
|
-
import type { ArrayType, ComptimeListType, EnumType, ExprType, PtrType,
|
|
6
|
+
import type { ArrayType, ComptimeListType, EnumType, ExprType, PtrType, StructType, TraitType, TupleType, Type } from "./types/definitions";
|
|
7
7
|
import type { UnitValue } from "./unit-value";
|
|
8
8
|
import { ValueTag } from "./value-tag";
|
|
9
9
|
export type ComptimeStringValue = {
|
|
@@ -49,13 +49,6 @@ export type ArrayValue = {
|
|
|
49
49
|
type: ArrayType;
|
|
50
50
|
elements: Value[];
|
|
51
51
|
};
|
|
52
|
-
export type SliceValue = {
|
|
53
|
-
tag: ValueTag.Slice;
|
|
54
|
-
type: SliceType;
|
|
55
|
-
sourceArray: [ArrayValue];
|
|
56
|
-
startIndex: number;
|
|
57
|
-
endIndex: number;
|
|
58
|
-
};
|
|
59
52
|
export type ExprValue = {
|
|
60
53
|
tag: ValueTag.Expr;
|
|
61
54
|
type: ExprType;
|
|
@@ -79,7 +72,7 @@ export type PtrValue = {
|
|
|
79
72
|
targetValue: [Value];
|
|
80
73
|
targetIndex: number;
|
|
81
74
|
};
|
|
82
|
-
export type Value = TypeValue | ComptimeStringValue | ComptimeListValue | NumberValue | UnitValue | BooleanValue | ArrayValue |
|
|
75
|
+
export type Value = TypeValue | ComptimeStringValue | ComptimeListValue | NumberValue | UnitValue | BooleanValue | ArrayValue | TupleValue | StructValue | EnumValue | TraitValue | FunctionValue | ExprValue | UnknownValue | PtrValue;
|
|
83
76
|
export declare function valueToString(value?: Value): string;
|
|
84
77
|
export declare function isTypeValue(value?: Value): value is TypeValue;
|
|
85
78
|
export declare function isComptimeIntValue(value?: Value): value is NumberValue;
|
|
@@ -94,7 +87,6 @@ export declare function isUnknownValue(value?: Value): value is UnknownValue;
|
|
|
94
87
|
export declare function isTupleValue(value?: Value): value is TupleValue;
|
|
95
88
|
export declare function isStructValue(value?: Value): value is StructValue;
|
|
96
89
|
export declare function isArrayValue(value?: Value): value is ArrayValue;
|
|
97
|
-
export declare function isSliceValue(value?: Value): value is SliceValue;
|
|
98
90
|
export declare function isEnumValue(value?: Value): value is EnumValue;
|
|
99
91
|
export declare function isTraitValue(value?: Value): value is TraitValue;
|
|
100
92
|
export declare function isPtrValue(value?: Value): value is PtrValue;
|
|
@@ -125,7 +117,6 @@ export declare function createTraitValue(type: TraitType, fields: (Value | undef
|
|
|
125
117
|
export declare function createTupleValue(type: TupleType, fields: Value[]): TupleValue;
|
|
126
118
|
export declare function createEnumValue(type: EnumType, variantName: string, fields: Value[]): EnumValue;
|
|
127
119
|
export declare function createArrayValue(type: ArrayType, elements: Value[]): ArrayValue;
|
|
128
|
-
export declare function createSliceValue(type: SliceType, sourceArray: [ArrayValue], startIndex: number, endIndex: number): SliceValue;
|
|
129
120
|
export declare function createExprValue(expr: Expr): ExprValue;
|
|
130
121
|
export declare function createPtrValue(type: PtrType, targetValue: [Value], targetIndex?: number): PtrValue;
|
|
131
122
|
export declare function areValuesEqual(expected: {
|