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

wip(uts): compiler

上级 b3b33ae9
......@@ -17469,10 +17469,11 @@ function initUTSProxyClass(options) {
//实例方法
name = parseClassMethodName(name, methods);
if (hasOwn$1(methods, name)) {
const { async, params } = methods[name];
const { async, params, return: returnOptions } = methods[name];
target[name] = initUTSInstanceMethod(!!async, extend({
name,
params,
return: returnOptions,
}, baseOptions), instanceId, proxy);
}
else if (props.includes(name)) {
......@@ -17498,9 +17499,9 @@ function initUTSProxyClass(options) {
name = parseClassMethodName(name, staticMethods);
if (hasOwn$1(staticMethods, name)) {
if (!staticMethodCache[name]) {
const { async, params } = staticMethods[name];
const { async, params, return: returnOptions } = staticMethods[name];
// 静态方法
staticMethodCache[name] = initUTSStaticMethod(!!async, extend({ name, companion: true, params }, baseOptions));
staticMethodCache[name] = initUTSStaticMethod(!!async, extend({ name, companion: true, params, return: returnOptions }, baseOptions));
}
return staticMethodCache[name];
}
......
......@@ -195,10 +195,11 @@ function initUTSProxyClass(options) {
//实例方法
name = parseClassMethodName(name, methods);
if (hasOwn(methods, name)) {
const { async, params } = methods[name];
const { async, params, return: returnOptions } = methods[name];
target[name] = initUTSInstanceMethod(!!async, extend({
name,
params,
return: returnOptions,
}, baseOptions), instanceId, proxy);
}
else if (props.includes(name)) {
......@@ -224,9 +225,9 @@ function initUTSProxyClass(options) {
name = parseClassMethodName(name, staticMethods);
if (hasOwn(staticMethods, name)) {
if (!staticMethodCache[name]) {
const { async, params } = staticMethods[name];
const { async, params, return: returnOptions } = staticMethods[name];
// 静态方法
staticMethodCache[name] = initUTSStaticMethod(!!async, extend({ name, companion: true, params }, baseOptions));
staticMethodCache[name] = initUTSStaticMethod(!!async, extend({ name, companion: true, params, return: returnOptions }, baseOptions));
}
return staticMethodCache[name];
}
......
......@@ -97,6 +97,7 @@ interface ProxyInterfaceOptions extends ModuleOptions {
[name: string]: {
async?: boolean
params: Parameter[]
return?: ProxyFunctionReturnOptions
}
}
/**
......@@ -117,12 +118,14 @@ interface ProxyClassOptions extends ModuleOptions {
[name: string]: {
async?: boolean
params: Parameter[]
return?: ProxyFunctionReturnOptions
}
}
staticMethods: {
[name: string]: {
async?: boolean
params: Parameter[]
return?: ProxyFunctionReturnOptions
}
}
/**
......@@ -448,13 +451,14 @@ export function initUTSProxyClass(
//实例方法
name = parseClassMethodName(name as string, methods)
if (hasOwn(methods, name)) {
const { async, params } = methods[name]
const { async, params, return: returnOptions } = methods[name]
target[name] = initUTSInstanceMethod(
!!async,
extend(
{
name,
params,
return: returnOptions,
},
baseOptions
),
......@@ -484,11 +488,14 @@ export function initUTSProxyClass(
name = parseClassMethodName(name as string, staticMethods)
if (hasOwn(staticMethods, name)) {
if (!staticMethodCache[name as string]) {
const { async, params } = staticMethods[name]
const { async, params, return: returnOptions } = staticMethods[name]
// 静态方法
staticMethodCache[name] = initUTSStaticMethod(
!!async,
extend({ name, companion: true, params }, baseOptions)
extend(
{ name, companion: true, params, return: returnOptions },
baseOptions
)
)
}
return staticMethodCache[name]
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册