【修复】修复 proto typescript对 TFlong及Tlong bigint情况下的代码及 array类型的代码的编译问题
parent
edd82f249c
commit
7ff3467d35
|
|
@ -76,7 +76,26 @@ namespace Luban.Job.Common.TypeVisitors
|
||||||
|
|
||||||
public abstract string Accept(TBean type, string bufVarName, string fieldName);
|
public abstract string Accept(TBean type, string bufVarName, string fieldName);
|
||||||
|
|
||||||
private string GetNewArray(TArray arrayType, string size)
|
|
||||||
|
|
||||||
|
public static string GetNewArray(TType elementType)
|
||||||
|
{
|
||||||
|
switch (elementType)
|
||||||
|
{
|
||||||
|
case TByte _: return "new Uint8Array()";
|
||||||
|
case TShort _:
|
||||||
|
case TFshort _: return "new Int16Array()";
|
||||||
|
case TInt _:
|
||||||
|
case TFint _: return "new Int32Array()";
|
||||||
|
case TLong _:
|
||||||
|
case TFlong _: return "new Int64Array()";
|
||||||
|
case TFloat _: return "new Float32Array()";
|
||||||
|
case TDouble _: return "new Float64Array()";
|
||||||
|
default: return "[]";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public static string GetNewArray(TArray arrayType, string size)
|
||||||
{
|
{
|
||||||
switch (arrayType.ElementType)
|
switch (arrayType.ElementType)
|
||||||
{
|
{
|
||||||
|
|
|
||||||
|
|
@ -39,12 +39,12 @@ namespace Luban.Job.Common.TypeVisitors
|
||||||
|
|
||||||
public string Accept(TLong type)
|
public string Accept(TLong type)
|
||||||
{
|
{
|
||||||
return "0";
|
return type.IsBean ? "BigInt(0)" : "0";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Accept(TFlong type)
|
public string Accept(TFlong type)
|
||||||
{
|
{
|
||||||
return "0";
|
return "BigInt(0)";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Accept(TFloat type)
|
public string Accept(TFloat type)
|
||||||
|
|
@ -69,7 +69,7 @@ namespace Luban.Job.Common.TypeVisitors
|
||||||
|
|
||||||
public string Accept(TBytes type)
|
public string Accept(TBytes type)
|
||||||
{
|
{
|
||||||
return "null";
|
return "new Uint8Array()";
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Accept(TText type)
|
public string Accept(TText type)
|
||||||
|
|
@ -84,7 +84,7 @@ namespace Luban.Job.Common.TypeVisitors
|
||||||
|
|
||||||
public string Accept(TArray type)
|
public string Accept(TArray type)
|
||||||
{
|
{
|
||||||
return "[]";
|
return TypescriptBinUnderingDeserializeVisitorBase.GetNewArray(type.ElementType);
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Accept(TList type)
|
public string Accept(TList type)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue