diff --git a/src/gen/tools/common.js b/src/gen/tools/common.js index 852807287de0e0f23155bb2445fd3e3c32af616e..68b85913ec39602485af67f38bef2bb1c6cb7214 100644 --- a/src/gen/tools/common.js +++ b/src/gen/tools/common.js @@ -186,6 +186,10 @@ function getMapType(type) { let ttValue = re.search(",([a-zA-Z_0-9<>]+)>", type) let ttMap = re.search(",([a-zA-Z_0-9]+)>>", type) let ttArray = re.search("Array<([a-zA-Z_0-9]+)>", type) + + if(ttArray == null) { + ttArray = re.search("([a-zA-Z_0-9]+)\\[\\]>", type) + } let valueType let valueMapType @@ -195,7 +199,11 @@ function getMapType(type) { ttValue = re.search(":([a-zA-Z_0-9]+)}", type) ttMap = re.search(":([a-zA-Z_0-9]+)}}", type) ttArray = re.search("Array<([a-zA-Z_0-9]+)>", type) + if (ttArray == null) { + ttArray = re.search(":([a-zA-Z_0-9]+)\\[\\]}", type) + } } + if (ttValue != null) { valueType = re.getReg(type, ttValue.regs[1]) if (valueType.indexOf("Array<") == 0) { diff --git a/test/storytest/test_map/@ohos.test.d.ts b/test/storytest/test_map/@ohos.test.d.ts index e05e7fe142f39d3b737af9183032d4932c4d6142..b4afc8f023ed37c291c02b37c93627ac512dd43d 100644 --- a/test/storytest/test_map/@ohos.test.d.ts +++ b/test/storytest/test_map/@ohos.test.d.ts @@ -38,5 +38,15 @@ declare namespace napitest { fun9(v: {[key: string]: Human}): number; fun10(v: Map): number; } + + function fun13(v: {[key: string]: string[]}): number; + function fun18(v: Map): number; + + + /* + function fun14(v: number): {[key: string]: string[]}; --暂时不支持 + function fun15(v: number):Map --暂时不支持 + */ + } export default napitest; \ No newline at end of file diff --git a/test/storytest/test_map/test.js b/test/storytest/test_map/test.js index 94590d48ea878e6399d5c91ef75545b75d11b691..14b469c58b447a591b30000c425210bbdd9605ee 100644 --- a/test/storytest/test_map/test.js +++ b/test/storytest/test_map/test.js @@ -82,5 +82,5 @@ describe('Map', function () { {"peter":{"age":666,"name":"peter","isTrue":true}, "jane":{"age":666,"name":"jane","isTrue":false}}); assert.strictEqual(ret, 0); - }); + }); }); \ No newline at end of file