|
@ -67,28 +67,28 @@ namespace |
|
|
return LocationPair(_node.getLocation().start, _node.getLocation().end); |
|
|
return LocationPair(_node.getLocation().start, _node.getLocation().end); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
SolidityType nodeType(Type const* type) |
|
|
SolidityType nodeType(Type const* _type) |
|
|
{ |
|
|
{ |
|
|
if (!type) |
|
|
if (!_type) |
|
|
return SolidityType { SolidityType::Type::UnsignedInteger, 32 }; |
|
|
return SolidityType { SolidityType::Type::UnsignedInteger, 32 }; |
|
|
switch (type->getCategory()) |
|
|
switch (_type->getCategory()) |
|
|
{ |
|
|
{ |
|
|
case Type::Category::Integer: |
|
|
case Type::Category::Integer: |
|
|
{ |
|
|
{ |
|
|
IntegerType const* it = dynamic_cast<IntegerType const*>(type); |
|
|
IntegerType const* it = dynamic_cast<IntegerType const*>(_type); |
|
|
unsigned size = it->getNumBits() / 8; |
|
|
unsigned size = it->getNumBits() / 8; |
|
|
SolidityType::Type typeCode = it->isAddress() ? SolidityType::Type::Address : it->isHash() ? SolidityType::Type::Hash : it->isSigned() ? SolidityType::Type::SignedInteger : SolidityType::Type::UnsignedInteger; |
|
|
SolidityType::Type typeCode = it->isAddress() ? SolidityType::Type::Address : it->isHash() ? SolidityType::Type::Hash : it->isSigned() ? SolidityType::Type::SignedInteger : SolidityType::Type::UnsignedInteger; |
|
|
return SolidityType { typeCode, size }; |
|
|
return SolidityType { typeCode, size }; |
|
|
} |
|
|
} |
|
|
case Type::Category::Bool: |
|
|
case Type::Category::Bool: |
|
|
return SolidityType { SolidityType::Type::Bool, type->getSizeOnStack() * 32 }; |
|
|
return SolidityType { SolidityType::Type::Bool, _type->getSizeOnStack() * 32 }; |
|
|
case Type::Category::String: |
|
|
case Type::Category::String: |
|
|
{ |
|
|
{ |
|
|
StaticStringType const* s = dynamic_cast<StaticStringType const*>(type); |
|
|
StaticStringType const* s = dynamic_cast<StaticStringType const*>(_type); |
|
|
return SolidityType { SolidityType::Type::String, static_cast<unsigned>(s->getNumBytes()) }; |
|
|
return SolidityType { SolidityType::Type::String, static_cast<unsigned>(s->getNumBytes()) }; |
|
|
} |
|
|
} |
|
|
case Type::Category::Contract: |
|
|
case Type::Category::Contract: |
|
|
return SolidityType { SolidityType::Type::Address, type->getSizeOnStack() * 32 }; |
|
|
return SolidityType { SolidityType::Type::Address, _type->getSizeOnStack() * 32 }; |
|
|
case Type::Category::Array: |
|
|
case Type::Category::Array: |
|
|
case Type::Category::Enum: |
|
|
case Type::Category::Enum: |
|
|
case Type::Category::Function: |
|
|
case Type::Category::Function: |
|
|