Skip to content

Commit bb56a2a

Browse files
author
Sergey Mashkov
committed
IDL2K better dictionary support: generate interfaces with builder function
suppress inline warning, replace Long with Int (cherry picked from commit 342f35f)
1 parent 0806e94 commit bb56a2a

File tree

12 files changed

+466
-414
lines changed

12 files changed

+466
-414
lines changed

js/js.libraries/src/generated/org.khronos.webgl.kt

Lines changed: 20 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -31,17 +31,18 @@ native public interface WebGLContextAttributes {
3131
var failIfMajorPerformanceCaveat: Boolean
3232
}
3333

34+
suppress("NOTHING_TO_INLINE")
3435
inline fun WebGLContextAttributes(alpha: Boolean = true, depth: Boolean = true, stencil: Boolean = false, antialias: Boolean = true, premultipliedAlpha: Boolean = true, preserveDrawingBuffer: Boolean = false, preferLowPowerToHighPerformance: Boolean = false, failIfMajorPerformanceCaveat: Boolean = false): WebGLContextAttributes {
35-
val o = js("({})") as WebGLContextAttributes
36+
val o = js("({})")
3637

37-
o.`alpha` = alpha
38-
o.`depth` = depth
39-
o.`stencil` = stencil
40-
o.`antialias` = antialias
41-
o.`premultipliedAlpha` = premultipliedAlpha
42-
o.`preserveDrawingBuffer` = preserveDrawingBuffer
43-
o.`preferLowPowerToHighPerformance` = preferLowPowerToHighPerformance
44-
o.`failIfMajorPerformanceCaveat` = failIfMajorPerformanceCaveat
38+
o["alpha"] = alpha
39+
o["depth"] = depth
40+
o["stencil"] = stencil
41+
o["antialias"] = antialias
42+
o["premultipliedAlpha"] = premultipliedAlpha
43+
o["preserveDrawingBuffer"] = preserveDrawingBuffer
44+
o["preferLowPowerToHighPerformance"] = preferLowPowerToHighPerformance
45+
o["failIfMajorPerformanceCaveat"] = failIfMajorPerformanceCaveat
4546

4647
return o
4748
}
@@ -111,9 +112,9 @@ native public interface WebGLRenderingContext : RenderingContext {
111112
fun blendEquationSeparate(modeRGB: Int, modeAlpha: Int): Unit = noImpl
112113
fun blendFunc(sfactor: Int, dfactor: Int): Unit = noImpl
113114
fun blendFuncSeparate(srcRGB: Int, dstRGB: Int, srcAlpha: Int, dstAlpha: Int): Unit = noImpl
114-
fun bufferData(target: Int, size: Long, usage: Int): Unit = noImpl
115+
fun bufferData(target: Int, size: Int, usage: Int): Unit = noImpl
115116
fun bufferData(target: Int, data: dynamic, usage: Int): Unit = noImpl
116-
fun bufferSubData(target: Int, offset: Long, data: dynamic): Unit = noImpl
117+
fun bufferSubData(target: Int, offset: Int, data: dynamic): Unit = noImpl
117118
fun checkFramebufferStatus(target: Int): Int = noImpl
118119
fun clear(mask: Int): Unit = noImpl
119120
fun clearColor(red: Float, green: Float, blue: Float, alpha: Float): Unit = noImpl
@@ -145,7 +146,7 @@ native public interface WebGLRenderingContext : RenderingContext {
145146
fun disable(cap: Int): Unit = noImpl
146147
fun disableVertexAttribArray(index: Int): Unit = noImpl
147148
fun drawArrays(mode: Int, first: Int, count: Int): Unit = noImpl
148-
fun drawElements(mode: Int, count: Int, type: Int, offset: Long): Unit = noImpl
149+
fun drawElements(mode: Int, count: Int, type: Int, offset: Int): Unit = noImpl
149150
fun enable(cap: Int): Unit = noImpl
150151
fun enableVertexAttribArray(index: Int): Unit = noImpl
151152
fun finish(): Unit = noImpl
@@ -173,7 +174,7 @@ native public interface WebGLRenderingContext : RenderingContext {
173174
fun getUniform(program: WebGLProgram?, location: WebGLUniformLocation?): Any? = noImpl
174175
fun getUniformLocation(program: WebGLProgram?, name: String): WebGLUniformLocation? = noImpl
175176
fun getVertexAttrib(index: Int, pname: Int): Any? = noImpl
176-
fun getVertexAttribOffset(index: Int, pname: Int): Long = noImpl
177+
fun getVertexAttribOffset(index: Int, pname: Int): Int = noImpl
177178
fun hint(target: Int, mode: Int): Unit = noImpl
178179
fun isBuffer(buffer: WebGLBuffer?): Boolean = noImpl
179180
fun isEnabled(cap: Int): Boolean = noImpl
@@ -247,7 +248,7 @@ native public interface WebGLRenderingContext : RenderingContext {
247248
fun vertexAttrib4f(indx: Int, x: Float, y: Float, z: Float, w: Float): Unit = noImpl
248249
fun vertexAttrib4fv(indx: Int, values: Float32Array): Unit = noImpl
249250
fun vertexAttrib4fv(indx: Int, values: Array<Float>): Unit = noImpl
250-
fun vertexAttribPointer(indx: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Long): Unit = noImpl
251+
fun vertexAttribPointer(indx: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Int): Unit = noImpl
251252
fun viewport(x: Int, y: Int, width: Int, height: Int): Unit = noImpl
252253

253254
companion object {
@@ -560,12 +561,13 @@ native public interface WebGLContextEventInit : EventInit {
560561
var statusMessage: String
561562
}
562563

564+
suppress("NOTHING_TO_INLINE")
563565
inline fun WebGLContextEventInit(statusMessage: String, bubbles: Boolean = false, cancelable: Boolean = false): WebGLContextEventInit {
564-
val o = js("({})") as WebGLContextEventInit
566+
val o = js("({})")
565567

566-
o.`statusMessage` = statusMessage
567-
o.`bubbles` = bubbles
568-
o.`cancelable` = cancelable
568+
o["statusMessage"] = statusMessage
569+
o["bubbles"] = bubbles
570+
o["cancelable"] = cancelable
569571

570572
return o
571573
}

js/js.libraries/src/generated/org.w3c.dom.events.kt

Lines changed: 131 additions & 124 deletions
Original file line numberDiff line numberDiff line change
@@ -126,13 +126,14 @@ native public interface UIEventInit : EventInit {
126126
var detail: Int
127127
}
128128

129+
suppress("NOTHING_TO_INLINE")
129130
inline fun UIEventInit(view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): UIEventInit {
130-
val o = js("({})") as UIEventInit
131+
val o = js("({})")
131132

132-
o.`view` = view
133-
o.`detail` = detail
134-
o.`bubbles` = bubbles
135-
o.`cancelable` = cancelable
133+
o["view"] = view
134+
o["detail"] = detail
135+
o["bubbles"] = bubbles
136+
o["cancelable"] = cancelable
136137

137138
return o
138139
}
@@ -147,14 +148,15 @@ native public interface FocusEventInit : UIEventInit {
147148
var relatedTarget: EventTarget?
148149
}
149150

151+
suppress("NOTHING_TO_INLINE")
150152
inline fun FocusEventInit(relatedTarget: EventTarget? = null, view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): FocusEventInit {
151-
val o = js("({})") as FocusEventInit
153+
val o = js("({})")
152154

153-
o.`relatedTarget` = relatedTarget
154-
o.`view` = view
155-
o.`detail` = detail
156-
o.`bubbles` = bubbles
157-
o.`cancelable` = cancelable
155+
o["relatedTarget"] = relatedTarget
156+
o["view"] = view
157+
o["detail"] = detail
158+
o["bubbles"] = bubbles
159+
o["cancelable"] = cancelable
158160

159161
return o
160162
}
@@ -169,35 +171,36 @@ native public interface MouseEventInit : EventModifierInit {
169171
var relatedTarget: EventTarget?
170172
}
171173

174+
suppress("NOTHING_TO_INLINE")
172175
inline fun MouseEventInit(screenX: Int = 0, screenY: Int = 0, clientX: Int = 0, clientY: Int = 0, button: Short = 0, buttons: Short = 0, relatedTarget: EventTarget? = null, ctrlKey: Boolean = false, shiftKey: Boolean = false, altKey: Boolean = false, metaKey: Boolean = false, modifierAltGraph: Boolean = false, modifierCapsLock: Boolean = false, modifierFn: Boolean = false, modifierFnLock: Boolean = false, modifierHyper: Boolean = false, modifierNumLock: Boolean = false, modifierOS: Boolean = false, modifierScrollLock: Boolean = false, modifierSuper: Boolean = false, modifierSymbol: Boolean = false, modifierSymbolLock: Boolean = false, view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): MouseEventInit {
173-
val o = js("({})") as MouseEventInit
174-
175-
o.`screenX` = screenX
176-
o.`screenY` = screenY
177-
o.`clientX` = clientX
178-
o.`clientY` = clientY
179-
o.`button` = button
180-
o.`buttons` = buttons
181-
o.`relatedTarget` = relatedTarget
182-
o.`ctrlKey` = ctrlKey
183-
o.`shiftKey` = shiftKey
184-
o.`altKey` = altKey
185-
o.`metaKey` = metaKey
186-
o.`modifierAltGraph` = modifierAltGraph
187-
o.`modifierCapsLock` = modifierCapsLock
188-
o.`modifierFn` = modifierFn
189-
o.`modifierFnLock` = modifierFnLock
190-
o.`modifierHyper` = modifierHyper
191-
o.`modifierNumLock` = modifierNumLock
192-
o.`modifierOS` = modifierOS
193-
o.`modifierScrollLock` = modifierScrollLock
194-
o.`modifierSuper` = modifierSuper
195-
o.`modifierSymbol` = modifierSymbol
196-
o.`modifierSymbolLock` = modifierSymbolLock
197-
o.`view` = view
198-
o.`detail` = detail
199-
o.`bubbles` = bubbles
200-
o.`cancelable` = cancelable
176+
val o = js("({})")
177+
178+
o["screenX"] = screenX
179+
o["screenY"] = screenY
180+
o["clientX"] = clientX
181+
o["clientY"] = clientY
182+
o["button"] = button
183+
o["buttons"] = buttons
184+
o["relatedTarget"] = relatedTarget
185+
o["ctrlKey"] = ctrlKey
186+
o["shiftKey"] = shiftKey
187+
o["altKey"] = altKey
188+
o["metaKey"] = metaKey
189+
o["modifierAltGraph"] = modifierAltGraph
190+
o["modifierCapsLock"] = modifierCapsLock
191+
o["modifierFn"] = modifierFn
192+
o["modifierFnLock"] = modifierFnLock
193+
o["modifierHyper"] = modifierHyper
194+
o["modifierNumLock"] = modifierNumLock
195+
o["modifierOS"] = modifierOS
196+
o["modifierScrollLock"] = modifierScrollLock
197+
o["modifierSuper"] = modifierSuper
198+
o["modifierSymbol"] = modifierSymbol
199+
o["modifierSymbolLock"] = modifierSymbolLock
200+
o["view"] = view
201+
o["detail"] = detail
202+
o["bubbles"] = bubbles
203+
o["cancelable"] = cancelable
201204

202205
return o
203206
}
@@ -220,28 +223,29 @@ native public interface EventModifierInit : UIEventInit {
220223
var modifierSymbolLock: Boolean
221224
}
222225

226+
suppress("NOTHING_TO_INLINE")
223227
inline fun EventModifierInit(ctrlKey: Boolean = false, shiftKey: Boolean = false, altKey: Boolean = false, metaKey: Boolean = false, modifierAltGraph: Boolean = false, modifierCapsLock: Boolean = false, modifierFn: Boolean = false, modifierFnLock: Boolean = false, modifierHyper: Boolean = false, modifierNumLock: Boolean = false, modifierOS: Boolean = false, modifierScrollLock: Boolean = false, modifierSuper: Boolean = false, modifierSymbol: Boolean = false, modifierSymbolLock: Boolean = false, view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): EventModifierInit {
224-
val o = js("({})") as EventModifierInit
225-
226-
o.`ctrlKey` = ctrlKey
227-
o.`shiftKey` = shiftKey
228-
o.`altKey` = altKey
229-
o.`metaKey` = metaKey
230-
o.`modifierAltGraph` = modifierAltGraph
231-
o.`modifierCapsLock` = modifierCapsLock
232-
o.`modifierFn` = modifierFn
233-
o.`modifierFnLock` = modifierFnLock
234-
o.`modifierHyper` = modifierHyper
235-
o.`modifierNumLock` = modifierNumLock
236-
o.`modifierOS` = modifierOS
237-
o.`modifierScrollLock` = modifierScrollLock
238-
o.`modifierSuper` = modifierSuper
239-
o.`modifierSymbol` = modifierSymbol
240-
o.`modifierSymbolLock` = modifierSymbolLock
241-
o.`view` = view
242-
o.`detail` = detail
243-
o.`bubbles` = bubbles
244-
o.`cancelable` = cancelable
228+
val o = js("({})")
229+
230+
o["ctrlKey"] = ctrlKey
231+
o["shiftKey"] = shiftKey
232+
o["altKey"] = altKey
233+
o["metaKey"] = metaKey
234+
o["modifierAltGraph"] = modifierAltGraph
235+
o["modifierCapsLock"] = modifierCapsLock
236+
o["modifierFn"] = modifierFn
237+
o["modifierFnLock"] = modifierFnLock
238+
o["modifierHyper"] = modifierHyper
239+
o["modifierNumLock"] = modifierNumLock
240+
o["modifierOS"] = modifierOS
241+
o["modifierScrollLock"] = modifierScrollLock
242+
o["modifierSuper"] = modifierSuper
243+
o["modifierSymbol"] = modifierSymbol
244+
o["modifierSymbolLock"] = modifierSymbolLock
245+
o["view"] = view
246+
o["detail"] = detail
247+
o["bubbles"] = bubbles
248+
o["cancelable"] = cancelable
245249

246250
return o
247251
}
@@ -271,39 +275,40 @@ native public interface WheelEventInit : MouseEventInit {
271275
var deltaMode: Int
272276
}
273277

278+
suppress("NOTHING_TO_INLINE")
274279
inline fun WheelEventInit(deltaX: Double = 0.0, deltaY: Double = 0.0, deltaZ: Double = 0.0, deltaMode: Int = 0, screenX: Int = 0, screenY: Int = 0, clientX: Int = 0, clientY: Int = 0, button: Short = 0, buttons: Short = 0, relatedTarget: EventTarget? = null, ctrlKey: Boolean = false, shiftKey: Boolean = false, altKey: Boolean = false, metaKey: Boolean = false, modifierAltGraph: Boolean = false, modifierCapsLock: Boolean = false, modifierFn: Boolean = false, modifierFnLock: Boolean = false, modifierHyper: Boolean = false, modifierNumLock: Boolean = false, modifierOS: Boolean = false, modifierScrollLock: Boolean = false, modifierSuper: Boolean = false, modifierSymbol: Boolean = false, modifierSymbolLock: Boolean = false, view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): WheelEventInit {
275-
val o = js("({})") as WheelEventInit
276-
277-
o.`deltaX` = deltaX
278-
o.`deltaY` = deltaY
279-
o.`deltaZ` = deltaZ
280-
o.`deltaMode` = deltaMode
281-
o.`screenX` = screenX
282-
o.`screenY` = screenY
283-
o.`clientX` = clientX
284-
o.`clientY` = clientY
285-
o.`button` = button
286-
o.`buttons` = buttons
287-
o.`relatedTarget` = relatedTarget
288-
o.`ctrlKey` = ctrlKey
289-
o.`shiftKey` = shiftKey
290-
o.`altKey` = altKey
291-
o.`metaKey` = metaKey
292-
o.`modifierAltGraph` = modifierAltGraph
293-
o.`modifierCapsLock` = modifierCapsLock
294-
o.`modifierFn` = modifierFn
295-
o.`modifierFnLock` = modifierFnLock
296-
o.`modifierHyper` = modifierHyper
297-
o.`modifierNumLock` = modifierNumLock
298-
o.`modifierOS` = modifierOS
299-
o.`modifierScrollLock` = modifierScrollLock
300-
o.`modifierSuper` = modifierSuper
301-
o.`modifierSymbol` = modifierSymbol
302-
o.`modifierSymbolLock` = modifierSymbolLock
303-
o.`view` = view
304-
o.`detail` = detail
305-
o.`bubbles` = bubbles
306-
o.`cancelable` = cancelable
280+
val o = js("({})")
281+
282+
o["deltaX"] = deltaX
283+
o["deltaY"] = deltaY
284+
o["deltaZ"] = deltaZ
285+
o["deltaMode"] = deltaMode
286+
o["screenX"] = screenX
287+
o["screenY"] = screenY
288+
o["clientX"] = clientX
289+
o["clientY"] = clientY
290+
o["button"] = button
291+
o["buttons"] = buttons
292+
o["relatedTarget"] = relatedTarget
293+
o["ctrlKey"] = ctrlKey
294+
o["shiftKey"] = shiftKey
295+
o["altKey"] = altKey
296+
o["metaKey"] = metaKey
297+
o["modifierAltGraph"] = modifierAltGraph
298+
o["modifierCapsLock"] = modifierCapsLock
299+
o["modifierFn"] = modifierFn
300+
o["modifierFnLock"] = modifierFnLock
301+
o["modifierHyper"] = modifierHyper
302+
o["modifierNumLock"] = modifierNumLock
303+
o["modifierOS"] = modifierOS
304+
o["modifierScrollLock"] = modifierScrollLock
305+
o["modifierSuper"] = modifierSuper
306+
o["modifierSymbol"] = modifierSymbol
307+
o["modifierSymbolLock"] = modifierSymbolLock
308+
o["view"] = view
309+
o["detail"] = detail
310+
o["bubbles"] = bubbles
311+
o["cancelable"] = cancelable
307312

308313
return o
309314
}
@@ -352,33 +357,34 @@ native public interface KeyboardEventInit : EventModifierInit {
352357
var isComposing: Boolean
353358
}
354359

360+
suppress("NOTHING_TO_INLINE")
355361
inline fun KeyboardEventInit(key: String = "", code: String = "", location: Int = 0, repeat: Boolean = false, isComposing: Boolean = false, ctrlKey: Boolean = false, shiftKey: Boolean = false, altKey: Boolean = false, metaKey: Boolean = false, modifierAltGraph: Boolean = false, modifierCapsLock: Boolean = false, modifierFn: Boolean = false, modifierFnLock: Boolean = false, modifierHyper: Boolean = false, modifierNumLock: Boolean = false, modifierOS: Boolean = false, modifierScrollLock: Boolean = false, modifierSuper: Boolean = false, modifierSymbol: Boolean = false, modifierSymbolLock: Boolean = false, view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): KeyboardEventInit {
356-
val o = js("({})") as KeyboardEventInit
357-
358-
o.`key` = key
359-
o.`code` = code
360-
o.`location` = location
361-
o.`repeat` = repeat
362-
o.`isComposing` = isComposing
363-
o.`ctrlKey` = ctrlKey
364-
o.`shiftKey` = shiftKey
365-
o.`altKey` = altKey
366-
o.`metaKey` = metaKey
367-
o.`modifierAltGraph` = modifierAltGraph
368-
o.`modifierCapsLock` = modifierCapsLock
369-
o.`modifierFn` = modifierFn
370-
o.`modifierFnLock` = modifierFnLock
371-
o.`modifierHyper` = modifierHyper
372-
o.`modifierNumLock` = modifierNumLock
373-
o.`modifierOS` = modifierOS
374-
o.`modifierScrollLock` = modifierScrollLock
375-
o.`modifierSuper` = modifierSuper
376-
o.`modifierSymbol` = modifierSymbol
377-
o.`modifierSymbolLock` = modifierSymbolLock
378-
o.`view` = view
379-
o.`detail` = detail
380-
o.`bubbles` = bubbles
381-
o.`cancelable` = cancelable
362+
val o = js("({})")
363+
364+
o["key"] = key
365+
o["code"] = code
366+
o["location"] = location
367+
o["repeat"] = repeat
368+
o["isComposing"] = isComposing
369+
o["ctrlKey"] = ctrlKey
370+
o["shiftKey"] = shiftKey
371+
o["altKey"] = altKey
372+
o["metaKey"] = metaKey
373+
o["modifierAltGraph"] = modifierAltGraph
374+
o["modifierCapsLock"] = modifierCapsLock
375+
o["modifierFn"] = modifierFn
376+
o["modifierFnLock"] = modifierFnLock
377+
o["modifierHyper"] = modifierHyper
378+
o["modifierNumLock"] = modifierNumLock
379+
o["modifierOS"] = modifierOS
380+
o["modifierScrollLock"] = modifierScrollLock
381+
o["modifierSuper"] = modifierSuper
382+
o["modifierSymbol"] = modifierSymbol
383+
o["modifierSymbolLock"] = modifierSymbolLock
384+
o["view"] = view
385+
o["detail"] = detail
386+
o["bubbles"] = bubbles
387+
o["cancelable"] = cancelable
382388

383389
return o
384390
}
@@ -393,14 +399,15 @@ native public interface CompositionEventInit : UIEventInit {
393399
var data: String
394400
}
395401

402+
suppress("NOTHING_TO_INLINE")
396403
inline fun CompositionEventInit(data: String = "", view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): CompositionEventInit {
397-
val o = js("({})") as CompositionEventInit
404+
val o = js("({})")
398405

399-
o.`data` = data
400-
o.`view` = view
401-
o.`detail` = detail
402-
o.`bubbles` = bubbles
403-
o.`cancelable` = cancelable
406+
o["data"] = data
407+
o["view"] = view
408+
o["detail"] = detail
409+
o["bubbles"] = bubbles
410+
o["cancelable"] = cancelable
404411

405412
return o
406413
}

0 commit comments

Comments
 (0)