@shd101wyy/yo 0.1.25 → 0.1.27
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 +4 -4
- package/.github/skills/yo-async-effects/async-effects-recipes.md +40 -40
- package/.github/skills/yo-core-patterns/SKILL.md +1 -1
- package/.github/skills/yo-core-patterns/core-patterns-cheatsheet.md +30 -26
- package/.github/skills/yo-project-workflow/SKILL.md +6 -3
- package/.github/skills/yo-project-workflow/workflow-cheatsheet.md +34 -11
- package/.github/skills/yo-syntax/SKILL.md +7 -6
- package/.github/skills/yo-syntax/syntax-cheatsheet.md +78 -60
- package/.github/skills/yo-wasm-integration/wasm-integration-cheatsheet.md +3 -3
- package/README.md +10 -8
- package/out/cjs/index.cjs +583 -567
- package/out/cjs/yo-cli.cjs +664 -632
- package/out/cjs/yo-lsp.cjs +510 -485
- package/out/esm/index.mjs +538 -522
- package/out/types/src/codegen/codegen-c.d.ts +2 -2
- package/out/types/src/codegen/functions/collection.d.ts +2 -2
- package/out/types/src/codegen/functions/context.d.ts +3 -2
- package/out/types/src/codegen/types/collection.d.ts +2 -2
- package/out/types/src/codegen/utils/index.d.ts +3 -1
- package/out/types/src/doc/builder.d.ts +2 -2
- package/out/types/src/evaluator/calls/closure-type.d.ts +2 -2
- package/out/types/src/evaluator/calls/record-type.d.ts +11 -0
- package/out/types/src/evaluator/context.d.ts +8 -9
- package/out/types/src/evaluator/index.d.ts +3 -3
- package/out/types/src/evaluator/types/record.d.ts +14 -0
- package/out/types/src/evaluator/types/validation.d.ts +2 -2
- package/out/types/src/evaluator/values/anonymous-module.d.ts +5 -5
- package/out/types/src/evaluator/values/impl.d.ts +1 -1
- package/out/types/src/expr.d.ts +1 -4
- package/out/types/src/formatter.d.ts +11 -0
- package/out/types/src/function-value.d.ts +1 -1
- package/out/types/src/lsp/document-manager.d.ts +1 -1
- package/out/types/src/lsp/formatting.d.ts +2 -0
- package/out/types/src/module-manager.d.ts +3 -3
- package/out/types/src/tests/formatter.test.d.ts +1 -0
- package/out/types/src/types/creators.d.ts +3 -4
- package/out/types/src/types/definitions.d.ts +8 -19
- package/out/types/src/types/guards.d.ts +3 -3
- package/out/types/src/types/tags.d.ts +0 -1
- package/out/types/src/types/utils.d.ts +1 -1
- package/out/types/src/value-tag.d.ts +0 -1
- package/out/types/src/value.d.ts +6 -13
- package/out/types/tsconfig.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/std/alg/hash.yo +13 -21
- package/std/allocator.yo +25 -40
- package/std/async.yo +3 -7
- package/std/build.yo +105 -151
- package/std/cli/arg_parser.yo +184 -169
- package/std/collections/array_list.yo +350 -314
- package/std/collections/btree_map.yo +142 -131
- package/std/collections/deque.yo +132 -128
- package/std/collections/hash_map.yo +542 -566
- package/std/collections/hash_set.yo +623 -687
- package/std/collections/linked_list.yo +275 -293
- package/std/collections/ordered_map.yo +113 -85
- package/std/collections/priority_queue.yo +73 -73
- package/std/crypto/md5.yo +191 -95
- package/std/crypto/random.yo +56 -64
- package/std/crypto/sha256.yo +151 -107
- package/std/encoding/base64.yo +87 -81
- package/std/encoding/hex.yo +43 -50
- package/std/encoding/html.yo +56 -81
- package/std/encoding/html_char_utils.yo +7 -13
- package/std/encoding/html_entities.yo +2248 -2253
- package/std/encoding/json.yo +316 -224
- package/std/encoding/punycode.yo +86 -116
- package/std/encoding/toml.yo +67 -66
- package/std/encoding/utf16.yo +37 -44
- package/std/env.yo +62 -91
- package/std/error.yo +12 -20
- package/std/fmt/display.yo +5 -9
- package/std/fmt/index.yo +8 -14
- package/std/fmt/to_string.yo +330 -315
- package/std/fmt/writer.yo +58 -87
- package/std/fs/dir.yo +83 -102
- package/std/fs/file.yo +147 -180
- package/std/fs/metadata.yo +45 -78
- package/std/fs/temp.yo +55 -65
- package/std/fs/types.yo +27 -40
- package/std/fs/walker.yo +53 -68
- package/std/gc.yo +5 -8
- package/std/glob.yo +30 -43
- package/std/http/client.yo +107 -120
- package/std/http/http.yo +106 -96
- package/std/http/index.yo +4 -6
- package/std/imm/list.yo +88 -93
- package/std/imm/map.yo +528 -464
- package/std/imm/set.yo +52 -57
- package/std/imm/sorted_map.yo +340 -286
- package/std/imm/sorted_set.yo +57 -63
- package/std/imm/string.yo +404 -345
- package/std/imm/vec.yo +173 -181
- package/std/io/reader.yo +3 -6
- package/std/io/writer.yo +4 -8
- package/std/libc/assert.yo +5 -9
- package/std/libc/ctype.yo +32 -22
- package/std/libc/dirent.yo +26 -25
- package/std/libc/errno.yo +164 -90
- package/std/libc/fcntl.yo +52 -45
- package/std/libc/float.yo +66 -44
- package/std/libc/limits.yo +42 -33
- package/std/libc/math.yo +53 -82
- package/std/libc/signal.yo +72 -47
- package/std/libc/stdatomic.yo +217 -188
- package/std/libc/stdint.yo +5 -29
- package/std/libc/stdio.yo +5 -29
- package/std/libc/stdlib.yo +32 -39
- package/std/libc/string.yo +5 -23
- package/std/libc/sys/stat.yo +58 -56
- package/std/libc/time.yo +5 -19
- package/std/libc/unistd.yo +5 -20
- package/std/libc/wctype.yo +6 -9
- package/std/libc/windows.yo +26 -30
- package/std/log.yo +41 -55
- package/std/net/addr.yo +102 -97
- package/std/net/dns.yo +27 -28
- package/std/net/errors.yo +50 -49
- package/std/net/tcp.yo +113 -124
- package/std/net/udp.yo +55 -66
- package/std/os/env.yo +35 -33
- package/std/os/signal.yo +15 -25
- package/std/path.yo +276 -311
- package/std/prelude.yo +6316 -4333
- package/std/process/command.yo +87 -103
- package/std/process/index.yo +12 -31
- package/std/regex/compiler.yo +196 -95
- package/std/regex/flags.yo +58 -39
- package/std/regex/index.yo +157 -173
- package/std/regex/match.yo +20 -31
- package/std/regex/node.yo +134 -152
- package/std/regex/parser.yo +283 -259
- package/std/regex/unicode.yo +172 -202
- package/std/regex/vm.yo +155 -171
- package/std/string/index.yo +5 -7
- package/std/string/rune.yo +45 -55
- package/std/string/string.yo +937 -964
- package/std/string/string_builder.yo +94 -104
- package/std/string/unicode.yo +46 -64
- package/std/sync/channel.yo +72 -73
- package/std/sync/cond.yo +31 -36
- package/std/sync/mutex.yo +30 -32
- package/std/sync/once.yo +13 -16
- package/std/sync/rwlock.yo +26 -31
- package/std/sync/waitgroup.yo +20 -25
- package/std/sys/advise.yo +16 -24
- package/std/sys/bufio/buf_reader.yo +77 -93
- package/std/sys/bufio/buf_writer.yo +52 -65
- package/std/sys/clock.yo +4 -9
- package/std/sys/constants.yo +77 -61
- package/std/sys/copy.yo +4 -10
- package/std/sys/dir.yo +26 -43
- package/std/sys/dns.yo +41 -61
- package/std/sys/errors.yo +95 -103
- package/std/sys/events.yo +45 -57
- package/std/sys/externs.yo +319 -267
- package/std/sys/fallocate.yo +7 -11
- package/std/sys/fcntl.yo +14 -22
- package/std/sys/file.yo +26 -40
- package/std/sys/future.yo +5 -8
- package/std/sys/iov.yo +12 -25
- package/std/sys/lock.yo +12 -13
- package/std/sys/mmap.yo +38 -43
- package/std/sys/path.yo +3 -8
- package/std/sys/perm.yo +7 -21
- package/std/sys/pipe.yo +5 -12
- package/std/sys/process.yo +23 -29
- package/std/sys/seek.yo +10 -12
- package/std/sys/signal.yo +7 -13
- package/std/sys/signals.yo +52 -35
- package/std/sys/socket.yo +63 -58
- package/std/sys/socketpair.yo +3 -6
- package/std/sys/sockinfo.yo +11 -20
- package/std/sys/statfs.yo +11 -34
- package/std/sys/statx.yo +25 -52
- package/std/sys/sysinfo.yo +15 -20
- package/std/sys/tcp.yo +62 -92
- package/std/sys/temp.yo +5 -9
- package/std/sys/time.yo +5 -15
- package/std/sys/timer.yo +6 -11
- package/std/sys/tty.yo +10 -18
- package/std/sys/udp.yo +22 -39
- package/std/sys/umask.yo +3 -6
- package/std/sys/unix.yo +33 -52
- package/std/testing/bench.yo +49 -52
- package/std/thread.yo +10 -15
- package/std/time/datetime.yo +105 -89
- package/std/time/duration.yo +43 -56
- package/std/time/instant.yo +13 -18
- package/std/time/sleep.yo +5 -9
- package/std/url/index.yo +184 -209
- package/std/worker.yo +6 -10
- package/out/types/src/evaluator/calls/module-type.d.ts +0 -11
- package/out/types/src/evaluator/types/module.d.ts +0 -19
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Expr } from "../expr";
|
|
2
|
-
import type {
|
|
2
|
+
import type { StructValue } from "../value";
|
|
3
3
|
export declare class CodeGeneratorC {
|
|
4
4
|
private emitter;
|
|
5
5
|
private exportedFunctionNames;
|
|
6
6
|
private _needsIntelAsmSyntax;
|
|
7
7
|
private _usesParallelism;
|
|
8
8
|
constructor();
|
|
9
|
-
compileModule(modulePath: string, moduleValue:
|
|
9
|
+
compileModule(modulePath: string, moduleValue: StructValue, options?: {
|
|
10
10
|
debugGc?: boolean;
|
|
11
11
|
debugParallelism?: boolean;
|
|
12
12
|
debugAsyncAwait?: boolean;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { type Expr } from "../../expr";
|
|
2
|
-
import { type
|
|
2
|
+
import { type StructValue, type TraitValue } from "../../value";
|
|
3
3
|
import { type CodeGenContext } from "../utils";
|
|
4
|
-
export declare function collectRequiredFunctions(moduleValue:
|
|
4
|
+
export declare function collectRequiredFunctions(moduleValue: StructValue | TraitValue, context: CodeGenContext, isTopLevelExport?: boolean): void;
|
|
5
5
|
export declare function findFunctionCallsInExpr(expr: Expr, context: CodeGenContext): void;
|
|
6
6
|
export declare function collectDisposeMethodsFromGenericImpls(context: CodeGenContext): void;
|
|
@@ -27,7 +27,7 @@ export interface FunctionGenerationContext extends CodeGenContext {
|
|
|
27
27
|
stateMachineVariables?: Map<string, CapturedVariable>;
|
|
28
28
|
stateMachineFieldAliases?: Map<string, string>;
|
|
29
29
|
inEffectStateMachine?: unknown;
|
|
30
|
-
|
|
30
|
+
isEffectRecordMemberFunction?: boolean;
|
|
31
31
|
currentEvidenceParams?: Map<string, EvidenceParameter>;
|
|
32
32
|
continuationVariables?: Map<string, {
|
|
33
33
|
directReturnVar: string;
|
|
@@ -44,8 +44,9 @@ export interface FunctionGenerationContext extends CodeGenContext {
|
|
|
44
44
|
resumeFunctionName: string;
|
|
45
45
|
constructorName: string;
|
|
46
46
|
disposeFunctionName: string;
|
|
47
|
+
setEffectFunctionName: string;
|
|
47
48
|
futureType: SomeType | DynType;
|
|
48
|
-
|
|
49
|
+
futureTraitType: FutureTraitType;
|
|
49
50
|
resultType: Type;
|
|
50
51
|
resultTypeCName: string;
|
|
51
52
|
captureType: StructType | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { type Expr } from "../../expr";
|
|
2
2
|
import type { FunctionType, Type } from "../../types/definitions";
|
|
3
|
-
import { type
|
|
3
|
+
import { type StructValue } from "../../value";
|
|
4
4
|
import { type CodeGenContext } from "../utils";
|
|
5
|
-
export declare function collectRequiredTypes(moduleValue:
|
|
5
|
+
export declare function collectRequiredTypes(moduleValue: StructValue, context: CodeGenContext): void;
|
|
6
6
|
export declare function collectTypesFromFunctionType(functionType: FunctionType, context: CodeGenContext): void;
|
|
7
7
|
export declare function collectTypesFromExpr(expr: Expr, context: CodeGenContext): void;
|
|
8
8
|
export declare function collectType(type: Type, context: CodeGenContext): void;
|
|
@@ -3,7 +3,7 @@ import { type Environment } 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";
|
|
6
|
-
import type { DynType, EnumType, FunctionType, IsoType, StructType, Type, TypeId } from "../../types/definitions";
|
|
6
|
+
import type { DynType, EnumType, FunctionType, IsoType, StructType, Type, TypeField, TypeId } from "../../types/definitions";
|
|
7
7
|
import { type TraitValue } from "../../value";
|
|
8
8
|
export interface CodeGenContext {
|
|
9
9
|
types: Record<TypeId, {
|
|
@@ -83,6 +83,8 @@ export interface CodeGenContext {
|
|
|
83
83
|
currentModuleId?: string;
|
|
84
84
|
exportedFunctionLabels?: Map<FuncValueId, string>;
|
|
85
85
|
}
|
|
86
|
+
export declare function isComptimeOnlyStructField(field: TypeField, _ownerType: StructType): boolean;
|
|
87
|
+
export declare function getRuntimeStructFields(structType: StructType): TypeField[];
|
|
86
88
|
export declare function sanitizeForCIdentifier(str: string, isExternC?: boolean): string;
|
|
87
89
|
export declare function shouldAvoidConst(type: Type): boolean;
|
|
88
90
|
export declare function getTypeString(type: Type | undefined, context: CodeGenContext): string;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import type { Token } from "../token";
|
|
2
2
|
import type { Environment } from "../env";
|
|
3
|
-
import type {
|
|
3
|
+
import type { StructValue } from "../value";
|
|
4
4
|
import type { DocExtractionResult } from "./extractor";
|
|
5
5
|
import type { DocModule } from "./model";
|
|
6
6
|
export interface BuildDocModuleOptions {
|
|
7
7
|
name: string;
|
|
8
8
|
path: string;
|
|
9
|
-
moduleValue:
|
|
9
|
+
moduleValue: StructValue;
|
|
10
10
|
extraction: DocExtractionResult;
|
|
11
11
|
tokens: Token[];
|
|
12
12
|
env?: Environment;
|
|
@@ -2,9 +2,9 @@ import { type Environment } from "../../env";
|
|
|
2
2
|
import { type Expr, type FnCallExpr } from "../../expr";
|
|
3
3
|
import type { DynType, FnTraitType, SomeType } from "../../types/definitions";
|
|
4
4
|
import type { EvaluatorContext } from "../context";
|
|
5
|
-
export declare function
|
|
5
|
+
export declare function tryToImplementClosureByFnTraitType({ expr, fnTraitType, wrapperType, callerEnv, context, }: {
|
|
6
6
|
expr: FnCallExpr;
|
|
7
|
-
|
|
7
|
+
fnTraitType: FnTraitType;
|
|
8
8
|
wrapperType: SomeType | DynType;
|
|
9
9
|
callerEnv: Environment;
|
|
10
10
|
context: EvaluatorContext;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { type Environment } from "../../env";
|
|
2
|
+
import { type Expr } from "../../expr";
|
|
3
|
+
import type { SourceNamespaceType } from "../../types/definitions";
|
|
4
|
+
import type { EvaluatorContext, RecordTypeCallResult } from "../context";
|
|
5
|
+
export declare function tryToImplementRecordWithArgumentsByRecordType({ moduleExpr, sourceNamespaceType, argExprs, callerEnv, context, }: {
|
|
6
|
+
moduleExpr: Expr;
|
|
7
|
+
sourceNamespaceType: SourceNamespaceType;
|
|
8
|
+
argExprs: Expr[];
|
|
9
|
+
callerEnv: Environment;
|
|
10
|
+
context: EvaluatorContext;
|
|
11
|
+
}): RecordTypeCallResult;
|
|
@@ -4,7 +4,7 @@ import type { Expr, FnCallExpr, PathCollection, ComptimeRef } from "../expr";
|
|
|
4
4
|
import type { FunctionValue } from "../function-value";
|
|
5
5
|
import type { Token } from "../token";
|
|
6
6
|
import type { FunctionType, TraitType, Type } from "../types/definitions";
|
|
7
|
-
import type {
|
|
7
|
+
import type { StructValue, TraitValue, Value } from "../value";
|
|
8
8
|
export interface FunctionEvaluationContext {
|
|
9
9
|
kind: "function-body";
|
|
10
10
|
type: FunctionType;
|
|
@@ -12,7 +12,7 @@ export interface FunctionEvaluationContext {
|
|
|
12
12
|
evaluationEnv: Environment;
|
|
13
13
|
}
|
|
14
14
|
export type LoadModuleFn = (modulePath: string) => {
|
|
15
|
-
moduleValue:
|
|
15
|
+
moduleValue: StructValue;
|
|
16
16
|
moduleError: Error | undefined;
|
|
17
17
|
};
|
|
18
18
|
export type EvaluateExpressionFn = ({ expr, env, context, }: {
|
|
@@ -45,11 +45,10 @@ export interface EvaluatorContext {
|
|
|
45
45
|
};
|
|
46
46
|
SelfType?: Type;
|
|
47
47
|
SelfTraitType?: Type;
|
|
48
|
-
SelfModuleType?: Type;
|
|
49
48
|
ReceiverType?: Type;
|
|
50
49
|
isEvaluatingFunctionType?: boolean;
|
|
51
50
|
loadModule?: (modulePath: string) => {
|
|
52
|
-
moduleValue:
|
|
51
|
+
moduleValue: StructValue;
|
|
53
52
|
moduleError: Error | undefined;
|
|
54
53
|
};
|
|
55
54
|
stdPath: string;
|
|
@@ -122,8 +121,8 @@ export interface TypeCallResult {
|
|
|
122
121
|
runtimeArgExprsInOrder: Expr[];
|
|
123
122
|
callerEnv: Environment;
|
|
124
123
|
}
|
|
125
|
-
export interface
|
|
126
|
-
moduleValue:
|
|
124
|
+
export interface RecordTypeCallResult {
|
|
125
|
+
moduleValue: StructValue;
|
|
127
126
|
callerEnv: Environment;
|
|
128
127
|
}
|
|
129
128
|
export interface TraitTypeCallResult {
|
|
@@ -174,8 +173,8 @@ export interface FunctionToCall {
|
|
|
174
173
|
} | {
|
|
175
174
|
kind: "closure-type";
|
|
176
175
|
} | {
|
|
177
|
-
kind: "
|
|
178
|
-
result:
|
|
176
|
+
kind: "record-type";
|
|
177
|
+
result: RecordTypeCallResult;
|
|
179
178
|
} | {
|
|
180
179
|
kind: "trait-type";
|
|
181
180
|
result: TraitTypeCallResult;
|
|
@@ -201,7 +200,7 @@ export interface FunctionToCall {
|
|
|
201
200
|
}
|
|
202
201
|
export declare function getFunctionCallResult(functionToCall: FunctionToCall): FunctionCallResult;
|
|
203
202
|
export declare function getTypeCallResult(functionToCall: FunctionToCall): TypeCallResult;
|
|
204
|
-
export declare function
|
|
203
|
+
export declare function getRecordTypeCallResult(functionToCall: FunctionToCall): RecordTypeCallResult;
|
|
205
204
|
export declare function getTraitTypeCallResult(functionToCall: FunctionToCall): TraitTypeCallResult;
|
|
206
205
|
export declare function getIndexCallResult(functionToCall: FunctionToCall): IndexCallResult;
|
|
207
206
|
export declare function getPointerTypeCallResult(functionToCall: FunctionToCall): PointerTypeCallResult;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { type Environment } from "../env";
|
|
2
2
|
import type { Expr } from "../expr";
|
|
3
3
|
import { type Token } from "../token";
|
|
4
|
-
import type {
|
|
4
|
+
import type { StructValue } from "../value";
|
|
5
5
|
import type { LoadModuleFn } from "./context";
|
|
6
6
|
import { clearAllGlobalImplState, clearGenericImplsFromModule, clearImplsFromModule } from "./values/impl";
|
|
7
7
|
export { clearAllGlobalImplState, clearGenericImplsFromModule, clearImplsFromModule, };
|
|
@@ -22,12 +22,12 @@ export default class Evaluator {
|
|
|
22
22
|
loadModule: LoadModuleFn;
|
|
23
23
|
inputString?: string;
|
|
24
24
|
allowPartialModule?: boolean;
|
|
25
|
-
registerPartialModule?: (mv:
|
|
25
|
+
registerPartialModule?: (mv: StructValue) => void;
|
|
26
26
|
});
|
|
27
27
|
getProgram(): Expr[];
|
|
28
28
|
getTokens(): Token[];
|
|
29
29
|
private evaluateProgram;
|
|
30
|
-
getModuleValue():
|
|
30
|
+
getModuleValue(): StructValue;
|
|
31
31
|
getModuleError(): Error | undefined;
|
|
32
32
|
getEnv(): Environment;
|
|
33
33
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { Environment } from "../../env";
|
|
2
|
+
import { type Expr } from "../../expr";
|
|
3
|
+
import type { TypeField } from "../../types/definitions";
|
|
4
|
+
import type { EvaluatorContext } from "../context";
|
|
5
|
+
export declare function evaluateRecordField({ expr, recordFieldIndex, env, context, isForEvaluatingRecordType, }: {
|
|
6
|
+
expr: Expr;
|
|
7
|
+
recordFieldIndex: number;
|
|
8
|
+
env: Environment;
|
|
9
|
+
context: EvaluatorContext;
|
|
10
|
+
isForEvaluatingRecordType: boolean;
|
|
11
|
+
}): {
|
|
12
|
+
field: TypeField;
|
|
13
|
+
env: Environment;
|
|
14
|
+
};
|
|
@@ -1,3 +1,3 @@
|
|
|
1
1
|
import type { Token } from "../../token";
|
|
2
|
-
import type {
|
|
3
|
-
export declare function validateDisposeFunction(moduleElement:
|
|
2
|
+
import type { TypeField } from "../../types/definitions";
|
|
3
|
+
export declare function validateDisposeFunction(moduleElement: TypeField, token: Token): void;
|
|
@@ -1,17 +1,17 @@
|
|
|
1
1
|
import { type Environment } from "../../env";
|
|
2
2
|
import { type Expr } from "../../expr";
|
|
3
|
-
import type {
|
|
4
|
-
import type {
|
|
3
|
+
import type { SourceNamespaceType } from "../../types/definitions";
|
|
4
|
+
import type { StructValue } from "../../value";
|
|
5
5
|
import type { EvaluatorContext } from "../context";
|
|
6
6
|
export declare function evaluateAnonymousModuleBeginExprs({ beginExprs, env, context, allowPartialModule, registerPartialModule, }: {
|
|
7
7
|
beginExprs: Expr[];
|
|
8
8
|
env: Environment;
|
|
9
9
|
context: EvaluatorContext;
|
|
10
10
|
allowPartialModule?: boolean;
|
|
11
|
-
registerPartialModule?: (mv:
|
|
11
|
+
registerPartialModule?: (mv: StructValue) => void;
|
|
12
12
|
}): {
|
|
13
|
-
moduleValue:
|
|
14
|
-
|
|
13
|
+
moduleValue: StructValue;
|
|
14
|
+
sourceNamespaceType: SourceNamespaceType;
|
|
15
15
|
env: Environment;
|
|
16
16
|
partialModuleError?: Error;
|
|
17
17
|
};
|
|
@@ -85,7 +85,7 @@ export declare function findMethodFromGenericImplForTrait({ concreteType, traitT
|
|
|
85
85
|
} | undefined;
|
|
86
86
|
export declare function clearImplsFromModule(modulePath: string): void;
|
|
87
87
|
export declare function snapshotAllImplTraitFields(): Map<TraitType, TraitField[]>;
|
|
88
|
-
export declare function
|
|
88
|
+
export declare function evaluateImplBlock({ expr, env, context, }: {
|
|
89
89
|
expr: FnCallExpr;
|
|
90
90
|
env: Environment;
|
|
91
91
|
context: EvaluatorContext;
|
package/out/types/src/expr.d.ts
CHANGED
|
@@ -4,7 +4,7 @@ import type { EvaluatorContext } from "./evaluator/context";
|
|
|
4
4
|
import type { EffectAnalysisResult } from "./evaluator/effects/effect-analysis-types";
|
|
5
5
|
import { type Token } from "./token";
|
|
6
6
|
import type { FunctionType, StructType, Type } from "./types/definitions";
|
|
7
|
-
import { type ArrayValue, type ComptimeListValue, type StructValue, type
|
|
7
|
+
import { type ArrayValue, type ComptimeListValue, type StructValue, type TraitValue, type TupleValue, type Value } from "./value";
|
|
8
8
|
import { ValueTag } from "./value-tag";
|
|
9
9
|
export type Path = string[];
|
|
10
10
|
export type PathCollection = Path[];
|
|
@@ -140,12 +140,10 @@ export declare const BuiltinKeywords: {
|
|
|
140
140
|
newtype: string[];
|
|
141
141
|
enum: string[];
|
|
142
142
|
union: string[];
|
|
143
|
-
module: string[];
|
|
144
143
|
trait: string[];
|
|
145
144
|
impl: string[];
|
|
146
145
|
Impl: string[];
|
|
147
146
|
begin: string[];
|
|
148
|
-
module_begin: string[];
|
|
149
147
|
import: string[];
|
|
150
148
|
export: string[];
|
|
151
149
|
open: string[];
|
|
@@ -174,7 +172,6 @@ export declare const BuiltinKeywords: {
|
|
|
174
172
|
Future: string[];
|
|
175
173
|
Concrete: string[];
|
|
176
174
|
Type: string[];
|
|
177
|
-
Module: string[];
|
|
178
175
|
Trait: string[];
|
|
179
176
|
ComptimeList: string[];
|
|
180
177
|
tuple: string[];
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
export interface FormatYoFilesOptions {
|
|
2
|
+
check?: boolean;
|
|
3
|
+
cwd?: string;
|
|
4
|
+
}
|
|
5
|
+
export interface FormatYoFilesResult {
|
|
6
|
+
files: string[];
|
|
7
|
+
changed: string[];
|
|
8
|
+
}
|
|
9
|
+
export declare function formatYoSource(input: string, modulePath?: string): string;
|
|
10
|
+
export declare function findYoFormatFiles(inputPaths: string[], cwd?: string): string[];
|
|
11
|
+
export declare function formatYoFiles(inputPaths: string[], options?: FormatYoFilesOptions): FormatYoFilesResult;
|
|
@@ -33,7 +33,7 @@ export type FunctionValue = {
|
|
|
33
33
|
isControlFunction?: boolean;
|
|
34
34
|
definitionSiteEnclosingFunctionType?: FunctionType;
|
|
35
35
|
closureInfo?: ClosureInfo;
|
|
36
|
-
|
|
36
|
+
isEffectRecordMember?: boolean;
|
|
37
37
|
isIoAsyncStateMachineClosure?: boolean;
|
|
38
38
|
deriveRule?: FunctionValue;
|
|
39
39
|
};
|
|
@@ -14,7 +14,7 @@ export declare class LspDocumentManager {
|
|
|
14
14
|
attachToDocuments(documents: TextDocuments<TextDocument>, onDiagnostics: (uri: string) => void): void;
|
|
15
15
|
analyzeDocument(document: TextDocument, onDiagnostics: (uri: string) => void): void;
|
|
16
16
|
getModule(uri: string): {
|
|
17
|
-
moduleValue: import("../value").
|
|
17
|
+
moduleValue: import("../value").StructValue;
|
|
18
18
|
moduleError: Error | undefined;
|
|
19
19
|
evaluator: import("../evaluator").default;
|
|
20
20
|
} | undefined;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import Evaluator from "./evaluator/index";
|
|
2
|
-
import type {
|
|
2
|
+
import type { StructValue } from "./value";
|
|
3
3
|
export declare class ModuleManager {
|
|
4
4
|
modules: Map<string, {
|
|
5
|
-
moduleValue:
|
|
5
|
+
moduleValue: StructValue;
|
|
6
6
|
moduleError: Error | undefined;
|
|
7
7
|
evaluator: Evaluator;
|
|
8
8
|
}>;
|
|
@@ -25,7 +25,7 @@ export declare class ModuleManager {
|
|
|
25
25
|
private clearDependencies;
|
|
26
26
|
resetAllState(): void;
|
|
27
27
|
loadModule(modulePath: string, inputString?: string, parentModule?: string): {
|
|
28
|
-
moduleValue:
|
|
28
|
+
moduleValue: StructValue;
|
|
29
29
|
moduleError: Error | undefined;
|
|
30
30
|
};
|
|
31
31
|
deleteModule(modulePath: string): void;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -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, EffectsRowType, EnumType, FnTraitType, FunctionForallParameter, FunctionImplicitParameter, FunctionParameter, FunctionParameterExprs, FunctionReturn, FunctionType, FutureTraitType, IsoType,
|
|
6
|
+
import type { ArrayType, ComptimeListType, DynType, EffectsRowType, EnumType, FnTraitType, FunctionForallParameter, FunctionImplicitParameter, FunctionParameter, FunctionParameterExprs, 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;
|
|
@@ -41,11 +41,11 @@ export declare function createStrType(env: Environment): Type;
|
|
|
41
41
|
export declare function createVoidType(): VoidType;
|
|
42
42
|
export declare function createTupleType(fields: TypeField[]): TupleType;
|
|
43
43
|
export declare function createStructType(env: Environment, isReferenceSemantics?: boolean, isNewtype?: boolean, isAtomicRc?: boolean): StructType;
|
|
44
|
-
export declare function
|
|
44
|
+
export declare function createSourceNamespaceType(env: Environment): SourceNamespaceType;
|
|
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, implicitParameters, variadicParameter, whereClauseExprs, return_, env, parametersFrame, SelfType, SelfTraitType,
|
|
48
|
+
export declare function createFunctionType({ parameters, forallParameters, implicitParameters, variadicParameter, whereClauseExprs, return_, env, parametersFrame, SelfType, SelfTraitType, isClosure, }: {
|
|
49
49
|
parameters: FunctionParameter[];
|
|
50
50
|
forallParameters: FunctionForallParameter[];
|
|
51
51
|
implicitParameters?: FunctionImplicitParameter[];
|
|
@@ -56,7 +56,6 @@ export declare function createFunctionType({ parameters, forallParameters, impli
|
|
|
56
56
|
parametersFrame: Frame;
|
|
57
57
|
SelfType?: Type;
|
|
58
58
|
SelfTraitType?: Type;
|
|
59
|
-
SelfModuleType?: Type;
|
|
60
59
|
isClosure?: boolean;
|
|
61
60
|
}): FunctionType;
|
|
62
61
|
export declare function createPtrType(childType: Type): PtrType;
|
|
@@ -93,10 +93,12 @@ export type FieldExprs = {
|
|
|
93
93
|
export interface TypeField {
|
|
94
94
|
type: Type;
|
|
95
95
|
label: string;
|
|
96
|
+
isCompileTimeOnly?: boolean;
|
|
96
97
|
defaultValue?: Value;
|
|
97
98
|
assignedValue?: Value;
|
|
98
99
|
exprs: FieldExprs;
|
|
99
100
|
isEffectParam?: boolean;
|
|
101
|
+
sourceModulePath?: string;
|
|
100
102
|
docComment?: string;
|
|
101
103
|
}
|
|
102
104
|
export interface TupleType extends Type {
|
|
@@ -135,30 +137,18 @@ export interface StructType extends Type {
|
|
|
135
137
|
isReferenceSemantics: boolean;
|
|
136
138
|
isAtomicRc?: boolean;
|
|
137
139
|
isNewtype: boolean;
|
|
140
|
+
isSourceNamespace?: true;
|
|
138
141
|
functionValue?: FunctionValue;
|
|
139
142
|
fields: TypeField[];
|
|
140
143
|
trait: TraitType;
|
|
141
144
|
env: Environment;
|
|
142
145
|
}
|
|
143
|
-
export interface
|
|
144
|
-
type: Type;
|
|
145
|
-
label: string;
|
|
146
|
-
sourceModulePath?: string;
|
|
147
|
-
defaultValue?: Value;
|
|
148
|
-
assignedValue?: Value;
|
|
149
|
-
exprs: FieldExprs;
|
|
150
|
-
docComment?: string;
|
|
151
|
-
}
|
|
152
|
-
export interface TraitField extends ModuleField {
|
|
146
|
+
export interface TraitField extends TypeField {
|
|
153
147
|
unassignedSomeType?: SomeType;
|
|
154
148
|
}
|
|
155
|
-
export
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
fields: ModuleField[];
|
|
159
|
-
trait: undefined;
|
|
160
|
-
env: Environment;
|
|
161
|
-
}
|
|
149
|
+
export type SourceNamespaceType = StructType & {
|
|
150
|
+
isSourceNamespace: true;
|
|
151
|
+
};
|
|
162
152
|
export interface TraitType extends Type {
|
|
163
153
|
tag: TypeTag.Trait;
|
|
164
154
|
functionValue?: FunctionValue;
|
|
@@ -197,7 +187,7 @@ export type FutureTraitType = TraitType & {
|
|
|
197
187
|
effects: FunctionImplicitParameter[];
|
|
198
188
|
};
|
|
199
189
|
};
|
|
200
|
-
export type
|
|
190
|
+
export type ConcreteTraitType = TraitType & {
|
|
201
191
|
isConcrete: {
|
|
202
192
|
concreteType: Type;
|
|
203
193
|
};
|
|
@@ -245,7 +235,6 @@ export interface FunctionType extends Type {
|
|
|
245
235
|
parametersFrame: Frame;
|
|
246
236
|
SelfType?: Type;
|
|
247
237
|
SelfTraitType?: Type;
|
|
248
|
-
SelfModuleType?: Type;
|
|
249
238
|
trait: TraitType;
|
|
250
239
|
isClosure?: boolean;
|
|
251
240
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { FunctionValue } from "../function-value";
|
|
2
|
-
import type { ArrayType, ComptimeListType,
|
|
2
|
+
import type { ArrayType, ComptimeListType, ConcreteTraitType, DynType, EffectsRowType, 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;
|
|
@@ -37,7 +37,7 @@ export declare function isAtomicObjectType(type?: Type): type is StructType & {
|
|
|
37
37
|
export declare function isNewtypeType(type?: Type): type is StructType & {
|
|
38
38
|
isNewtype: true;
|
|
39
39
|
};
|
|
40
|
-
export declare function
|
|
40
|
+
export declare function isSourceNamespaceType(type?: Type): type is SourceNamespaceType;
|
|
41
41
|
export declare function isTraitType(type?: Type): type is TraitType;
|
|
42
42
|
export declare function isFnTraitType(type?: Type): type is FnTraitType;
|
|
43
43
|
export declare function isFunctionType(type?: Type): type is FunctionType;
|
|
@@ -68,7 +68,7 @@ export declare function isULongLongType(type?: Type): boolean;
|
|
|
68
68
|
export declare function isLongDoubleType(type?: Type): boolean;
|
|
69
69
|
export declare function isVoidType(type?: Type): type is VoidType;
|
|
70
70
|
export declare function isFutureTraitType(type?: Type): type is FutureTraitType;
|
|
71
|
-
export declare function isConcreteTraitType(type?: Type): type is
|
|
71
|
+
export declare function isConcreteTraitType(type?: Type): type is ConcreteTraitType;
|
|
72
72
|
export declare function isCCompatibleType(type?: Type): boolean;
|
|
73
73
|
export declare function isFunctionTypeGeneric(functionType: FunctionType): boolean;
|
|
74
74
|
export declare function isFunctionTypeHardGeneric(functionType: FunctionType): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import type { Environment } from "../env";
|
|
2
2
|
import { type Expr } from "../expr";
|
|
3
3
|
import { type Token } from "../token";
|
|
4
|
-
import type { FunctionParameter, SomeType, Type
|
|
4
|
+
import type { FunctionParameter, TypeField, SomeType, Type } from "./definitions";
|
|
5
5
|
export declare function typeRequiresComptimeModifier(type: Type | undefined, env: Environment): boolean;
|
|
6
6
|
export declare function typeProhibitsComptimeModifier(type: Type | undefined, env: Environment): boolean;
|
|
7
7
|
export declare function isComptimeOnlyType(type: Type, env: Environment): boolean;
|
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,
|
|
6
|
+
import type { ArrayType, ComptimeListType, EnumType, ExprType, PtrType, SliceType, 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 = {
|
|
@@ -29,7 +29,9 @@ export type TupleValue = {
|
|
|
29
29
|
export type StructValue = {
|
|
30
30
|
tag: ValueTag.Struct;
|
|
31
31
|
type: StructType;
|
|
32
|
-
fields: Value[];
|
|
32
|
+
fields: (Value | undefined)[];
|
|
33
|
+
moduleLevelInitExprs?: Expr[];
|
|
34
|
+
isLoading?: boolean;
|
|
33
35
|
};
|
|
34
36
|
export type EnumValue = {
|
|
35
37
|
tag: ValueTag.Enum;
|
|
@@ -37,13 +39,6 @@ export type EnumValue = {
|
|
|
37
39
|
variantName: string;
|
|
38
40
|
fields: Value[];
|
|
39
41
|
};
|
|
40
|
-
export type ModuleValue = {
|
|
41
|
-
tag: ValueTag.Module;
|
|
42
|
-
type: ModuleType;
|
|
43
|
-
fields: (Value | undefined)[];
|
|
44
|
-
moduleLevelInitExprs?: Expr[];
|
|
45
|
-
isLoading?: boolean;
|
|
46
|
-
};
|
|
47
42
|
export type TraitValue = {
|
|
48
43
|
tag: ValueTag.Trait;
|
|
49
44
|
type: TraitType;
|
|
@@ -83,7 +78,7 @@ export type PtrValue = {
|
|
|
83
78
|
targetValue: [Value];
|
|
84
79
|
targetIndex: number;
|
|
85
80
|
};
|
|
86
|
-
export type Value = TypeValue | ComptimeStringValue | ComptimeListValue | NumberValue | UnitValue | BooleanValue | ArrayValue | SliceValue | TupleValue | StructValue | EnumValue |
|
|
81
|
+
export type Value = TypeValue | ComptimeStringValue | ComptimeListValue | NumberValue | UnitValue | BooleanValue | ArrayValue | SliceValue | TupleValue | StructValue | EnumValue | TraitValue | FunctionValue | ExprValue | UnknownValue | PtrValue;
|
|
87
82
|
export declare function valueToString(value?: Value): string;
|
|
88
83
|
export declare function isTypeValue(value?: Value): value is TypeValue;
|
|
89
84
|
export declare function isComptimeIntValue(value?: Value): value is NumberValue;
|
|
@@ -100,7 +95,6 @@ export declare function isStructValue(value?: Value): value is StructValue;
|
|
|
100
95
|
export declare function isArrayValue(value?: Value): value is ArrayValue;
|
|
101
96
|
export declare function isSliceValue(value?: Value): value is SliceValue;
|
|
102
97
|
export declare function isEnumValue(value?: Value): value is EnumValue;
|
|
103
|
-
export declare function isModuleValue(value?: Value): value is ModuleValue;
|
|
104
98
|
export declare function isTraitValue(value?: Value): value is TraitValue;
|
|
105
99
|
export declare function isPtrValue(value?: Value): value is PtrValue;
|
|
106
100
|
export declare function isRegionValue(_value?: Value): boolean;
|
|
@@ -125,8 +119,7 @@ export declare function createUnknownValue(type: Type, { variableName, recursive
|
|
|
125
119
|
env: Environment;
|
|
126
120
|
context: EvaluatorContext;
|
|
127
121
|
}): UnknownValue | TypeValue;
|
|
128
|
-
export declare function createStructValue(type: StructType, fields: Value[]): StructValue;
|
|
129
|
-
export declare function createModuleValue(type: ModuleType, fields: (Value | undefined)[], moduleLevelInitExprs?: Expr[]): ModuleValue;
|
|
122
|
+
export declare function createStructValue(type: StructType, fields: (Value | undefined)[], moduleLevelInitExprs?: Expr[]): StructValue;
|
|
130
123
|
export declare function createTraitValue(type: TraitType, fields: (Value | undefined)[]): TraitValue;
|
|
131
124
|
export declare function createTupleValue(type: TupleType, fields: Value[]): TupleValue;
|
|
132
125
|
export declare function createEnumValue(type: EnumType, variantName: string, fields: Value[]): EnumValue;
|