diff --git a/ui2abc/libarkts/native/src/bridges.cc b/ui2abc/libarkts/native/src/bridges.cc index a4c887e115b344f4d3cce49fb4a40901aa7841d0..e3594d4e07485869a4543cb57e7d44270de528e8 100644 --- a/ui2abc/libarkts/native/src/bridges.cc +++ b/ui2abc/libarkts/native/src/bridges.cc @@ -388,12 +388,30 @@ KNativePointer impl_CreateGlobalContext(KNativePointer configPtr, KStringArray e } KOALA_INTEROP_4(CreateGlobalContext, KNativePointer, KNativePointer, KStringArray, KUInt, KBoolean) -void impl_DestroyGlobalContext(KNativePointer contextPtr) { - auto context = reinterpret_cast(contextPtr); - GetImpl()->DestroyGlobalContext(context); +void impl_DestroyGlobalContext(KNativePointer globalContextPtr) { + auto globalContext = reinterpret_cast(globalContextPtr); + GetImpl()->DestroyGlobalContext(globalContext); } KOALA_INTEROP_V1(DestroyGlobalContext, KNativePointer) +void impl_InvalidateFileCache(KNativePointer globalContextPtr, KStringPtr& fileName) { + auto globalContext = reinterpret_cast(globalContextPtr); + GetImpl()->InvalidateFileCache(globalContext, getStringCopy(fileName)); +} +KOALA_INTEROP_V2(InvalidateFileCache, KNativePointer, KStringPtr) + +void impl_RemoveFileCache(KNativePointer globalContextPtr, KStringPtr& fileName) { + auto globalContext = reinterpret_cast(globalContextPtr); + GetImpl()->RemoveFileCache(globalContext, getStringCopy(fileName)); +} +KOALA_INTEROP_V2(RemoveFileCache, KNativePointer, KStringPtr) + +void impl_AddFileCache(KNativePointer globalContextPtr, KStringPtr& fileName) { + auto globalContext = reinterpret_cast(globalContextPtr); + GetImpl()->AddFileCache(globalContext, getStringCopy(fileName)); +} +KOALA_INTEROP_V2(AddFileCache, KNativePointer, KStringPtr) + // From koala-wrapper // TODO check if some code should be generated @@ -556,3 +574,4 @@ KInt impl_GenerateStaticDeclarationsFromContext(KNativePointer contextPtr, KStri return GetImpl()->GenerateStaticDeclarationsFromContext(context, outputPath.data()); } KOALA_INTEROP_2(GenerateStaticDeclarationsFromContext, KInt, KNativePointer, KStringPtr) + diff --git a/ui2abc/libarkts/src/Es2pandaNativeModule.ts b/ui2abc/libarkts/src/Es2pandaNativeModule.ts index db7cffb801c0618aac4b453f5d4f0cfd8ebd9290..861ee831c4ebb2caf01ebe4bad7062201029765a 100644 --- a/ui2abc/libarkts/src/Es2pandaNativeModule.ts +++ b/ui2abc/libarkts/src/Es2pandaNativeModule.ts @@ -81,6 +81,15 @@ export class Es2pandaNativeModule { _DestroyGlobalContext(context: KNativePointer): void { throw new Error("Not implemented"); } + _InvalidateFileCache(globalContext: KNativePointer, fileName: String): void { + throw new Error("Not implemented"); + } + _RemoveFileCache(globalContext: KNativePointer, fileName: String): void { + throw new Error("Not implemented"); + } + _AddFileCache(globalContext: KNativePointer, fileName: String): void { + throw new Error("Not implemented"); + } _DestroyContext(context: KPtr): void { throw new Error("Not implemented") } diff --git a/ui2abc/libarkts/src/arkts-api/peers/Context.ts b/ui2abc/libarkts/src/arkts-api/peers/Context.ts index 349884d6e2050f5671db201cc4cc2ec8d8dffec3..965a52fbe9e1d6bc88f33b47c10bea23aa0ea7a4 100644 --- a/ui2abc/libarkts/src/arkts-api/peers/Context.ts +++ b/ui2abc/libarkts/src/arkts-api/peers/Context.ts @@ -109,4 +109,16 @@ export class GlobalContext extends ArktsObject { this.peer = nullptr } } + + invalidateFileCache(fileName: string) { + global.es2panda._InvalidateFileCache(this.peer, fileName) + } + + removeFileCache(fileName: string) { + global.es2panda._RemoveFileCache(this.peer, fileName) + } + + addFileCache(fileName: string) { + global.es2panda._AddFileCache(this.peer, fileName) + } } diff --git a/ui2abc/libarkts/src/arkts-api/utilities/public.ts b/ui2abc/libarkts/src/arkts-api/utilities/public.ts index dfca572305bde0f02e0fc2a0ef19c904f16d57eb..abd4c8a8191d09df2dd23db6a25eb68eef63c1e8 100644 --- a/ui2abc/libarkts/src/arkts-api/utilities/public.ts +++ b/ui2abc/libarkts/src/arkts-api/utilities/public.ts @@ -112,6 +112,19 @@ export function rebindSubtree(node: AstNode): void { checkErrors() } +export function recheckContext(context: KNativePointer): void { + global.es2panda._AstNodeRecheck( + context, + global.es2panda._ProgramAst( + context, + global.es2panda._ContextProgram( + context + ) + ) + ) + checkErrors() +} + export function getDecl(node: AstNode): AstNode | undefined { if (isMemberExpression(node)) { return getDecl(node.property!)