UNPKG

@awayfl/avm2

Version:

Virtual machine for executing AS3 code

97 lines 3.77 kB
import { Scope } from './run/Scope'; import { HasNext2Info } from './run/HasNext2Info'; import { Multiname } from './abc/lazy/Multiname'; import { MethodInfo } from './abc/lazy/MethodInfo'; import { AXClass } from './run/AXClass'; import { Bytecode } from './Bytecode'; import { ASObject } from './nat/ASObject'; import { COMPILATION_FAIL_REASON, COMPILER_OPT_FLAGS } from './flags'; import { AXCallable } from './run/AXCallable'; import { ASClass } from './nat/ASClass'; import { AXObject } from './run/AXObject'; import { AXFunction } from './run/AXFunction'; import { ASRegExp } from './nat/ASRegExp'; export declare const BytecodeName: typeof Bytecode; /** * Try resolve method and attach hook to it */ export declare function UNSAFE_attachMethodHook(path: string, place: 'begin' | 'return', hook: Function): void; export interface ICompilerProcess { error?: { message: string; reason: COMPILATION_FAIL_REASON; }; source?: string; compiling?: Promise<Function> | undefined; compiled?: Function; names?: Multiname[]; } export interface ICompilerOptions { scope?: Scope; optimise?: COMPILER_OPT_FLAGS; encrupted?: boolean; } export declare function compile(methodInfo: MethodInfo, options?: ICompilerOptions): ICompilerProcess; export declare class Context { private readonly mi; private readonly savedScope; private readonly names; static REG_EXP_CACHE: Record<string, ASRegExp>; private readonly rn; private readonly sec; private readonly abc; readonly jsGlobal: Object; readonly axCoerceString: Function; readonly axCheckFilter: Function; readonly internNamespace: Function; private domain; readonly emptyArray: any; readonly AX_CLASS_SYMBOL: symbol; static readonly HAS_NEXT_INFO: HasNext2Info; constructor(mi: MethodInfo, savedScope: Scope, names: Multiname[]); get domainMemory(): DataView; getRegExp(args: [string, string?]): any; /** * Coerce returned value to type * @param value */ coerceReturn(value: any): any; createFunction(methodId: number, scope: Scope, hasDynamicScope: boolean, parentMethodId: number): AXFunction; escXElem(value: string): string; escXAttr(value: string): string; /** * Execute JS hook */ executeHook(context: any, name: string): void; /** * Generate static import for builtins */ getTopLevel(mnId: number, name?: string): any; /** * Generate static import of object */ getStaticImportExt(namespace: string, name?: string): any; typeof(object: any): string; call(value: AXCallable, obj: ASObject, pp: any[], scope?: Scope): any; getdefinitionbyname(scope: Scope, _: any, args: any[]): AXClass; getpropertydyn(mn: Multiname | number, obj: ASObject): ASObject; setproperty(mn: Multiname, value: any, obj: AXClass | null): any; deleteproperty(name: string | number | Multiname, obj: AXObject): any; /** * Fast constructor for compile-time knowned external classes, like box2D or nape */ constructExt(ctor: AXClass, args: any[], mn?: Multiname): AXObject; /** * Fast constructor for strictly known non-interactive classes, that not required checks */ constructFast(ctor: AXClass, args: any[], mn?: Multiname): AXObject; /** * Basic constructor for axObjects, slower that any others */ construct(obj: AXClass, pp: any[]): AXObject; constructprop(mn: Multiname, obj: AXClass, pp: any[]): any; pushwith(scope: Scope, obj: AXObject): Scope; hasnext2(obj: AXObject, name: number): [AXObject, number]; runtimename(mn: Multiname, propName: Multiname & ASClass | string, nsName?: string): Multiname; } //# sourceMappingURL=jit.d.ts.map