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

wip(uts): compiler

上级 cfabda77
{"version":3,"sources":["uni_modules/test-uniplugin/static/logo.png","uni_modules/test-uniplugin/utssdk/app-android/index.uts","uni_modules/test-uniplugin/utssdk/app-android/utils.uts","uni_modules/test-uniplugin/utssdk/app-android/login.uts","uni_modules/test-uniplugin/utssdk/app-android/interface.uts","uni_modules/test-uniplugin/utssdk/interface.uts"],"sourcesContent":["import { UTSAndroid } from 'io.dcloud.uts'\nexport default UTSAndroid.getResourcePath('uni_modules/test-uniplugin/static/logo.png')\n ","import Log from 'android.util.Log'\nimport FrameLayout from 'android.widget.FrameLayout'\nimport View from 'android.view.View'\nimport { login } from 'login'\nimport { IUser } from './interface'\nimport logo from '../../static/logo.png'\nimport { ShowToast } from '../interface.uts'\n\nconst test = arrayOf(1, 2, 3)\n\ntype GetBatteryInfoOptions = {\n success?: (res: UTSJSONObject) => void\n fail?: (res: UTSJSONObject) => void\n complete?: (res: UTSJSONObject) => void\n}\nexport class User implements IUser {\n async login(name: string, pwd: string) {\n setTimeout(() => {\n console.log('timeout')\n }, 1000)\n login(name, pwd)\n for (let i = 0; i < 10; i++) {\n console.log(i)\n }\n Log.info(logo)\n\n console.log('def android')\n\n\n\n\n\n\n\n\n console.log('ndef ios')\n\n\n console.log('def android || def ios')\n\n\n\n\n const a = -3\n console.log(~a)\n new XToast<XToast<unknown>>(getUniActivity())\n .setContentView(R.layout.toast_hint)\n .setDuration(1000)\n .setImageDrawable(android.R.id.icon, R.mipmap.ic_dialog_tip_finish)\n .setText(android.R.id.message, '点我消失')\n .show()\n }\n register(name: string, callback: () => void) {\n Log.info(logo as FrameLayout)\n }\n test(view: View) {\n console.log(new TestClass())\n }\n}\nfunction login(name: string, callback: () => void) { }\n\n@Suppress(\"DEPRECATION\")\n export function register(name: string, callback: () => void) { }\nexport function offMemoryWarning(\n callback: null | ((level: number) => void) = null\n) {\n uni.showToast()\n uni.showToast()\n uni.showModel()\n}\nclass TestClass {\n\n}\nexport const showToast1: ShowToast = (msg) => { }\nexport const showToast2: ShowToast = function (msg) { }\nexport const showToast3: ShowToast = function showToast(msg) { }\n","export function test(){\n console.log('test')\n}\n","import { test } from \"./utils.uts\"\nexport function login(name: string, pwd: string) {\n console.log('login')\n test()\n return { name, pwd }\n}\n","export interface IUser {\n register(name: string): void\n}\n","export type ShowToast = (msg: string) => void\n"],"names":[],"mappings":";;;;;;;;;AAAA;ACAA,OAAgB,gBAAkB,CAAA;AAClC,OAAwB,0BAA4B,CAAA;AACpD,OAAiB,iBAAmB,CAAA;ACF7B,IAAS,OAAM;IAClB,QAAQ,GAAG,CAAC;AAChB;ACDO,IAAS,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,iBAAE;IAC/C,QAAQ,GAAG,CAAC;IACZ;IACA,OAAO;QAAE,IAAA,OAAA;QAAM,IAAA,MAAA;KAAK;AACtB;UCLiB;QACf,SAAS,MAAM,MAAM,GAAG,IAAI;;cJAf,WAAW,eAAe,CAAC;UKD9B,aAAa,KAAK,MAAM,KAAK,IAAI;AJQ7C,IAAM,QAAO,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAOrB,WAAM;IACX,iBAAM,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,8CAAE;QACrC,WAAW,KAAM;YACf,QAAQ,GAAG,CAAC;QACd;UAAG,IAAI;QACP,MAAM,MAAM;YACZ;YAAK,IAAI,IAAI,CAAC;YAAd,MAAgB,IAAI,EAAE;gBACpB,QAAQ,GAAG,CAAC;gBADU;;QAExB;QACA,IAAI,IAAI;QAER,QAAQ,GAAG,CAAC;QASZ,QAAQ,GAAG,CAAC;QAGZ,QAAQ,GAAG,CAAC;QAMZ,QAAQ,GAAG,CAAC,CADF,EAAE,KACE;QACV,OAAO,OAAO,CAAO,GAAG,kBACzB,cAAc,CAAC,EAAE,MAAM,CAAC,UAAU,EAClC,WAAW,CAAC,IAAI,EAChB,gBAAgB,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,IAAI,EAAE,EAAE,MAAM,CAAC,oBAAoB,EACjE,OAAO,CAAC,QAAQ,CAAC,CAAC,EAAE,CAAC,OAAO,EAAE,QAC9B,IAAI;IACT;IACA,aAAA,SAAS,MAAM,MAAM,EAAE,qBAAoB,EAAE;QAC3C,IAAI,IAAI,YAAS;IACnB;IACA,SAAA,KAAK,MAAM,IAAI,EAAE;QACf,QAAQ,GAAG,CAAC,AAAI;IAClB;AACF;AACA,UAAe,MAAM,MAAM,EAAE,gBAAgB,IAAI,EAAE,CAAE;AAErD,CAAC,SAAS;AAAc,IACN,SAAS,MAAM,MAAM,EAAE,qBAAoB,EAAE,CAAE;AAC1D,IAAS,iBACd,2BAA6C,IAAI,EACjD;IACI;IACA;IACA;AACN;AACA,WAAM;AAEN;AACO,IAAM,wBAAwB,IAAC,IAAQ,CAAE;AACzC,IAAM,wBAAwB,IAAU,GAAG,EAAE,CAAE;AAC/C,IAAM,wBAAwB,IAAmB,GAAG,EAAE,CAAE;qBAbpC,MAAM,MAAM,EAAE;oBAAd,6BAAc"}
\ No newline at end of file
{"version":3,"sources":["uni_modules/test-uniplugin/static/logo.png","uni_modules/test-uniplugin/utssdk/app-android/index.uts","uni_modules/test-uniplugin/utssdk/app-android/utils.uts","uni_modules/test-uniplugin/utssdk/app-android/login.uts","uni_modules/test-uniplugin/utssdk/app-android/interface.uts","uni_modules/test-uniplugin/utssdk/interface.uts"],"sourcesContent":["import { UTSAndroid } from 'io.dcloud.uts'\nexport default UTSAndroid.getResourcePath('uni_modules/test-uniplugin/static/logo.png')\n ","import Log from 'android.util.Log'\nimport FrameLayout from 'android.widget.FrameLayout'\nimport View from 'android.view.View'\nimport { login } from 'login'\nimport { IUser } from './interface'\nimport logo from '../../static/logo.png'\nimport { ShowToast } from '../interface.uts'\n\nconst test = arrayOf(1, 2, 3)\n\ntype GetBatteryInfoOptions = {\n success?: (res: UTSJSONObject) => void\n fail?: (res: UTSJSONObject) => void\n complete?: (res: UTSJSONObject) => void\n}\nexport class User implements IUser {\n async login(name: string, pwd: string) {\n setTimeout(() => {\n console.log('timeout')\n }, 1000)\n login(name, pwd)\n for (let i = 0; i < 10; i++) {\n console.log(i)\n }\n Log.info(logo)\n\n console.log('def android')\n\n\n\n\n\n\n\n\n console.log('ndef ios')\n\n\n console.log('def android || def ios')\n\n\n\n\n const a = -3\n console.log(~a)\n new XToast<XToast<unknown>>(getUniActivity())\n .setContentView(R.layout.toast_hint)\n .setDuration(1000)\n .setImageDrawable(android.R.id.icon, R.mipmap.ic_dialog_tip_finish)\n .setText(android.R.id.message, '点我消失')\n .show()\n }\n register(name: string, callback: () => void) {\n Log.info(logo as FrameLayout)\n }\n test(view: View) {\n console.log(new TestClass())\n }\n}\nfunction login(name: string, callback: () => void) { }\n\n@Suppress(\"DEPRECATION\")\n export function register(name: string, callback: () => void) { }\nexport function offMemoryWarning(\n callback: null | ((level: number) => void) = null\n) {\n uni.showToast()\n uni.showToast()\n uni.showModel()\n}\nclass TestClass {\n\n}\nexport const showToast1: ShowToast = (msg) => { }\nexport const showToast2: ShowToast = function (msg) { }\nexport const showToast3: ShowToast = function showToast(msg) { }\n","export function test(){\n console.log('test')\n}\n","import { test } from \"./utils.uts\"\nexport function login(name: string, pwd: string) {\n console.log('login')\n test()\n return { name, pwd }\n}\n","export interface IUser {\n register(name: string): void\n}\n","export type ShowToast = (msg: string) => void\n"],"names":[],"mappings":";;;;;;;;;AAAA;ACAA,OAAgB,gBAAkB,CAAA;AAClC,OAAwB,0BAA4B,CAAA;AACpD,OAAiB,iBAAmB,CAAA;ACF7B,IAAS,OAAM;IAClB,QAAQ,GAAG,CAAC;AAChB;ACDO,IAAS,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,iBAAE;IAC/C,QAAQ,GAAG,CAAC;IACZ;IACA,OAAO;QAAE,IAAA,OAAA;QAAM,IAAA,MAAA;KAAK;AACtB;UCLiB;QACf,SAAS,MAAM,MAAM,GAAG,IAAI;;cJAf,WAAW,eAAe,CAAC;UK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MAAM,MAAM,EAAE,qBAAoB;oBAAlC;QAAc;;;;yBAEvC,2BAA6C,IAAI;;;mBIhE1B,KAAK,MAAM,GAAK,IAAI;sBAApB;;mBAAA,KAAK,MAAM,GAAK,IAAI;sBAApB;;mBAAA,KAAK,MAAM,GAAK,IAAI;sBAApB"}
\ No newline at end of file
{"version":3,"sources":["uni_modules/test-uniplugin/utssdk/interface.uts","uni_modules/test-uniplugin/utssdk/app-ios/index.uts"],"sourcesContent":["export type ShowToast = (msg: string) => void\n","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"],"names":[],"mappings":";;;;iBAAY,eAAa,KAAK,MAAM,KAAK,IAAI;ACA7C,aAAgC;AAChC,oBAAuE;AAG1C;;aAAxB;IACH,WAAA,MAAM,MAAM,EAAA;IACZ,WAAA,KAAK,QAAM,EAAA;IACX,WAAA,SAAQ,aAA8B;IACtC,WAAA,MAAK,aAA8B;IACnC,WAAA,UAAS,aAA8B;;;;2CAF5B,KAAK,kBAAkB,IAAI;;2DAAtB;;;wCACR,KAAK,kBAAkB,IAAI;;wDAAtB;;;4CACD,KAAK,kBAAkB,IAAI;;4DAAtB;;;;;;AACnB;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,qBAAoB,KAAG,MAAM,CAAC;IAClD,QAAQ,GAAG,CAAC;QAAE,KAAK;MAAK;IACxB,QAAQ,GAAG,CAAC;IAKZ,QAAQ,GAAG,CAAC;IAGZ,QAAQ,GAAG,CAAC;IAMZ,QAAQ,GAAG,CAAC;IAKZ,QAAQ,GAAG,CAAC,mBAAmB;IAC/B,IAAM,IAAI,EAAE;IACZ,QAAQ,GAAG,CAAC,CAAC;IACb,OAAO;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;;;;;wCA9EpB,EAAA,SAAS,qBAAqB;eAA7C,eAAe;;+BAmBjB,EAAA,qBAAoB,KAAG,MAAM;eAAnC,MAAM;;;;qBAkDA;;sCDjFG,KAAK,MAAM;eCwFvB,WDxFY;;sCAAA,KAAK,MAAM;eCyFvB,WDzFY;;sCAAA,KAAK,MAAM;eC0FvB,WD1FY;;;qCCYc;6CAAA;;4BAmBjB,4BAAuB,MAAM;oCAA7B"}
\ No newline at end of file
{"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,cAAxB;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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B,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;;KALxD;qBAAA;;KACH;kBAAA;;KACI;sBAAA;;;sBAsBQ,EAAA,qBAAoB,KAAG,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;;mCAmBjB,EAAA,qBAAoB,KAAG,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
{"version":3,"sources":["utssdk/test-uts/app-android/index.uts"],"sourcesContent":["export function test(): number {\n return 1\n}\n"],"names":[],"mappings":";;;;;;;AAAO,IAAS,QAAQ,MAAM,CAAC;IAC7B,OAAO,CAAC;AACV;oBAFwB,MAAM"}
\ No newline at end of file
{"version":3,"sources":["utssdk/test-uts/app-android/index.uts"],"sourcesContent":["export function test(): number {\n return 1\n}\n"],"names":[],"mappings":";;;;;;;AAAO,IAAS,QAAQ,MAAM,CAAC;IAC7B,OAAO,CAAC;AACV;gBAFwB,MAAM"}
\ No newline at end of file
{"version":3,"sources":["utssdk/test-uts/app-ios/index.uts"],"sourcesContent":["export function test(): string {\n return '1'\n}\n"],"names":[],"mappings":";AAAO,YAAS,UAAQ,MAAM,CAAC;IAC7B,OAAO;AACT;;;;mCAFwB,MAAM;eAAd;;;8BAAQ,MAAM"}
\ No newline at end of file
{"version":3,"sources":["utssdk/test-uts/app-ios/index.uts"],"sourcesContent":["export function test(): string {\n return '1'\n}\n"],"names":[],"mappings":";AAAO,YAAS,UAAQ,MAAM,CAAC;IAC7B,OAAO;AACT;0BAFwB,MAAM;;;;;;uCAAN,MAAM"}
\ No newline at end of file
......@@ -69,9 +69,21 @@ open class TestClass {
val showToast1: ShowToast = fun(msg){};
val showToast2: ShowToast = fun(msg) {};
val showToast3: ShowToast = fun(msg) {};
fun registerWithJSON(name: String, callback: UTSJSONObject) {
return register(name, UTSAndroid.parseObject(callback));
fun registerByJs(name: String, callback: UTSCallback) {
return register(name, fun(){
callback(res);
}
);
}
fun offMemoryWarningWithJSON() {
fun offMemoryWarningByJs(callback: (UTSCallback)? = null) {
return offMemoryWarning();
}
fun showToast1ByJs(msg: String): Unit {
return showToast1(msg);
}
fun showToast2ByJs(msg: String): Unit {
return showToast2(msg);
}
fun showToast3ByJs(msg: String): Unit {
return showToast3(msg);
}
import DCloudUTSExtAPI;
import DCloudUTSFoundation;
import DCloudUTSExtAPI;
import UIKit;
import CoreLocation;
public var uni_showToast = DCloudUTSExtAPI.showToast;
public var uni_showModel = DCloudUTSExtAPI.showModel;
public typealias ShowToast = (_ msg: String) -> Void;
import UIKit;
import CoreLocation;
@objc(UTSSDKModulesTestUniPluginGetBatteryInfoOptions)
@objcMembers
public class GetBatteryInfoOptions : NSObject, UTSCallbackDelegate {
public struct GetBatteryInfoOptions {
public var name: String!;
public var pwd: NSNumber!;
public var success: UTSCallback?;
public var fail: UTSCallback?;
public var complete: UTSCallback?;
public func callUTSNativeCallback(_ name: String, _ callback: Any, _ args: [Any]) {
switch(name){
case "success":
typealias successType = (_ res: UTSJSONObject) -> Void;
if (callback is successType) {
(callback as! successType)(args[0] as! UTSJSONObject);
}
case "fail":
typealias failType = (_ res: UTSJSONObject) -> Void;
if (callback is failType) {
(callback as! failType)(args[0] as! UTSJSONObject);
}
case "complete":
typealias completeType = (_ res: UTSJSONObject) -> Void;
if (callback is completeType) {
(callback as! completeType)(args[0] as! UTSJSONObject);
}
default:
break;
}
}
public var success: ((_ res: UTSJSONObject) -> Void)?;
public var fail: ((_ res: UTSJSONObject) -> Void)?;
public var complete: ((_ res: UTSJSONObject) -> Void)?;
}
public func getBatteryInfo(_ options: GetBatteryInfoOptions) {
UIAlertController(title: title, message: message, preferredStyle: UIAlertController.Style.alert);
......@@ -62,7 +39,7 @@ public func test1(_ callback: UTSCallback) -> String {
console.log(~a, " at uni_modules/test-uniplugin/utssdk/app-ios/index.uts:55");
return "test1";
}
@objc
@objc(UTSSDKModulesTestUniPluginTest1)
@objcMembers
public class Test1 : NSObject {
}
......@@ -111,35 +88,64 @@ public var showToast2: ShowToast = {
public var showToast3: ShowToast = {
(_ msg) in
};
@objc(UTSSDKModulesTestUniPluginGetBatteryInfoOptionsJSONObject)
@objcMembers
public class GetBatteryInfoOptionsJSONObject : NSObject {
public var name: String!;
public var pwd: NSNumber!;
public var success: UTSCallback?;
public var fail: UTSCallback?;
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);
}));
}
public func test1ByJs(_ callback: UTSCallback) -> String {
return test1({
callback(res);
}
);
}
public func testAsyncByJs() {
return testAsync();
}
public func showToast1ByJs(_ msg: String) -> Void {
return showToast1(msg);
}
public func showToast2ByJs(_ msg: String) -> Void {
return showToast2(msg);
}
public func showToast3ByJs(_ msg: String) -> Void {
return showToast3(msg);
}
@objc(UTSSDKModulesTestUniPluginIndexSwift)
@objcMembers
public class IndexSwift : NSObject {
public static func s_getBatteryInfo(_ options: GetBatteryInfoOptions) {
return getBatteryInfo(options);
public static func s_getBatteryInfoByJs(_ options: GetBatteryInfoOptionsJSONObject) {
return getBatteryInfoByJs(options);
}
public static func s_test1(_ callback: UTSCallback) -> String {
return test1(callback);
public static func s_test1ByJs(_ callback: UTSCallback) -> String {
return test1ByJs(callback);
}
@available(iOS 13.0.0, *)
public static func s_testAsync() async -> UTSJSONObject {
return await testAsync();
public static func s_testAsyncByJs() {
return testAsyncByJs();
}
public static func s_showToast1(_ msg: String) {
return showToast1(msg);
public static func s_showToast1ByJs(_ msg: String) -> Void {
return showToast1ByJs(msg);
}
public static func s_showToast2(_ msg: String) {
return showToast2(msg);
public static func s_showToast2ByJs(_ msg: String) -> Void {
return showToast2ByJs(msg);
}
public static func s_showToast3(_ msg: String) {
return showToast3(msg);
public static func s_showToast3ByJs(_ msg: String) -> Void {
return showToast3ByJs(msg);
}
}
public func getBatteryInfoWithJSON(_ options: UTSJSONObject) {
return getBatteryInfo(UTSiOS.parseObject(options));
}
public func test1WithJSON(_ callback: UTSJSONObject) -> String {
return test1(UTSiOS.parseObject(callback));
}
public func testAsyncWithJSON() -> UTSJSONObject {
return testAsync();
}
......@@ -8,6 +8,6 @@ import io.dcloud.uts.*;
fun test(): Number {
return 1;
}
fun testWithJSON(): Number {
fun testByJs(): Number {
return test();
}
......@@ -2,13 +2,13 @@ import DCloudUTSFoundation;
public func test() -> String {
return "1";
}
public func testByJs() -> String {
return test();
}
@objc(UTSSDKModulesTestUtsIndexSwift)
@objcMembers
public class IndexSwift : NSObject {
public static func s_test() -> String {
return test();
public static func s_testByJs() -> String {
return testByJs();
}
}
public func testWithJSON() -> String {
return test();
}
......@@ -251,13 +251,13 @@ const options = {
const miniprogram = (_a = projectJson.condition) === null || _a === void 0 ? void 0 : _a.miniprogram;
if (miniprogram && shared.isArray(miniprogram.list) && miniprogram.list.length) {
const compileModeJson = {
modes: []
modes: [],
};
compileModeJson.modes = miniprogram.list.map(item => {
compileModeJson.modes = miniprogram.list.map((item) => {
return {
title: item.name,
page: item.pathName,
pageQuery: item.query
pageQuery: item.query,
};
});
const miniIdeDir = path__default.default.join(process.env.UNI_OUTPUT_DIR, '.mini-ide');
......@@ -268,7 +268,7 @@ const options = {
delete projectJson.condition;
}
return projectJson;
}
},
},
template: Object.assign(Object.assign({}, miniProgram), { customElements, filter: {
extname: '.sjs',
......
......@@ -158,21 +158,24 @@ const options = {
normalize(projectJson) {
var _a;
const miniprogram = (_a = projectJson.condition) === null || _a === void 0 ? void 0 : _a.miniprogram;
if (miniprogram && Array.isArray(miniprogram.list) && miniprogram.list.length) {
projectJson['compilation-args'].options = miniprogram.list.map((item) => {
return {
id: item.id,
text: item.name,
extra: {
index: item.pathName,
query: item.query
}
};
});
if (miniprogram &&
Array.isArray(miniprogram.list) &&
miniprogram.list.length) {
projectJson['compilation-args'].options =
miniprogram.list.map((item) => {
return {
id: item.id,
text: item.name,
extra: {
index: item.pathName,
query: item.query,
},
};
});
delete projectJson.condition;
}
return projectJson;
}
},
},
template: Object.assign(Object.assign({}, miniProgram), { customElements, filter: {
extname: '.sjs',
......
......@@ -6,6 +6,6 @@ import kotlinx.coroutines.Dispatchers;
import io.dcloud.uts.Map;
import io.dcloud.uts.*;
fun test() {}
fun testWithJSON() {
fun testByJs() {
return test();
}
import DCloudUTSFoundation;
public func test() {}
public func testByJs() {
return test();
}
@objc(UTSSDKModulesTestUtsIndexSwift)
@objcMembers
public class IndexSwift : NSObject {
public static func s_test() {
return test();
public static func s_testByJs() {
return testByJs();
}
}
public func testWithJSON() {
return test();
}
......@@ -183,12 +183,12 @@ describe('uts:sourceMap', () => {
)
const { line, column, source } = await originalPositionFor({
sourceMapFile,
line: 40,
column: 16,
line: 17,
column: 0,
})
expect(line).toBe(19)
expect(column).toBe(14)
expect(column).toBe(2)
expect(source).toContain('index.uts')
})
})
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册