/** * Call expression analysis and detection helpers */ import { IrExpression, IrType } from "@tsonic/frontend"; import { EmitterContext } from "../../types.js"; /** * Ref/out/in parameter handling: * The frontend extracts parameter passing modes from resolved signatures * and attaches them to IrCallExpression.argumentPassing array. * The emitter reads this array and prefixes arguments with ref/out/in keywords. */ /** * Check if an expression is an lvalue (can be passed by reference) * Only identifiers and member accesses are lvalues in C# */ export declare const isLValue: (expr: IrExpression) => boolean; /** * Check if an expression has an `as out`, `as ref`, or `as inref` cast. * Returns the modifier ("out", "ref", "in") or undefined if not a passing modifier cast. * * When TypeScript code has `value as out`, the frontend converts this to * an expression with `inferredType: { kind: "referenceType", name: "out", ... }`. */ export declare const getPassingModifierFromCast: (expr: IrExpression) => "out" | "ref" | "in" | undefined; /** * Check if a member access expression targets System.Text.Json.JsonSerializer */ export declare const isJsonSerializerCall: (callee: IrExpression) => { method: "Serialize" | "Deserialize"; } | null; /** * Check if a call targets global JSON.stringify or JSON.parse * These global JSON methods compile to JsonSerializer */ export declare const isGlobalJsonCall: (callee: IrExpression, context: EmitterContext) => { method: "Serialize" | "Deserialize"; } | null; /** * Determine if a member access is an instance-style access (receiver.value) * vs a static type reference (Type.Member). * * Extension-method lowering only applies to instance-style member accesses. * If the frontend did not attach a receiver type, do not guess. */ export declare const isInstanceMemberAccess: (expr: Extract, context: EmitterContext) => boolean; /** * Whether to emit an extension method call using fluent instance syntax (receiver.Method(...)) * instead of explicit static invocation (Type.Method(receiver, ...)). * * Default: prefer static invocation to avoid relying on `using` directives and to avoid * accidental binding to an instance member when a type has both an instance method and * an extension method with the same name. * * Exception: certain toolchains (notably EF query precompilation) require the *syntax* * of extension-method invocation so the analyzer can locate queries in user code. */ export declare const shouldEmitFluentExtensionCall: (memberBinding: { readonly type: string; readonly member: string; readonly emitSemantics?: { readonly callStyle?: "receiver" | "static"; readonly callableStaticAccessorKind?: "property" | "field"; }; }) => boolean; export declare const getTypeNamespace: (typeName: string) => string | undefined; /** * Register a type with the JSON AOT registry. * Ensures types are fully qualified with namespace for the AOT source generator. */ export declare const registerJsonAotType: (type: IrType | undefined, context: EmitterContext) => void; export declare const registerJsonAotExpressionTypes: (expr: IrExpression | undefined, context: EmitterContext, expectedType?: IrType) => void; /** * Check if a call expression needs an explicit cast because the inferred type * differs from the C# return type. This handles cases like Math.floor() which * returns double in C# but is cast to int in TypeScript via `as int`. */ export declare const needsIntCast: (expr: Extract, calleeName: string) => boolean; export declare const isAsyncWrapperType: (type: IrType | undefined, visited?: Set) => boolean; export declare const isPromiseChainMethod: (name: string) => boolean; //# sourceMappingURL=call-analysis.d.ts.map