Skip to content

Commit

Permalink
Merge pull request #956 from GaijinEntertainment/missing_types
Browse files Browse the repository at this point in the history
mismatching enum, missing conversions
  • Loading branch information
borisbat authored Feb 9, 2024
2 parents c724d94 + 4140fab commit eeec54f
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 18 deletions.
10 changes: 5 additions & 5 deletions daslib/ast_boost.das
Original file line number Diff line number Diff line change
Expand Up @@ -566,20 +566,20 @@ def private walk_and_convert_basic ( data : uint8?; info:TypeDeclPtr; at:LineInf
return new [[ExprConstURange64() at=at, value=*reinterpret<urange64?> data]]
elif info.baseType == Type tString
return new [[ExprConstString() at=at, value:=*reinterpret<string?> data]]
elif info.baseType == Type tBitfield
return new [[ExprConstBitfield() at=at, value=*reinterpret<bitfield?> data]]
else
panic("unsupported {info.baseType}")
return [[ExpressionPtr]]

def private walk_and_convert_enumeration ( data : uint8?; info:TypeDeclPtr; at:LineInfo ) : ExpressionPtr
var eval = 0
if info.baseType == Type tEnumeration
unsafe
eval = int(* reinterpret<uint?> data)
eval = * unsafe(reinterpret<int?> data)
elif info.baseType == Type tEnumeration8
eval = int(* data)
eval = int(*data)
elif info.baseType == Type tEnumeration16
unsafe
eval = int(* reinterpret<uint16?> data)
eval = int(*unsafe(reinterpret<int16?> data))
else
panic("unsupported enumeration")
return <- new [[ExprConstEnumeration() enumType:=info.enumType, value:=info.enumType.list[eval].name]]
Expand Down
20 changes: 7 additions & 13 deletions src/builtin/module_builtin_rtti.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,19 +7,13 @@
#include "daScript/simulate/aot_builtin_rtti.h"

DAS_BASE_BIND_ENUM(das::Type, Type,
none, autoinfer, alias, option,
fakeContext, fakeLineInfo,
anyArgument, tVoid, tBool, tInt64,
tUInt64, tInt, tInt2, tInt3,
tInt4, tUInt, tUInt2, tUInt3,
tUInt4, tFloat, tFloat2, tFloat3,
tFloat4, tDouble, tRange, tURange,
tRange64, tURange64,
tString, tStructure, tHandle, tEnumeration,
tPointer, tFunction, tLambda, tIterator,
tArray, tTable, tBlock, tInt8,
tUInt8, tInt16, tUInt16, tTuple,
tEnumeration8, tEnumeration16, tVariant, tBitfield
none, autoinfer, alias, option, fakeContext, fakeLineInfo,
anyArgument, tVoid, tBool, tInt8, tUInt8, tInt16, tUInt16,
tInt64, tUInt64, tInt, tInt2, tInt3, tInt4, tUInt,
tUInt2, tUInt3, tUInt4, tFloat, tFloat2, tFloat3, tFloat4,
tDouble, tRange, tURange, tRange64, tURange64, tString, tStructure,
tHandle, tEnumeration, tEnumeration8, tEnumeration16, tBitfield, tPointer, tFunction,
tLambda, tIterator, tArray, tTable, tBlock, tTuple, tVariant
)

DAS_BASE_BIND_ENUM(das::RefMatters, RefMatters, no, yes)
Expand Down

0 comments on commit eeec54f

Please sign in to comment.