@shd101wyy/yo 0.1.31 → 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.
@@ -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;
@@ -0,0 +1,35 @@
1
+ import type { Environment } from "../../env";
2
+ import { type Expr, type FnCallExpr } from "../../expr";
3
+ import type { FunctionType } from "../../types/definitions";
4
+ import type { EvaluatorContext } from "../context";
5
+ export declare function evaluateRequires(args: {
6
+ expr: FnCallExpr;
7
+ env: Environment;
8
+ context: EvaluatorContext;
9
+ }): FnCallExpr;
10
+ export declare function evaluateEnsures(args: {
11
+ expr: FnCallExpr;
12
+ env: Environment;
13
+ context: EvaluatorContext;
14
+ }): FnCallExpr;
15
+ export declare function evaluateInvariant(args: {
16
+ expr: FnCallExpr;
17
+ env: Environment;
18
+ context: EvaluatorContext;
19
+ }): FnCallExpr;
20
+ export declare function evaluateGhost(args: {
21
+ expr: FnCallExpr;
22
+ env: Environment;
23
+ context: EvaluatorContext;
24
+ }): FnCallExpr;
25
+ export declare function evaluateGhostFn({ expr, env, context, }: {
26
+ expr: FnCallExpr;
27
+ env: Environment;
28
+ context: EvaluatorContext;
29
+ }): FnCallExpr;
30
+ export declare function evaluateOld({ expr, env, context, }: {
31
+ expr: FnCallExpr;
32
+ env: Environment;
33
+ context: EvaluatorContext;
34
+ }): FnCallExpr;
35
+ export declare function wrapFunctionBodyWithContracts(body: Expr, fnType: FunctionType): Expr;
@@ -1,4 +1,4 @@
1
- export type PragmaKind = "AllowUnsafe" | "SkipPrelude" | "SkipWasm" | "SkipWasm32Emscripten" | "SkipWasm32Wasi";
1
+ export type PragmaKind = "AllowUnsafe" | "SkipPrelude" | "SkipWasm" | "SkipWasm32Emscripten" | "SkipWasm32Wasi" | "Verify" | "VerifyOrAssert" | "NoContracts";
2
2
  export declare function registerFilePragma(modulePath: string, kind: PragmaKind): void;
3
3
  export declare function fileHasPragma(modulePath: string | undefined, kind: PragmaKind): boolean;
4
4
  export declare function _clearPragmaRegistry(): void;
@@ -3,4 +3,5 @@ export declare function isFlowableExpr(expr: Expr, options?: {
3
3
  allowSameFrameLocal?: boolean;
4
4
  allowParameterSource?: boolean;
5
5
  allowComptimeSource?: boolean;
6
+ maxLocalFrameLevel?: number;
6
7
  }): boolean;
@@ -34,6 +34,8 @@ export declare function evaluateFunctionParameters({ parameterExprs, env, contex
34
34
  forallParameters: FunctionParameter[];
35
35
  variadicParameter?: FunctionParameter;
36
36
  whereClauseExprs?: Expr[];
37
+ requiresExprs?: Expr[];
38
+ ensuresExprs?: Expr[];
37
39
  env: Environment;
38
40
  };
39
41
  export declare function evaluateFunctionType({ expr, env, context, }: {
@@ -602,6 +602,12 @@ export declare const BuiltinFunctions: {
602
602
  __yo_build_doc: string[];
603
603
  asm: string[];
604
604
  global_asm: string[];
605
+ requires: string[];
606
+ ensures: string[];
607
+ invariant: string[];
608
+ ghost: string[];
609
+ ghost_fn: string[];
610
+ old: string[];
605
611
  };
606
612
  export declare function exprIsInfixOperatorFunctionCall(expr: Expr): boolean;
607
613
  export interface ExprToStringConfig {
@@ -45,11 +45,13 @@ 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, variadicParameter, whereClauseExprs, return_, env, parametersFrame, SelfType, SelfTraitType, isClosure, isControl, }: {
48
+ export declare function createFunctionType({ parameters, forallParameters, variadicParameter, whereClauseExprs, requiresExprs, ensuresExprs, return_, env, parametersFrame, SelfType, SelfTraitType, isClosure, isControl, }: {
49
49
  parameters: FunctionParameter[];
50
50
  forallParameters: FunctionForallParameter[];
51
51
  variadicParameter: FunctionParameter | undefined;
52
52
  whereClauseExprs?: Expr[];
53
+ requiresExprs?: Expr[];
54
+ ensuresExprs?: Expr[];
53
55
  return_: FunctionReturn;
54
56
  env: Environment;
55
57
  parametersFrame: Frame;
@@ -222,6 +222,8 @@ export interface FunctionType extends Type {
222
222
  forallParameters: FunctionForallParameter[];
223
223
  variadicParameter?: FunctionParameter;
224
224
  whereClauseExprs?: Expr[];
225
+ requiresExprs?: Expr[];
226
+ ensuresExprs?: Expr[];
225
227
  return: FunctionReturn;
226
228
  env: Environment;
227
229
  parametersFrame: Frame;