@shd101wyy/yo 0.1.8 → 0.1.9

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.
@@ -31,3 +31,8 @@ export declare function evaluateYoComptimeListElementType({ expr, env, context,
31
31
  env: Environment;
32
32
  context: EvaluatorContext;
33
33
  }): FnCallExpr;
34
+ export declare function evaluateYoComptimeListGet({ expr, env, context, }: {
35
+ expr: FnCallExpr;
36
+ env: Environment;
37
+ context: EvaluatorContext;
38
+ }): FnCallExpr;
@@ -0,0 +1,8 @@
1
+ import type { Environment } from "../../env";
2
+ import { type FnCallExpr } from "../../expr";
3
+ import type { EvaluatorContext } from "../context";
4
+ export declare function evaluateDeriveRule({ expr, env, context, }: {
5
+ expr: FnCallExpr;
6
+ env: Environment;
7
+ context: EvaluatorContext;
8
+ }): FnCallExpr;
@@ -0,0 +1,8 @@
1
+ import type { Environment } from "../../env";
2
+ import { type FnCallExpr } from "../../expr";
3
+ import type { EvaluatorContext } from "../context";
4
+ export declare function evaluateDerive({ expr, env, context, }: {
5
+ expr: FnCallExpr;
6
+ env: Environment;
7
+ context: EvaluatorContext;
8
+ }): FnCallExpr;
@@ -11,6 +11,11 @@ export declare function evaluateYoAreTypesCompatible({ expr, env, context, }: {
11
11
  env: Environment;
12
12
  context: EvaluatorContext;
13
13
  }): FnCallExpr;
14
+ export declare function evaluateYoAreTypesEqual({ expr, env, context, }: {
15
+ expr: FnCallExpr;
16
+ env: Environment;
17
+ context: EvaluatorContext;
18
+ }): FnCallExpr;
14
19
  export declare function evaluateYoTypeContainsRcType({ expr, env, context, }: {
15
20
  expr: FnCallExpr;
16
21
  env: Environment;
@@ -26,3 +31,28 @@ export declare function evaluateYoTypeImpls({ expr, env, context, }: {
26
31
  env: Environment;
27
32
  context: EvaluatorContext;
28
33
  }): FnCallExpr;
34
+ export declare function evaluateYoTypeGetInfo({ expr, env, context, }: {
35
+ expr: FnCallExpr;
36
+ env: Environment;
37
+ context: EvaluatorContext;
38
+ }): FnCallExpr;
39
+ export declare function evaluateComptimeEval({ expr, env, context, }: {
40
+ expr: FnCallExpr;
41
+ env: Environment;
42
+ context: EvaluatorContext;
43
+ }): FnCallExpr;
44
+ export declare function evaluateComptimeStringToExpr({ expr, env, context, }: {
45
+ expr: FnCallExpr;
46
+ env: Environment;
47
+ context: EvaluatorContext;
48
+ }): FnCallExpr;
49
+ export declare function evaluateTypeJoinFields({ expr, env, context, }: {
50
+ expr: FnCallExpr;
51
+ env: Environment;
52
+ context: EvaluatorContext;
53
+ }): FnCallExpr;
54
+ export declare function evaluateTypeMapVariants({ expr, env, context, }: {
55
+ expr: FnCallExpr;
56
+ env: Environment;
57
+ context: EvaluatorContext;
58
+ }): FnCallExpr;
@@ -16,4 +16,5 @@ export declare function evaluateComptimeFunctionCall({ functionCalleeExpr, funct
16
16
  value: Value;
17
17
  callerEnv: Environment;
18
18
  calleeEnv: Environment;
19
+ comptimeRef?: import("../../expr").ComptimeRef;
19
20
  };
@@ -1,10 +1,12 @@
1
1
  import type { Environment } from "../../env";
2
2
  import { type Expr, type FnCallExpr } from "../../expr";
3
3
  import type { Type } from "../../types/definitions";
4
+ import type { Value } from "../../value";
4
5
  import type { EvaluatorContext, IndexCallResult } from "../context";
5
- export declare function tryToCallWithIndexTrait({ expr, valueType, argExprs, callerEnv, context, }: {
6
+ export declare function tryToCallWithIndexTrait({ expr, valueType, selfValue, argExprs, callerEnv, context, }: {
6
7
  expr: FnCallExpr;
7
8
  valueType: Type;
9
+ selfValue?: Value;
8
10
  argExprs: Expr[];
9
11
  callerEnv: Environment;
10
12
  context: EvaluatorContext;
@@ -1,10 +1,10 @@
1
1
  import type { Environment } from "../env";
2
2
  import { YoError } from "../error";
3
- import type { Expr, FnCallExpr, PathCollection } from "../expr";
3
+ 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 { ArrayValue, ModuleValue, TraitValue, Value } from "../value";
7
+ import type { ModuleValue, TraitValue, Value } from "../value";
8
8
  export interface FunctionEvaluationContext {
9
9
  kind: "function-body";
10
10
  type: FunctionType;
@@ -141,10 +141,7 @@ export interface IndexCallResult {
141
141
  indexMethodValue: Value | undefined;
142
142
  callerEnv: Environment;
143
143
  index?: number;
144
- arrayElementRef?: {
145
- arrayValue: ArrayValue;
146
- index: number;
147
- };
144
+ comptimeRef?: ComptimeRef;
148
145
  }
149
146
  export interface FunctionToCall {
150
147
  type: Type;
@@ -4,10 +4,27 @@ 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 TraitValue, type Value } from "./value";
7
+ import { type ArrayValue, type ComptimeListValue, type StructValue, type TupleValue, type TraitValue, type Value } from "./value";
8
8
  import { ValueTag } from "./value-tag";
9
9
  export type Path = string[];
10
10
  export type PathCollection = Path[];
11
+ export type ComptimeRef = {
12
+ kind: "array";
13
+ arrayValue: ArrayValue;
14
+ index: number;
15
+ } | {
16
+ kind: "comptime_list";
17
+ listValue: ComptimeListValue;
18
+ index: number;
19
+ } | {
20
+ kind: "struct";
21
+ structValue: StructValue;
22
+ fieldIndex: number;
23
+ } | {
24
+ kind: "tuple";
25
+ tupleValue: TupleValue;
26
+ fieldIndex: number;
27
+ };
11
28
  export declare function pathContainsPath(path1: Path, path2: Path): boolean;
12
29
  export declare function pathCollectionConflictsWithPathCollection(collection1: PathCollection, collection2: PathCollection): boolean;
13
30
  export declare function pathConflictsWithPath(path1: Path, path2: Path): boolean;
@@ -63,10 +80,7 @@ export interface EvaluatedExprData {
63
80
  poppedEnvFrame?: Frame;
64
81
  originalExpr?: Expr;
65
82
  sourceVariable?: Variable;
66
- arrayElementRef?: {
67
- arrayValue: ArrayValue;
68
- index: number;
69
- };
83
+ comptimeRef?: ComptimeRef;
70
84
  indexTraitPtrType?: Type;
71
85
  indexMethodType?: FunctionType;
72
86
  indexMethodValue?: Value;
@@ -225,6 +239,10 @@ export declare const BuiltinFunctions: {
225
239
  __yo_comptime_list_append: string[];
226
240
  __yo_comptime_list_length: string[];
227
241
  __yo_comptime_list_element_type: string[];
242
+ __yo_comptime_list_get: string[];
243
+ __yo_comptime_list_index: string[];
244
+ __yo_comptime_list_index_range: string[];
245
+ __yo_comptime_list_index_range_inclusive: string[];
228
246
  __yo_comptime_int_add: string[];
229
247
  __yo_comptime_int_sub: string[];
230
248
  __yo_comptime_int_mul: string[];
@@ -494,7 +512,15 @@ export declare const BuiltinFunctions: {
494
512
  __yo_type_contains_rc_type: string[];
495
513
  __yo_type_can_form_rc_cycle: string[];
496
514
  __yo_are_types_compatible: string[];
515
+ __yo_are_types_equal: string[];
497
516
  __yo_type_impls: string[];
517
+ __yo_type_get_info: string[];
518
+ comptime_eval: string[];
519
+ derive: string[];
520
+ derive_rule: string[];
521
+ __yo_comptime_string_to_expr: string[];
522
+ __yo_type_join_fields: string[];
523
+ __yo_type_map_variants: string[];
498
524
  __yo_var_print_info: string[];
499
525
  __yo_var_is_owning_the_rc_value: string[];
500
526
  __yo_var_has_other_aliases: string[];
@@ -35,6 +35,7 @@ export type FunctionValue = {
35
35
  closureInfo?: ClosureInfo;
36
36
  isModuleEffectMember?: boolean;
37
37
  isIoAsyncStateMachineClosure?: boolean;
38
+ deriveRule?: FunctionValue;
38
39
  };
39
40
  export interface FunctionCapturedVariableInfo extends CapturedVariableInfo {
40
41
  value: Value | undefined;
@@ -33,3 +33,4 @@ export default class Parser {
33
33
  getTokens(): Token[];
34
34
  }
35
35
  export declare function generateExprFromCode(code: string): Expr;
36
+ export declare function generateExprsFromCode(code: string): Expr[];
@@ -181,6 +181,7 @@ export interface TraitType extends Type {
181
181
  label: string;
182
182
  constraintType: Type;
183
183
  }[];
184
+ deriveRule?: FunctionValue;
184
185
  }
185
186
  export type FnTraitType = TraitType & {
186
187
  isFn: {