Skip to content

Commit

Permalink
Merge branch 'Tencent:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
ArnoChenFx authored Jun 28, 2024
2 parents fb9735f + 6f4515c commit cbae9fb
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 20 deletions.
13 changes: 7 additions & 6 deletions unreal/Puerts/Content/JavaScript/puerts/uelazyload.js
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ var global = global || (function () { return this; }());
get : function(classWrapers, name)
{
let value = classWrapers[name];
if (!value)
if (value === undefined)
{
value = loadUEType(name);
classWrapers[name] = value;
Expand Down Expand Up @@ -81,7 +81,7 @@ var global = global || (function () { return this; }());
let CPP = new Proxy(cache, {
get: function(classWrapers, name) {
let value = classWrapers[name];
if (!value)
if (value === undefined)
{
value = loadCPPType(name);
classWrapers[name] = value;
Expand Down Expand Up @@ -337,10 +337,11 @@ var global = global || (function () { return this; }());
cache.BuiltinByte = 1;
cache.BuiltinInt = 2;
cache.BuiltinFloat = 3;
cache.BuiltinInt64 = 4;
cache.BuiltinString = 5;
cache.BuiltinText = 6;
cache.BuiltinName = 7;
cache.BuiltinDouble = 4;
cache.BuiltinInt64 = 5;
cache.BuiltinString = 6;
cache.BuiltinText = 7;
cache.BuiltinName = 8;

// call once to inject iterators to constructor
NewArray(cache.BuiltinInt);
Expand Down
11 changes: 11 additions & 0 deletions unreal/Puerts/Source/JsEnv/Private/ContainerMeta.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ PropertyMacro* FContainerMeta::GetBuiltinProperty(BuiltinType type)
Ret = new (EC_InternalUseOnlyConstructor, PropertyMetaRoot, NAME_None, RF_Transient)
UFloatProperty(FObjectInitializer(), EC_CppProperty, 0, CPF_HasGetValueTypeHash);
break;
case TDouble:
Ret = new (EC_InternalUseOnlyConstructor, PropertyMetaRoot, NAME_None, RF_Transient)
UDoubleProperty(FObjectInitializer(), EC_CppProperty, 0, CPF_HasGetValueTypeHash);
break;
case TInt64:
Ret = new (EC_InternalUseOnlyConstructor, PropertyMetaRoot, NAME_None, RF_Transient)
UInt64Property(FObjectInitializer(), EC_CppProperty, 0, CPF_HasGetValueTypeHash);
Expand Down Expand Up @@ -109,6 +113,10 @@ PropertyMacro* FContainerMeta::GetBuiltinProperty(BuiltinType type)
Ret = new FFloatProperty(PropertyMetaRoot, NAME_None, RF_Transient);
Ret->PropertyFlags |= CPF_HasGetValueTypeHash;
break;
case TDouble:
Ret = new FDoubleProperty(PropertyMetaRoot, NAME_None, RF_Transient);
Ret->PropertyFlags |= CPF_HasGetValueTypeHash;
break;
case TInt64:
Ret = new FInt64Property(PropertyMetaRoot, NAME_None, RF_Transient);
Ret->PropertyFlags |= CPF_HasGetValueTypeHash;
Expand Down Expand Up @@ -138,6 +146,9 @@ PropertyMacro* FContainerMeta::GetBuiltinProperty(BuiltinType type)
case TFloat:
Ret = new FFloatProperty(PropertyMetaRoot, NAME_None, RF_Transient, 0, CPF_HasGetValueTypeHash);
break;
case TDouble:
Ret = new FDoubleProperty(PropertyMetaRoot, NAME_None, RF_Transient, 0, CPF_HasGetValueTypeHash);
break;
case TInt64:
Ret = new FInt64Property(PropertyMetaRoot, NAME_None, RF_Transient, 0, CPF_HasGetValueTypeHash);
break;
Expand Down
9 changes: 5 additions & 4 deletions unreal/Puerts/Source/JsEnv/Private/ContainerMeta.h
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,11 @@ enum BuiltinType
TByte = 1,
TInt = 2,
TFloat = 3,
TInt64 = 4,
TString = 5,
TText = 6,
TName = 7,
TDouble = 4,
TInt64 = 5,
TString = 6,
TText = 7,
TName = 8,
MaxBuiltinType
};

Expand Down
22 changes: 12 additions & 10 deletions unreal/Puerts/Typing/ue/puerts.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -85,30 +85,32 @@ declare module "ue" {
type BuiltinByte = 1;
type BuiltinInt = 2;
type BuiltinFloat = 3;
type BuiltinInt64 = 4;
type BuiltinString = 5;
type BuiltinText = 6;
type BuiltinName = 7;
type BuiltinDouble = 4;
type BuiltinInt64 = 5;
type BuiltinString = 6;
type BuiltinText = 7;
type BuiltinName = 8;

const BuiltinBool = 0;
const BuiltinByte = 1;
const BuiltinInt = 2;
const BuiltinFloat = 3;
const BuiltinInt64 = 4;
const BuiltinString = 5;
const BuiltinText = 6;
const BuiltinName = 7;
const BuiltinDouble = 4;
const BuiltinInt64 = 5;
const BuiltinString = 6;
const BuiltinText = 7;
const BuiltinName = 8;

type ContainerKVType<T> =
T extends BuiltinBool ? boolean :
T extends BuiltinByte | BuiltinInt | BuiltinFloat ? number :
T extends BuiltinByte | BuiltinInt | BuiltinFloat | BuiltinDouble ? number :
T extends BuiltinInt64 ? bigint :
T extends BuiltinString | BuiltinText | BuiltinName ? string :
T extends {__typeKeyDoNoAccess: infer R} ? R :
T extends {new (...args:any[]): infer R} ? R :
never;

type SupportedContainerKVType = BuiltinBool | BuiltinByte | BuiltinInt | BuiltinFloat | BuiltinInt64 | BuiltinString | BuiltinText | BuiltinName | {StaticClass(): Class} | {StaticStruct(): ScriptStruct} | {__typeKeyDoNoAccess: any}
type SupportedContainerKVType = BuiltinBool | BuiltinByte | BuiltinInt | BuiltinFloat | BuiltinDouble | BuiltinInt64 | BuiltinString | BuiltinText | BuiltinName | {StaticClass(): Class} | {StaticStruct(): ScriptStruct} | {__typeKeyDoNoAccess: any}

function NewArray<T extends SupportedContainerKVType>(t: T): TArray<ContainerKVType<T>>;
function NewSet<T extends SupportedContainerKVType>(t: T): TSet<ContainerKVType<T>>;
Expand Down

0 comments on commit cbae9fb

Please sign in to comment.