diff options
author | Lu Guanqun <guanqun.lu@gmail.com> | 2015-03-09 06:26:36 +0800 |
---|---|---|
committer | Lu Guanqun <guanqun.lu@gmail.com> | 2015-03-09 06:26:36 +0800 |
commit | ff4d2cc7dc035a248de4698c2c59a8df14db2e82 (patch) | |
tree | 16c4b856ca96f41bdc8ccbcdb45f9b125f171194 /AST.cpp | |
parent | 5dcee599f1f0d65fb4564426312732ce7e56ba29 (diff) | |
download | dexon-solidity-ff4d2cc7dc035a248de4698c2c59a8df14db2e82.tar dexon-solidity-ff4d2cc7dc035a248de4698c2c59a8df14db2e82.tar.gz dexon-solidity-ff4d2cc7dc035a248de4698c2c59a8df14db2e82.tar.bz2 dexon-solidity-ff4d2cc7dc035a248de4698c2c59a8df14db2e82.tar.lz dexon-solidity-ff4d2cc7dc035a248de4698c2c59a8df14db2e82.tar.xz dexon-solidity-ff4d2cc7dc035a248de4698c2c59a8df14db2e82.tar.zst dexon-solidity-ff4d2cc7dc035a248de4698c2c59a8df14db2e82.zip |
fix rebase errors
Diffstat (limited to 'AST.cpp')
-rw-r--r-- | AST.cpp | 39 |
1 files changed, 6 insertions, 33 deletions
@@ -356,7 +356,12 @@ void VariableDeclaration::checkTypeRequirements() else { // no type declared and no previous assignment, infer the type - m_value->checkTypeRequirements(); + Identifier* identifier = dynamic_cast<Identifier*>(m_value.get()); + if (identifier) + identifier->checkTypeRequirementsFromVariableDeclaration(); + else + m_value->checkTypeRequirements(); + TypePointer type = m_value->getType(); if (type->getCategory() == Type::Category::IntegerConstant) { @@ -484,39 +489,7 @@ void Return::checkTypeRequirements() void VariableDeclarationStatement::checkTypeRequirements() { -<<<<<<< HEAD m_variable->checkTypeRequirements(); -======= - // Variables can be declared without type (with "var"), in which case the first assignment - // sets the type. - // Note that assignments before the first declaration are legal because of the special scoping - // rules inherited from JavaScript. - if (m_variable->getValue()) - { - if (m_variable->getType()) - m_variable->getValue()->expectType(*m_variable->getType()); - else - { - // no type declared and no previous assignment, infer the type - Identifier* identifier = dynamic_cast<Identifier*>(m_variable->getValue().get()); - if (identifier) - identifier->checkTypeRequirementsFromVariableDeclaration(); - else - m_variable->getValue()->checkTypeRequirements(); - TypePointer type = m_variable->getValue()->getType(); - if (type->getCategory() == Type::Category::IntegerConstant) - { - auto intType = dynamic_pointer_cast<IntegerConstantType const>(type)->getIntegerType(); - if (!intType) - BOOST_THROW_EXCEPTION(m_variable->getValue()->createTypeError("Invalid integer constant " + type->toString())); - type = intType; - } - else if (type->getCategory() == Type::Category::Void) - BOOST_THROW_EXCEPTION(m_variable->createTypeError("var cannot be void type")); - m_variable->setType(type); - } - } ->>>>>>> implement overload resolution } void Assignment::checkTypeRequirements() |