diff --git a/arkoala-arkts/arkui/src/ets/handwritten/Router.ets b/arkoala-arkts/arkui/src/ets/handwritten/Router.ets index 8cc504f7d8fa2f1b612ea827324d57f77eb8e95d..b4ce44494c5c08d5f7938eb643f28760564b69a7 100644 --- a/arkoala-arkts/arkui/src/ets/handwritten/Router.ets +++ b/arkoala-arkts/arkui/src/ets/handwritten/Router.ets @@ -281,7 +281,7 @@ class RouterImpl implements Router { newVisiblePage = state.visiblePages.value[index] newVisiblePage.setTransitionState(RouterTransitionVisibility.Showing, route) // remove all hidden pages removed from the stack - for (let i = state.visiblePages.length - 1; i > index; i--) { + for (let i = state.visiblePages.length.toInt() - 1; i > index; i--) { const visibility = state.visiblePages.value[i].transition.visibility if (visibility == RouterTransitionVisibility.Hidden) { state.visiblePages.splice(i, undefined) diff --git a/arkoala-arkts/ets-plugin/test/ets/Rewrite.ets b/arkoala-arkts/ets-plugin/test/ets/Rewrite.ets index 301cea778fcea4e85f506430f3dc301460fcb9d4..49350193e10a336830ee1536bf69d833ac5a84f6 100644 --- a/arkoala-arkts/ets-plugin/test/ets/Rewrite.ets +++ b/arkoala-arkts/ets-plugin/test/ets/Rewrite.ets @@ -134,7 +134,7 @@ function looks() { @Component struct StylesExample { build() { - Text() + Text("") .width(17) .looks() } @@ -150,7 +150,7 @@ struct StylesMethodExample { } build() { - Text() + Text("") .width(17) .nice() } @@ -196,7 +196,7 @@ function attributeExtend(n: number, animatable: AnimatableValue) { @Component struct AnimatableExtendExample { build() { - Text() + Text("") .width(17) .attributeExtend(50, new AnimatableValue()) } diff --git a/arkoala-arkts/ets-plugin/test/ets/dollar-dollar/components.ets b/arkoala-arkts/ets-plugin/test/ets/dollar-dollar/components.ets index 3e7cfa06f361497892ed462c24f66437fbff603f..14e836df8840c411bfbeb87143f947733461c6f4 100644 --- a/arkoala-arkts/ets-plugin/test/ets/dollar-dollar/components.ets +++ b/arkoala-arkts/ets-plugin/test/ets/dollar-dollar/components.ets @@ -61,5 +61,5 @@ struct DollarDollar { @Builder function builder() { - Text() -} \ No newline at end of file + Text("") +} diff --git a/arkoala-arkts/ets-plugin/test/ets/ets-component-call/ets-call.ets b/arkoala-arkts/ets-plugin/test/ets/ets-component-call/ets-call.ets index 8686b960091efe2c0f4e9b82537e62d24abe5714..c7feeaa4ebc10c1cb57307f3448fd41276a40fe6 100644 --- a/arkoala-arkts/ets-plugin/test/ets/ets-component-call/ets-call.ets +++ b/arkoala-arkts/ets-plugin/test/ets/ets-component-call/ets-call.ets @@ -27,7 +27,7 @@ export function callBuiltinComponent() { @Builder export function callFunctionWithReservedName() { - Text() + Text("") } @Builder @@ -52,4 +52,4 @@ function main() { Column({ space: 30 }) { Flex({ justifyContent: 30 }) } -} \ No newline at end of file +} diff --git a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/detailPage/detail.ets b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/detailPage/detail.ets index aa0eae795c3addf65b4008253c519cdc7c3a885e..a5892a54908cfb74c741be6d033dd8f3a3714f87 100644 --- a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/detailPage/detail.ets +++ b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/detailPage/detail.ets @@ -361,7 +361,7 @@ export struct Detail { .margin({ top: 5, bottom: 5 }) Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { - Text() + Text("") Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { ForEach(this.phoneType, (item: PhoneTypeModel) => { Image(`${item.uri}`) @@ -650,4 +650,4 @@ export struct Detail { .backgroundColor('#10000000') }.hideTitleBar(true) } -} \ No newline at end of file +} diff --git a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/core1.ets b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/core1.ets index 9fed96caa298a0239cb74bbbcda2bdae5da34c8c..0f15f586b2a73959c9911ed076eae1dc443ea949 100644 --- a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/core1.ets +++ b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/core1.ets @@ -32,11 +32,11 @@ export struct Core1 { ForEach(this.rows, (item2: number) => { GridItem() { Column() { - Image(`${this.coreData[item1 * 2 + item2].uri}`) + Image(`${this.coreData[(item1 * 2 + item2).toInt()].uri}`) .width(40 * this.ratio) .aspectRatio(1) .objectFit(ImageFit.Contain) - Text(`${this.coreData[item1 * 2 + item2].title}`) + Text(`${this.coreData[(item1 * 2 + item2).toInt()].title}`) .fontSize(15 * this.ratio) .margin({ top: 5 }) } diff --git a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/core2.ets b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/core2.ets index cffd9be27d206b494d885cc05f6ad578d027bca2..39b9c5fcbee0b9a0b6d51d627e2665af93839f6e 100644 --- a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/core2.ets +++ b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/core2.ets @@ -32,11 +32,11 @@ export struct Core2 { ForEach(this.rows, (item2: number) => { GridItem() { Column() { - Image(`${this.coreData[item1 * 2 + item2].uri}`) + Image(`${this.coreData[(item1 * 2 + item2).toInt()].uri}`) .width(30 * this.ratio) .aspectRatio(1) .objectFit(ImageFit.Contain) - Text(`${this.coreData[item1 * 2 + item2].title}`) + Text(`${this.coreData[(item1 * 2 + item2).toInt()].title}`) .fontSize(15 * this.ratio) .margin({ top: 5 }) } diff --git a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/goodsList.ets b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/goodsList.ets index c48901d4a6532d13f0223596a01e9937f1013db1..39a59b256cade165287d476910c1dee3e69940cd 100644 --- a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/goodsList.ets +++ b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/goodsList.ets @@ -68,19 +68,19 @@ export struct GoodsList { GridItem() { Column() { // Image(this.productData[item % 14].uri) - Image(this.productData[this.data.getData(item) % 14].uri) + Image(this.productData[(this.data.getData(item) % 14).toInt()].uri) .width('100%') .height('40%') .objectFit(ImageFit.Contain) .margin({ bottom: 40 }) // Text(this.productData[item % 14].title) - Text(this.productData[this.data.getData(item) % 14].title) + Text(this.productData[(this.data.getData(item) % 14).toInt()].title) .fontSize(16 * this.ratio) .fontWeight(600) .margin({ bottom: 10, left: 10 }) Row() { // Text(this.productData[item % 14].labels) - Text(this.productData[this.data.getData(item) % 14].labels) + Text(this.productData[(this.data.getData(item) % 14).toInt()].labels) .fontSize(10 * this.ratio) .border({ width: 1, color: '#FA808080' }) .margin({ bottom: 2, left: 10 }) diff --git a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/imageItem.ets b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/imageItem.ets index 321dd07fbfb66da1b0e0e4700c69c9280252c18b..b92a5dbb78403121ddb49c0cde8a66d71636283a 100644 --- a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/imageItem.ets +++ b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/imageItem.ets @@ -29,25 +29,25 @@ export struct ImageItem { build() { Column() { - Image(this.imgSrc[this.itemNum].imgSrc) + Image(this.imgSrc[this.itemNum.toInt()].imgSrc) .width('100%') .height('70%') .objectFit(ImageFit.Cover) .border({ radius: 10 * this.ratio }) - Text(this.imgIntro[this.itemNum].imgIntro) + Text(this.imgIntro[this.itemNum.toInt()].imgIntro) .fontSize(15 * this.ratio) .maxLines(2) .textOverflow({ overflow: TextOverflow.Ellipsis }) .height('15%') Row() { Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Image(this.iconSrc[this.itemNum].iconSrc) + Image(this.iconSrc[this.itemNum.toInt()].iconSrc) .width(20 * this.ratio) .aspectRatio(1) .objectFit(ImageFit.Contain) .border({ radius: 10 * this.ratio }) .margin({ right: 5 }) - Text(this.imgName[this.itemNum].imgName) + Text(this.imgName[this.itemNum.toInt()].imgName) .fontSize(12 * this.ratio) .maxLines(1) .textOverflow({ overflow: TextOverflow.Ellipsis }) diff --git a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/other.ets b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/other.ets index 60bc0f91d268ca2f69cc7d5e6a0939c6d2dd2f64..995a22af1d8293066bcd9298ec3b6586b8666ba2 100644 --- a/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/other.ets +++ b/arkoala-arkts/loader/app/shopping/entry/src/main/ets/pages/homePage/other.ets @@ -24,11 +24,11 @@ export struct Other { build() { Column() { - Image(this.shopCartItem[this.item].img) + Image(this.shopCartItem[this.item.toInt()].img) .width('95%') .aspectRatio(0.8) .objectFit(ImageFit.Contain) - Text(this.shopCartItem[this.item].title) + Text(this.shopCartItem[this.item.toInt()].title) .fontSize(14 * this.ratio) .lineHeight(25 * this.ratio) .maxLines(2) diff --git a/arkoala-arkts/shopping/user/src/ets/pages/detailPage/detail.ets b/arkoala-arkts/shopping/user/src/ets/pages/detailPage/detail.ets index c6f873c995fe58a13e403a5ef464529cb5c919b7..e43f35b1ce8bbbbfa968dfd1b0c8bdfad31b5e14 100644 --- a/arkoala-arkts/shopping/user/src/ets/pages/detailPage/detail.ets +++ b/arkoala-arkts/shopping/user/src/ets/pages/detailPage/detail.ets @@ -364,7 +364,7 @@ export struct Detail { .margin({ top: 5, bottom: 5 } as Margin) Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { - Text() + Text("") Flex({ justifyContent: FlexAlign.SpaceBetween, alignItems: ItemAlign.Center }) { ForEach(this.phoneType, (item: PhoneTypeModel) => { Image(`${item.uri}`) diff --git a/arkoala-arkts/shopping/user/src/ets/pages/homePage/core1.ets b/arkoala-arkts/shopping/user/src/ets/pages/homePage/core1.ets index 8dc8bd254c3fc0275d0181f641d11b148d0db713..89632771a7e1e61917c344e95faaebd80787a689 100644 --- a/arkoala-arkts/shopping/user/src/ets/pages/homePage/core1.ets +++ b/arkoala-arkts/shopping/user/src/ets/pages/homePage/core1.ets @@ -34,11 +34,11 @@ export struct Core1 { ForEach(this.rows, (item2: Number) => { GridItem({}) { Column({}) { - Image(`${this.coreData[item1.valueOf() * 2 + item2.valueOf()].uri}`) + Image(`${this.coreData[(item1.valueOf() * 2 + item2.valueOf()).toInt()].uri}`) .width(40 * this.ratio) .aspectRatio(1) .objectFit(ImageFit.Contain) - Text(`${this.coreData[item1.valueOf() * 2 + item2.valueOf()].title}`) + Text(`${this.coreData[(item1.valueOf() * 2 + item2.valueOf()).toInt()].title}`) .fontSize(15 * this.ratio) .margin({ top: 5 } as Margin) } diff --git a/arkoala-arkts/shopping/user/src/ets/pages/homePage/core2.ets b/arkoala-arkts/shopping/user/src/ets/pages/homePage/core2.ets index 33f00f900deb0b055379fd031a29b4d127930074..cc2bd77f32179d6e062cc2743318b05373897d01 100644 --- a/arkoala-arkts/shopping/user/src/ets/pages/homePage/core2.ets +++ b/arkoala-arkts/shopping/user/src/ets/pages/homePage/core2.ets @@ -34,11 +34,11 @@ export struct Core2 { ForEach(this.rows, (item2: Number) => { GridItem({}) { Column({}) { - Image(`${this.coreData[item1.valueOf() * 2 + item2.valueOf()].uri}`) + Image(`${this.coreData[(item1.valueOf() * 2 + item2.valueOf()).toInt()].uri}`) .width(30 * this.ratio) .aspectRatio(1) .objectFit(ImageFit.Contain) - Text(`${this.coreData[item1.valueOf() * 2 + item2.valueOf()].title}`) + Text(`${this.coreData[(item1.valueOf() * 2 + item2.valueOf()).toInt()].title}`) .fontSize(15 * this.ratio) .margin({ top: 5 } as Margin) } diff --git a/arkoala-arkts/shopping/user/src/ets/pages/homePage/goodsList.ets b/arkoala-arkts/shopping/user/src/ets/pages/homePage/goodsList.ets index eb9b85955760dc1ce5f08d2353ffb4b958e4771e..f6c6e12c4979bdcd6004fa81a668c7c8499b9b28 100644 --- a/arkoala-arkts/shopping/user/src/ets/pages/homePage/goodsList.ets +++ b/arkoala-arkts/shopping/user/src/ets/pages/homePage/goodsList.ets @@ -114,7 +114,7 @@ export struct GoodsList { Column({}) { Grid({}) { LazyForEach(this.data, (item: Number, index: number): void => { - GGGItem({ data: this.productData[item.valueOf() % 14], ratio: this.ratio }) + GGGItem({ data: this.productData[(item.valueOf() % 14).toInt()], ratio: this.ratio }) }, (item: Number, index: number): string => cacheId(item.valueOf())) } .columnsTemplate('1fr 1fr') diff --git a/arkoala-arkts/shopping/user/src/ets/pages/homePage/imageItem.ets b/arkoala-arkts/shopping/user/src/ets/pages/homePage/imageItem.ets index 19564e703f8f0eb8bb8834a27ec8cfcff4bbba52..f998aa7c814a8f57182b38c9c0ae9e18c69c9f17 100644 --- a/arkoala-arkts/shopping/user/src/ets/pages/homePage/imageItem.ets +++ b/arkoala-arkts/shopping/user/src/ets/pages/homePage/imageItem.ets @@ -30,25 +30,25 @@ export struct ImageItem { build() { Column({}) { - Image(this.imgSrc[this.itemNum].imgSrc) + Image(this.imgSrc[this.itemNum.toInt()].imgSrc) .width('100%') .height('70%') .objectFit(ImageFit.Cover) .border({ radius: 10 * this.ratio } as BorderOptions) - Text(this.imgIntro[this.itemNum].imgIntro) + Text(this.imgIntro[this.itemNum.toInt()].imgIntro) .fontSize(15 * this.ratio) .maxLines(2) .textOverflow({ overflow: TextOverflow.Ellipsis } as TextOverflowOptions) .height('15%') Row({}) { Flex({ justifyContent: FlexAlign.Start, alignItems: ItemAlign.Center }) { - Image(this.iconSrc[this.itemNum].iconSrc) + Image(this.iconSrc[this.itemNum.toInt()].iconSrc) .width(20 * this.ratio) .aspectRatio(1) .objectFit(ImageFit.Contain) .border({ radius: 10 * this.ratio } as BorderOptions) .margin({ right: 5 } as Margin) - Text(this.imgName[this.itemNum].imgName) + Text(this.imgName[this.itemNum.toInt()].imgName) .fontSize(12 * this.ratio) .maxLines(1) .textOverflow({ overflow: TextOverflow.Ellipsis } as TextOverflowOptions) diff --git a/arkoala-arkts/shopping/user/src/ets/pages/homePage/other.ets b/arkoala-arkts/shopping/user/src/ets/pages/homePage/other.ets index 03df626438be3b5d4bcab6f29e9c6237ffbf9adb..fa253e98c21d5be7748800de80f32928ec9d91e5 100644 --- a/arkoala-arkts/shopping/user/src/ets/pages/homePage/other.ets +++ b/arkoala-arkts/shopping/user/src/ets/pages/homePage/other.ets @@ -25,11 +25,11 @@ export struct Other { build() { Column({}) { - Image(this.shopCartItem[this.item].img) + Image(this.shopCartItem[this.item.toInt()].img) .width('95%') .aspectRatio(0.8) .objectFit(ImageFit.Contain) - Text(this.shopCartItem[this.item].title) + Text(this.shopCartItem[this.item.toInt()].title) .fontSize(14 * this.ratio) .lineHeight(25 * this.ratio) .maxLines(2) diff --git a/arkoala-arkts/shopping/user/src/ets/pages/homePage/utils.ets b/arkoala-arkts/shopping/user/src/ets/pages/homePage/utils.ets index c1020b98e399d0d8db00fe8459682be98539fa38..c48aabeb64d9c41ae5e94b5790ad6945f71d7a14 100644 --- a/arkoala-arkts/shopping/user/src/ets/pages/homePage/utils.ets +++ b/arkoala-arkts/shopping/user/src/ets/pages/homePage/utils.ets @@ -16,7 +16,7 @@ function simpleHash(str: string) { let hash = 0; for (let i = 0; i < str.length; i++) { - const char_ = str.charCodeAt(i); + const char_ = str.charCodeAt(i).toInt(); hash = (hash << 5) - hash + char_; } return BigInt(hash >>> 0).toString(36).padStart(7, '0'); diff --git a/incremental/common/src/Unique.ts b/incremental/common/src/Unique.ts index 28dee7a0914a6df556e18c3b2d0f1e78f85777ac..591d9afc9d5127e88cec3a21417dd96697fb7b9f 100644 --- a/incremental/common/src/Unique.ts +++ b/incremental/common/src/Unique.ts @@ -297,7 +297,7 @@ class Entry implements Unique { function found(array: Array, uid: UID, index: number): U | undefined { if (index < array.length) { - const element = array[index] + const element = array[index as int32] if (element.uid == uid) return element } return undefined diff --git a/incremental/common/src/koalaKey.ts b/incremental/common/src/koalaKey.ts index 729bf43cb86f25ed54b0537c8ffcf7cbef2c06dd..289b65824f620097fbd36abf8d1ff62e3e7bd2bf 100644 --- a/incremental/common/src/koalaKey.ts +++ b/incremental/common/src/koalaKey.ts @@ -13,6 +13,7 @@ * limitations under the License. */ +import { float64ToInt } from "@koalaui/compat" import { int32 } from "@koalaui/compat" export type KoalaCallsiteKey = int32 @@ -37,7 +38,7 @@ export class KoalaCallsiteKeys { export function toKoalaCallsiteKey(str: string): KoalaCallsiteKey { let key = KoalaCallsiteKeys.empty for (let i = 0; i < str.length; i++) { - key = (key << 3) | (key >> 29) ^ str.charCodeAt(i) + key = (key << 3) | (key >> 29) ^ float64ToInt(str.charCodeAt(i)) } // DEBUG: console.log(`KEY: ${KoalaCallsiteKeys.asString(key)} from "${str}"`) return key diff --git a/incremental/common/src/sha1.ts b/incremental/common/src/sha1.ts index 1cf2cffeabdc8ecaf90001e6be2ad3ebe8672def..14e052ef52c49c3576fa6f7ff950cf6c2a4bb074 100644 --- a/incremental/common/src/sha1.ts +++ b/incremental/common/src/sha1.ts @@ -158,7 +158,7 @@ export class SHA1Hash { let index = start while (offset < length && index < inputBytes) { - let code = text.charCodeAt(offset++) | 0 + let code = float64ToInt(text.charCodeAt(offset++)) | 0 if (code < 0x80) { // ASCII characters _byte[index++] = code diff --git a/incremental/common/src/stringUtils.ts b/incremental/common/src/stringUtils.ts index ce01753ae35a55952e5f5526a7654942d8f75367..4ce02d1069bb8fc7f448e3900df5d15f92f6316d 100644 --- a/incremental/common/src/stringUtils.ts +++ b/incremental/common/src/stringUtils.ts @@ -13,6 +13,7 @@ * limitations under the License. */ +import { float64ToInt } from "@koalaui/compat" import { int32 } from "@koalaui/compat" @@ -22,7 +23,7 @@ import { int32 } from "@koalaui/compat" export function hashCodeFromString(value: string): int32 { let hash = 5381 for(let i = 0; i < value.length; i++) { - hash = (hash * 33) ^ value.charCodeAt(i) + hash = (hash * 33) ^ float64ToInt(value.charCodeAt(i)) hash |= 0 } return hash diff --git a/incremental/compat/src/arkts/observable.ts b/incremental/compat/src/arkts/observable.ts index 681891ad99f19ad220ec1f8042c6accc54472b85..ea8df9bd11a86c6ff008d6477cf9a6824a2e08c1 100644 --- a/incremental/compat/src/arkts/observable.ts +++ b/incremental/compat/src/arkts/observable.ts @@ -280,6 +280,11 @@ class CustomProxyHandler extends proxy.DefaultProxyHandler } } +function proxyChildrenOnlyOne(value: T, parent: ObservableHandler, observed?: boolean) { + if (observed === undefined) observed = ObservableHandler.contains(parent) + value = observableProxy(value, parent, observed) +} + function proxyChildrenOnly(array: T[], parent: ObservableHandler, observed?: boolean) { for (let i = 0; i < array.length; i++) { if (observed === undefined) observed = ObservableHandler.contains(parent) @@ -306,12 +311,12 @@ class ObservableArray extends Array { return ObservableHandler.find(this) } - override get length(): number { + override get length(): int { this.handler?.onAccess() return super.length } - override set length(length: number) { + override set length(length: int) { this.handler?.onModify() super.length = length } @@ -360,13 +365,22 @@ class ObservableArray extends Array { return result } - override push(...items: T[]): number { + override pushArray(...items: T[]): number { const handler = this.handler if (handler) { handler.onModify() proxyChildrenOnly(items, handler) } - return super.push(...items) + return super.pushArray(...items) + } + + override pushOne(item: T): number { + const handler = this.handler + if (handler) { + handler.onModify() + proxyChildrenOnlyOne(item, handler) + } + return super.pushOne(item) } override pushECMA(...items: T[]): number { @@ -595,7 +609,7 @@ class ObservableMap extends Map { return ObservableHandler.find(this) } - override get size(): number { + override get size(): int { this.handler?.onAccess() return super.size } @@ -699,7 +713,7 @@ class ObservableSet extends Set { return new Set(this.elements.keys()).toString() } - override get size(): number { + override get size(): int { this.handler?.onAccess() return this.elements.size } diff --git a/incremental/runtime/src/animation/Easing.ts b/incremental/runtime/src/animation/Easing.ts index 2ae78449e782bc683a24604d4fc57bd0e841fb42..fd67a7423ae0da14e260ffb23cf53a31c89ca231 100644 --- a/incremental/runtime/src/animation/Easing.ts +++ b/incremental/runtime/src/animation/Easing.ts @@ -99,7 +99,7 @@ export class Easing { if (value < 1) { value *= easing.length const index = Math.floor(value) - if (index < easing.length) return easing[index](value - index) + if (index < easing.length) return easing[index.toInt()](value - index) } return easing[easing.length - 1](1) } diff --git a/incremental/runtime/src/states/State.ts b/incremental/runtime/src/states/State.ts index a4925d89f780dda901e31040b36b8b1b669bca04..878ada0b0321962687ef90675f5e23ce06dbf8ae 100644 --- a/incremental/runtime/src/states/State.ts +++ b/incremental/runtime/src/states/State.ts @@ -385,7 +385,7 @@ class StateImpl implements Observable, ManagedState, MutableState class ArrayStateImpl extends StateImpl> implements ArrayState { constructor(manager: StateManagerImpl, initial: Array, global: boolean, equivalent?: Equivalent) { super(manager, initial, global, (oldArray: Array, newArray: Array): boolean => { - let i: number = oldArray.length + let i: int32 = oldArray.length if (i != newArray.length) return false while (0 < i--) { if (isModified(oldArray[i], newArray[i], equivalent)) return false @@ -405,20 +405,20 @@ class ArrayStateImpl extends StateImpl> implements ArrayState< } set length(value: number) { - this.mutable.length = value + this.mutable.length = value.toInt() } at(index: number): Item { const array = this.value - return array[index < 0 ? array.length + index : index] + return array[(index < 0 ? array.length + index : index).toInt()] } get(index: number): Item { - return this.value[index] + return this.value[index.toInt()] } set(index: number, item: Item): void { - this.mutable[index] = item + this.mutable[index.toInt()] = item } copyWithin(target: number, start: number, end?: number): Array { @@ -451,7 +451,7 @@ class ArrayStateImpl extends StateImpl> implements ArrayState< splice(start: number, deleteCount: number | undefined, ...items: Item[]): Array { const array = this.mutable - return array.splice(start, deleteCount ?? array.length, ...items) + return array.splice(start, deleteCount ?? array.length.toDouble(), ...items) } unshift(...items: Item[]): number { @@ -1272,4 +1272,4 @@ class TrackedScopes { clear() { this.trackedScopes.clear() } -} \ No newline at end of file +} diff --git a/interop/src/arkts/ResourceManager.ts b/interop/src/arkts/ResourceManager.ts index 85d990bd1c2972ee205ae492dc47d4c82de26330..18665a45cddd93d0d0989bdcbc66beefacaf50ec 100644 --- a/interop/src/arkts/ResourceManager.ts +++ b/interop/src/arkts/ResourceManager.ts @@ -84,7 +84,7 @@ export class ResourceHolder { } static unregister(resource: Disposable) { - const index = ResourceHolder.disposables.indexOf(resource); + const index = ResourceHolder.disposables.indexOf(resource) as int32; if (index !== -1 && index < ResourceHolder.disposablesSize) { if (index !== ResourceHolder.disposablesSize - 1) { ResourceHolder.disposables[index] = ResourceHolder.disposables[ResourceHolder.disposablesSize - 1]; diff --git a/interop/src/cpp/ani/ani.h b/interop/src/cpp/ani/ani.h index a171d16adb17d8a2d8ad6455f74a86f902298909..1626cc5683d4a21a01243bba4a0d79750304854e 100644 --- a/interop/src/cpp/ani/ani.h +++ b/interop/src/cpp/ani/ani.h @@ -6095,6 +6095,20 @@ struct __ani_interaction_api { * The `resolver` is freed upon successful completion. */ ani_status (*PromiseResolver_Reject)(ani_env *env, ani_resolver resolver, ani_error rejection); + + /** + * @brief Binds static native methods to a class. + * + * This function binds an array of static native methods to the specified class. + * + * @param[in] env A pointer to the environment structure. + * @param[in] cls The class to which the native methods will be bound. + * @param[in] methods A pointer to an array of static native methods to bind. + * @param[in] nr_methods The number of static native methods in the array. + * @return Returns a status code of type `ani_status` indicating success or failure. + */ + ani_status (*Class_BindStaticNativeMethods)(ani_env *env, ani_class cls, const ani_native_function *methods, + ani_size nr_methods); }; // C++ API @@ -8101,6 +8115,10 @@ struct __ani_env { { return c_api->PromiseResolver_Reject(this, resolver, rejection); } + ani_status Class_BindStaticNativeMethods(ani_class cls, const ani_native_function *methods, ani_size nr_methods) + { + return c_api->Class_BindStaticNativeMethods(this, cls, methods, nr_methods); + } #endif // __cplusplus }; diff --git a/interop/src/cpp/ani/convertors-ani.cc b/interop/src/cpp/ani/convertors-ani.cc index 3352aa826f69502f83d0e373fc5ab41e0f1deffa..7373e45d793ee9c2ca88d16a713ff3cb8aa2d230 100644 --- a/interop/src/cpp/ani/convertors-ani.cc +++ b/interop/src/cpp/ani/convertors-ani.cc @@ -20,7 +20,7 @@ #include "interop-types.h" static const char* callCallbackFromNative = "callCallbackFromNative"; -static const char* callCallbackFromNativeSig = "IJI:I"; +static const char* callCallbackFromNativeSig = "ili:i"; const bool registerByOne = true; @@ -145,11 +145,11 @@ void AniExports::setClasspath(const char* module, const char *classpath) { } static std::map g_defaultClasspaths = { - {"InteropNativeModule", "L@koalaui/interop/InteropNativeModule/InteropNativeModule;"}, + {"InteropNativeModule", "@koalaui.interop.InteropNativeModule.InteropNativeModule"}, // todo leave just InteropNativeModule, define others via KOALA_ETS_INTEROP_MODULE_CLASSPATH - {"TestNativeModule", "L@ohos/arkui/generated/arkts/TestNativeModule/TestNativeModule;"}, - {"ArkUINativeModule", "L@ohos/arkui/generated/arkts/ArkUINativeModule/ArkUINativeModule;"}, - {"ArkUIGeneratedNativeModule", "L@ohos/arkui/generated/arkts/ArkUIGeneratedNativeModule/ArkUIGeneratedNativeModule;"}, + {"TestNativeModule", "@ohos.arkui.generated.arkts.TestNativeModule.TestNativeModule"}, + {"ArkUINativeModule", "@ohos.arkui.generated.arkts.ArkUINativeModule.ArkUINativeModule"}, + {"ArkUIGeneratedNativeModule", "@ohos.arkui.generated.arkts.ArkUIGeneratedNativeModule.ArkUIGeneratedNativeModule"}, }; const std::string& AniExports::getClasspath(const std::string& module) { diff --git a/interop/src/cpp/ani/convertors-ani.h b/interop/src/cpp/ani/convertors-ani.h index 68ba12a03a128b7bdd5acac2973a135195cb1614..17529180b9e9a4c66907f5528e218aaab5ec048c 100644 --- a/interop/src/cpp/ani/convertors-ani.h +++ b/interop/src/cpp/ani/convertors-ani.h @@ -331,16 +331,16 @@ struct InteropTypeConverter { static ani_class string_class = nullptr; static ani_class resource_class = nullptr; if (!double_class) { - CHECK_ANI_FATAL(env->FindClass("Lstd/core/Double;", &double_class)); + CHECK_ANI_FATAL(env->FindClass("std.core.Double", &double_class)); } if (!int_class) { - CHECK_ANI_FATAL(env->FindClass("Lstd/core/Int;", &int_class)); + CHECK_ANI_FATAL(env->FindClass("std.core.Int", &int_class)); } if (!string_class) { - CHECK_ANI_FATAL(env->FindClass("Lstd/core/String;", &string_class)); + CHECK_ANI_FATAL(env->FindClass("std.core.String", &string_class)); } if (!resource_class) { - CHECK_ANI_FATAL(env->FindClass("L@ohos/arkui/generated/resource/Resource;", &resource_class)); + CHECK_ANI_FATAL(env->FindClass("@ohos.arkui.generated.resource.Resource", &resource_class)); } const ani_object valueObj = reinterpret_cast(value); @@ -349,7 +349,7 @@ struct InteropTypeConverter { CHECK_ANI_FATAL(env->Object_InstanceOf(valueObj, double_class, &isInstanceOf)); if (isInstanceOf) { static ani_method double_p = nullptr; - if (!double_p) CHECK_ANI_FATAL(env->Class_FindMethod(double_class, "unboxed", ":D", &double_p)); + if (!double_p) CHECK_ANI_FATAL(env->Class_FindMethod(double_class, "unboxed", ":d", &double_p)); ani_double result; CHECK_ANI_FATAL(env->Object_CallMethod_Double(valueObj, double_p, &result)); return KLength{ 1, (KFloat) result, 1, 0 }; @@ -358,7 +358,7 @@ struct InteropTypeConverter { CHECK_ANI_FATAL(env->Object_InstanceOf(valueObj, int_class, &isInstanceOf)); if (isInstanceOf) { static ani_method int_p = nullptr; - if (!int_p) CHECK_ANI_FATAL(env->Class_FindMethod(int_class, "unboxed", ":I", &int_p)); + if (!int_p) CHECK_ANI_FATAL(env->Class_FindMethod(int_class, "unboxed", ":i", &int_p)); ani_int result; CHECK_ANI_FATAL(env->Object_CallMethod_Int(valueObj, int_p, &result)); return KLength{ 1, (KFloat) result, 1, 0 }; @@ -377,7 +377,7 @@ struct InteropTypeConverter { CHECK_ANI_FATAL(env->Object_InstanceOf(valueObj, resource_class, &isInstanceOf)); if (isInstanceOf) { static ani_method resource_p = nullptr; - if (!resource_p) CHECK_ANI_FATAL(env->Class_FindMethod(resource_class, "id",":D", &resource_p)); + if (!resource_p) CHECK_ANI_FATAL(env->Class_FindMethod(resource_class, "id",":d", &resource_p)); ani_double result; CHECK_ANI_FATAL(env->Object_CallMethod_Double(valueObj, resource_p, &result)); return KLength{ 3, 0, 1, (KInt) result }; @@ -1940,10 +1940,10 @@ void getKoalaANICallbackDispatcher(ani_class* clazz, ani_static_method* method); do { \ ani_env* env = reinterpret_cast(vmContext); \ ani_class errorClass {}; \ - CHECK_ANI_FATAL(env->FindClass("Lescompat/Error;", &errorClass)); \ + CHECK_ANI_FATAL(env->FindClass("escompat.Error", &errorClass)); \ ani_method errorCtor {}; \ CHECK_ANI_FATAL(env->Class_FindMethod(errorClass, "", \ - "Lstd/core/String;Lescompat/ErrorOptions;:V", &errorCtor)); \ + "C{std.core.String}C{escompat.ErrorOptions}:", &errorCtor)); \ ani_string messageObject{}; \ CHECK_ANI_FATAL(env->String_NewUTF8(message, strlen(message), &messageObject)); \ ani_ref undefined{}; \ diff --git a/interop/src/cpp/common-interop.cc b/interop/src/cpp/common-interop.cc index 47cf2f4d87b37dceaa4e7ddd1a9d271436aa0a3e..24cdd5d659d7be3383b0ef2edd5725d4d1a914b9 100644 --- a/interop/src/cpp/common-interop.cc +++ b/interop/src/cpp/common-interop.cc @@ -486,7 +486,10 @@ void resolveDeferred(KVMDeferred* deferred, uint8_t* argsData, int32_t argsLengt status = vm->AttachCurrentThread(nullptr, ANI_VERSION_1, &env); CHECK_ANI_FATAL(status); } - status = env->PromiseResolver_Resolve((ani_resolver)deferred->handler, nullptr); + ani_ref undef = nullptr; + status = env->GetUndefined(&undef); + CHECK_ANI_FATAL(status); + status = env->PromiseResolver_Resolve((ani_resolver)deferred->handler, undef); CHECK_ANI_FATAL(status); #endif } diff --git a/interop/src/cpp/vmloader.cc b/interop/src/cpp/vmloader.cc index fa6b8000dee9ce03b3244537a238c08e9ace0d52..bc504e1c5e10d0b524cb03c71bffdae18dd66edd 100644 --- a/interop/src/cpp/vmloader.cc +++ b/interop/src/cpp/vmloader.cc @@ -585,34 +585,34 @@ const AppInfo harnessAppInfo = { #endif #ifdef KOALA_ANI const AppInfo harnessAniAppInfo = { - "L@koalaui/ets-harness/src/EtsHarnessApplication/EtsHarnessApplication;", + "@koalaui.ets-harness.src.EtsHarnessApplication.EtsHarnessApplication", "createApplication", - "Lstd/core/String;Lstd/core/String;Lstd/core/String;ZI:L@koalaui/ets-harness/src/EtsHarnessApplication/EtsHarnessApplication;", + "C{std.core.String}C{std.core.String}C{std.core.String}zi:C{@koalaui.ets-harness.src.EtsHarnessApplication.EtsHarnessApplication}", "start", - "JI:J", + "li:l", "enter", - "IIJ:Z", + "iil:z", "emitEvent", - "IIII:Lstd/core/String;", + "iiii:C{std.core.String}", "restartWith", - "Lstd/core/String;:V", + "C{std.core.String}:", "UNUSED", - "I:I" + "i:i" }; const AppInfo aniAppInfo = { - "L@ohos/arkui/Application/Application;", + "@ohos.arkui.Application.Application", "createApplication", - "Lstd/core/String;Lstd/core/String;Lstd/core/String;ZI:L@ohos/arkui/Application/Application;", + "C{std.core.String}C{std.core.String}C{std.core.String}zi:C{@ohos.arkui.Application.Application}", "start", - "JI:J", + "li:l", "enter", - "IJ:Z", + "il:z", "emitEvent", - "IIII:Lstd/core/String;", + "iiii:C{std.core.String}", "UNUSED", - "I:I", + "i:i", "loadView", - "Lstd/core/String;Lstd/core/String;:Lstd/core/String;", + "C{std.core.String}C{std.core.String}:C{std.core.String}", }; #endif diff --git a/ui2abc/libarkts/native/src/bridges.cc b/ui2abc/libarkts/native/src/bridges.cc index 1dad35c6e3b8fa6132b3f9feeaff63572889bcb2..cb3767e56563b9e045d98279c739368dc2c35d7a 100644 --- a/ui2abc/libarkts/native/src/bridges.cc +++ b/ui2abc/libarkts/native/src/bridges.cc @@ -509,7 +509,7 @@ KNativePointer impl_CreateDiagnosticKind(KNativePointer context, KStringPtr& mes } KOALA_INTEROP_3(CreateDiagnosticKind, KNativePointer, KNativePointer, KStringPtr, KInt) -KNativePointer impl_CreateDiagnosticInfo(KNativePointer context, KNativePointer kind, KStringArray argsPtr, KInt argc) +KNativePointer impl_CreateDiagnosticInfo(KNativePointer context, KNativePointer kind, KStringArray argsPtr, KInt argc, KNativePointer pos) { const auto _context = reinterpret_cast(context); const auto _kind = reinterpret_cast(kind); @@ -523,12 +523,13 @@ KNativePointer impl_CreateDiagnosticInfo(KNativePointer context, KNativePointer _args[i] = strdup(std::string(reinterpret_cast(argsPtr + position), strLen).c_str()); position += strLen; } - return GetImpl()->CreateDiagnosticInfo(_context, _kind, _args, argc); + auto&& _pos = reinterpret_cast(pos); + return GetImpl()->CreateDiagnosticInfo(_context, _kind, _args, argc, _pos); } -KOALA_INTEROP_4(CreateDiagnosticInfo, KNativePointer, KNativePointer, KNativePointer, KStringArray, KInt) +KOALA_INTEROP_5(CreateDiagnosticInfo, KNativePointer, KNativePointer, KNativePointer, KStringArray, KInt, KNativePointer) KNativePointer impl_CreateSuggestionInfo(KNativePointer context, KNativePointer kind, KStringArray argsPtr, - KInt argc, KStringPtr& substitutionCode) + KInt argc, KStringPtr& substitutionCode, KNativePointer range) { const auto _context = reinterpret_cast(context); const auto _kind = reinterpret_cast(kind); @@ -543,9 +544,10 @@ KNativePointer impl_CreateSuggestionInfo(KNativePointer context, KNativePointer position += strLen; } const auto _substitutionCode = getStringCopy(substitutionCode); - return GetImpl()->CreateSuggestionInfo(_context, _kind, _args, argc, _substitutionCode); + const auto _range = reinterpret_cast(range); + return GetImpl()->CreateSuggestionInfo(_context, _kind, _args, argc, _substitutionCode, _range); } -KOALA_INTEROP_5(CreateSuggestionInfo, KNativePointer, KNativePointer, KNativePointer, KStringArray, KInt, KStringPtr) +KOALA_INTEROP_6(CreateSuggestionInfo, KNativePointer, KNativePointer, KNativePointer, KStringArray, KInt, KStringPtr, KNativePointer) void impl_LogDiagnostic(KNativePointer context, KNativePointer kind, KStringArray argvPtr, KInt argc, KNativePointer pos) @@ -568,15 +570,14 @@ void impl_LogDiagnostic(KNativePointer context, KNativePointer kind, KStringArra KOALA_INTEROP_V5(LogDiagnostic, KNativePointer, KNativePointer, KStringArray, KInt, KNativePointer) void impl_LogDiagnosticWithSuggestion(KNativePointer context, KNativePointer diagnosticInfo, - KNativePointer suggestionInfo, KNativePointer range) + KNativePointer suggestionInfo) { const auto _context = reinterpret_cast(context); const auto _diagnosticInfo = reinterpret_cast(diagnosticInfo); const auto _suggestionInfo = reinterpret_cast(suggestionInfo); - const auto _range = reinterpret_cast(range); - GetImpl()->LogDiagnosticWithSuggestion(_context, _diagnosticInfo, _suggestionInfo, _range); + GetImpl()->LogDiagnosticWithSuggestion(_context, _diagnosticInfo, _suggestionInfo); } -KOALA_INTEROP_V4(LogDiagnosticWithSuggestion, KNativePointer, KNativePointer, KNativePointer, KNativePointer) +KOALA_INTEROP_V3(LogDiagnosticWithSuggestion, KNativePointer, KNativePointer, KNativePointer) KInt impl_GenerateStaticDeclarationsFromContext(KNativePointer contextPtr, KStringPtr &outputPath) { @@ -596,12 +597,12 @@ KNativePointer impl_AnnotationUsageIrPropertiesPtrConst(KNativePointer context, KOALA_INTEROP_2(AnnotationUsageIrPropertiesPtrConst, KNativePointer, KNativePointer, KNativePointer); KInt impl_GenerateTsDeclarationsFromContext(KNativePointer contextPtr, KStringPtr &outputDeclEts, KStringPtr &outputEts, - KBoolean exportAll, KBoolean isolated) + KBoolean exportAll, KBoolean isolated, KStringPtr &recordFile) { auto context = reinterpret_cast(contextPtr); - return GetImpl()->GenerateTsDeclarationsFromContext(context, outputDeclEts.data(), outputEts.data(), exportAll, isolated ); + return GetImpl()->GenerateTsDeclarationsFromContext(context, outputDeclEts.data(), outputEts.data(), exportAll, isolated, recordFile.data()); } -KOALA_INTEROP_5(GenerateTsDeclarationsFromContext, KInt, KNativePointer, KStringPtr, KStringPtr, KBoolean, KBoolean) +KOALA_INTEROP_6(GenerateTsDeclarationsFromContext, KInt, KNativePointer, KStringPtr, KStringPtr, KBoolean, KBoolean, KStringPtr) // TODO: simplify KNativePointer impl_CreateContextGenerateAbcForExternalSourceFiles( diff --git a/ui2abc/libarkts/package.json b/ui2abc/libarkts/package.json index 361749dfea9e78c819d3455ab2c4f9cfd8a23671..46c1357332fe05873284b3ca6c04dde591d3fcf0 100644 --- a/ui2abc/libarkts/package.json +++ b/ui2abc/libarkts/package.json @@ -29,6 +29,7 @@ "panda_sdk_version": "next" }, "dependencies": { + "@idlizer/arktscgen": "2.1.9-arktscgen-6", "@koalaui/ets-tsc": "4.9.5-r5", "@koalaui/build-common": "1.7.6+devel", "@koalaui/compat": "1.7.6+devel", diff --git a/ui2abc/libarkts/src/Es2pandaNativeModule.ts b/ui2abc/libarkts/src/Es2pandaNativeModule.ts index da797b0a98d85e97df9b3e0d56c03b77c1982621..57ad82b4c077d38643159f00699f756d8557691e 100644 --- a/ui2abc/libarkts/src/Es2pandaNativeModule.ts +++ b/ui2abc/libarkts/src/Es2pandaNativeModule.ts @@ -188,18 +188,18 @@ export class Es2pandaNativeModule { _CreateDiagnosticKind(context: KNativePointer, message: string, type: Es2pandaPluginDiagnosticType): KNativePointer { throw new Error("Not implemented") } - _CreateDiagnosticInfo(context: KNativePointer, kind: KNativePointer, args: string[], argc: number): KNativePointer { + _CreateDiagnosticInfo(context: KNativePointer, kind: KNativePointer, args: string[], argc: number, pos: KNativePointer): KNativePointer { throw new Error("Not implemented") } _CreateSuggestionInfo(context: KNativePointer, kind: KNativePointer, args: string[], - argc: number, substitutionCode: string): KNativePointer { + argc: number, substitutionCode: string, range?: KNativePointer): KNativePointer { throw new Error("Not implemented") } _LogDiagnostic(context: KNativePointer, kind: KNativePointer, argv: string[], argc: number, pos: KNativePointer): void { throw new Error("Not implemented") } _LogDiagnosticWithSuggestion(context: KNativePointer, diagnosticInfo: KNativePointer, - suggestionInfo?: KNativePointer, range?: KNativePointer): void { + suggestionInfo?: KNativePointer): void { throw new Error("Not implemented") } _SetUpSoPath(soPath: string): void { @@ -214,7 +214,7 @@ export class Es2pandaNativeModule { _ProgramCanSkipPhases(context: KNativePointer, program: KNativePointer): boolean { throw new Error("Not implemented") } - _GenerateTsDeclarationsFromContext(config: KPtr, outputDeclEts: String, outputEts: String, exportAll: KBoolean, isolated: KBoolean): KPtr { + _GenerateTsDeclarationsFromContext(config: KPtr, outputDeclEts: String, outputEts: String, exportAll: KBoolean, isolated: KBoolean, recordFile: String): KPtr { throw new Error("Not implemented") } _GenerateStaticDeclarationsFromContext(config: KPtr, outputPath: String): KPtr { @@ -258,4 +258,4 @@ export function initGeneratedEs2panda(): GeneratedEs2pandaNativeModule { // registerNativeModule("InteropNativeModule", NativeModule) loadNativeModuleLibrary("NativeModule", instance) return instance -} \ No newline at end of file +} diff --git a/ui2abc/libarkts/src/arkts-api/utilities/public.ts b/ui2abc/libarkts/src/arkts-api/utilities/public.ts index 2149fab953318b34595f1586f9cdb24147367170..2ebd090c6296a69b0c1318297249892466558862 100644 --- a/ui2abc/libarkts/src/arkts-api/utilities/public.ts +++ b/ui2abc/libarkts/src/arkts-api/utilities/public.ts @@ -40,7 +40,7 @@ import { listPrograms } from "../plugins" /** * TODO: Replace or remove with better naming - * + * * @deprecated */ export function createETSModuleFromContext(): ETSModule { @@ -59,7 +59,7 @@ export function createETSModuleFromContext(): ETSModule { /** * Now used only in tests * TODO: Remove or replace with better method - * + * * @deprecated */ export function createETSModuleFromSource( @@ -255,17 +255,19 @@ export function generateTsDeclarationsFromContext( outputDeclEts: string, outputEts: string, exportAll: boolean, - isolated: boolean + isolated: boolean, + recordFile: string ): KInt { return global.es2panda._GenerateTsDeclarationsFromContext( global.context, passString(outputDeclEts), passString(outputEts), exportAll, - isolated + isolated, + passString(recordFile) ); } export function setAllParents(ast: AstNode): void { global.es2panda._AstNodeUpdateAll(global.context, ast.peer); -} \ No newline at end of file +} diff --git a/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/Diagnostic.ts b/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/Diagnostic.ts index 9b2165ee797e717ab6f49b716f833171ec200e1c..318edb419062dfbcb3f3814c84ef57de36dfb926 100644 --- a/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/Diagnostic.ts +++ b/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/Diagnostic.ts @@ -31,9 +31,9 @@ export class Diagnostic extends ArktsObject { global.es2panda._LogDiagnostic(global.context, kind.peer, passStringArray(args), args.length, pos.peer); } - static logDiagnosticWithSuggestion(diagnosticInfo: DiagnosticInfo, suggestionInfo: SuggestionInfo, - range: SourceRange): void { - global.es2panda._LogDiagnosticWithSuggestion(global.context, diagnosticInfo.peer, suggestionInfo.peer, range.peer); + static logDiagnosticWithSuggestion(diagnosticInfo: DiagnosticInfo, suggestionInfo: SuggestionInfo): void { + console.warn(`Range parameter is not used anymore`) + global.es2panda._LogDiagnosticWithSuggestion(global.context, diagnosticInfo.peer, suggestionInfo.peer); } -} \ No newline at end of file +} diff --git a/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts b/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts index f708cdebd9f8c092796a660df2a1c9f001e2a0ca..a85fa599124335a60c6d10f8b7d7cc6eccc29ebc 100644 --- a/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts +++ b/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/DiagnosticInfo.ts @@ -18,16 +18,17 @@ import { global } from '../static/global'; import { KNativePointer } from '@koalaui/interop'; import { DiagnosticKind } from './DiagnosticKind'; import { passStringArray } from '../utilities/private'; +import { SourcePosition } from '../../../arkts-api/peers/SourcePosition'; export class DiagnosticInfo extends ArktsObject { constructor(peer: KNativePointer) { super(peer); } - static create(kind: DiagnosticKind, ...args: string[]): DiagnosticInfo { + static create(kind: DiagnosticKind, pos: SourcePosition, ...args: string[]): DiagnosticInfo { return new DiagnosticInfo( - global.es2panda._CreateDiagnosticInfo(global.context, kind.peer, passStringArray(args), args.length) + global.es2panda._CreateDiagnosticInfo(global.context, kind.peer, passStringArray(args), args.length, pos.peer) ); } -} \ No newline at end of file +} diff --git a/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts b/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts index 3c063111042da9d994499b2bf7851880f30338e6..f4b92b37430f07212bd6ccba5c89cd2b6ff5f500 100644 --- a/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts +++ b/ui2abc/libarkts/src/wrapper-compat/arkts-api/peers/SuggestionInfo.ts @@ -18,16 +18,17 @@ import { global } from '../static/global'; import { KNativePointer } from '@koalaui/interop'; import { DiagnosticKind } from './DiagnosticKind'; import { passStringArray } from '../utilities/private'; +import { SourceRange } from './SourceRange'; export class SuggestionInfo extends ArktsObject { constructor(peer: KNativePointer) { super(peer); } - static create(kind: DiagnosticKind, substitutionCode: string, ...args: string[]): SuggestionInfo { + static create(kind: DiagnosticKind, substitutionCode: string, range: SourceRange, ...args: string[]): SuggestionInfo { return new SuggestionInfo( - global.es2panda._CreateSuggestionInfo(global.context, kind.peer, passStringArray(args), args.length, substitutionCode) + global.es2panda._CreateSuggestionInfo(global.context, kind.peer, passStringArray(args), args.length, substitutionCode, range.peer) ); } -} \ No newline at end of file +} diff --git a/ui2abc/libarkts/src/wrapper-compat/arkts-api/utilities/public.ts b/ui2abc/libarkts/src/wrapper-compat/arkts-api/utilities/public.ts index 919054abe135d0c0fef95c05213478c3bc9428c6..dcf947ea74639d393ef96506a28e526288c15189 100644 --- a/ui2abc/libarkts/src/wrapper-compat/arkts-api/utilities/public.ts +++ b/ui2abc/libarkts/src/wrapper-compat/arkts-api/utilities/public.ts @@ -256,14 +256,16 @@ export function generateTsDeclarationsFromContext( outputDeclEts: string, outputEts: string, exportAll: boolean, - isolated: boolean + isolated: boolean, + recordFile: string ): KInt { return global.es2panda._GenerateTsDeclarationsFromContext( global.context, passString(outputDeclEts), passString(outputEts), exportAll, - isolated + isolated, + passString(recordFile) ); }