JS Introduce typed arrays

This commit is contained in:
Sergey Mashkov
2015-05-07 21:26:03 +03:00
committed by Sergey Mashkov
parent a6bed4f623
commit 6366f966b7
11 changed files with 593 additions and 74 deletions
@@ -464,21 +464,6 @@ nonAnyType
| 'Date' typeSuffix
| 'RegExp' typeSuffix
| 'DOMException' typeSuffix
| bufferRelatedType typeSuffix
;
bufferRelatedType
: 'ArrayBuffer'
| 'DataView'
| 'Int8Array'
| 'Int16Array'
| 'Int32Array'
| 'Uint8Array'
| 'Uint16Array'
| 'Uint32Array'
| 'Uint8ClampedArray'
| 'Float32Array'
| 'Float64Array'
;
constType
@@ -37,7 +37,8 @@ val urls = listOf(
"https://raw.githubusercontent.com/whatwg/fetch/master/Overview.src.html" to "org.w3c.fetch",
"http://www.w3.org/TR/vibration/" to "org.w3c.vibration",
"http://dev.w3.org/csswg/cssom/" to "org.w3c.dom.css",
"https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl" to "org.khronos.webgl"
"https://www.khronos.org/registry/webgl/specs/latest/1.0/webgl.idl" to "org.khronos.webgl",
"https://www.khronos.org/registry/typedarray/specs/latest/typedarray.idl" to "org.khronos.webgl"
)
fun main(args: Array<String>) {
@@ -23,10 +23,14 @@ private val typeMapper = mapOf(
"unsignedlonglong" to "Long",
"longlong" to "Long",
"unsignedshort" to "Short",
"unsignedbyte" to "Byte",
"octet" to "Byte",
"void" to "Unit",
"boolean" to "Boolean",
"byte" to "Byte",
"short" to "Short",
"long" to "Int",
"float" to "Float",
"double" to "Double",
"any" to "Any?",
"DOMTimeStamp" to "Number",
@@ -38,8 +42,6 @@ private val typeMapper = mapOf(
"DOMString" to "String",
"ByteString" to "String",
"DOMError" to "dynamic",
"Uint8ClampedArray" to "dynamic", // TODO think of native arrays,
"ArrayBuffer" to "dynamic",
"Elements" to "dynamic",
"Date" to "Date",
"" to "dynamic"