2021-11-23 18:00:29 +00:00
|
|
|
import QtQml
|
|
|
|
import TestTypes
|
2022-08-23 08:42:35 +00:00
|
|
|
import TestTypes as TT2
|
2021-12-10 13:27:06 +00:00
|
|
|
import Ambiguous 1.2
|
2021-11-23 18:00:29 +00:00
|
|
|
|
|
|
|
QtObject {
|
2022-06-03 13:12:10 +00:00
|
|
|
id: self
|
2021-11-23 18:00:29 +00:00
|
|
|
property string attachedForNonObject: objectName.Component.objectName
|
|
|
|
property string attachedForNasty: Nasty.objectName
|
|
|
|
|
|
|
|
property Nasty nasty: Nasty {
|
2023-09-26 13:45:09 +00:00
|
|
|
id: theNasty
|
2021-11-23 18:00:29 +00:00
|
|
|
objectName: Component.objectName
|
|
|
|
}
|
|
|
|
|
|
|
|
onFooBar: console.log("nope")
|
|
|
|
|
|
|
|
function doesReturnValue() { return 5; }
|
2021-12-10 13:27:06 +00:00
|
|
|
|
|
|
|
property Thing thing: Thing {
|
|
|
|
property int b: a + 1
|
|
|
|
}
|
|
|
|
|
2022-04-01 12:21:02 +00:00
|
|
|
property Thing2 thing2: Thing2 {
|
|
|
|
property int b: a + 2
|
|
|
|
}
|
|
|
|
|
2021-12-10 13:27:06 +00:00
|
|
|
property NotHere here: NotHere {
|
|
|
|
property int c: b + 1
|
|
|
|
}
|
2022-01-12 12:07:47 +00:00
|
|
|
|
|
|
|
Component.onCompleted: doesNotExist()
|
2022-06-03 13:12:10 +00:00
|
|
|
|
2022-06-15 12:16:11 +00:00
|
|
|
property BirthdayParty party: BirthdayParty {
|
|
|
|
onPartyStarted: (foozle) => { objectName = foozle }
|
|
|
|
}
|
2022-06-24 12:40:02 +00:00
|
|
|
|
2022-08-23 08:42:35 +00:00
|
|
|
property int enumFromGadget1: GadgetWithEnum.CONNECTED + 1
|
2022-11-10 13:50:18 +00:00
|
|
|
|
|
|
|
function constStore() : int {
|
|
|
|
const x = 1;
|
|
|
|
x = 2;
|
|
|
|
return x;
|
|
|
|
}
|
|
|
|
|
|
|
|
function earlyLoad() : int {
|
|
|
|
var a = b;
|
|
|
|
let b = 5;
|
|
|
|
return a;
|
|
|
|
}
|
2022-11-11 13:23:42 +00:00
|
|
|
|
|
|
|
function earlyStore() : int {
|
|
|
|
a = 5;
|
|
|
|
let a;
|
|
|
|
return a;
|
|
|
|
}
|
2023-04-18 13:54:07 +00:00
|
|
|
|
|
|
|
function getText(myArr: list<string>): string {
|
|
|
|
myArr.shiftss()
|
|
|
|
}
|
2023-04-19 08:26:49 +00:00
|
|
|
|
|
|
|
function readTracks(metadataList : list<badType>): int {
|
|
|
|
return metadataList.length
|
|
|
|
}
|
2023-04-17 12:12:05 +00:00
|
|
|
|
|
|
|
function dtzFail() : int {
|
|
|
|
for (var a = 10; a < 20; ++a) {
|
|
|
|
switch (a) {
|
|
|
|
case 11:
|
|
|
|
let b = 5;
|
|
|
|
break;
|
|
|
|
case 10:
|
|
|
|
console.log(b);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
return a;
|
|
|
|
}
|
2023-05-09 08:47:06 +00:00
|
|
|
|
|
|
|
// TODO: Drop these once we can manipulate QVariant-wrapped lists.
|
|
|
|
property list<withLength> withLengths
|
|
|
|
property int l: withLengths.length
|
|
|
|
property withLength w: withLengths[10]
|
2023-06-30 08:14:17 +00:00
|
|
|
|
|
|
|
property unconstructibleWithLength uwl: 12 + 1
|
|
|
|
|
|
|
|
// Cannot generate code for getters
|
|
|
|
property rect r3: ({ get x() { return 42; }, y: 4 })
|
2023-09-26 13:02:57 +00:00
|
|
|
|
|
|
|
property int nonIterable: {
|
|
|
|
var result = 1;
|
|
|
|
for (var a in Component)
|
|
|
|
++result;
|
|
|
|
return result;
|
|
|
|
}
|
2023-09-26 13:45:09 +00:00
|
|
|
|
|
|
|
property alias selfself: self
|
|
|
|
property alias nastyBad: theNasty.bad
|
|
|
|
function writeToUnknown() : int {
|
|
|
|
self.selfself.nastyBad = undefined;
|
|
|
|
return 5;
|
|
|
|
}
|
2023-10-17 13:36:54 +00:00
|
|
|
|
|
|
|
readonly property int someNumber: 10
|
|
|
|
function writeToReadonly() { someNumber = 20 }
|
2023-11-17 08:35:35 +00:00
|
|
|
|
|
|
|
property var silly: [,0]
|
2021-11-23 18:00:29 +00:00
|
|
|
}
|