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

wip(uts): compiler

上级 afc705f3
import { UIDevice } from 'UIKit'
import { CLLocationManager, CLAuthorizationStatus } from 'CoreLocation'
type GetBatteryInfoOptions = {
name: string
......@@ -42,6 +43,7 @@ export function test1(callback: () => void): string {
//#ifdef MP-WEIXIN
console.log('def weixin')
//#endif
console.log(CLLocationManager, CLAuthorizationStatus)
return 'test1'
}
......
......@@ -15,7 +15,7 @@ fun login(name: String, pwd: String): UTSJSONObject {
var pwd = pwd
};
}
val __default = getResourcePath("uni_modules/test-uniplugin/static/logo.png");
val default = getResourcePath("uni_modules/test-uniplugin/static/logo.png");
val test = arrayOf(1, 2, 3);
open class GetBatteryInfoOptions : UTSJSONObject() {
open var success: UTSCallback? = null;
......@@ -29,13 +29,13 @@ open class User : IUser {
}
, 1000);
login(name, pwd);
Log.info(__default);
Log.info(default);
console.log("def android", " at uni_modules/test-uniplugin/app-android/index.uts:23");
console.log("ndef ios", " at uni_modules/test-uniplugin/app-android/index.uts:32");
console.log("def android || def ios", " at uni_modules/test-uniplugin/app-android/index.uts:35");
}
override fun register(name: String, callback: UTSCallback) {
Log.info(__default as FrameLayout);
Log.info(default as FrameLayout);
}
open fun test(view: View) {}
}
......
{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/static/logo.png","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/index.uts","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/interface.uts","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/login.uts"],"sourcesContent":["import { getResourcePath } from 'io.dcloud.uts.android'\nexport default 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 { IUser } from './interface.uts'\nimport { login } from './login.uts'\nimport logo from '../static/logo.png'\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 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 }\n register(name: string, callback: () => void) {\n Log.info(logo as FrameLayout)\n }\n test(view: View) {}\n}\nfunction login(name: string, callback: () => void) {}\nexport function register(name: string, callback: () => void) {}\n","export interface IUser {\n register(name: string): void\n}\n","export function login(name: string, pwd: string) {\n console.log('login')\n return { name, pwd }\n}\n"],"names":[],"mappings":";;;AAAA;ACAA,OAAgB,gBAAkB,CAAA;AAClC,OAAwB,0BAA4B,CAAA;AACpD,OAAiB,iBAAmB,CAAA;UCFnB;QACf,SAAS,MAAM,MAAM,GAAG,IAAI;;ACDvB,IAAS,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,iBAAE;IAC/C,QAAQ,GAAG,CAAC;IACZ,OAAO;QAAE,IAAA,OAAA;QAAM,IAAA,MAAA;KAAK;AACtB;gBHFe,gBAAgB;ACM/B,IAAM,OAAO,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAEC,WAAxB;IACH,SAAA,SAAQ,oBAA8B;IACtC,SAAA,MAAK,oBAA8B;IACnC,SAAA,UAAS,oBAA8B;AACzC;AACO,WAAM,OAAgB;IAC3B,iBAAM,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,8CAAE;QACrC,WAAW,KAAM;YACf,QAAQ,GAAG,CAAC;QACd;UAAG,IAAI;QACP,MAAM,MAAM;QACZ,IAAI,IAAI;QAER,QAAQ,GAAG,CAAC;QASZ,QAAQ,GAAG,CAAC;QAGZ,QAAQ,GAAG,CAAC;IAKd;IACA,aAAA,SAAS,MAAM,MAAM,EAAE,qBAAoB,EAAE;QAC3C,IAAI,IAAI,cAAS;IACnB;IACA,SAAA,KAAK,MAAM,IAAI,EAAE,CAAC;AACpB;AACA,UAAe,MAAM,MAAM,EAAE,gBAAgB,IAAI,EAAE,CAAC;AAC7C,IAAS,SAAS,MAAM,MAAM,EAAE,qBAAoB,EAAE,CAAC"}
\ No newline at end of file
{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/static/logo.png","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/index.uts","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/interface.uts","/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-android/login.uts"],"sourcesContent":["import { getResourcePath } from 'io.dcloud.uts.android'\nexport default 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 { IUser } from './interface.uts'\nimport { login } from './login.uts'\nimport logo from '../static/logo.png'\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 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 }\n register(name: string, callback: () => void) {\n Log.info(logo as FrameLayout)\n }\n test(view: View) {}\n}\nfunction login(name: string, callback: () => void) {}\nexport function register(name: string, callback: () => void) {}\n","export interface IUser {\n register(name: string): void\n}\n","export function login(name: string, pwd: string) {\n console.log('login')\n return { name, pwd }\n}\n"],"names":[],"mappings":";;;AAAA;ACAA,OAAgB,gBAAkB,CAAA;AAClC,OAAwB,0BAA4B,CAAA;AACpD,OAAiB,iBAAmB,CAAA;UCFnB;QACf,SAAS,MAAM,MAAM,GAAG,IAAI;;ACDvB,IAAS,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,iBAAE;IAC/C,QAAQ,GAAG,CAAC;IACZ,OAAO;QAAE,IAAA,OAAA;QAAM,IAAA,MAAA;KAAK;AACtB;cHFe,gBAAgB;ACM/B,IAAM,OAAO,QAAQ,CAAC,EAAE,CAAC,EAAE,CAAC;AAEC,WAAxB;IACH,SAAA,SAAQ,oBAA8B;IACtC,SAAA,MAAK,oBAA8B;IACnC,SAAA,UAAS,oBAA8B;AACzC;AACO,WAAM,OAAgB;IAC3B,iBAAM,MAAM,MAAM,MAAM,EAAE,KAAK,MAAM,8CAAE;QACrC,WAAW,KAAM;YACf,QAAQ,GAAG,CAAC;QACd;UAAG,IAAI;QACP,MAAM,MAAM;QACZ,IAAI,IAAI;QAER,QAAQ,GAAG,CAAC;QASZ,QAAQ,GAAG,CAAC;QAGZ,QAAQ,GAAG,CAAC;IAKd;IACA,aAAA,SAAS,MAAM,MAAM,EAAE,qBAAoB,EAAE;QAC3C,IAAI,IAAI,YAAS;IACnB;IACA,SAAA,KAAK,MAAM,IAAI,EAAE,CAAC;AACpB;AACA,UAAe,MAAM,MAAM,EAAE,gBAAgB,IAAI,EAAE,CAAC;AAC7C,IAAS,SAAS,MAAM,MAAM,EAAE,qBAAoB,EAAE,CAAC"}
\ No newline at end of file
import DCUTSPlugin;
import UIKit;
import CoreLocation;
@objc(UTSSDKModulesTestUniPluginGetBatteryInfoOptions)
@objcMembers
class GetBatteryInfoOptions : UTSJSONObject {
......@@ -23,10 +24,11 @@ func getBatteryInfo(_ options: GetBatteryInfoOptions) {
}
}
func test1(_ callback: UTSCallback) -> String {
console.log("test1", " at uni_modules/test-uniplugin/app-ios/index.uts:26");
console.log("def ios", " at uni_modules/test-uniplugin/app-ios/index.uts:31");
console.log("ndef android", " at uni_modules/test-uniplugin/app-ios/index.uts:34");
console.log("def android || def ios", " at uni_modules/test-uniplugin/app-ios/index.uts:40");
console.log("test1", " at uni_modules/test-uniplugin/app-ios/index.uts:27");
console.log("def ios", " at uni_modules/test-uniplugin/app-ios/index.uts:32");
console.log("ndef android", " at uni_modules/test-uniplugin/app-ios/index.uts:35");
console.log("def android || def ios", " at uni_modules/test-uniplugin/app-ios/index.uts:41");
console.log(CLLocationManager, CLAuthorizationStatus, " at uni_modules/test-uniplugin/app-ios/index.uts:46");
return "test1";
}
class Test1 : NSObject {
......
{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts"],"sourcesContent":["import { UIDevice } from 'UIKit'\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 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('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 return 'test1'\n}\n\nclass Test1 {}\nexport class Test {\n constructor() {\n new Test1()\n }\n test(): string | null {\n return null\n }\n}\n\nexport async function testAsync() {\n return { a: 1 }\n}\n"],"names":[],"mappings":";AAAA;AAE6B;;MAAxB;IACH,WAAA,MAAM,MAAM,EAAA;IACZ,WAAA,KAAK,QAAM,EAAA;IACX,WAAA,SAAQ,aAA8B;IACtC,WAAA,MAAK,aAA8B;IACnC,WAAA,UAAS,aAA8B;AACzC;AAEe,KAAS,eAAe,EAAA,SAAS,qBAAqB,EAAE;IACrE,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,KAAS,MAAM,EAAA,qBAAoB,KAAG,MAAM,CAAC;IAClD,QAAQ,GAAG,CAAC;IAKZ,QAAQ,GAAG,CAAC;IAGZ,QAAQ,GAAG,CAAC;IAMZ,QAAQ,GAAG,CAAC;IAKZ,OAAO;AACT;AAEA,MAAM;AAAO;AACN;;MAAM;IACX,aAAc;QACR;IACN;IACA,YAAA,UAAQ,MAAM,EAAQ;QACpB,OAAO,GAAI;IACb;AACF;AAEO;KAAe,oCAAY;IAChC,OAAO;QAAE,CAAA,IAAG,CAAC;MAAE;AACjB;;;;wCAjDuC,EAAA,SAAS,qBAAqB;eAA7C,eAAe;;+BAcjB,EAAA,qBAAoB,KAAG,MAAM;eAAnC,MAAM;;;;qBAiCA"}
\ No newline at end of file
{"version":3,"sources":["/Users/fxy/Projects/GitHub/uni-app/uni-app-next/packages/playground/uts/uni_modules/test-uniplugin/app-ios/index.uts"],"sourcesContent":["import { UIDevice } from 'UIKit'\nimport { CLLocationManager, CLAuthorizationStatus } from 'CoreLocation'\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 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('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 return 'test1'\n}\n\nclass Test1 {}\nexport class Test {\n constructor() {\n new Test1()\n }\n test(): string | null {\n return null\n }\n}\n\nexport async function testAsync() {\n return { a: 1 }\n}\n"],"names":[],"mappings":";AAAA;AACA;AAE6B;;MAAxB;IACH,WAAA,MAAM,MAAM,EAAA;IACZ,WAAA,KAAK,QAAM,EAAA;IACX,WAAA,SAAQ,aAA8B;IACtC,WAAA,MAAK,aAA8B;IACnC,WAAA,UAAS,aAA8B;AACzC;AAEe,KAAS,eAAe,EAAA,SAAS,qBAAqB,EAAE;IACrE,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,KAAS,MAAM,EAAA,qBAAoB,KAAG,MAAM,CAAC;IAClD,QAAQ,GAAG,CAAC;IAKZ,QAAQ,GAAG,CAAC;IAGZ,QAAQ,GAAG,CAAC;IAMZ,QAAQ,GAAG,CAAC;IAKZ,QAAQ,GAAG,CAAC,mBAAmB;IAC/B,OAAO;AACT;AAEA,MAAM;AAAO;AACN;;MAAM;IACX,aAAc;QACR;IACN;IACA,YAAA,UAAQ,MAAM,EAAQ;QACpB,OAAO,GAAI;IACb;AACF;AAEO;KAAe,oCAAY;IAChC,OAAO;QAAE,CAAA,IAAG,CAAC;MAAE;AACjB;;;;wCAlDuC,EAAA,SAAS,qBAAqB;eAA7C,eAAe;;+BAcjB,EAAA,qBAAoB,KAAG,MAAM;eAAnC,MAAM;;;;qBAkCA"}
\ No newline at end of file
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册