From bb56a2a5877c87f378800c79afb9825117877724 Mon Sep 17 00:00:00 2001 From: Sergey Mashkov Date: Wed, 17 Jun 2015 15:25:40 +0300 Subject: [PATCH] IDL2K better dictionary support: generate interfaces with builder function suppress inline warning, replace Long with Int (cherry picked from commit 342f35f) --- .../src/generated/org.khronos.webgl.kt | 38 ++- .../src/generated/org.w3c.dom.events.kt | 255 +++++++------- js/js.libraries/src/generated/org.w3c.dom.kt | 318 ++++++++++-------- .../src/generated/org.w3c.fetch.kt | 26 +- .../src/generated/org.w3c.files.kt | 22 +- .../src/generated/org.w3c.notifications.kt | 43 +-- .../src/generated/org.w3c.performance.kt | 42 +-- .../src/generated/org.w3c.workers.kt | 88 ++--- js/js.libraries/src/generated/org.w3c.xhr.kt | 23 +- libraries/tools/idl2k/src/main/kotlin/idl.kt | 10 +- .../tools/idl2k/src/main/kotlin/render.kt | 11 +- .../idl2k/src/main/kotlin/typeMappings.kt | 4 +- 12 files changed, 466 insertions(+), 414 deletions(-) diff --git a/js/js.libraries/src/generated/org.khronos.webgl.kt b/js/js.libraries/src/generated/org.khronos.webgl.kt index bf176325c77eb..d6820478bde30 100644 --- a/js/js.libraries/src/generated/org.khronos.webgl.kt +++ b/js/js.libraries/src/generated/org.khronos.webgl.kt @@ -31,17 +31,18 @@ native public interface WebGLContextAttributes { var failIfMajorPerformanceCaveat: Boolean } +suppress("NOTHING_TO_INLINE") 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 { - val o = js("({})") as WebGLContextAttributes + val o = js("({})") - o.`alpha` = alpha - o.`depth` = depth - o.`stencil` = stencil - o.`antialias` = antialias - o.`premultipliedAlpha` = premultipliedAlpha - o.`preserveDrawingBuffer` = preserveDrawingBuffer - o.`preferLowPowerToHighPerformance` = preferLowPowerToHighPerformance - o.`failIfMajorPerformanceCaveat` = failIfMajorPerformanceCaveat + o["alpha"] = alpha + o["depth"] = depth + o["stencil"] = stencil + o["antialias"] = antialias + o["premultipliedAlpha"] = premultipliedAlpha + o["preserveDrawingBuffer"] = preserveDrawingBuffer + o["preferLowPowerToHighPerformance"] = preferLowPowerToHighPerformance + o["failIfMajorPerformanceCaveat"] = failIfMajorPerformanceCaveat return o } @@ -111,9 +112,9 @@ native public interface WebGLRenderingContext : RenderingContext { fun blendEquationSeparate(modeRGB: Int, modeAlpha: Int): Unit = noImpl fun blendFunc(sfactor: Int, dfactor: Int): Unit = noImpl fun blendFuncSeparate(srcRGB: Int, dstRGB: Int, srcAlpha: Int, dstAlpha: Int): Unit = noImpl - fun bufferData(target: Int, size: Long, usage: Int): Unit = noImpl + fun bufferData(target: Int, size: Int, usage: Int): Unit = noImpl fun bufferData(target: Int, data: dynamic, usage: Int): Unit = noImpl - fun bufferSubData(target: Int, offset: Long, data: dynamic): Unit = noImpl + fun bufferSubData(target: Int, offset: Int, data: dynamic): Unit = noImpl fun checkFramebufferStatus(target: Int): Int = noImpl fun clear(mask: Int): Unit = noImpl fun clearColor(red: Float, green: Float, blue: Float, alpha: Float): Unit = noImpl @@ -145,7 +146,7 @@ native public interface WebGLRenderingContext : RenderingContext { fun disable(cap: Int): Unit = noImpl fun disableVertexAttribArray(index: Int): Unit = noImpl fun drawArrays(mode: Int, first: Int, count: Int): Unit = noImpl - fun drawElements(mode: Int, count: Int, type: Int, offset: Long): Unit = noImpl + fun drawElements(mode: Int, count: Int, type: Int, offset: Int): Unit = noImpl fun enable(cap: Int): Unit = noImpl fun enableVertexAttribArray(index: Int): Unit = noImpl fun finish(): Unit = noImpl @@ -173,7 +174,7 @@ native public interface WebGLRenderingContext : RenderingContext { fun getUniform(program: WebGLProgram?, location: WebGLUniformLocation?): Any? = noImpl fun getUniformLocation(program: WebGLProgram?, name: String): WebGLUniformLocation? = noImpl fun getVertexAttrib(index: Int, pname: Int): Any? = noImpl - fun getVertexAttribOffset(index: Int, pname: Int): Long = noImpl + fun getVertexAttribOffset(index: Int, pname: Int): Int = noImpl fun hint(target: Int, mode: Int): Unit = noImpl fun isBuffer(buffer: WebGLBuffer?): Boolean = noImpl fun isEnabled(cap: Int): Boolean = noImpl @@ -247,7 +248,7 @@ native public interface WebGLRenderingContext : RenderingContext { fun vertexAttrib4f(indx: Int, x: Float, y: Float, z: Float, w: Float): Unit = noImpl fun vertexAttrib4fv(indx: Int, values: Float32Array): Unit = noImpl fun vertexAttrib4fv(indx: Int, values: Array): Unit = noImpl - fun vertexAttribPointer(indx: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Long): Unit = noImpl + fun vertexAttribPointer(indx: Int, size: Int, type: Int, normalized: Boolean, stride: Int, offset: Int): Unit = noImpl fun viewport(x: Int, y: Int, width: Int, height: Int): Unit = noImpl companion object { @@ -560,12 +561,13 @@ native public interface WebGLContextEventInit : EventInit { var statusMessage: String } +suppress("NOTHING_TO_INLINE") inline fun WebGLContextEventInit(statusMessage: String, bubbles: Boolean = false, cancelable: Boolean = false): WebGLContextEventInit { - val o = js("({})") as WebGLContextEventInit + val o = js("({})") - o.`statusMessage` = statusMessage - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["statusMessage"] = statusMessage + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } diff --git a/js/js.libraries/src/generated/org.w3c.dom.events.kt b/js/js.libraries/src/generated/org.w3c.dom.events.kt index 7e6938fbdc6e8..f8bc6926dfd4f 100644 --- a/js/js.libraries/src/generated/org.w3c.dom.events.kt +++ b/js/js.libraries/src/generated/org.w3c.dom.events.kt @@ -126,13 +126,14 @@ native public interface UIEventInit : EventInit { var detail: Int } +suppress("NOTHING_TO_INLINE") inline fun UIEventInit(view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): UIEventInit { - val o = js("({})") as UIEventInit + val o = js("({})") - o.`view` = view - o.`detail` = detail - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["view"] = view + o["detail"] = detail + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -147,14 +148,15 @@ native public interface FocusEventInit : UIEventInit { var relatedTarget: EventTarget? } +suppress("NOTHING_TO_INLINE") inline fun FocusEventInit(relatedTarget: EventTarget? = null, view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): FocusEventInit { - val o = js("({})") as FocusEventInit + val o = js("({})") - o.`relatedTarget` = relatedTarget - o.`view` = view - o.`detail` = detail - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["relatedTarget"] = relatedTarget + o["view"] = view + o["detail"] = detail + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -169,35 +171,36 @@ native public interface MouseEventInit : EventModifierInit { var relatedTarget: EventTarget? } +suppress("NOTHING_TO_INLINE") 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 { - val o = js("({})") as MouseEventInit - - o.`screenX` = screenX - o.`screenY` = screenY - o.`clientX` = clientX - o.`clientY` = clientY - o.`button` = button - o.`buttons` = buttons - o.`relatedTarget` = relatedTarget - o.`ctrlKey` = ctrlKey - o.`shiftKey` = shiftKey - o.`altKey` = altKey - o.`metaKey` = metaKey - o.`modifierAltGraph` = modifierAltGraph - o.`modifierCapsLock` = modifierCapsLock - o.`modifierFn` = modifierFn - o.`modifierFnLock` = modifierFnLock - o.`modifierHyper` = modifierHyper - o.`modifierNumLock` = modifierNumLock - o.`modifierOS` = modifierOS - o.`modifierScrollLock` = modifierScrollLock - o.`modifierSuper` = modifierSuper - o.`modifierSymbol` = modifierSymbol - o.`modifierSymbolLock` = modifierSymbolLock - o.`view` = view - o.`detail` = detail - o.`bubbles` = bubbles - o.`cancelable` = cancelable + val o = js("({})") + + o["screenX"] = screenX + o["screenY"] = screenY + o["clientX"] = clientX + o["clientY"] = clientY + o["button"] = button + o["buttons"] = buttons + o["relatedTarget"] = relatedTarget + o["ctrlKey"] = ctrlKey + o["shiftKey"] = shiftKey + o["altKey"] = altKey + o["metaKey"] = metaKey + o["modifierAltGraph"] = modifierAltGraph + o["modifierCapsLock"] = modifierCapsLock + o["modifierFn"] = modifierFn + o["modifierFnLock"] = modifierFnLock + o["modifierHyper"] = modifierHyper + o["modifierNumLock"] = modifierNumLock + o["modifierOS"] = modifierOS + o["modifierScrollLock"] = modifierScrollLock + o["modifierSuper"] = modifierSuper + o["modifierSymbol"] = modifierSymbol + o["modifierSymbolLock"] = modifierSymbolLock + o["view"] = view + o["detail"] = detail + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -220,28 +223,29 @@ native public interface EventModifierInit : UIEventInit { var modifierSymbolLock: Boolean } +suppress("NOTHING_TO_INLINE") 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 { - val o = js("({})") as EventModifierInit - - o.`ctrlKey` = ctrlKey - o.`shiftKey` = shiftKey - o.`altKey` = altKey - o.`metaKey` = metaKey - o.`modifierAltGraph` = modifierAltGraph - o.`modifierCapsLock` = modifierCapsLock - o.`modifierFn` = modifierFn - o.`modifierFnLock` = modifierFnLock - o.`modifierHyper` = modifierHyper - o.`modifierNumLock` = modifierNumLock - o.`modifierOS` = modifierOS - o.`modifierScrollLock` = modifierScrollLock - o.`modifierSuper` = modifierSuper - o.`modifierSymbol` = modifierSymbol - o.`modifierSymbolLock` = modifierSymbolLock - o.`view` = view - o.`detail` = detail - o.`bubbles` = bubbles - o.`cancelable` = cancelable + val o = js("({})") + + o["ctrlKey"] = ctrlKey + o["shiftKey"] = shiftKey + o["altKey"] = altKey + o["metaKey"] = metaKey + o["modifierAltGraph"] = modifierAltGraph + o["modifierCapsLock"] = modifierCapsLock + o["modifierFn"] = modifierFn + o["modifierFnLock"] = modifierFnLock + o["modifierHyper"] = modifierHyper + o["modifierNumLock"] = modifierNumLock + o["modifierOS"] = modifierOS + o["modifierScrollLock"] = modifierScrollLock + o["modifierSuper"] = modifierSuper + o["modifierSymbol"] = modifierSymbol + o["modifierSymbolLock"] = modifierSymbolLock + o["view"] = view + o["detail"] = detail + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -271,39 +275,40 @@ native public interface WheelEventInit : MouseEventInit { var deltaMode: Int } +suppress("NOTHING_TO_INLINE") 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 { - val o = js("({})") as WheelEventInit - - o.`deltaX` = deltaX - o.`deltaY` = deltaY - o.`deltaZ` = deltaZ - o.`deltaMode` = deltaMode - o.`screenX` = screenX - o.`screenY` = screenY - o.`clientX` = clientX - o.`clientY` = clientY - o.`button` = button - o.`buttons` = buttons - o.`relatedTarget` = relatedTarget - o.`ctrlKey` = ctrlKey - o.`shiftKey` = shiftKey - o.`altKey` = altKey - o.`metaKey` = metaKey - o.`modifierAltGraph` = modifierAltGraph - o.`modifierCapsLock` = modifierCapsLock - o.`modifierFn` = modifierFn - o.`modifierFnLock` = modifierFnLock - o.`modifierHyper` = modifierHyper - o.`modifierNumLock` = modifierNumLock - o.`modifierOS` = modifierOS - o.`modifierScrollLock` = modifierScrollLock - o.`modifierSuper` = modifierSuper - o.`modifierSymbol` = modifierSymbol - o.`modifierSymbolLock` = modifierSymbolLock - o.`view` = view - o.`detail` = detail - o.`bubbles` = bubbles - o.`cancelable` = cancelable + val o = js("({})") + + o["deltaX"] = deltaX + o["deltaY"] = deltaY + o["deltaZ"] = deltaZ + o["deltaMode"] = deltaMode + o["screenX"] = screenX + o["screenY"] = screenY + o["clientX"] = clientX + o["clientY"] = clientY + o["button"] = button + o["buttons"] = buttons + o["relatedTarget"] = relatedTarget + o["ctrlKey"] = ctrlKey + o["shiftKey"] = shiftKey + o["altKey"] = altKey + o["metaKey"] = metaKey + o["modifierAltGraph"] = modifierAltGraph + o["modifierCapsLock"] = modifierCapsLock + o["modifierFn"] = modifierFn + o["modifierFnLock"] = modifierFnLock + o["modifierHyper"] = modifierHyper + o["modifierNumLock"] = modifierNumLock + o["modifierOS"] = modifierOS + o["modifierScrollLock"] = modifierScrollLock + o["modifierSuper"] = modifierSuper + o["modifierSymbol"] = modifierSymbol + o["modifierSymbolLock"] = modifierSymbolLock + o["view"] = view + o["detail"] = detail + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -352,33 +357,34 @@ native public interface KeyboardEventInit : EventModifierInit { var isComposing: Boolean } +suppress("NOTHING_TO_INLINE") 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 { - val o = js("({})") as KeyboardEventInit - - o.`key` = key - o.`code` = code - o.`location` = location - o.`repeat` = repeat - o.`isComposing` = isComposing - o.`ctrlKey` = ctrlKey - o.`shiftKey` = shiftKey - o.`altKey` = altKey - o.`metaKey` = metaKey - o.`modifierAltGraph` = modifierAltGraph - o.`modifierCapsLock` = modifierCapsLock - o.`modifierFn` = modifierFn - o.`modifierFnLock` = modifierFnLock - o.`modifierHyper` = modifierHyper - o.`modifierNumLock` = modifierNumLock - o.`modifierOS` = modifierOS - o.`modifierScrollLock` = modifierScrollLock - o.`modifierSuper` = modifierSuper - o.`modifierSymbol` = modifierSymbol - o.`modifierSymbolLock` = modifierSymbolLock - o.`view` = view - o.`detail` = detail - o.`bubbles` = bubbles - o.`cancelable` = cancelable + val o = js("({})") + + o["key"] = key + o["code"] = code + o["location"] = location + o["repeat"] = repeat + o["isComposing"] = isComposing + o["ctrlKey"] = ctrlKey + o["shiftKey"] = shiftKey + o["altKey"] = altKey + o["metaKey"] = metaKey + o["modifierAltGraph"] = modifierAltGraph + o["modifierCapsLock"] = modifierCapsLock + o["modifierFn"] = modifierFn + o["modifierFnLock"] = modifierFnLock + o["modifierHyper"] = modifierHyper + o["modifierNumLock"] = modifierNumLock + o["modifierOS"] = modifierOS + o["modifierScrollLock"] = modifierScrollLock + o["modifierSuper"] = modifierSuper + o["modifierSymbol"] = modifierSymbol + o["modifierSymbolLock"] = modifierSymbolLock + o["view"] = view + o["detail"] = detail + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -393,14 +399,15 @@ native public interface CompositionEventInit : UIEventInit { var data: String } +suppress("NOTHING_TO_INLINE") inline fun CompositionEventInit(data: String = "", view: Window? = null, detail: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): CompositionEventInit { - val o = js("({})") as CompositionEventInit + val o = js("({})") - o.`data` = data - o.`view` = view - o.`detail` = detail - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["data"] = data + o["view"] = view + o["detail"] = detail + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } diff --git a/js/js.libraries/src/generated/org.w3c.dom.kt b/js/js.libraries/src/generated/org.w3c.dom.kt index de52b0fb431e3..2f5a976355737 100644 --- a/js/js.libraries/src/generated/org.w3c.dom.kt +++ b/js/js.libraries/src/generated/org.w3c.dom.kt @@ -1621,12 +1621,13 @@ native public interface TrackEventInit : EventInit { var track: UnionAudioTrackOrTextTrackOrVideoTrack? } +suppress("NOTHING_TO_INLINE") inline fun TrackEventInit(track: UnionAudioTrackOrTextTrackOrVideoTrack?, bubbles: Boolean = false, cancelable: Boolean = false): TrackEventInit { - val o = js("({})") as TrackEventInit + val o = js("({})") - o.`track` = track - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["track"] = track + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -2467,12 +2468,13 @@ native public interface AutocompleteErrorEventInit : EventInit { var reason: String } +suppress("NOTHING_TO_INLINE") inline fun AutocompleteErrorEventInit(reason: String, bubbles: Boolean = false, cancelable: Boolean = false): AutocompleteErrorEventInit { - val o = js("({})") as AutocompleteErrorEventInit + val o = js("({})") - o.`reason` = reason - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["reason"] = reason + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -2555,12 +2557,13 @@ native public interface RelatedEventInit : EventInit { var relatedTarget: EventTarget? } +suppress("NOTHING_TO_INLINE") inline fun RelatedEventInit(relatedTarget: EventTarget?, bubbles: Boolean = false, cancelable: Boolean = false): RelatedEventInit { - val o = js("({})") as RelatedEventInit + val o = js("({})") - o.`relatedTarget` = relatedTarget - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["relatedTarget"] = relatedTarget + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -2635,10 +2638,11 @@ native public interface CanvasRenderingContext2DSettings { var alpha: Boolean } +suppress("NOTHING_TO_INLINE") inline fun CanvasRenderingContext2DSettings(alpha: Boolean = true): CanvasRenderingContext2DSettings { - val o = js("({})") as CanvasRenderingContext2DSettings + val o = js("({})") - o.`alpha` = alpha + o["alpha"] = alpha return o } @@ -2815,17 +2819,18 @@ native public interface HitRegionOptions { var role: String? } +suppress("NOTHING_TO_INLINE") inline fun HitRegionOptions(path: Path2D? = null, fillRule: String = "nonzero", id: String = "", parentID: String? = null, cursor: String = "inherit", control: Element? = null, label: String? = null, role: String? = null): HitRegionOptions { - val o = js("({})") as HitRegionOptions + val o = js("({})") - o.`path` = path - o.`fillRule` = fillRule - o.`id` = id - o.`parentID` = parentID - o.`cursor` = cursor - o.`control` = control - o.`label` = label - o.`role` = role + o["path"] = path + o["fillRule"] = fillRule + o["id"] = id + o["parentID"] = parentID + o["cursor"] = cursor + o["control"] = control + o["label"] = label + o["role"] = role return o } @@ -2947,36 +2952,37 @@ native public interface DragEventInit : MouseEventInit { var dataTransfer: DataTransfer? } +suppress("NOTHING_TO_INLINE") inline fun DragEventInit(dataTransfer: DataTransfer?, 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): DragEventInit { - val o = js("({})") as DragEventInit - - o.`dataTransfer` = dataTransfer - o.`screenX` = screenX - o.`screenY` = screenY - o.`clientX` = clientX - o.`clientY` = clientY - o.`button` = button - o.`buttons` = buttons - o.`relatedTarget` = relatedTarget - o.`ctrlKey` = ctrlKey - o.`shiftKey` = shiftKey - o.`altKey` = altKey - o.`metaKey` = metaKey - o.`modifierAltGraph` = modifierAltGraph - o.`modifierCapsLock` = modifierCapsLock - o.`modifierFn` = modifierFn - o.`modifierFnLock` = modifierFnLock - o.`modifierHyper` = modifierHyper - o.`modifierNumLock` = modifierNumLock - o.`modifierOS` = modifierOS - o.`modifierScrollLock` = modifierScrollLock - o.`modifierSuper` = modifierSuper - o.`modifierSymbol` = modifierSymbol - o.`modifierSymbolLock` = modifierSymbolLock - o.`view` = view - o.`detail` = detail - o.`bubbles` = bubbles - o.`cancelable` = cancelable + val o = js("({})") + + o["dataTransfer"] = dataTransfer + o["screenX"] = screenX + o["screenY"] = screenY + o["clientX"] = clientX + o["clientY"] = clientY + o["button"] = button + o["buttons"] = buttons + o["relatedTarget"] = relatedTarget + o["ctrlKey"] = ctrlKey + o["shiftKey"] = shiftKey + o["altKey"] = altKey + o["metaKey"] = metaKey + o["modifierAltGraph"] = modifierAltGraph + o["modifierCapsLock"] = modifierCapsLock + o["modifierFn"] = modifierFn + o["modifierFnLock"] = modifierFnLock + o["modifierHyper"] = modifierHyper + o["modifierNumLock"] = modifierNumLock + o["modifierOS"] = modifierOS + o["modifierScrollLock"] = modifierScrollLock + o["modifierSuper"] = modifierSuper + o["modifierSymbol"] = modifierSymbol + o["modifierSymbolLock"] = modifierSymbolLock + o["view"] = view + o["detail"] = detail + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -3402,12 +3408,13 @@ native public interface PopStateEventInit : EventInit { var state: Any? } +suppress("NOTHING_TO_INLINE") inline fun PopStateEventInit(state: Any?, bubbles: Boolean = false, cancelable: Boolean = false): PopStateEventInit { - val o = js("({})") as PopStateEventInit + val o = js("({})") - o.`state` = state - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["state"] = state + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -3424,13 +3431,14 @@ native public interface HashChangeEventInit : EventInit { var newURL: String } +suppress("NOTHING_TO_INLINE") inline fun HashChangeEventInit(oldURL: String, newURL: String, bubbles: Boolean = false, cancelable: Boolean = false): HashChangeEventInit { - val o = js("({})") as HashChangeEventInit + val o = js("({})") - o.`oldURL` = oldURL - o.`newURL` = newURL - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["oldURL"] = oldURL + o["newURL"] = newURL + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -3444,12 +3452,13 @@ native public interface PageTransitionEventInit : EventInit { var persisted: Boolean } +suppress("NOTHING_TO_INLINE") inline fun PageTransitionEventInit(persisted: Boolean, bubbles: Boolean = false, cancelable: Boolean = false): PageTransitionEventInit { - val o = js("({})") as PageTransitionEventInit + val o = js("({})") - o.`persisted` = persisted - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["persisted"] = persisted + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -3522,16 +3531,17 @@ native public interface ErrorEventInit : EventInit { var error: Any? } +suppress("NOTHING_TO_INLINE") inline fun ErrorEventInit(message: String, filename: String, lineno: Int, colno: Int, error: Any?, bubbles: Boolean = false, cancelable: Boolean = false): ErrorEventInit { - val o = js("({})") as ErrorEventInit + val o = js("({})") - o.`message` = message - o.`filename` = filename - o.`lineno` = lineno - o.`colno` = colno - o.`error` = error - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["message"] = message + o["filename"] = filename + o["lineno"] = lineno + o["colno"] = colno + o["error"] = error + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -3657,16 +3667,17 @@ native public interface MessageEventInit : EventInit { var ports: Array } +suppress("NOTHING_TO_INLINE") inline fun MessageEventInit(data: Any?, origin: String, lastEventId: String, source: UnionMessagePortOrWindow?, ports: Array, bubbles: Boolean = false, cancelable: Boolean = false): MessageEventInit { - val o = js("({})") as MessageEventInit + val o = js("({})") - o.`data` = data - o.`origin` = origin - o.`lastEventId` = lastEventId - o.`source` = source - o.`ports` = ports - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["data"] = data + o["origin"] = origin + o["lastEventId"] = lastEventId + o["source"] = source + o["ports"] = ports + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -3700,10 +3711,11 @@ native public interface EventSourceInit { var withCredentials: Boolean } +suppress("NOTHING_TO_INLINE") inline fun EventSourceInit(withCredentials: Boolean = false): EventSourceInit { - val o = js("({})") as EventSourceInit + val o = js("({})") - o.`withCredentials` = withCredentials + o["withCredentials"] = withCredentials return o } @@ -3763,14 +3775,15 @@ native public interface CloseEventInit : EventInit { var reason: String } +suppress("NOTHING_TO_INLINE") inline fun CloseEventInit(wasClean: Boolean, code: Short, reason: String, bubbles: Boolean = false, cancelable: Boolean = false): CloseEventInit { - val o = js("({})") as CloseEventInit + val o = js("({})") - o.`wasClean` = wasClean - o.`code` = code - o.`reason` = reason - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["wasClean"] = wasClean + o["code"] = code + o["reason"] = reason + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -3961,16 +3974,17 @@ native public interface StorageEventInit : EventInit { var storageArea: Storage? } +suppress("NOTHING_TO_INLINE") inline fun StorageEventInit(key: String?, oldValue: String?, newValue: String?, url: String, storageArea: Storage?, bubbles: Boolean = false, cancelable: Boolean = false): StorageEventInit { - val o = js("({})") as StorageEventInit + val o = js("({})") - o.`key` = key - o.`oldValue` = oldValue - o.`newValue` = newValue - o.`url` = url - o.`storageArea` = storageArea - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["key"] = key + o["oldValue"] = oldValue + o["newValue"] = newValue + o["url"] = url + o["storageArea"] = storageArea + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -4226,11 +4240,12 @@ native public interface EventInit { var cancelable: Boolean } +suppress("NOTHING_TO_INLINE") inline fun EventInit(bubbles: Boolean = false, cancelable: Boolean = false): EventInit { - val o = js("({})") as EventInit + val o = js("({})") - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -4245,12 +4260,13 @@ native public interface CustomEventInit : EventInit { var detail: Any? } +suppress("NOTHING_TO_INLINE") inline fun CustomEventInit(detail: Any? = null, bubbles: Boolean = false, cancelable: Boolean = false): CustomEventInit { - val o = js("({})") as CustomEventInit + val o = js("({})") - o.`detail` = detail - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["detail"] = detail + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -4287,16 +4303,17 @@ native public interface MutationObserverInit { var attributeFilter: Array } +suppress("NOTHING_TO_INLINE") inline fun MutationObserverInit(childList: Boolean = false, attributes: Boolean, characterData: Boolean, subtree: Boolean = false, attributeOldValue: Boolean, characterDataOldValue: Boolean, attributeFilter: Array): MutationObserverInit { - val o = js("({})") as MutationObserverInit + val o = js("({})") - o.`childList` = childList - o.`attributes` = attributes - o.`characterData` = characterData - o.`subtree` = subtree - o.`attributeOldValue` = attributeOldValue - o.`characterDataOldValue` = characterDataOldValue - o.`attributeFilter` = attributeFilter + o["childList"] = childList + o["attributes"] = attributes + o["characterData"] = characterData + o["subtree"] = subtree + o["attributeOldValue"] = attributeOldValue + o["characterDataOldValue"] = characterDataOldValue + o["attributeFilter"] = attributeFilter return o } @@ -4766,13 +4783,14 @@ native public interface EditingBeforeInputEventInit : EventInit { var value: String } +suppress("NOTHING_TO_INLINE") inline fun EditingBeforeInputEventInit(command: String, value: String, bubbles: Boolean = false, cancelable: Boolean = false): EditingBeforeInputEventInit { - val o = js("({})") as EditingBeforeInputEventInit + val o = js("({})") - o.`command` = command - o.`value` = value - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["command"] = command + o["value"] = value + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -4789,13 +4807,14 @@ native public interface EditingInputEventInit : EventInit { var value: String } +suppress("NOTHING_TO_INLINE") inline fun EditingInputEventInit(command: String, value: String, bubbles: Boolean = false, cancelable: Boolean = false): EditingInputEventInit { - val o = js("({})") as EditingInputEventInit + val o = js("({})") - o.`command` = command - o.`value` = value - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["command"] = command + o["value"] = value + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -4836,13 +4855,14 @@ native public interface DOMPointInit { var w: Double } +suppress("NOTHING_TO_INLINE") inline fun DOMPointInit(x: Double = 0.0, y: Double = 0.0, z: Double = 0.0, w: Double = 1.0): DOMPointInit { - val o = js("({})") as DOMPointInit + val o = js("({})") - o.`x` = x - o.`y` = y - o.`z` = z - o.`w` = w + o["x"] = x + o["y"] = y + o["z"] = z + o["w"] = w return o } @@ -4888,13 +4908,14 @@ native public interface DOMRectInit { var height: Double } +suppress("NOTHING_TO_INLINE") inline fun DOMRectInit(x: Double = 0.0, y: Double = 0.0, width: Double = 0.0, height: Double = 0.0): DOMRectInit { - val o = js("({})") as DOMRectInit + val o = js("({})") - o.`x` = x - o.`y` = y - o.`width` = width - o.`height` = height + o["x"] = x + o["y"] = y + o["width"] = width + o["height"] = height return o } @@ -5072,10 +5093,11 @@ native public interface ScrollOptions { var behavior: String } +suppress("NOTHING_TO_INLINE") inline fun ScrollOptions(behavior: String = "auto"): ScrollOptions { - val o = js("({})") as ScrollOptions + val o = js("({})") - o.`behavior` = behavior + o["behavior"] = behavior return o } @@ -5116,11 +5138,12 @@ native public interface ScrollOptionsHorizontal : ScrollOptions { var x: Double } +suppress("NOTHING_TO_INLINE") inline fun ScrollOptionsHorizontal(x: Double, behavior: String = "auto"): ScrollOptionsHorizontal { - val o = js("({})") as ScrollOptionsHorizontal + val o = js("({})") - o.`x` = x - o.`behavior` = behavior + o["x"] = x + o["behavior"] = behavior return o } @@ -5129,11 +5152,12 @@ native public interface ScrollOptionsVertical : ScrollOptions { var y: Double } +suppress("NOTHING_TO_INLINE") inline fun ScrollOptionsVertical(y: Double, behavior: String = "auto"): ScrollOptionsVertical { - val o = js("({})") as ScrollOptionsVertical + val o = js("({})") - o.`y` = y - o.`behavior` = behavior + o["y"] = y + o["behavior"] = behavior return o } @@ -5143,11 +5167,12 @@ native public interface BoxQuadOptions { var relativeTo: GeometryNode } +suppress("NOTHING_TO_INLINE") inline fun BoxQuadOptions(box: String = "border", relativeTo: GeometryNode): BoxQuadOptions { - val o = js("({})") as BoxQuadOptions + val o = js("({})") - o.`box` = box - o.`relativeTo` = relativeTo + o["box"] = box + o["relativeTo"] = relativeTo return o } @@ -5157,11 +5182,12 @@ native public interface ConvertCoordinateOptions { var toBox: String } +suppress("NOTHING_TO_INLINE") inline fun ConvertCoordinateOptions(fromBox: String = "border", toBox: String = "border"): ConvertCoordinateOptions { - val o = js("({})") as ConvertCoordinateOptions + val o = js("({})") - o.`fromBox` = fromBox - o.`toBox` = toBox + o["fromBox"] = fromBox + o["toBox"] = toBox return o } diff --git a/js/js.libraries/src/generated/org.w3c.fetch.kt b/js/js.libraries/src/generated/org.w3c.fetch.kt index bdd9c7a665041..fce634d6c325c 100644 --- a/js/js.libraries/src/generated/org.w3c.fetch.kt +++ b/js/js.libraries/src/generated/org.w3c.fetch.kt @@ -68,16 +68,17 @@ native public interface RequestInit { var redirect: String } +suppress("NOTHING_TO_INLINE") inline fun RequestInit(method: String, headers: dynamic, body: dynamic, mode: String, credentials: String, cache: String, redirect: String): RequestInit { - val o = js("({})") as RequestInit + val o = js("({})") - o.`method` = method - o.`headers` = headers - o.`body` = body - o.`mode` = mode - o.`credentials` = credentials - o.`cache` = cache - o.`redirect` = redirect + o["method"] = method + o["headers"] = headers + o["body"] = body + o["mode"] = mode + o["credentials"] = credentials + o["cache"] = cache + o["redirect"] = redirect return o } @@ -116,12 +117,13 @@ native public interface ResponseInit { var headers: dynamic } +suppress("NOTHING_TO_INLINE") inline fun ResponseInit(status: Short = 200, statusText: String = "OK", headers: dynamic): ResponseInit { - val o = js("({})") as ResponseInit + val o = js("({})") - o.`status` = status - o.`statusText` = statusText - o.`headers` = headers + o["status"] = status + o["statusText"] = statusText + o["headers"] = headers return o } diff --git a/js/js.libraries/src/generated/org.w3c.files.kt b/js/js.libraries/src/generated/org.w3c.files.kt index 5d74106b2af7f..49485bbceea0c 100644 --- a/js/js.libraries/src/generated/org.w3c.files.kt +++ b/js/js.libraries/src/generated/org.w3c.files.kt @@ -22,13 +22,13 @@ import org.w3c.xhr.* native public open class Blob() : ImageBitmapSource { constructor(blobParts: Array, options: BlobPropertyBag = noImpl) : this() - open val size: Long + open val size: Int get() = noImpl open val type: String get() = noImpl open val isClosed: Boolean get() = noImpl - fun slice(start: Long = noImpl, end: Long = noImpl, contentType: String = noImpl): Blob = noImpl + fun slice(start: Int = noImpl, end: Int = noImpl, contentType: String = noImpl): Blob = noImpl fun close(): Unit = noImpl } @@ -36,10 +36,11 @@ native public interface BlobPropertyBag { var type: String } +suppress("NOTHING_TO_INLINE") inline fun BlobPropertyBag(type: String = ""): BlobPropertyBag { - val o = js("({})") as BlobPropertyBag + val o = js("({})") - o.`type` = type + o["type"] = type return o } @@ -47,20 +48,21 @@ inline fun BlobPropertyBag(type: String = ""): BlobPropertyBag { native public open class File(fileBits: Array, fileName: String, options: FilePropertyBag = noImpl) : Blob() { open val name: String get() = noImpl - open val lastModified: Long + open val lastModified: Int get() = noImpl } native public interface FilePropertyBag { var type: String - var lastModified: Long + var lastModified: Int } -inline fun FilePropertyBag(type: String = "", lastModified: Long): FilePropertyBag { - val o = js("({})") as FilePropertyBag +suppress("NOTHING_TO_INLINE") +inline fun FilePropertyBag(type: String = "", lastModified: Int): FilePropertyBag { + val o = js("({})") - o.`type` = type - o.`lastModified` = lastModified + o["type"] = type + o["lastModified"] = lastModified return o } diff --git a/js/js.libraries/src/generated/org.w3c.notifications.kt b/js/js.libraries/src/generated/org.w3c.notifications.kt index 6ec1052442e81..1b4ec8fb8d311 100644 --- a/js/js.libraries/src/generated/org.w3c.notifications.kt +++ b/js/js.libraries/src/generated/org.w3c.notifications.kt @@ -76,21 +76,22 @@ native public interface NotificationOptions { var data: Any? } +suppress("NOTHING_TO_INLINE") inline fun NotificationOptions(dir: String = "auto", lang: String = "", body: String = "", tag: String = "", icon: String, sound: String, vibrate: dynamic, renotify: Boolean = false, silent: Boolean = false, noscreen: Boolean = false, sticky: Boolean = false, data: Any? = null): NotificationOptions { - val o = js("({})") as NotificationOptions - - o.`dir` = dir - o.`lang` = lang - o.`body` = body - o.`tag` = tag - o.`icon` = icon - o.`sound` = sound - o.`vibrate` = vibrate - o.`renotify` = renotify - o.`silent` = silent - o.`noscreen` = noscreen - o.`sticky` = sticky - o.`data` = data + val o = js("({})") + + o["dir"] = dir + o["lang"] = lang + o["body"] = body + o["tag"] = tag + o["icon"] = icon + o["sound"] = sound + o["vibrate"] = vibrate + o["renotify"] = renotify + o["silent"] = silent + o["noscreen"] = noscreen + o["sticky"] = sticky + o["data"] = data return o } @@ -99,10 +100,11 @@ native public interface GetNotificationOptions { var tag: String } +suppress("NOTHING_TO_INLINE") inline fun GetNotificationOptions(tag: String = ""): GetNotificationOptions { - val o = js("({})") as GetNotificationOptions + val o = js("({})") - o.`tag` = tag + o["tag"] = tag return o } @@ -116,12 +118,13 @@ native public interface NotificationEventInit : ExtendableEventInit { var notification: Notification } +suppress("NOTHING_TO_INLINE") inline fun NotificationEventInit(notification: Notification, bubbles: Boolean = false, cancelable: Boolean = false): NotificationEventInit { - val o = js("({})") as NotificationEventInit + val o = js("({})") - o.`notification` = notification - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["notification"] = notification + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } diff --git a/js/js.libraries/src/generated/org.w3c.performance.kt b/js/js.libraries/src/generated/org.w3c.performance.kt index 98f6714d26e08..c9f82d67bb736 100644 --- a/js/js.libraries/src/generated/org.w3c.performance.kt +++ b/js/js.libraries/src/generated/org.w3c.performance.kt @@ -29,47 +29,47 @@ native public interface Performance { } native public interface PerformanceTiming { - val navigationStart: Long + val navigationStart: Int get() = noImpl - val unloadEventStart: Long + val unloadEventStart: Int get() = noImpl - val unloadEventEnd: Long + val unloadEventEnd: Int get() = noImpl - val redirectStart: Long + val redirectStart: Int get() = noImpl - val redirectEnd: Long + val redirectEnd: Int get() = noImpl - val fetchStart: Long + val fetchStart: Int get() = noImpl - val domainLookupStart: Long + val domainLookupStart: Int get() = noImpl - val domainLookupEnd: Long + val domainLookupEnd: Int get() = noImpl - val connectStart: Long + val connectStart: Int get() = noImpl - val connectEnd: Long + val connectEnd: Int get() = noImpl - val secureConnectionStart: Long + val secureConnectionStart: Int get() = noImpl - val requestStart: Long + val requestStart: Int get() = noImpl - val responseStart: Long + val responseStart: Int get() = noImpl - val responseEnd: Long + val responseEnd: Int get() = noImpl - val domLoading: Long + val domLoading: Int get() = noImpl - val domInteractive: Long + val domInteractive: Int get() = noImpl - val domContentLoadedEventStart: Long + val domContentLoadedEventStart: Int get() = noImpl - val domContentLoadedEventEnd: Long + val domContentLoadedEventEnd: Int get() = noImpl - val domComplete: Long + val domComplete: Int get() = noImpl - val loadEventStart: Long + val loadEventStart: Int get() = noImpl - val loadEventEnd: Long + val loadEventEnd: Int get() = noImpl } diff --git a/js/js.libraries/src/generated/org.w3c.workers.kt b/js/js.libraries/src/generated/org.w3c.workers.kt index f017be5e824dd..6a2e5ba3fbd72 100644 --- a/js/js.libraries/src/generated/org.w3c.workers.kt +++ b/js/js.libraries/src/generated/org.w3c.workers.kt @@ -106,10 +106,11 @@ native public interface RegistrationOptions { var scope: String } +suppress("NOTHING_TO_INLINE") inline fun RegistrationOptions(scope: String): RegistrationOptions { - val o = js("({})") as RegistrationOptions + val o = js("({})") - o.`scope` = scope + o["scope"] = scope return o } @@ -136,16 +137,17 @@ native public interface ServiceWorkerMessageEventInit : EventInit { var ports: Array } +suppress("NOTHING_TO_INLINE") inline fun ServiceWorkerMessageEventInit(data: Any?, origin: String, lastEventId: String, source: UnionMessagePortOrServiceWorker?, ports: Array, bubbles: Boolean = false, cancelable: Boolean = false): ServiceWorkerMessageEventInit { - val o = js("({})") as ServiceWorkerMessageEventInit + val o = js("({})") - o.`data` = data - o.`origin` = origin - o.`lastEventId` = lastEventId - o.`source` = source - o.`ports` = ports - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["data"] = data + o["origin"] = origin + o["lastEventId"] = lastEventId + o["source"] = source + o["ports"] = ports + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -179,11 +181,12 @@ native public interface ClientQueryOptions { var type: String } +suppress("NOTHING_TO_INLINE") inline fun ClientQueryOptions(includeUncontrolled: Boolean = false, type: String = "window"): ClientQueryOptions { - val o = js("({})") as ClientQueryOptions + val o = js("({})") - o.`includeUncontrolled` = includeUncontrolled - o.`type` = type + o["includeUncontrolled"] = includeUncontrolled + o["type"] = type return o } @@ -195,11 +198,12 @@ native public open class ExtendableEvent(type: String, eventInitDict: Extendable native public interface ExtendableEventInit : EventInit { } +suppress("NOTHING_TO_INLINE") inline fun ExtendableEventInit(bubbles: Boolean = false, cancelable: Boolean = false): ExtendableEventInit { - val o = js("({})") as ExtendableEventInit + val o = js("({})") - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -220,14 +224,15 @@ native public interface FetchEventInit : ExtendableEventInit { var isReload: Boolean } +suppress("NOTHING_TO_INLINE") inline fun FetchEventInit(request: Request, client: Client, isReload: Boolean = false, bubbles: Boolean = false, cancelable: Boolean = false): FetchEventInit { - val o = js("({})") as FetchEventInit + val o = js("({})") - o.`request` = request - o.`client` = client - o.`isReload` = isReload - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["request"] = request + o["client"] = client + o["isReload"] = isReload + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -254,16 +259,17 @@ native public interface ExtendableMessageEventInit : ExtendableEventInit { var ports: Array } +suppress("NOTHING_TO_INLINE") inline fun ExtendableMessageEventInit(data: Any?, origin: String, lastEventId: String, source: UnionClientOrMessagePortOrServiceWorker?, ports: Array, bubbles: Boolean = false, cancelable: Boolean = false): ExtendableMessageEventInit { - val o = js("({})") as ExtendableMessageEventInit + val o = js("({})") - o.`data` = data - o.`origin` = origin - o.`lastEventId` = lastEventId - o.`source` = source - o.`ports` = ports - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["data"] = data + o["origin"] = origin + o["lastEventId"] = lastEventId + o["source"] = source + o["ports"] = ports + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } @@ -285,13 +291,14 @@ native public interface CacheQueryOptions { var cacheName: String } +suppress("NOTHING_TO_INLINE") inline fun CacheQueryOptions(ignoreSearch: Boolean = false, ignoreMethod: Boolean = false, ignoreVary: Boolean = false, cacheName: String): CacheQueryOptions { - val o = js("({})") as CacheQueryOptions + val o = js("({})") - o.`ignoreSearch` = ignoreSearch - o.`ignoreMethod` = ignoreMethod - o.`ignoreVary` = ignoreVary - o.`cacheName` = cacheName + o["ignoreSearch"] = ignoreSearch + o["ignoreMethod"] = ignoreMethod + o["ignoreVary"] = ignoreVary + o["cacheName"] = cacheName return o } @@ -303,13 +310,14 @@ native public interface CacheBatchOperation { var options: CacheQueryOptions } +suppress("NOTHING_TO_INLINE") inline fun CacheBatchOperation(type: String, request: Request, response: Response, options: CacheQueryOptions): CacheBatchOperation { - val o = js("({})") as CacheBatchOperation + val o = js("({})") - o.`type` = type - o.`request` = request - o.`response` = response - o.`options` = options + o["type"] = type + o["request"] = request + o["response"] = response + o["options"] = options return o } diff --git a/js/js.libraries/src/generated/org.w3c.xhr.kt b/js/js.libraries/src/generated/org.w3c.xhr.kt index 9c055ada5a387..38efae6aaf17a 100644 --- a/js/js.libraries/src/generated/org.w3c.xhr.kt +++ b/js/js.libraries/src/generated/org.w3c.xhr.kt @@ -106,26 +106,27 @@ native public open class FormData(form: HTMLFormElement = noImpl) { native public open class ProgressEvent(type: String, eventInitDict: ProgressEventInit = noImpl) : Event(type, eventInitDict) { open val lengthComputable: Boolean get() = noImpl - open val loaded: Long + open val loaded: Int get() = noImpl - open val total: Long + open val total: Int get() = noImpl } native public interface ProgressEventInit : EventInit { var lengthComputable: Boolean - var loaded: Long - var total: Long + var loaded: Int + var total: Int } -inline fun ProgressEventInit(lengthComputable: Boolean = false, loaded: Long = 0, total: Long = 0, bubbles: Boolean = false, cancelable: Boolean = false): ProgressEventInit { - val o = js("({})") as ProgressEventInit +suppress("NOTHING_TO_INLINE") +inline fun ProgressEventInit(lengthComputable: Boolean = false, loaded: Int = 0, total: Int = 0, bubbles: Boolean = false, cancelable: Boolean = false): ProgressEventInit { + val o = js("({})") - o.`lengthComputable` = lengthComputable - o.`loaded` = loaded - o.`total` = total - o.`bubbles` = bubbles - o.`cancelable` = cancelable + o["lengthComputable"] = lengthComputable + o["loaded"] = loaded + o["total"] = total + o["bubbles"] = bubbles + o["cancelable"] = cancelable return o } diff --git a/libraries/tools/idl2k/src/main/kotlin/idl.kt b/libraries/tools/idl2k/src/main/kotlin/idl.kt index 0ebdd783fa80d..dceaa8fae43ae 100644 --- a/libraries/tools/idl2k/src/main/kotlin/idl.kt +++ b/libraries/tools/idl2k/src/main/kotlin/idl.kt @@ -414,14 +414,14 @@ class DefinitionVisitor(val extendedAttributes: List, val nam } override fun visitReadOnly(ctx: WebIDLParser.ReadOnlyContext): Definition { - readOnly = true - visitChildren(ctx) - readOnly = false + return visitReadOnlyImpl(ctx) + } - return defaultResult() + override fun visitReadonlyMemberRest(ctx: ReadonlyMemberRestContext): Definition? { + return visitReadOnlyImpl(ctx) } - override fun visitReadonlyMemberRest(ctx: ReadonlyMemberRestContext?): Definition? { + private fun visitReadOnlyImpl(ctx: ParserRuleContext): Definition { readOnly = true visitChildren(ctx) readOnly = false diff --git a/libraries/tools/idl2k/src/main/kotlin/render.kt b/libraries/tools/idl2k/src/main/kotlin/render.kt index 16fa5680675fb..ffb76e3e7b84f 100644 --- a/libraries/tools/idl2k/src/main/kotlin/render.kt +++ b/libraries/tools/idl2k/src/main/kotlin/render.kt @@ -32,7 +32,7 @@ private fun Appendable.renderAttributeDeclaration(arg: GenerateAttribute, overri } } -private fun Appendable.renderAttributeDeclarationAsProperty(arg: GenerateAttribute, override: Boolean, open: Boolean, commented: Boolean, level: Int, omitDefaults: Boolean) { +private fun Appendable.renderAttributeDeclarationAsProperty(arg: GenerateAttribute, override: Boolean, open: Boolean, commented: Boolean, level: Int, omitDefaults: Boolean = false) { indent(commented, level) renderAttributeDeclaration(arg, override, open, omitDefaults) @@ -169,10 +169,10 @@ fun Appendable.render(allTypes: Map, typeNamesToUn indent(false, 1) appendln("companion object {") iface.constants.forEach { - renderAttributeDeclarationAsProperty(it, override = false, open = false, level = 2, commented = it.isCommented(iface.name), omitDefaults = false) + renderAttributeDeclarationAsProperty(it, override = false, open = false, level = 2, commented = it.isCommented(iface.name)) } staticAttributes.forEach { - renderAttributeDeclarationAsProperty(it, override = false, open = false, level = 2, commented = it.isCommented(iface.name), omitDefaults = false) + renderAttributeDeclarationAsProperty(it, override = false, open = false, level = 2, commented = it.isCommented(iface.name)) } staticFunctions.forEach { renderFunctionDeclaration(it.fixRequiredArguments(iface.name), override = false, level = 2, commented = it.isCommented(iface.name)) @@ -192,17 +192,18 @@ fun Appendable.render(allTypes: Map, typeNamesToUn fun Appendable.renderBuilderFunction(dictionary: GenerateTraitOrClass, allSuperTypes: List, allTypes: Set) { val fields = (dictionary.memberAttributes + allSuperTypes.flatMap { it.memberAttributes }).distinctBy { it.signature }.map { it.copy(kind = AttributeKind.ARGUMENT) }.dynamicIfUnknownType(allTypes) + appendln("suppress(\"NOTHING_TO_INLINE\")") append("inline fun ${dictionary.name}") renderArgumentsDeclaration(fields) appendln(": ${dictionary.name} {") indent(level = 1) - appendln("val o = js(\"({})\") as ${dictionary.name}") + appendln("val o = js(\"({})\")") appendln() for (field in fields) { indent(level = 1) - appendln("o.`${field.name}` = ${field.name.replaceKeywords()}") + appendln("o[\"${field.name}\"] = ${field.name.replaceKeywords()}") } appendln() diff --git a/libraries/tools/idl2k/src/main/kotlin/typeMappings.kt b/libraries/tools/idl2k/src/main/kotlin/typeMappings.kt index 4cab9e9282238..303eff520bdf6 100644 --- a/libraries/tools/idl2k/src/main/kotlin/typeMappings.kt +++ b/libraries/tools/idl2k/src/main/kotlin/typeMappings.kt @@ -20,8 +20,8 @@ import java.util.* private val typeMapper = mapOf( "unsignedlong" to SimpleType("Int", false), - "unsignedlonglong" to SimpleType("Long", false), - "longlong" to SimpleType("Long", false), + "unsignedlonglong" to SimpleType("Int", false), + "longlong" to SimpleType("Int", false), "unsignedshort" to SimpleType("Short", false), "unsignedbyte" to SimpleType("Byte", false), "octet" to SimpleType("Byte", false),