提交 e110c99a 编写于 作者: fxy060608's avatar fxy060608

wip(uts): compiler

上级 0a0908b5
{"version":3,"sources":["uni_modules/test-uniplugin/utssdk/app-ios/index.uts","uni_modules/test-uniplugin/utssdk/interface.uts"],"sourcesContent":["import { UIDevice } from 'UIKit'\nimport { CLLocationManager, CLAuthorizationStatus } from 'CoreLocation'\nimport { ShowToast } from '../interface.uts'\n\ntype GetBatteryInfoOptions = {\n name: string\n pwd: number\n success?: (res: UTSJSONObject) => void\n fail?: (res: UTSJSONObject) => void\n complete?: (res: UTSJSONObject) => void\n}\n\nexport default function getBatteryInfo(options: GetBatteryInfoOptions) {\n new UIAlertController(\n (title = title),\n (message = message),\n (preferredStyle = UIAlertController.Style.alert)\n )\n const res = {\n errMsg: 'getBatteryInfo:ok',\n level: UIDevice.current.batteryLevel * 100,\n isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,\n }\n if (options.success != null) {\n options.success!(res)\n }\n if (options.complete != null) {\n options.complete!(res)\n }\n}\n\nexport function test1(callback: () => void): string {\n console.log({ \"a\": \"b\" })\n console.log('test1')\n\n\n\n\n console.log('def ios')\n\n\n console.log('ndef android')\n\n\n\n\n\n console.log('def android || def ios')\n\n\n\n\n console.log(CLLocationManager, CLAuthorizationStatus)\n const a = -3\n console.log(~a)\n return 'test1'\n}\n\nclass Test1 { }\nexport class Test {\n constructor() {\n new Test1()\n }\n test(): string | null {\n if (UTSiOS.macros(\"swift(>=1)\")) {\n console.log(\"swift(>=1)\")\n }\n if (UTSiOS.macros(\"arch(i386) || arch(arm)\")) {\n console.log(\"arch(i386) || arch(arm)\")\n }\n if (UTSiOS.available(\"iOS 14, macOS 11.0, *\")) {\n console.log(\"iOS 14, macOS 11.0, *\")\n } else if (UTSiOS.available(\"iOS 13,*\")) {\n console.log(\"iOS 13,*\")\n } else if (UTSiOS.unavailable(\"tvOS 12\")) {\n console.log(\"tvOS 12\")\n }\n return null\n }\n}\n\nexport async function testAsync() {\n uni.showToast()\n uni.showToast()\n uni.showModel()\n return { a: 1 }\n}\n\nexport const showToast1: ShowToast = (msg) => { }\nexport const showToast2: ShowToast = function (msg) { }\nexport const showToast3: ShowToast = function showToast(msg) { }\n","export type ShowToast = (msg: string) => void\n"],"names":[],"mappings":";;AAAA,aAAgC;AAChC,oBAAuE;;;iBCD3D,eAAa,KAAK,MAAM,KAAK,IAAI;ADIhB,aAAxB;IACH,WAAA,MAAM,MAAM,EAAA;IACZ,WAAA,KAAK,QAAM,EAAA;IACX,WAAA,aAAW,KAAK,kBAAkB,IAAI,GAAA;IACtC,WAAA,UAAQ,KAAK,kBAAkB,IAAI,GAAA;IACnC,WAAA,cAAY,KAAK,kBAAkB,IAAI,GAAA;;gBAJvC,MAAM,MAAM,EACZ,KAAK,QAAM,EACX,sBAAW,KAAK,kBAAkB,IAAI,GACtC,mBAAQ,KAAK,kBAAkB,IAAI,GACnC,uBAAY,KAAK,kBAAkB,IAAI;aAJvC,OAAA;aACA,MAAA;aACA,UAAA;aACA,OAAA;aACA,WAAA;;AACF;AAEe,YAAS,eAAe,EAAA,SAAS,qBAAqB,EAAE;IACjE,kBACD,OAAQ,OACR,SAAU,SACV,gBAAiB,kBAAkB,KAAK,CAAC,KAAK;IAEjD,IAAM,MAAM;QACV,CAAA,SAAQ;QACR,CAAA,QAAO,SAAS,OAAO,CAAC,YAAY,GAAG,GAAG;QAC1C,CAAA,aAAY,SAAS,OAAO,CAAC,YAAY,IAAI,SAAS,YAAY,CAAC,QAAQ;MAC5E;IACD,IAAI,QAAQ,OAAO,IAAI,GAAI;QACzB,QAAQ,OAAO,EAAE;;IAEnB,IAAI,QAAQ,QAAQ,IAAI,GAAI;QAC1B,QAAQ,QAAQ,EAAE;;AAEtB;AAEO,YAAS,MAAM,EAAA,yBAAgB,IAAI,KAAG,MAAM,CAAC;IAClD,QAAQ,GAAG,CAAC;QAAE,KAAK;MAAK;IACxB,QAAQ,GAAG,CAAC;IAKZ,QAAQ,GAAG,CAAC;IAGZ,QAAQ,GAAG,C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/test-uniplugin/utssdk/app-ios/index.uts","uni_modules/test-uniplugin/utssdk/interface.uts"],"sourcesContent":["import { UIDevice } from 'UIKit'\nimport { CLLocationManager, CLAuthorizationStatus } from 'CoreLocation'\nimport { ShowToast } from '../interface.uts'\n\ntype GetBatteryInfoOptions = {\n name: string\n pwd: number\n success?: (res: UTSJSONObject) => void\n fail?: (res: UTSJSONObject) => void\n complete?: (res: UTSJSONObject) => void\n}\n\nexport default function getBatteryInfo(options: GetBatteryInfoOptions) {\n new UIAlertController(\n (title = title),\n (message = message),\n (preferredStyle = UIAlertController.Style.alert)\n )\n const res = {\n errMsg: 'getBatteryInfo:ok',\n level: UIDevice.current.batteryLevel * 100,\n isCharging: UIDevice.current.batteryState == UIDevice.BatteryState.charging,\n }\n if (options.success != null) {\n options.success!(res)\n }\n if (options.complete != null) {\n options.complete!(res)\n }\n}\n\nexport function test1(callback: () => void): string {\n console.log({ \"a\": \"b\" })\n console.log('test1')\n\n\n\n\n console.log('def ios')\n\n\n console.log('ndef android')\n\n\n\n\n\n console.log('def android || def ios')\n\n\n\n\n console.log(CLLocationManager, CLAuthorizationStatus)\n const a = -3\n console.log(~a)\n return 'test1'\n}\n\nclass Test1 { }\nexport class Test {\n constructor() {\n new Test1()\n }\n test(): string | null {\n if (UTSiOS.macros(\"swift(>=1)\")) {\n console.log(\"swift(>=1)\")\n }\n if (UTSiOS.macros(\"arch(i386) || arch(arm)\")) {\n console.log(\"arch(i386) || arch(arm)\")\n }\n if (UTSiOS.available(\"iOS 14, macOS 11.0, *\")) {\n console.log(\"iOS 14, macOS 11.0, *\")\n } else if (UTSiOS.available(\"iOS 13,*\")) {\n console.log(\"iOS 13,*\")\n } else if (UTSiOS.unavailable(\"tvOS 12\")) {\n console.log(\"tvOS 12\")\n }\n return null\n }\n}\n\nexport async function testAsync() {\n uni.showToast()\n uni.showToast()\n uni.showModel()\n return { a: 1 }\n}\n\nexport const showToast1: ShowToast = (msg) => { }\nexport const showToast2: ShowToast = function (msg) {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;AACT;AAEA;;aAAM;AAAQ;AACP;;aAAM;IACX,aAAc;QACR;IACN;IACA,YAAA,UAAQ,MAAM,EAAQ;QACpB;YACE,QAAQ,GAAG,CAAC;cACb;QACD;YACE,QAAQ,GAAG,CAAC;cACb;QACD;YACE,QAAQ,GAAG,CAAC;;YACP;gBACL,QAAQ,GAAG,CAAC;;gBACP;oBACL,QAAQ,GAAG,CAAC;;;;QAEd,OAAO,GAAI;IACb;AACF;AAEO;YAAe,mCAAY;IAC5B;IACA;IACA;IACJ,OAAO;QAAE,CAAA,IAAG,CAAC;MAAE;AACjB;AAEO,WAAM,wBAAwB;GAAC;;AAC/B,WAAM,wBAAwB;CAAU,EAAA,GAAG;;AAC3C,WAAM,wBAAwB;CAAmB,EAAA,GAAG;;AAtF9B;;;IAC3B,WAAA,MAAM,MAAM,EAAA;IACZ,WAAA,KAAK,QAAM,EAAA;IACX,WAAA,SAAQ,aAA8B;IACtC,WAAA,MAAK,aAA8B;IACnC,WAAA,UAAS,aAA8B;AACzC;+BAEuC,EAAA,SAAS,+BAAqB;;;;;SALxD,KAAK;yBAAL;;;SACH,KAAK;sBAAL;;;SACI,KAAK;0BAAL;;;;wBAsBQ,0BAAuB,MAAM;;QAA7B;;;;;;;;6BC/BG,KAAK,MAAM,KAAK,IAAI;sBAApB;;6BAAA,KAAK,MAAM,KAAK,IAAI;sBAApB;;6BAAA,KAAK,MAAM,KAAK,IAAI;sBAApB;;;;;4CDYc,EAAA,SAAS,+BAAqB;kCAA9B;;qCAmBjB,0BAAuB,MAAM;yBAA7B;;;;;;0CC/BG,KAAK,MAAM,KAAK,IAAI;8BAApB;;0CAAA,KAAK,MAAM,KAAK,IAAI;8BAApB;;0CAAA,KAAK,MAAM,KAAK,IAAI;8BAApB"}
\ No newline at end of file
......@@ -5,19 +5,21 @@ import CoreLocation;
public var uni_showToast = DCloudUTSExtAPI.showToast;
public var uni_showModel = DCloudUTSExtAPI.showModel;
public typealias ShowToast = (_ msg: String) -> Void;
public class GetBatteryInfoOptions {
@objc(UTSSDKModulesTestUniPluginGetBatteryInfoOptions)
@objcMembers
public class GetBatteryInfoOptions : NSObject {
public var name: String!;
public var pwd: NSNumber!;
public var success: ((_ res: UTSJSONObject) -> Void)?;
public var fail: ((_ res: UTSJSONObject) -> Void)?;
public var complete: ((_ res: UTSJSONObject) -> Void)?;
public init() {}
public init(name: String, pwd: NSNumber, success:@escaping ((_ res: UTSJSONObject) -> Void), fail:@escaping ((_ res: UTSJSONObject) -> Void), complete:@escaping ((_ res: UTSJSONObject) -> Void)) {
self.name = name;
self.pwd = pwd;
self.success = success;
self.fail = fail;
self.complete = complete;
public override init() {}
public init(_ obj: UTSJSONObject) {
name = obj["name"] as! String;
pwd = obj["pwd"] as! NSNumber;
success = obj["success"] as? ((_ res: UTSJSONObject) -> Void);
fail = obj["fail"] as? ((_ res: UTSJSONObject) -> Void);
complete = obj["complete"] as? ((_ res: UTSJSONObject) -> Void);
}
}
public func getBatteryInfo(_ options: GetBatteryInfoOptions) {
......@@ -106,16 +108,22 @@ public class GetBatteryInfoOptionsJSONObject : NSObject {
public var complete: UTSCallback?;
}
public func getBatteryInfoByJs(_ options: GetBatteryInfoOptionsJSONObject) {
return getBatteryInfo(GetBatteryInfoOptions(name: options.name, pwd: options.pwd, success: {
(res) in
options.success?(res);
}, fail: {
(res) in
options.fail?(res);
}, complete: {
(res) in
options.complete?(res);
}));
return getBatteryInfo(GetBatteryInfoOptions(UTSJSONObject([
"name": options.name,
"pwd": options.pwd,
"success": {
(res: UTSJSONObject) in
options.success?(res);
},
"fail": {
(res: UTSJSONObject) in
options.fail?(res);
},
"complete": {
(res: UTSJSONObject) in
options.complete?(res);
}
])));
}
public func test1ByJs(_ callback: UTSCallback) -> String {
return test1({
......@@ -124,7 +132,6 @@ public func test1ByJs(_ callback: UTSCallback) -> String {
);
}
@available(iOS 13.0.0, *)
@available(iOS 13.0.0, *)
public func testAsyncByJs() async -> UTSJSONObject {
return await testAsync();
}
......@@ -147,7 +154,6 @@ public class IndexSwift : NSObject {
return test1ByJs(callback);
}
@available(iOS 13.0.0, *)
@available(iOS 13.0.0, *)
public static func s_testAsyncByJs() async -> UTSJSONObject {
return await testAsyncByJs();
}
......
......@@ -179,6 +179,7 @@ const customElements = [
'ix-native-list',
'mkt',
'page-container',
'page-meta',
];
const options = {
cdn: 2,
......
......@@ -183,7 +183,7 @@ describe('uts:sourceMap', () => {
)
const { line, column, source } = await originalPositionFor({
sourceMapFile,
line: 25,
line: 27,
column: 0,
})
......
......@@ -19,7 +19,7 @@ const pkgs = {
latest: '4.1.0',
},
pinia: {
latest: '2.0.32',
latest: '2.0.33',
},
'vue-i18n': {
next: '9.1.9',
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册