Update release

This commit is contained in:
vczh
2022-12-09 16:33:25 -08:00
parent d31e9a5d4c
commit 03a5ee8544
123 changed files with 6883 additions and 6272 deletions

View File

@@ -29,7 +29,7 @@ WfRuntimeGlobalContext
WfRuntimeGlobalContext::WfRuntimeGlobalContext(Ptr<WfAssembly> _assembly)
:assembly(_assembly)
{
globalVariables = new WfRuntimeVariableContext;
globalVariables = Ptr(new WfRuntimeVariableContext);
globalVariables->variables.Resize(assembly->variableNames.Count());
if (assembly->typeImpl)
{
@@ -97,7 +97,7 @@ WfRuntimeCallStackInfo
if (function->argumentNames.Count() > 0)
{
arguments = new WfRuntimeVariableContext;
arguments = Ptr(new WfRuntimeVariableContext);
arguments->variables.Resize(function->argumentNames.Count());
for (vint i = 0; i < arguments->variables.Count(); i++)
{
@@ -107,7 +107,7 @@ WfRuntimeCallStackInfo
if (function->localVariableNames.Count()>0)
{
localVariables = new WfRuntimeVariableContext;
localVariables = Ptr(new WfRuntimeVariableContext);
localVariables->variables.Resize(function->localVariableNames.Count());
for (vint i = 0; i < localVariables->variables.Count(); i++)
{
@@ -452,7 +452,7 @@ WfRuntimeThreadContext
WfRuntimeThreadContextError WfRuntimeThreadContext::RaiseException(const WString& exception, bool fatalError, bool skipDebugger)
{
auto info = MakePtr<WfRuntimeExceptionInfo>(exception, fatalError);
auto info = Ptr(new WfRuntimeExceptionInfo(exception, fatalError));
return RaiseException(info, skipDebugger);
}
@@ -473,12 +473,12 @@ WfRuntimeThreadContext
for (vint j = stackCount - 1; j >= 0; j--)
{
const auto& stackFrame = context->stackFrames[j];
info->callStack.Add(new WfRuntimeCallStackInfo(context, stackFrame));
info->callStack.Add(Ptr(new WfRuntimeCallStackInfo(context, stackFrame)));
}
if (i > 0)
{
info->callStack.Add(new WfRuntimeCallStackInfo);
info->callStack.Add(Ptr(new WfRuntimeCallStackInfo));
}
}
@@ -975,28 +975,28 @@ Serizliation (ITypeInfo)
{
Ptr<ITypeInfo> elementType;
IOType(reader, elementType);
typeInfo = MakePtr<RawPtrTypeInfo>(elementType);
typeInfo = Ptr(new RawPtrTypeInfo(elementType));
}
break;
case ITypeInfo::SharedPtr:
{
Ptr<ITypeInfo> elementType;
IOType(reader, elementType);
typeInfo = MakePtr<SharedPtrTypeInfo>(elementType);
typeInfo = Ptr(new SharedPtrTypeInfo(elementType));
}
break;
case ITypeInfo::Nullable:
{
Ptr<ITypeInfo> elementType;
IOType(reader, elementType);
typeInfo = MakePtr<NullableTypeInfo>(elementType);
typeInfo = Ptr(new NullableTypeInfo(elementType));
}
break;
case ITypeInfo::Generic:
{
Ptr<ITypeInfo> elementType;
IOType(reader, elementType);
auto genericType = MakePtr<GenericTypeInfo>(elementType);
auto genericType = Ptr(new GenericTypeInfo(elementType));
typeInfo = genericType;
vint count = 0;
@@ -1016,7 +1016,7 @@ Serizliation (ITypeInfo)
vint index;
reader << index;
typeInfo = MakePtr<TypeDescriptorTypeInfo>(reader.context->tdIndex[index], static_cast<TypeInfoHint>(hint));
typeInfo = Ptr(new TypeDescriptorTypeInfo(reader.context->tdIndex[index], static_cast<TypeInfoHint>(hint)));
}
break;
}
@@ -1433,7 +1433,7 @@ Serialization (TypeImpl)
WString name;
IOType(reader, type);
reader << name;
info->AddParameter(new ParameterInfoImpl(info, name, type));
info->AddParameter(Ptr(new ParameterInfoImpl(info, name, type)));
}
}
@@ -1485,7 +1485,7 @@ Serialization (TypeImpl)
static void IOClassConstructor(WfReader& reader, Ptr<WfClassConstructor>& info)
{
info = new WfClassConstructor(nullptr);
info = Ptr(new WfClassConstructor(nullptr));
reader << info->functionIndex;
IOMethodBase(reader, info.Obj());
}
@@ -1502,7 +1502,7 @@ Serialization (TypeImpl)
{
Ptr<ITypeInfo> type;
IOType(reader, type);
info = new WfInterfaceConstructor(type);
info = Ptr(new WfInterfaceConstructor(type));
}
static void IOInterfaceConstructor(WfWriter& writer, WfInterfaceConstructor* info)
@@ -1574,19 +1574,19 @@ Serialization (TypeImpl)
if (isStaticMethod)
{
auto info = MakePtr<WfStaticMethod>();
auto info = Ptr(new WfStaticMethod);
td->AddMember(methodName, info);
IOStaticMethod(reader, info.Obj());
}
else if (isClass)
{
auto info = MakePtr<WfClassMethod>();
auto info = Ptr(new WfClassMethod);
td->AddMember(methodName, info);
IOClassMethod(reader, info.Obj());
}
else
{
auto info = MakePtr<WfInterfaceMethod>();
auto info = Ptr(new WfInterfaceMethod);
td->AddMember(methodName, info);
IOInterfaceMethod(reader, info.Obj());
}
@@ -1604,7 +1604,7 @@ Serialization (TypeImpl)
Ptr<ITypeInfo> eventType;
IOType(reader, eventType);
auto info = MakePtr<WfEvent>(td, eventName);
auto info = Ptr(new WfEvent(td, eventName));
info->SetHandlerType(eventType);
td->AddMember(info);
}
@@ -1620,7 +1620,7 @@ Serialization (TypeImpl)
if (isProperty)
{
auto info = MakePtr<WfProperty>(td, propName);
auto info = Ptr(new WfProperty(td, propName));
WString getterName, setterName, eventName;
reader << getterName << setterName << eventName;
@@ -1645,7 +1645,7 @@ Serialization (TypeImpl)
Ptr<ITypeInfo> fieldType;
IOType(reader, fieldType);
auto info = MakePtr<WfField>(td, propName);
auto info = Ptr(new WfField(td, propName));
info->SetReturn(fieldType);
td->AddMember(info);
}
@@ -1807,7 +1807,7 @@ Serialization (TypeImpl)
Ptr<ITypeInfo> typeInfo;
IOType(reader, typeInfo);
auto field = MakePtr<WfStructField>(td, name);
auto field = Ptr(new WfStructField(td, name));
field->SetReturn(typeInfo);
td->AddMember(field);
}
@@ -2059,7 +2059,7 @@ Serialization (Assembly)
reader.context->errors.duplicatedTypes.Add(typeName);
}
reader << isFlags << typeName;
type = MakePtr<WfEnum>(isFlags, typeName);
type = Ptr(new WfEnum(isFlags, typeName));
}
static void IOCustomType(WfWriter& writer, Ptr<WfEnum>& type)
@@ -2078,7 +2078,7 @@ Serialization (Assembly)
{
reader.context->errors.duplicatedTypes.Add(typeName);
}
type = MakePtr<TType>(typeName);
type = Ptr(new TType(typeName));
}
template<typename TType>
@@ -2131,12 +2131,12 @@ Serialization (Assembly)
static void IOPrepare(WfReader& reader, WfAssembly& value, WfAssemblyLoadErrors& errors)
{
reader.context = new WfReaderContext(errors);
reader.context = Ptr(new WfReaderContext(errors));
bool hasTypeImpl = false;
reader << hasTypeImpl;
if (hasTypeImpl)
{
value.typeImpl = new WfTypeImpl;
value.typeImpl = Ptr(new WfTypeImpl);
IOCustomTypeList(reader, value.typeImpl->classes);
IOCustomTypeList(reader, value.typeImpl->interfaces);
IOCustomTypeList(reader, value.typeImpl->structs);
@@ -2193,7 +2193,7 @@ Serialization (Assembly)
static void IOPrepare(WfWriter& writer, WfAssembly& value, WfAssemblyLoadErrors&)
{
writer.context = new WfWriterContext;
writer.context = Ptr(new WfWriterContext);
bool hasTypeImpl = value.typeImpl != nullptr;
writer << hasTypeImpl;
if (hasTypeImpl)
@@ -2310,7 +2310,7 @@ WfAssembly
{
try
{
auto assembly = MakePtr<WfAssembly>();
auto assembly = Ptr(new WfAssembly);
stream::internal::WfReader reader(input);
stream::internal::Serialization<WfAssembly>::IO(reader, *assembly.Obj(), errors);
assembly->Initialize();
@@ -3459,7 +3459,7 @@ WfRuntimeThreadContext (Range)
CONTEXT_ACTION(PopValue(first), L"failed to pop a value from the stack.");
T firstValue = UnboxValue<T>(first);
T secondValue = UnboxValue<T>(second);
auto enumerable = MakePtr<WfRuntimeRange<T>>(firstValue, secondValue);
auto enumerable = Ptr(new WfRuntimeRange<T>(firstValue, secondValue));
CONTEXT_ACTION(PushValue(Value::From(enumerable)), L"failed to push a value to the stack.");
return WfRuntimeExecutionAction::ExecuteInstruction;
}
@@ -3478,7 +3478,7 @@ Helper Functions
const auto& names = context->assembly->functionByName[name];
CHECK_ERROR(names.Count() == 1, L"vl::workflow::runtime::LoadFunction(Ptr<WfRUntimeGlobalContext>, const WString&)#Multiple functions are found.");
vint functionIndex = names[0];
auto lambda = MakePtr<WfRuntimeLambda>(context, nullptr, functionIndex);
auto lambda = Ptr(new WfRuntimeLambda(context, nullptr, functionIndex));
return lambda;
}
@@ -3694,7 +3694,7 @@ WfRuntimeThreadContext
Ptr<WfRuntimeVariableContext> capturedVariables;
if (ins.countParameter > 0)
{
capturedVariables = new WfRuntimeVariableContext;
capturedVariables = Ptr(new WfRuntimeVariableContext);
capturedVariables->variables.Resize(ins.countParameter);
Value operand;
for (vint i = 0; i < ins.countParameter; i++)
@@ -3715,13 +3715,13 @@ WfRuntimeThreadContext
auto capturedVariables = context.GetSharedPtr().Cast<WfRuntimeVariableContext>();
auto functionIndex = UnboxValue<vint>(function);
auto lambda = MakePtr<WfRuntimeLambda>(globalContext, capturedVariables, functionIndex);
auto lambda = Ptr(new WfRuntimeLambda(globalContext, capturedVariables, functionIndex));
CONTEXT_ACTION(PushValue(Value::From(lambda)), L"failed to push a value to the stack.");
return WfRuntimeExecutionAction::ExecuteInstruction;
}
case WfInsCode::CreateInterface:
{
auto proxy = MakePtr<WfRuntimeInterfaceInstance>();
auto proxy = Ptr(new WfRuntimeInterfaceInstance);
Value key, value, operand;
for (vint i = 0; i < ins.countParameter; i+=2)
{
@@ -3922,7 +3922,7 @@ WfRuntimeThreadContext
arguments.Insert(0, argument);
}
Ptr<IValueList> list = new ValueListWrapper<List<Value>*>(&arguments);
Ptr<IValueList> list = Ptr(new ValueListWrapper<List<Value>*>(&arguments));
Value result = proxy->Invoke(list);
CONTEXT_ACTION(PushValue(result), L"failed to push a value to the stack.");
return WfRuntimeExecutionAction::ExecuteInstruction;
@@ -3946,7 +3946,7 @@ WfRuntimeThreadContext
{
if (classMethod->GetGlobalContext() == globalContext.Obj())
{
auto capturedVariable = MakePtr<WfRuntimeVariableContext>();
auto capturedVariable = Ptr(new WfRuntimeVariableContext);
capturedVariable->variables.Resize(1);
capturedVariable->variables[0] = Value::From(thisValue.GetRawPtr());
@@ -3995,7 +3995,7 @@ WfRuntimeThreadContext
{
if (ctor->GetGlobalContext() == globalContext.Obj())
{
auto capturedVariable = MakePtr<WfRuntimeVariableContext>();
auto capturedVariable = Ptr(new WfRuntimeVariableContext);
capturedVariable->variables.Resize(1);
capturedVariable->variables[0] = Value::From(thisValue.GetRawPtr());
@@ -4704,7 +4704,7 @@ WfMethodBase
Value WfMethodBase::CreateFunctionProxyInternal(const Value& thisObject)
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
return Value::From(MakePtr<WfMethodProxy>(thisObject, this));
return Value::From(Ptr(new WfMethodProxy(thisObject, this)));
#else
CHECK_FAIL(L"Not Implemented under VCZH_DEBUG_METAONLY_REFLECTION!");
#endif
@@ -4747,7 +4747,7 @@ WfStaticMethod
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
auto argumentArray = IValueList::Create(arguments);
return WfRuntimeLambda::Invoke(globalContext, nullptr, functionIndex, argumentArray);
return WfRuntimeLambda::Invoke(Ptr(globalContext), nullptr, functionIndex, argumentArray);
#else
CHECK_FAIL(L"Not Implemented under VCZH_DEBUG_METAONLY_REFLECTION!");
#endif
@@ -4765,7 +4765,7 @@ WfClassConstructor
Value WfClassConstructor::InvokeInternal(const Value& thisObject, collections::Array<Value>& arguments)
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
auto instance = MakePtr<WfClassInstance>(GetOwnerTypeDescriptor());
auto instance = Ptr(new WfClassInstance(GetOwnerTypeDescriptor()));
{
InvokeBaseCtor(Value::From(instance.Obj()), arguments);
}
@@ -4792,12 +4792,12 @@ WfClassConstructor
void WfClassConstructor::InvokeBaseCtor(const Value& thisObject, collections::Array<Value>& arguments)
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
auto capturedVariables = MakePtr<WfRuntimeVariableContext>();
auto capturedVariables = Ptr(new WfRuntimeVariableContext);
capturedVariables->variables.Resize(1);
capturedVariables->variables[0] = Value::From(thisObject.GetRawPtr());
auto argumentArray = IValueList::Create(arguments);
WfRuntimeLambda::Invoke(globalContext, capturedVariables, functionIndex, argumentArray);
WfRuntimeLambda::Invoke(Ptr(globalContext), capturedVariables, functionIndex, argumentArray);
#else
CHECK_FAIL(L"Not Implemented under VCZH_DEBUG_METAONLY_REFLECTION!");
#endif
@@ -4810,12 +4810,12 @@ WfClassMethod
Value WfClassMethod::InvokeInternal(const Value& thisObject, collections::Array<Value>& arguments)
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
auto capturedVariables = MakePtr<WfRuntimeVariableContext>();
auto capturedVariables = Ptr(new WfRuntimeVariableContext);
capturedVariables->variables.Resize(1);
capturedVariables->variables[0] = Value::From(thisObject.GetRawPtr());
auto argumentArray = IValueList::Create(arguments);
return WfRuntimeLambda::Invoke(globalContext, capturedVariables, functionIndex, argumentArray);
return WfRuntimeLambda::Invoke(Ptr(globalContext), capturedVariables, functionIndex, argumentArray);
#else
CHECK_FAIL(L"Not Implemented under VCZH_DEBUG_METAONLY_REFLECTION!");
#endif
@@ -4884,7 +4884,7 @@ WfInterfaceConstructor
}
}
Ptr<WfInterfaceInstance> instance = new WfInterfaceInstance(GetOwnerTypeDescriptor(), proxy, baseCtors);
auto instance = Ptr(new WfInterfaceInstance(GetOwnerTypeDescriptor(), proxy, baseCtors));
if (returnInfo->GetDecorator() == ITypeInfo::SharedPtr)
{
@@ -4903,7 +4903,7 @@ WfInterfaceConstructor
:WfMethodBase(true)
{
auto argumentType = TypeInfoRetriver<Ptr<IValueInterfaceProxy>>::CreateTypeInfo();
auto parameter = MakePtr<ParameterInfoImpl>(this, L"proxy", argumentType);
auto parameter = Ptr(new ParameterInfoImpl(this, L"proxy", argumentType));
AddParameter(parameter);
SetReturn(type);
}
@@ -4950,7 +4950,7 @@ GetInfoRecord
}
else if(createIfNotExist)
{
typedValue = new TRecord;
typedValue = Ptr(new TRecord);
thisObject->SetInternalProperty(key, typedValue);
}
return typedValue;
@@ -4976,7 +4976,7 @@ WfEvent
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
auto record = GetEventRecord(thisObject, true);
auto result = MakePtr<EventHandlerImpl>(handler);
auto result = Ptr(new EventHandlerImpl(handler));
record->handlers.Add(this, result);
return result;
#else
@@ -5353,7 +5353,7 @@ WfStruct
Value WfStruct::WfValueType::CreateDefault()
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
return Value::From(new IValueType::TypedBox<WfStructInstance>, owner);
return Value::From(Ptr(new IValueType::TypedBox<WfStructInstance>), owner);
#else
CHECK_FAIL(L"Not Implemented under VCZH_DEBUG_METAONLY_REFLECTION!");
#endif
@@ -5367,7 +5367,7 @@ WfStruct
WfStruct::WfStruct(const WString& typeName)
:WfCustomTypeBase<reflection::description::ValueTypeDescriptorBase>(TypeDescriptorFlags::Struct, typeName)
{
this->valueType = new WfValueType(this);
this->valueType = Ptr(new WfValueType(this));
}
WfStruct::~WfStruct()
@@ -5454,7 +5454,7 @@ WfEnum::WfEnumType
Value WfEnum::WfEnumType::ToEnum(vuint64_t value)
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
auto boxedValue = MakePtr<IValueType::TypedBox<WfEnumInstance>>();
auto boxedValue = Ptr(new IValueType::TypedBox<WfEnumInstance>);
boxedValue->value.value = value;
return Value::From(boxedValue, owner);
#else
@@ -5488,7 +5488,7 @@ WfEnum
Value WfEnum::WfValueType::CreateDefault()
{
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
return Value::From(new IValueType::TypedBox<WfEnumInstance>, owner);
return Value::From(Ptr(new IValueType::TypedBox<WfEnumInstance>), owner);
#else
CHECK_FAIL(L"Not Implemented under VCZH_DEBUG_METAONLY_REFLECTION!");
#endif
@@ -5520,8 +5520,8 @@ WfEnum
WfEnum::WfEnum(bool isFlags, const WString& typeName)
:WfCustomTypeBase<reflection::description::ValueTypeDescriptorBase>((isFlags ? TypeDescriptorFlags::FlagEnum : TypeDescriptorFlags::NormalEnum), typeName)
{
this->valueType = new WfValueType(this);
this->enumType = new WfEnumType(this);
this->valueType = Ptr(new WfValueType(this));
this->enumType = Ptr(new WfEnumType(this));
}
WfEnum::~WfEnum()
@@ -5553,12 +5553,12 @@ WfClassInstance
#ifdef VCZH_DESCRIPTABLEOBJECT_WITH_METADATA
if (classType->destructorFunctionIndex != -1)
{
auto capturedVariables = MakePtr<WfRuntimeVariableContext>();
auto capturedVariables = Ptr(new WfRuntimeVariableContext);
capturedVariables->variables.Resize(1);
capturedVariables->variables[0] = Value::From(this);
auto argumentArray = IValueList::Create();
WfRuntimeLambda::Invoke(classType->GetGlobalContext(), capturedVariables, classType->destructorFunctionIndex, argumentArray);
WfRuntimeLambda::Invoke(Ptr(classType->GetGlobalContext()), capturedVariables, classType->destructorFunctionIndex, argumentArray);
}
#endif
}
@@ -5569,7 +5569,7 @@ WfClassInstance
{
if (!(ptr = value.GetSharedPtr()))
{
ptr = value.GetRawPtr();
ptr = Ptr(value.GetRawPtr());
}
value = Value();
}
@@ -5600,7 +5600,7 @@ WfInterfaceInstance
auto value = ctor->Invoke(Value(), arguments);
if (!(ptr = value.GetSharedPtr()))
{
ptr = value.GetRawPtr();
ptr = Ptr(value.GetRawPtr());
}
}