@shd101wyy/yo 0.1.28 → 0.1.29
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/SKILL.md +15 -15
- package/.github/skills/yo-async-effects/async-effects-recipes.md +110 -121
- package/.github/skills/yo-syntax/SKILL.md +2 -2
- package/.github/skills/yo-syntax/syntax-cheatsheet.md +49 -75
- package/README.md +2 -0
- package/out/cjs/index.cjs +622 -611
- package/out/cjs/yo-cli.cjs +727 -716
- package/out/cjs/yo-lsp.cjs +637 -626
- package/out/esm/index.mjs +515 -504
- package/out/types/src/codegen/functions/declarations.d.ts +1 -1
- package/out/types/src/doc/model.d.ts +0 -1
- package/out/types/src/env.d.ts +0 -2
- package/out/types/src/evaluator/context.d.ts +1 -1
- package/out/types/src/evaluator/exprs/{escape.d.ts → unwind.d.ts} +1 -1
- package/out/types/src/evaluator/types/function.d.ts +1 -2
- package/out/types/src/evaluator/utils.d.ts +0 -1
- package/out/types/src/expr.d.ts +5 -6
- package/out/types/src/types/creators.d.ts +4 -6
- package/out/types/src/types/definitions.d.ts +7 -16
- package/out/types/src/types/guards.d.ts +1 -2
- package/out/types/src/types/tags.d.ts +0 -1
- package/out/types/src/types/utils.d.ts +1 -0
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/async.yo +1 -1
- package/std/crypto/random.yo +6 -6
- package/std/encoding/base64.yo +4 -4
- package/std/encoding/hex.yo +2 -2
- package/std/encoding/json.yo +3 -3
- package/std/encoding/utf16.yo +1 -1
- package/std/error.yo +14 -2
- package/std/fs/dir.yo +56 -62
- package/std/fs/file.yo +118 -124
- package/std/fs/metadata.yo +11 -17
- package/std/fs/temp.yo +21 -27
- package/std/fs/walker.yo +10 -16
- package/std/http/client.yo +25 -29
- package/std/http/index.yo +4 -4
- package/std/io/reader.yo +1 -1
- package/std/io/writer.yo +2 -2
- package/std/net/addr.yo +1 -1
- package/std/net/dns.yo +10 -14
- package/std/net/errors.yo +1 -1
- package/std/net/tcp.yo +67 -71
- package/std/net/udp.yo +36 -40
- package/std/os/signal.yo +2 -2
- package/std/prelude.yo +27 -21
- package/std/process/command.yo +32 -38
- package/std/regex/parser.yo +10 -10
- package/std/sys/bufio/buf_reader.yo +14 -14
- package/std/sys/bufio/buf_writer.yo +17 -17
- package/std/sys/errors.yo +1 -1
- package/std/thread.yo +2 -2
- package/std/url/index.yo +2 -2
- package/std/worker.yo +2 -2
|
@@ -10,7 +10,7 @@ export interface EvidenceParameter {
|
|
|
10
10
|
fieldFunctionType: FunctionType;
|
|
11
11
|
cParamName: string;
|
|
12
12
|
}
|
|
13
|
-
export declare function getEvidenceParameters(
|
|
13
|
+
export declare function getEvidenceParameters(_functionType: FunctionType): EvidenceParameter[];
|
|
14
14
|
export declare function generateFunctionPrototype(functionType: FunctionType, cFunctionName: string, context: CodeGenContext, overrideReturnType?: string, originalFunctionType?: FunctionType): string;
|
|
15
15
|
export declare function generateFunctionDeclaration(functionType: FunctionType, cFunctionName: string, isExtern: boolean, context: CodeGenContext, functionBody?: Expr, originalFunctionType?: FunctionType): void;
|
|
16
16
|
export declare function generateObjectConstructorDeclarations(context: FunctionGenerationContext): void;
|
package/out/types/src/env.d.ts
CHANGED
|
@@ -17,7 +17,6 @@ export interface Variable {
|
|
|
17
17
|
token: Token;
|
|
18
18
|
isCreatedFromDestructuringAtomVariable?: boolean;
|
|
19
19
|
parameterAlias?: string;
|
|
20
|
-
isImplicit?: boolean;
|
|
21
20
|
isFromEffectSpread?: boolean;
|
|
22
21
|
isEffectParam?: boolean;
|
|
23
22
|
isModuleLevel?: boolean;
|
|
@@ -129,7 +128,6 @@ export declare function getReceiverMethodsByNameFromEnv({ env, context, methodNa
|
|
|
129
128
|
value: Value | undefined;
|
|
130
129
|
needsPointerConversion?: boolean;
|
|
131
130
|
}[];
|
|
132
|
-
export declare function stripImplicitVariablesFromEnv(env: Environment): Environment;
|
|
133
131
|
export declare function keepTopLevelFrameAndComptimeVariablesFromEnv(env: Environment): Environment;
|
|
134
132
|
export declare function getVariablesNeedingDrop(env: Environment): Variable[];
|
|
135
133
|
export declare function findNearestBeginBlockFrameLevel(env: Environment): number;
|
|
@@ -54,6 +54,7 @@ export interface EvaluatorContext {
|
|
|
54
54
|
stdPath: string;
|
|
55
55
|
currentModulePath?: string;
|
|
56
56
|
isUnsafeFunctionType?: boolean;
|
|
57
|
+
isControlFunctionType?: boolean;
|
|
57
58
|
enclosingFunctionReturnType?: Type;
|
|
58
59
|
hasControlFunctionImplicitParams?: boolean;
|
|
59
60
|
isInsideWhereClause?: boolean;
|
|
@@ -67,7 +68,6 @@ export interface EvaluatorContext {
|
|
|
67
68
|
isAnalyzingCtfeCapability?: boolean;
|
|
68
69
|
isInFunctionCallCheckingPhase?: boolean;
|
|
69
70
|
isInsideIoAsyncCall?: boolean;
|
|
70
|
-
isInsideGivenHandler?: boolean;
|
|
71
71
|
isEvaluatingGenericImplSpecialization?: boolean;
|
|
72
72
|
currentlySpecializingFunction?: {
|
|
73
73
|
originalFuncId: string;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Environment } from "../../env";
|
|
2
2
|
import { type Expr, type FnCallExpr } from "../../expr";
|
|
3
3
|
import type { EvaluatorContext } from "../context";
|
|
4
|
-
export declare function
|
|
4
|
+
export declare function evaluateUnwind({ expr, env, context, }: {
|
|
5
5
|
expr: FnCallExpr;
|
|
6
6
|
env: Environment;
|
|
7
7
|
context: EvaluatorContext;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Environment } from "../../env";
|
|
2
2
|
import { type Expr, type FnCallExpr } from "../../expr";
|
|
3
|
-
import type {
|
|
3
|
+
import type { FunctionParameter, FunctionType, Type } from "../../types/definitions";
|
|
4
4
|
import type { EvaluatorContext } from "../context";
|
|
5
5
|
export declare function evaluateFunctionParameter({ expr, env, context, isParameterComptimeByDefault, allowVariableShadowing, }: {
|
|
6
6
|
expr: Expr;
|
|
@@ -32,7 +32,6 @@ export declare function evaluateFunctionParameters({ parameterExprs, env, contex
|
|
|
32
32
|
}): {
|
|
33
33
|
parameters: FunctionParameter[];
|
|
34
34
|
forallParameters: FunctionParameter[];
|
|
35
|
-
implicitParameters: FunctionImplicitParameter[];
|
|
36
35
|
variadicParameter?: FunctionParameter;
|
|
37
36
|
whereClauseExprs?: Expr[];
|
|
38
37
|
env: Environment;
|
|
@@ -2,4 +2,3 @@ import { type Environment, type Variable } from "../env";
|
|
|
2
2
|
import { type Expr } from "../expr";
|
|
3
3
|
export declare function isValidVariableName(expr: Expr): boolean;
|
|
4
4
|
export declare function findRcValueOwnerRelationship(rhs: Expr, env: Environment, _modulePath: string): Variable | undefined;
|
|
5
|
-
export declare function throwExprIsImplicitVariableError(rhs: Expr): void;
|
package/out/types/src/expr.d.ts
CHANGED
|
@@ -39,12 +39,12 @@ export interface RuntimeDestructuring {
|
|
|
39
39
|
}
|
|
40
40
|
export type ControlFlowFlags = {
|
|
41
41
|
return?: boolean;
|
|
42
|
-
|
|
42
|
+
unwind?: boolean;
|
|
43
43
|
break?: boolean;
|
|
44
44
|
continue?: boolean;
|
|
45
45
|
};
|
|
46
|
-
export declare function controlFlowOf(kind: "return" | "
|
|
47
|
-
export declare function hasControlFlow(cf: ControlFlowFlags | undefined, kind: "return" | "
|
|
46
|
+
export declare function controlFlowOf(kind: "return" | "unwind" | "break" | "continue"): ControlFlowFlags;
|
|
47
|
+
export declare function hasControlFlow(cf: ControlFlowFlags | undefined, kind: "return" | "unwind" | "break" | "continue"): boolean;
|
|
48
48
|
export declare function hasAnyControlFlow(cf: ControlFlowFlags | undefined): boolean;
|
|
49
49
|
export declare function mergeControlFlows(flows: ControlFlowFlags[]): ControlFlowFlags;
|
|
50
50
|
export declare function controlFlowToString(cf: ControlFlowFlags): string;
|
|
@@ -118,8 +118,6 @@ export declare const BuiltinKeywords: {
|
|
|
118
118
|
runtime: string[];
|
|
119
119
|
ref: string[];
|
|
120
120
|
forall: string[];
|
|
121
|
-
using: string[];
|
|
122
|
-
given: string[];
|
|
123
121
|
where: string[];
|
|
124
122
|
quote: string[];
|
|
125
123
|
unquote: string[];
|
|
@@ -128,7 +126,8 @@ export declare const BuiltinKeywords: {
|
|
|
128
126
|
recur: string[];
|
|
129
127
|
fn: string[];
|
|
130
128
|
unsafe_fn: string[];
|
|
131
|
-
|
|
129
|
+
ctl: string[];
|
|
130
|
+
unwind: string[];
|
|
132
131
|
extern: string[];
|
|
133
132
|
cond: string[];
|
|
134
133
|
type: 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,
|
|
6
|
+
import type { ArrayType, ComptimeListType, DynType, EnumType, FnTraitType, FunctionForallParameter, FunctionParameter, FunctionParameterExprs, FutureEffect, FunctionReturn, FunctionType, FutureTraitType, IsoType, SourceNamespaceType, PtrType, SliceType, 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;
|
|
@@ -45,10 +45,9 @@ export declare function createSourceNamespaceType(env: Environment): SourceNames
|
|
|
45
45
|
export declare function createTraitType(env: Environment): TraitType;
|
|
46
46
|
export declare function createEnumType(env: Environment): EnumType;
|
|
47
47
|
export declare function createUnionType(env: Environment): UnionType;
|
|
48
|
-
export declare function createFunctionType({ parameters, forallParameters,
|
|
48
|
+
export declare function createFunctionType({ parameters, forallParameters, variadicParameter, whereClauseExprs, return_, env, parametersFrame, SelfType, SelfTraitType, isClosure, isControl, }: {
|
|
49
49
|
parameters: FunctionParameter[];
|
|
50
50
|
forallParameters: FunctionForallParameter[];
|
|
51
|
-
implicitParameters?: FunctionImplicitParameter[];
|
|
52
51
|
variadicParameter: FunctionParameter | undefined;
|
|
53
52
|
whereClauseExprs?: Expr[];
|
|
54
53
|
return_: FunctionReturn;
|
|
@@ -57,6 +56,7 @@ export declare function createFunctionType({ parameters, forallParameters, impli
|
|
|
57
56
|
SelfType?: Type;
|
|
58
57
|
SelfTraitType?: Type;
|
|
59
58
|
isClosure?: boolean;
|
|
59
|
+
isControl?: boolean;
|
|
60
60
|
}): FunctionType;
|
|
61
61
|
export declare function createPtrType(childType: Type): PtrType;
|
|
62
62
|
export declare function createIsoType(childType: Type, env: Environment): IsoType;
|
|
@@ -71,8 +71,6 @@ export declare function createSomeType(type: TypeHierarchyType, variableName: st
|
|
|
71
71
|
env: Environment;
|
|
72
72
|
context: EvaluatorContext;
|
|
73
73
|
}): SomeType;
|
|
74
|
-
export declare function createEffectsRowSomeType(variableName: string, env: Environment): SomeType;
|
|
75
|
-
export declare function createEffectsRowType(implicitParameters: FunctionImplicitParameter[]): EffectsRowType;
|
|
76
74
|
export declare function createTypeHierarchy(level: number, baseType?: Type): TypeHierarchyType;
|
|
77
75
|
export declare function getFunctionParameterExprs({ expr, labelExpr, typeExpr, defaultValueExpr, assignedValueExpr, }: {
|
|
78
76
|
expr: Expr;
|
|
@@ -82,7 +80,7 @@ export declare function getFunctionParameterExprs({ expr, labelExpr, typeExpr, d
|
|
|
82
80
|
assignedValueExpr: Expr | undefined;
|
|
83
81
|
}): FunctionParameterExprs;
|
|
84
82
|
export declare function createFnTraitType(fnType: FunctionType, env: Environment): FnTraitType;
|
|
85
|
-
export declare function createFutureTraitType(outputType: Type, env: Environment,
|
|
83
|
+
export declare function createFutureTraitType(outputType: Type, env: Environment, effect?: FutureEffect): FutureTraitType;
|
|
86
84
|
export declare function createDynType({ requiredTraits, env, negativeTraits, }: {
|
|
87
85
|
requiredTraits: TraitType[];
|
|
88
86
|
env: Environment;
|
|
@@ -53,14 +53,8 @@ export interface SomeType extends Type {
|
|
|
53
53
|
functionValue: FunctionValue;
|
|
54
54
|
argValues: Value[];
|
|
55
55
|
};
|
|
56
|
-
isEffectsRow?: boolean;
|
|
57
56
|
kindFunctionType?: FunctionType;
|
|
58
57
|
}
|
|
59
|
-
export interface EffectsRowType extends Type {
|
|
60
|
-
tag: TypeTag.EffectsRow;
|
|
61
|
-
implicitParameters: FunctionImplicitParameter[];
|
|
62
|
-
trait: TraitType;
|
|
63
|
-
}
|
|
64
58
|
export interface TypeApplicationType extends Type {
|
|
65
59
|
tag: TypeTag.TypeApplication;
|
|
66
60
|
constructor: SomeType;
|
|
@@ -119,18 +113,11 @@ export interface FunctionParameter {
|
|
|
119
113
|
isCompileTimeOnly: boolean;
|
|
120
114
|
isQuote: boolean;
|
|
121
115
|
isOwningTheRcValue: boolean;
|
|
122
|
-
isImplicit: boolean;
|
|
123
|
-
isEffectRowSpread?: boolean;
|
|
124
116
|
exprs: FunctionParameterExprs;
|
|
125
117
|
assignedValue?: Value;
|
|
126
118
|
}
|
|
127
119
|
export type FunctionForallParameter = FunctionParameter & {
|
|
128
120
|
isCompileTimeOnly: true;
|
|
129
|
-
isImplicit: false;
|
|
130
|
-
};
|
|
131
|
-
export type FunctionImplicitParameter = FunctionParameter & {
|
|
132
|
-
isCompileTimeOnly: true;
|
|
133
|
-
isImplicit: true;
|
|
134
121
|
};
|
|
135
122
|
export interface StructType extends Type {
|
|
136
123
|
tag: TypeTag.Struct;
|
|
@@ -164,7 +151,7 @@ export interface TraitType extends Type {
|
|
|
164
151
|
};
|
|
165
152
|
isFuture?: {
|
|
166
153
|
outputType: Type;
|
|
167
|
-
|
|
154
|
+
effect?: FutureEffect;
|
|
168
155
|
};
|
|
169
156
|
isConcrete?: {
|
|
170
157
|
concreteType: Type;
|
|
@@ -181,10 +168,14 @@ export type FnTraitType = TraitType & {
|
|
|
181
168
|
callType: FunctionType;
|
|
182
169
|
};
|
|
183
170
|
};
|
|
171
|
+
export interface FutureEffect {
|
|
172
|
+
label: string;
|
|
173
|
+
type: Type;
|
|
174
|
+
}
|
|
184
175
|
export type FutureTraitType = TraitType & {
|
|
185
176
|
isFuture: {
|
|
186
177
|
outputType: Type;
|
|
187
|
-
|
|
178
|
+
effect?: FutureEffect;
|
|
188
179
|
};
|
|
189
180
|
};
|
|
190
181
|
export type ConcreteTraitType = TraitType & {
|
|
@@ -227,7 +218,6 @@ export interface FunctionType extends Type {
|
|
|
227
218
|
tag: TypeTag.Function;
|
|
228
219
|
parameters: FunctionParameter[];
|
|
229
220
|
forallParameters: FunctionForallParameter[];
|
|
230
|
-
implicitParameters: FunctionImplicitParameter[];
|
|
231
221
|
variadicParameter?: FunctionParameter;
|
|
232
222
|
whereClauseExprs?: Expr[];
|
|
233
223
|
return: FunctionReturn;
|
|
@@ -237,6 +227,7 @@ export interface FunctionType extends Type {
|
|
|
237
227
|
SelfTraitType?: Type;
|
|
238
228
|
trait: TraitType;
|
|
239
229
|
isClosure?: boolean;
|
|
230
|
+
isControl?: boolean;
|
|
240
231
|
}
|
|
241
232
|
export interface PtrType extends Type {
|
|
242
233
|
tag: TypeTag.Ptr;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FunctionValue } from "../function-value";
|
|
2
|
-
import type { ArrayType, ComptimeListType, ConcreteTraitType, DynType,
|
|
2
|
+
import type { ArrayType, ComptimeListType, ConcreteTraitType, DynType, EnumType, FnTraitType, FunctionType, FutureTraitType, IsoType, SourceNamespaceType, PtrType, SliceType, 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;
|
|
@@ -77,4 +77,3 @@ export declare function isBoxedType(type: Type): type is StructType & {
|
|
|
77
77
|
isReferenceSemantics: true;
|
|
78
78
|
__isBoxed: true;
|
|
79
79
|
};
|
|
80
|
-
export declare function isEffectsRowType(type?: Type): type is EffectsRowType;
|
|
@@ -7,6 +7,7 @@ export declare function typeProhibitsComptimeModifier(type: Type | undefined, en
|
|
|
7
7
|
export declare function isComptimeOnlyType(type: Type, env: Environment): boolean;
|
|
8
8
|
export declare function isRuntimeOnlyType(type: Type, env: Environment): boolean;
|
|
9
9
|
export declare function typeContainsRcType(type?: Type, checkedTypes?: Type[]): boolean;
|
|
10
|
+
export declare function typeIsControlBound(type?: Type, checkedTypes?: Type[]): boolean;
|
|
10
11
|
export declare function typeContainsSomeType(type?: Type, checkedTypes?: Type[]): boolean;
|
|
11
12
|
export declare function typeContainsUnknownValue(type: Type, visited?: Set<string>): boolean;
|
|
12
13
|
export declare function getAllSomeTypes(type: Type): Set<SomeType>;
|