Skip to content

Commit 0741374

Browse files
committed
-
1 parent 8f7ca28 commit 0741374

File tree

2 files changed

+16
-8
lines changed

2 files changed

+16
-8
lines changed

inputfiles/patches/cssom-view.kdl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,10 @@ interface-mixin DocumentOrShadowRoot {
55
param x type=long
66
param y type=long
77
}
8-
method elementsFromPoint returns="Element" array {
8+
method elementsFromPoint {
9+
type sequence {
10+
type Element
11+
}
912
param x type=long
1013
param y type=long
1114
}

src/build/patches.ts

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -155,21 +155,26 @@ function handleProperty(child: Node): Partial<Property> {
155155
*/
156156
function handleMethod(child: Node): Partial<Method> {
157157
const name = child.values[0] as string;
158-
const isArray = child.values[1] as boolean | undefined;
158+
const type = child.children[0];
159159
const returnType = child.properties.returns as string;
160160
const nullable = child.properties.nullable as boolean;
161161

162-
const params = child.children.map((c) => ({
163-
name: c.values[0] as string,
164-
type: c.properties.type as string,
165-
}));
162+
const params = child.children
163+
.filter((c) => c.values[0] != "sequence")
164+
.map((c) => ({
165+
name: c.values[0] as string,
166+
type: c.properties.type as string,
167+
}));
166168

167169
const signature: Method["signature"] = [
168170
{
169-
type: isArray ? "sequence" : returnType,
171+
type: type.name == "type" ? (type.values[0] as string) : returnType,
170172
param: params,
171173
nullable,
172-
...(isArray ? { subtype: { type: returnType } } : {}),
174+
subtype:
175+
type.name == "type"
176+
? { type: type.children[0].values[0] as string }
177+
: undefined,
173178
},
174179
];
175180
return { name, signature };

0 commit comments

Comments
 (0)