mirror of
https://gitee.com/openharmony/third_party_jsframework
synced 2024-12-04 04:50:55 +00:00
Signed-off-by: fupengfei001 <fupengfei6@huawei.com>
This commit is contained in:
parent
6dd8a795eb
commit
2637c94fbf
@ -54,16 +54,46 @@ export function getReturnStatement(returnType: ReturnTypeEntity, sourceFile: Sou
|
|||||||
return `return new ${returnType.returnKindName}()`;
|
return `return new ${returnType.returnKindName}()`;
|
||||||
} else if (returnType.returnKindName.startsWith('IterableIterator')) {
|
} else if (returnType.returnKindName.startsWith('IterableIterator')) {
|
||||||
if (returnType.returnKindName.includes(',')) {
|
if (returnType.returnKindName.includes(',')) {
|
||||||
return `const IteratorEntriesMock = {
|
return `let index = 0;
|
||||||
|
const IteratorEntriesMock = {
|
||||||
*[Symbol.iterator]() {
|
*[Symbol.iterator]() {
|
||||||
yield ['[PC Preview] unkonwn paramIterMock_K', '[PC Preview] unkonwn paramIterMock_V'];
|
yield ['[PC Preview] unkonwn paramIterMock_K', '[PC Preview] unkonwn paramIterMock_V'];
|
||||||
|
},
|
||||||
|
next: () => {
|
||||||
|
if (index < 1) {
|
||||||
|
const returnValue = ['[PC Previwe] unkonwn paramIterMock_K', '[PC Previwe] unkonwn paramIterMock_V'];
|
||||||
|
index++;
|
||||||
|
return {
|
||||||
|
value: returnValue,
|
||||||
|
done: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
done: true
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return IteratorEntriesMock;`;
|
return IteratorEntriesMock;`;
|
||||||
} else {
|
} else {
|
||||||
return `const IteratorStringMock = {
|
return `let index = 0;
|
||||||
|
const IteratorStringMock = {
|
||||||
*[Symbol.iterator]() {
|
*[Symbol.iterator]() {
|
||||||
yield '[PC Preview] unkonwn string';
|
yield '[PC Preview] unkonwn string';
|
||||||
|
},
|
||||||
|
next: () => {
|
||||||
|
if (index < 1) {
|
||||||
|
const returnValue = '[PC Previwe] unkonwn string';
|
||||||
|
index++;
|
||||||
|
return {
|
||||||
|
value: returnValue,
|
||||||
|
done: false
|
||||||
|
};
|
||||||
|
} else {
|
||||||
|
return {
|
||||||
|
done: true
|
||||||
|
};
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
return IteratorStringMock;`;
|
return IteratorStringMock;`;
|
||||||
|
Loading…
Reference in New Issue
Block a user