From 125c0fc0b7f51847d2e6c92433c82c3e8982abb0 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Fri, 29 Jan 2021 18:12:39 +0100 Subject: Drop JavaScript root object members from builtins.qmltypes Those are not actually accessible from C++, and the description we had was incomplete and misleading. There was no way to know that the "Math" type, for example, was the type of a member of the global object called "Math", but the "float" type was not. Furthermore the types given for parameters and return values were only approximations. JavaScript's type coercion allows us to use a number of other types, too. There certainly is a place for a proper description of the global object, but such a description should be generated from the actual JavaScript root object as found in an actual QJSEngine. Furthermore, we do need better syntax to describe it. Change-Id: Ia573436df04ca967381e1e13dbd42a70bcc60979 Reviewed-by: Andrei Golubev Reviewed-by: Fabian Kosmale --- src/imports/builtins/builtins.qmltypes | 1642 +------------------------------- 1 file changed, 28 insertions(+), 1614 deletions(-) (limited to 'src') diff --git a/src/imports/builtins/builtins.qmltypes b/src/imports/builtins/builtins.qmltypes index 4d493193dc..c234300701 100644 --- a/src/imports/builtins/builtins.qmltypes +++ b/src/imports/builtins/builtins.qmltypes @@ -4,16 +4,15 @@ Module { dependencies: [] Component { - name: "undefined" - exports: ["QML/undefined 1.0"] - exportMetaObjectRevisions: [256] + name: "void" + accessSemantics: "none" } Component { name: "QVariant" accessSemantics: "value" exports: ["QML/var 1.0", "QML/variant 1.0"] - exportMetaObjectRevisions: [256] + exportMetaObjectRevisions: [256, 256] } Component { @@ -51,9 +50,7 @@ Module { name: "delay" type: "int" } - } - } Component { @@ -87,1632 +84,49 @@ Module { name: "errorString" type: "QString" } - } Component { - name: "Number" - // is a singleton, but its constructor can construct NumberPrototype objects... - isSingleton: true - prototype: "NumberPrototype" - - Property { - name: "EPSILON" - type: "NumberPrototype" - isReadonly: true - } - - Method { - name: "isFinite" - type: "bool" - - Parameter { - name: "number" - type: "NumberPrototype" - } - - } - - Method { - name: "isInteger" - type: "bool" - - Parameter { - name: "number" - type: "NumberPrototype" - } - - } - - Method { - name: "isNaN" - type: "bool" - - Parameter { - name: "number" - type: "NumberPrototype" - } - - } - - Method { - name: "isSafeInteger" - type: "bool" - - Parameter { - name: "number" - type: "NumberPrototype" - } - - } - - Property { - name: "MAX_SAFE_INTEGER" - type: "NumberPrototype" - isReadonly: true - } - - Property { - name: "MAX_VALUE" - type: "NumberPrototype" - isReadonly: true - } - - Property { - name: "MIN_SAFE_INTEGER" - type: "NumberPrototype" - isReadonly: true - } - - Property { - name: "MIN_VALUE" - type: "NumberPrototype" - isReadonly: true - } - - Property { - name: "NaN" - type: "NumberPrototype" - isReadonly: true - } - - Property { - name: "NEGATIVE_INFINITY" - type: "NumberPrototype" - isReadonly: true - } - - Method { - name: "parseFloat" - type: "double" - - Parameter { - name: "string" - type: "QString" - } - - } - - Method { - name: "parseInt" - type: "int" - - Parameter { - name: "string" - type: "QString" - } - - Parameter { - name: "radix" - type: "int" - } - - } - - Property { - name: "POSITIVE_INFINITY" - type: "NumberPrototype" - isReadonly: true - } - + name: "number" + accessSemantics: "value" } Component { - name: "NumberPrototype" + name: "int" + prototype: "number" + exports: ["QML/int 1.0"] + exportMetaObjectRevisions: [256] accessSemantics: "value" - - Method { - name: "toExponential" - type: "QString" - - Parameter { - name: "fractionDigits" - type: "int" - } - - } - - Method { - name: "toFixed" - type: "QString" - - Parameter { - name: "fractionDigits" - type: "int" - } - - } - - Method { - name: "toLocaleString" - type: "QString" - - Parameter { - name: "locales" - type: "QString" - } - - Parameter { - name: "options" - type: "object" - } - - } - - Method { - name: "toPrecision" - type: "QString" - - Parameter { - name: "precision" - type: "int" - } - - } - - Method { - name: "toString" - type: "QString" - - Parameter { - name: "base" - type: "int" - } - - } - - Method { - name: "valueOf" - type: "NumberPrototype" - } - } Component { - name: "Math" - - Property { - name: "E" - type: "double" - isReadonly: true - } - - Property { - name: "LN10" - type: "double" - isReadonly: true - } - - Property { - name: "LN2" - type: "double" - isReadonly: true - } - - Property { - name: "LOG10E" - type: "double" - isReadonly: true - } - - Property { - name: "LOG2E" - type: "double" - isReadonly: true - } - - Property { - name: "PI" - type: "double" - isReadonly: true - } - - Property { - name: "SQRT1_2" - type: "double" - isReadonly: true - } - - Property { - name: "SQRT2" - type: "double" - isReadonly: true - } - - Method { - name: "abs" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "acos" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "acosh" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "asin" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "asinh" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "atan" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "atanh" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "atan2" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "acbrt" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "ceil" - type: "double" + name: "float" + prototype: "number" + accessSemantics: "value" + } - Parameter { - name: "x" - type: "double" - } + Component { + name: "double" + prototype: "number" + exports: ["QML/real 1.0"] + exportMetaObjectRevisions: [256] + accessSemantics: "value" + } - } - - Method { - name: "clz32" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "cos" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "cosh" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "exp" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "expm1" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "floor" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "fround" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "hypot" - type: "double" - - Parameter { - name: "arguments" - type: "QQmlV4Function" - } - } - - Method { - name: "cosh" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "imul" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "log" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "log1p" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "log10" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "log2" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "max" - type: "NumberPrototype" - - Parameter { - name: "arguments" - type: "QQmlV4Function" - } - } - - Method { - name: "min" - type: "NumberPrototype" - - Parameter { - name: "arguments" - type: "QQmlV4Function" - } - } - - Method { - name: "pow" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - Parameter { - name: "y" - type: "double" - } - - } - - Method { - name: "random" - type: "double" - } - - Method { - name: "round" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "sign" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "sin" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "sinh" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "sqrt" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "tanh" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - Method { - name: "trunc" - type: "double" - - Parameter { - name: "x" - type: "double" - } - - } - - } - - Component { - name: "int" - exports: ["QML/int 1.0"] - exportMetaObjectRevisions: [256] - prototype: "NumberPrototype" - accessSemantics: "value" - } - - Component { - name: "float" - prototype: "NumberPrototype" - accessSemantics: "value" - } + Component { + name: "QString" + exports: ["QML/string 1.0"] + exportMetaObjectRevisions: [256] + accessSemantics: "value" + } Component { - name: "double" - exports: ["QML/real 1.0"] + name: "bool" + exports: ["QML/bool 1.0"] exportMetaObjectRevisions: [256] - prototype: "NumberPrototype" accessSemantics: "value" } - Component { - name: "JSON" - - Method { - name: "parse" - type: "QJSValue" - - Parameter { - name: "text" - type: "QString" - } - - Parameter { - name: "reviver" - type: "QJSValue" - } - - } - - Method { - name: "stringify" - type: "QString" - - Parameter { - name: "value" - type: "QJSValue" - } - - Parameter { - name: "replacer" - type: "QJSValue" - } - - Parameter { - name: "space" - type: "int" - } - - } - - } - - Component { - name: "String" - prototype: "StringPrototype" - - Method { - name: "fromCharCode" - type: "QString" - - Parameter { - name: "arguments" - type: "QQmlV4Function" - } - } - - Method { - name: "fromCodePoint" - type: "QString" - - Parameter { - name: "arguments" - type: "QQmlV4Function" - } - } - - Method { - name: "raw" - type: "QString" - - Parameter { - name: "template" - type: "QJSValue" - } - - Parameter { - name: "substitutions" - type: "QQmlV4Function" - } - } - - } - - Component { - name: "StringPrototype" - - Method { - name: "charAt" - type: "QString" - - Parameter { - name: "pos" - type: "int" - } - - } - - Method { - name: "codePointAt" - type: "int" - - Parameter { - name: "pos" - type: "int" - } - - } - - Method { - name: "charCodeAt" - type: "int" - - Parameter { - name: "pos" - type: "int" - } - - } - - Method { - name: "concat" - type: "QString" - - Parameter { - name: "arguments" - type: "QQmlV4Function" - } - } - - Method { - name: "endsWith" - type: "bool" - - Parameter { - name: "searchString" - type: "QString" - } - - Parameter { - name: "endPosition" - type: "int" - } - - } - - Method { - name: "includes" - type: "bool" - - Parameter { - name: "searchString" - type: "QString" - } - - Parameter { - name: "position" - type: "int" - } - - } - - Method { - name: "indexOf" - type: "int" - - Parameter { - name: "searchString" - type: "QString" - } - - Parameter { - name: "position" - type: "int" - } - - } - - Method { - name: "lastIndexOf" - type: "int" - - Parameter { - name: "searchString" - type: "QString" - } - - Parameter { - name: "position" - type: "int" - } - - } - - Method { - name: "localeCompare" - type: "int" - - Parameter { - name: "that" - type: "QString" - } - - Parameter { - name: "locale" - type: "QString" - } - - Parameter { - name: "options" - type: "int" - } - - } - - Method { - name: "match" - type: "QJSValue" - - Parameter { - name: "that" - type: "QString" - } - - Parameter { - name: "locale" - type: "QString" - } - - Parameter { - name: "options" - type: "int" - } - - } - - Method { - name: "normalize" - type: "QString" - - Parameter { - name: "form" - type: "QString" - } - - } - - Method { - name: "repeat" - type: "QString" - - Parameter { - name: "count" - type: "int" - } - - } - - Method { - name: "replace" - type: "QString" - - Parameter { - name: "searchValue" - type: "QString" - } - - Parameter { - name: "replaceValue" - type: "QString" - } - - } - - Method { - name: "search" - type: "QJSValue" - - Parameter { - name: "regexp" - type: "QJSValue" - } - - } - - Method { - name: "slice" - type: "QString" - - Parameter { - name: "start" - type: "int" - } - - Parameter { - name: "end" - type: "int" - } - - } - - Method { - name: "split" - type: "list" - - Parameter { - name: "separator" - type: "QString" - } - - Parameter { - name: "limit" - type: "int" - } - - } - - Method { - name: "startsWith" - type: "bool" - - Parameter { - name: "searchString" - type: "QString" - } - - Parameter { - name: "position" - type: "int" - } - - } - - Method { - name: "substring" - type: "QString" - - Parameter { - name: "start" - type: "int" - } - - Parameter { - name: "end" - type: "int" - } - - } - - Method { - name: "toLocaleLowerCase" - type: "QString" - - Parameter { - name: "locale" - type: "QString" - } - - Parameter { - name: "options" - type: "QJSValue" - } - - } - - Method { - name: "toLowerCase" - type: "QString" - } - - Method { - name: "toUpperCase" - type: "QString" - - Parameter { - name: "locale" - type: "QString" - } - - Parameter { - name: "options" - type: "QJSValue" - } - - } - - Method { - name: "toUpperCase" - type: "QString" - } - - Method { - name: "trim" - type: "QString" - } - - Method { - name: "valueOf" - type: "QString" - } - - Property { - name: "length" - type: "int" - } - - } - - Component { - name: "QString" - prototype: "StringPrototype" - exports: ["QML/string 1.0"] - exportMetaObjectRevisions: [256] - accessSemantics: "value" - } - - Component { - name: "Boolean" - isSingleton: true - prototype: "BooleanPrototype" - } - - Component { - name: "BooleanPrototype" - - Method { - name: "toString" - type: "QString" - } - - Method { - name: "valueOf" - type: "bool" - } - - } - - Component { - name: "bool" - prototype: "BooleanPrototype" - exports: ["QML/bool 1.0"] - exportMetaObjectRevisions: [256] - accessSemantics: "value" - } - - Component { - name: "Date" - isSingleton: true - prototype: "DatePrototype" - - // Date ( year, month [, date [ , hours [ , minutes [ , seconds [ , ms ] ] ] ] ] ) - Method { - name: "now" - type: "DatePrototype" - } - - Method { - name: "parse" - type: "DatePrototype" - - Parameter { - name: "string" - type: "QString" - } - - } - - Method { - name: "UTC" - type: "DatePrototype" - - Parameter { - name: "year" - type: "int" - } - - Parameter { - name: "month" - type: "int" - } - - Parameter { - name: "date" - type: "int" - } - - Parameter { - name: "hours" - type: "int" - } - - Parameter { - name: "minutes" - type: "int" - } - - Parameter { - name: "seconds" - type: "int" - } - - Parameter { - name: "ms" - type: "int" - } - - } - - } - - Component { - name: "DatePrototype" - - Method { - name: "getDate" - type: "int" - } - - Method { - name: "getDay" - type: "int" - } - - Method { - name: "getFullYear" - type: "int" - } - - Method { - name: "getHours" - type: "int" - } - - Method { - name: "getMilliseconds" - type: "int" - } - - Method { - name: "getMinutes" - type: "int" - } - - Method { - name: "getMonth" - type: "int" - } - - Method { - name: "getSeconds" - type: "int" - } - - Method { - name: "getTime" - type: "double" - } - - Method { - name: "getTimeZoneOffset" - type: "double" - } - - Method { - name: "getUTCDate" - type: "int" - } - - Method { - name: "getUTCDay" - type: "int" - } - - Method { - name: "getUTCFullYear" - type: "int" - } - - Method { - name: "getUTCHours" - type: "int" - } - - Method { - name: "getUTCMilliseconds" - type: "int" - } - - Method { - name: "getUTCMinutes" - type: "int" - } - - Method { - name: "getUTCMonth" - type: "int" - } - - Method { - name: "getUTCSeconds" - type: "int" - } - - Method { - name: "setDate" - type: "Date" - - Parameter { - name: "date" - type: "DatePrototype" - } - - } - - Method { - name: "setFullYear" - type: "Date" - - Parameter { - name: "year" - type: "int" - } - - Parameter { - name: "month" - type: "int" - } - - Parameter { - name: "date" - type: "int" - } - - } - - Method { - name: "setHours" - type: "Date" - - Parameter { - name: "hour" - type: "int" - } - - Parameter { - name: "min" - type: "int" - } - - Parameter { - name: "sec" - type: "int" - } - - Parameter { - name: "ms" - type: "int" - } - - } - - Method { - name: "setMilliseconds" - type: "Date" - - Parameter { - name: "ms" - type: "int" - } - - } - - Method { - name: "setMinutes" - type: "Date" - - Parameter { - name: "min" - type: "int" - } - - Parameter { - name: "sec" - type: "int" - } - - Parameter { - name: "ms" - type: "int" - } - - } - - Method { - name: "setMonth" - type: "Date" - - Parameter { - name: "month" - type: "int" - } - - Parameter { - name: "date" - type: "int" - } - - } - - Method { - name: "setSeconds" - type: "Date" - - Parameter { - name: "seconds" - type: "int" - } - - Parameter { - name: "ms" - type: "int" - } - - } - - Method { - name: "setTime" - type: "Date" - - Parameter { - name: "time" - type: "int" - } - - } - - Method { - name: "setUTCDate" - type: "Date" - - Parameter { - name: "date" - type: "DatePrototype" - } - - } - - Method { - name: "setUTCFullYear" - type: "Date" - - Parameter { - name: "year" - type: "int" - } - - Parameter { - name: "month" - type: "int" - } - - Parameter { - name: "date" - type: "int" - } - - } - - Method { - name: "setUTCHours" - type: "Date" - - Parameter { - name: "hour" - type: "int" - } - - Parameter { - name: "min" - type: "int" - } - - Parameter { - name: "sec" - type: "int" - } - - Parameter { - name: "ms" - type: "int" - } - - } - - Method { - name: "setUTCMilliseconds" - type: "Date" - - Parameter { - name: "ms" - type: "int" - } - - } - - Method { - name: "setUTCMinutes" - type: "Date" - - Parameter { - name: "min" - type: "int" - } - - Parameter { - name: "sec" - type: "int" - } - - Parameter { - name: "ms" - type: "int" - } - - } - - Method { - name: "setUTCMonth" - type: "Date" - - Parameter { - name: "month" - type: "int" - } - - Parameter { - name: "date" - type: "int" - } - - } - - Method { - name: "setUTCSeconds" - type: "Date" - - Parameter { - name: "seconds" - type: "int" - } - - Parameter { - name: "ms" - type: "int" - } - - } - - Method { - name: "toDateString" - type: "QString" - } - - Method { - name: "toISOString" - type: "QString" - } - - Method { - name: "toJSON" - type: "QString" - - Parameter { - name: "key" - type: "QJSValue" // ignored - } - - } - - Method { - name: "toLocaleDateString" - type: "QString" - - Parameter { - name: "locale" - type: "QString" - } - - Parameter { - name: "options" - type: "QJSValue" - } - - } - - Method { - name: "toLocaleDateDateString" - type: "QString" - - Parameter { - name: "locale" - type: "QString" - } - - Parameter { - name: "options" - type: "QJSValue" - } - - } - - Method { - name: "toLocaleDateTimeString" - type: "QString" - - Parameter { - name: "locale" - type: "QString" - } - - Parameter { - name: "options" - type: "QJSValue" - } - - } - - Method { - name: "toLocaleString" - type: "QString" - - Parameter { - name: "locale" - type: "QString" - } - - Parameter { - name: "options" - type: "QJSValue" - } - - } - - Method { - name: "toString" - type: "QString" - } - - Method { - name: "toTimeString" - type: "QString" - } - - Method { - name: "toUTCString" - type: "QString" - } - - Method { - name: "valueOf" - type: "Date" - } - - } - - Component { - name: "Date" - prototype: "DatePrototype" - } - Component { name: "QDateTime" exports: ["QML/date 1.0"] -- cgit v1.2.3