Leave undefined values for undefined params in idl-generated code unassigned

https://upsource.jetbrains.com/kotlin/review/KOTLIN-CR-2535
This commit is contained in:
Shagen Ogandzhanian
2018-12-07 16:02:13 +01:00
parent 1ad2434fa0
commit 1f0bca12e1
6 changed files with 33 additions and 47 deletions
+9 -13
View File
@@ -1793,7 +1793,7 @@ public external interface ElementDefinitionOptions {
}
@kotlin.internal.InlineOnly
public inline fun ElementDefinitionOptions(extends: String? = null): ElementDefinitionOptions {
public inline fun ElementDefinitionOptions(extends: String? = undefined): ElementDefinitionOptions {
val o = js("({})")
o["extends"] = extends
@@ -2109,7 +2109,7 @@ public external interface PromiseRejectionEventInit : EventInit {
}
@kotlin.internal.InlineOnly
public inline fun PromiseRejectionEventInit(promise: Promise<Any?>?, reason: Any? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PromiseRejectionEventInit {
public inline fun PromiseRejectionEventInit(promise: Promise<Any?>?, reason: Any? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): PromiseRejectionEventInit {
val o = js("({})")
o["promise"] = promise
@@ -2365,7 +2365,7 @@ public external interface ImageBitmapOptions {
}
@kotlin.internal.InlineOnly
public inline fun ImageBitmapOptions(imageOrientation: ImageOrientation? = ImageOrientation.NONE, premultiplyAlpha: PremultiplyAlpha? = PremultiplyAlpha.DEFAULT, colorSpaceConversion: ColorSpaceConversion? = ColorSpaceConversion.DEFAULT, resizeWidth: Int? = null, resizeHeight: Int? = null, resizeQuality: ResizeQuality? = ResizeQuality.LOW): ImageBitmapOptions {
public inline fun ImageBitmapOptions(imageOrientation: ImageOrientation? = ImageOrientation.NONE, premultiplyAlpha: PremultiplyAlpha? = PremultiplyAlpha.DEFAULT, colorSpaceConversion: ColorSpaceConversion? = ColorSpaceConversion.DEFAULT, resizeWidth: Int? = undefined, resizeHeight: Int? = undefined, resizeQuality: ResizeQuality? = ResizeQuality.LOW): ImageBitmapOptions {
val o = js("({})")
o["imageOrientation"] = imageOrientation
@@ -2416,9 +2416,7 @@ public inline fun MessageEventInit(data: Any? = null, origin: String? = "", last
o["origin"] = origin
o["lastEventId"] = lastEventId
o["source"] = source
if (ports != null) {
o["ports"] = ports
}
o["ports"] = ports
o["bubbles"] = bubbles
o["cancelable"] = cancelable
o["composed"] = composed
@@ -2998,7 +2996,7 @@ public external interface MutationObserverInit {
}
@kotlin.internal.InlineOnly
public inline fun MutationObserverInit(childList: Boolean? = false, attributes: Boolean? = null, characterData: Boolean? = null, subtree: Boolean? = false, attributeOldValue: Boolean? = null, characterDataOldValue: Boolean? = null, attributeFilter: Array<String>? = null): MutationObserverInit {
public inline fun MutationObserverInit(childList: Boolean? = false, attributes: Boolean? = undefined, characterData: Boolean? = undefined, subtree: Boolean? = false, attributeOldValue: Boolean? = undefined, characterDataOldValue: Boolean? = undefined, attributeFilter: Array<String>? = undefined): MutationObserverInit {
val o = js("({})")
o["childList"] = childList
@@ -3007,9 +3005,7 @@ public inline fun MutationObserverInit(childList: Boolean? = false, attributes:
o["subtree"] = subtree
o["attributeOldValue"] = attributeOldValue
o["characterDataOldValue"] = characterDataOldValue
if (attributeFilter != null) {
o["attributeFilter"] = attributeFilter
}
o["attributeFilter"] = attributeFilter
return o
}
@@ -3122,7 +3118,7 @@ public external interface ElementCreationOptions {
}
@kotlin.internal.InlineOnly
public inline fun ElementCreationOptions(is_: String? = null): ElementCreationOptions {
public inline fun ElementCreationOptions(is_: String? = undefined): ElementCreationOptions {
val o = js("({})")
o["is"] = is_
@@ -3706,7 +3702,7 @@ public external interface ScrollToOptions : ScrollOptions {
}
@kotlin.internal.InlineOnly
public inline fun ScrollToOptions(left: Double? = null, top: Double? = null, behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollToOptions {
public inline fun ScrollToOptions(left: Double? = undefined, top: Double? = undefined, behavior: ScrollBehavior? = ScrollBehavior.AUTO): ScrollToOptions {
val o = js("({})")
o["left"] = left
@@ -3810,7 +3806,7 @@ public external interface BoxQuadOptions {
}
@kotlin.internal.InlineOnly
public inline fun BoxQuadOptions(box: CSSBoxType? = CSSBoxType.BORDER, relativeTo: dynamic = null): BoxQuadOptions {
public inline fun BoxQuadOptions(box: CSSBoxType? = CSSBoxType.BORDER, relativeTo: dynamic = undefined): BoxQuadOptions {
val o = js("({})")
o["box"] = box
@@ -112,7 +112,7 @@ public external interface RequestInit {
}
@kotlin.internal.InlineOnly
public inline fun RequestInit(method: String? = null, headers: dynamic = null, body: dynamic = null, referrer: String? = null, referrerPolicy: dynamic = null, mode: RequestMode? = null, credentials: RequestCredentials? = null, cache: RequestCache? = null, redirect: RequestRedirect? = null, integrity: String? = null, keepalive: Boolean? = null, window: Any? = null): RequestInit {
public inline fun RequestInit(method: String? = undefined, headers: dynamic = undefined, body: dynamic = undefined, referrer: String? = undefined, referrerPolicy: dynamic = undefined, mode: RequestMode? = undefined, credentials: RequestCredentials? = undefined, cache: RequestCache? = undefined, redirect: RequestRedirect? = undefined, integrity: String? = undefined, keepalive: Boolean? = undefined, window: Any? = undefined): RequestInit {
val o = js("({})")
o["method"] = method
@@ -171,7 +171,7 @@ public external interface ResponseInit {
}
@kotlin.internal.InlineOnly
public inline fun ResponseInit(status: Short? = 200, statusText: String? = "OK", headers: dynamic = null): ResponseInit {
public inline fun ResponseInit(status: Short? = 200, statusText: String? = "OK", headers: dynamic = undefined): ResponseInit {
val o = js("({})")
o["status"] = status
@@ -64,7 +64,7 @@ public external interface FilePropertyBag : BlobPropertyBag {
}
@kotlin.internal.InlineOnly
public inline fun FilePropertyBag(lastModified: Int? = null, type: String? = ""): FilePropertyBag {
public inline fun FilePropertyBag(lastModified: Int? = undefined, type: String? = ""): FilePropertyBag {
val o = js("({})")
o["lastModified"] = lastModified
@@ -111,7 +111,7 @@ public external interface NotificationOptions {
}
@kotlin.internal.InlineOnly
public inline fun NotificationOptions(dir: NotificationDirection? = NotificationDirection.AUTO, lang: String? = "", body: String? = "", tag: String? = "", image: String? = null, icon: String? = null, badge: String? = null, sound: String? = null, vibrate: dynamic = null, timestamp: Number? = null, renotify: Boolean? = false, silent: Boolean? = false, noscreen: Boolean? = false, requireInteraction: Boolean? = false, sticky: Boolean? = false, data: Any? = null, actions: Array<NotificationAction>? = arrayOf()): NotificationOptions {
public inline fun NotificationOptions(dir: NotificationDirection? = NotificationDirection.AUTO, lang: String? = "", body: String? = "", tag: String? = "", image: String? = undefined, icon: String? = undefined, badge: String? = undefined, sound: String? = undefined, vibrate: dynamic = undefined, timestamp: Number? = undefined, renotify: Boolean? = false, silent: Boolean? = false, noscreen: Boolean? = false, requireInteraction: Boolean? = false, sticky: Boolean? = false, data: Any? = null, actions: Array<NotificationAction>? = arrayOf()): NotificationOptions {
val o = js("({})")
o["dir"] = dir
@@ -130,9 +130,7 @@ public inline fun NotificationOptions(dir: NotificationDirection? = Notification
o["requireInteraction"] = requireInteraction
o["sticky"] = sticky
o["data"] = data
if (actions != null) {
o["actions"] = actions
}
o["actions"] = actions
return o
}
@@ -150,7 +148,7 @@ public external interface NotificationAction {
}
@kotlin.internal.InlineOnly
public inline fun NotificationAction(action: String?, title: String?, icon: String? = null): NotificationAction {
public inline fun NotificationAction(action: String?, title: String?, icon: String? = undefined): NotificationAction {
val o = js("({})")
o["action"] = action
@@ -91,7 +91,7 @@ public external interface RegistrationOptions {
}
@kotlin.internal.InlineOnly
public inline fun RegistrationOptions(scope: String? = null, type: WorkerType? = WorkerType.CLASSIC): RegistrationOptions {
public inline fun RegistrationOptions(scope: String? = undefined, type: WorkerType? = WorkerType.CLASSIC): RegistrationOptions {
val o = js("({})")
o["scope"] = scope
@@ -130,16 +130,14 @@ public external interface ServiceWorkerMessageEventInit : EventInit {
}
@kotlin.internal.InlineOnly
public inline fun ServiceWorkerMessageEventInit(data: Any? = null, origin: String? = null, lastEventId: String? = null, source: UnionMessagePortOrServiceWorker? = null, ports: Array<MessagePort>? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ServiceWorkerMessageEventInit {
public inline fun ServiceWorkerMessageEventInit(data: Any? = undefined, origin: String? = undefined, lastEventId: String? = undefined, source: UnionMessagePortOrServiceWorker? = undefined, ports: Array<MessagePort>? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ServiceWorkerMessageEventInit {
val o = js("({})")
o["data"] = data
o["origin"] = origin
o["lastEventId"] = lastEventId
o["source"] = source
if (ports != null) {
o["ports"] = ports
}
o["ports"] = ports
o["bubbles"] = bubbles
o["cancelable"] = cancelable
o["composed"] = composed
@@ -237,12 +235,8 @@ public external interface ForeignFetchOptions {
public inline fun ForeignFetchOptions(scopes: Array<String>?, origins: Array<String>?): ForeignFetchOptions {
val o = js("({})")
if (scopes != null) {
o["scopes"] = scopes
}
if (origins != null) {
o["origins"] = origins
}
o["scopes"] = scopes
o["origins"] = origins
return o
}
@@ -324,14 +318,12 @@ public external interface ForeignFetchResponse {
}
@kotlin.internal.InlineOnly
public inline fun ForeignFetchResponse(response: Response?, origin: String? = null, headers: Array<String>? = null): ForeignFetchResponse {
public inline fun ForeignFetchResponse(response: Response?, origin: String? = undefined, headers: Array<String>? = undefined): ForeignFetchResponse {
val o = js("({})")
o["response"] = response
o["origin"] = origin
if (headers != null) {
o["headers"] = headers
}
o["headers"] = headers
return o
}
@@ -366,16 +358,14 @@ public external interface ExtendableMessageEventInit : ExtendableEventInit {
}
@kotlin.internal.InlineOnly
public inline fun ExtendableMessageEventInit(data: Any? = null, origin: String? = null, lastEventId: String? = null, source: UnionClientOrMessagePortOrServiceWorker? = null, ports: Array<MessagePort>? = null, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableMessageEventInit {
public inline fun ExtendableMessageEventInit(data: Any? = undefined, origin: String? = undefined, lastEventId: String? = undefined, source: UnionClientOrMessagePortOrServiceWorker? = undefined, ports: Array<MessagePort>? = undefined, bubbles: Boolean? = false, cancelable: Boolean? = false, composed: Boolean? = false): ExtendableMessageEventInit {
val o = js("({})")
o["data"] = data
o["origin"] = origin
o["lastEventId"] = lastEventId
o["source"] = source
if (ports != null) {
o["ports"] = ports
}
o["ports"] = ports
o["bubbles"] = bubbles
o["cancelable"] = cancelable
o["composed"] = composed
@@ -412,7 +402,7 @@ public external interface CacheQueryOptions {
}
@kotlin.internal.InlineOnly
public inline fun CacheQueryOptions(ignoreSearch: Boolean? = false, ignoreMethod: Boolean? = false, ignoreVary: Boolean? = false, cacheName: String? = null): CacheQueryOptions {
public inline fun CacheQueryOptions(ignoreSearch: Boolean? = false, ignoreMethod: Boolean? = false, ignoreVary: Boolean? = false, cacheName: String? = undefined): CacheQueryOptions {
val o = js("({})")
o["ignoreSearch"] = ignoreSearch
@@ -439,7 +429,7 @@ public external interface CacheBatchOperation {
}
@kotlin.internal.InlineOnly
public inline fun CacheBatchOperation(type: String? = null, request: Request? = null, response: Response? = null, options: CacheQueryOptions? = null): CacheBatchOperation {
public inline fun CacheBatchOperation(type: String? = undefined, request: Request? = undefined, response: Response? = undefined, options: CacheQueryOptions? = undefined): CacheBatchOperation {
val o = js("({})")
o["type"] = type