@shd101wyy/yo 0.0.25 → 0.0.26

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.
@@ -0,0 +1,3 @@
1
+ import type { FnCallExpr } from "../../expr";
2
+ import type { CodeGenContext } from "../utils";
3
+ export declare function generateDowncast(expr: FnCallExpr, indent: string, context: CodeGenContext): string;
@@ -0,0 +1,3 @@
1
+ import type { FnCallExpr } from "../../expr";
2
+ import type { CodeGenContext } from "../utils";
3
+ export declare function generateTypeId(expr: FnCallExpr, indent: string, context: CodeGenContext): string;
@@ -1,4 +1,5 @@
1
1
  import type { DynType } from "../../types/definitions";
2
2
  import { type CodeGenContext } from "../utils";
3
+ export declare function generateDynForwardDeclarations(context: CodeGenContext): void;
3
4
  export declare function generateDynDeclaration(dynType: DynType, cName: string, context: CodeGenContext): void;
4
5
  export declare function generateDynBoxTypes(context: CodeGenContext): void;
@@ -11,4 +11,4 @@ export declare function generateStructDeclaration(structType: StructType, cName:
11
11
  export declare function generateTupleDeclaration(tupleType: TupleType, cName: string, context: CodeGenContext): void;
12
12
  export declare function generateUnionDeclaration(unionType: UnionType, cName: string, context: CodeGenContext): void;
13
13
  export declare function generateEnumDeclaration(enumType: EnumType, cName: string, context: CodeGenContext): void;
14
- export { generateDynBoxTypes, generateDynDeclaration } from "./dyn";
14
+ export { generateDynBoxTypes, generateDynDeclaration, generateDynForwardDeclarations, } from "./dyn";
@@ -76,6 +76,7 @@ export interface CodeGenContext {
76
76
  currentLoopLabel?: string;
77
77
  currentContinueLabel?: string;
78
78
  insideMatch?: boolean;
79
+ typeIdStatics?: Map<string, string>;
79
80
  }
80
81
  export declare function sanitizeForCIdentifier(str: string, isExternC?: boolean): string;
81
82
  export declare function shouldAvoidConst(type: Type): boolean;
@@ -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 evaluateDowncast({ expr, env, context, }: {
5
+ expr: FnCallExpr;
6
+ env: Environment;
7
+ context: EvaluatorContext;
8
+ }): FnCallExpr;
@@ -1,6 +1,11 @@
1
1
  import { type Environment } from "../../env";
2
2
  import { type Expr, type FnCallExpr } from "../../expr";
3
+ import type { EnumType, Type } from "../../types/definitions";
3
4
  import type { EvaluatorContext } from "../context";
5
+ export declare function createOptionType(innerType: Type, env: Environment, context: EvaluatorContext): {
6
+ optionType: EnumType;
7
+ env: Environment;
8
+ };
4
9
  export declare function evaluateYoDecrRc({ expr, env, context, }: {
5
10
  expr: FnCallExpr;
6
11
  env: Environment;
@@ -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 evaluateTypeId({ expr, env, context, }: {
5
+ expr: FnCallExpr;
6
+ env: Environment;
7
+ context: EvaluatorContext;
8
+ }): FnCallExpr;
@@ -42,6 +42,7 @@ export interface EvaluatorContext {
42
42
  env: Environment;
43
43
  };
44
44
  SelfType?: Type;
45
+ SelfTraitType?: Type;
45
46
  ReceiverType?: Type;
46
47
  isEvaluatingFunctionType?: boolean;
47
48
  loadModule?: (modulePath: string) => {
@@ -171,6 +171,8 @@ export declare const BuiltinFunctions: {
171
171
  typeof: string[];
172
172
  sizeof: string[];
173
173
  alignof: string[];
174
+ typeid: string[];
175
+ downcast: string[];
174
176
  consume: string[];
175
177
  macro_expand: string[];
176
178
  as: string[];
@@ -45,7 +45,7 @@ export declare function createModuleType(env: Environment): ModuleType;
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, isClosure, }: {
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[];
@@ -55,6 +55,7 @@ export declare function createFunctionType({ parameters, forallParameters, impli
55
55
  env: Environment;
56
56
  parametersFrame: Frame;
57
57
  SelfType?: Type;
58
+ SelfTraitType?: Type;
58
59
  isClosure?: boolean;
59
60
  }): FunctionType;
60
61
  export declare function createPtrType(childType: Type): PtrType;
@@ -229,6 +229,7 @@ export interface FunctionType extends Type {
229
229
  env: Environment;
230
230
  parametersFrame: Frame;
231
231
  SelfType?: Type;
232
+ SelfTraitType?: Type;
232
233
  trait: TraitType;
233
234
  isClosure?: boolean;
234
235
  }