| 290 | } |
| 291 | |
| 292 | void IRGeneratorForStatements::initializeLocalVar(VariableDeclaration const& _varDecl) |
| 293 | { |
| 294 | try |
| 295 | { |
| 296 | setLocation(_varDecl); |
| 297 | |
| 298 | solAssert(m_context.isLocalVariable(_varDecl), "Must be a local variable."); |
| 299 | |
| 300 | auto const* type = _varDecl.type(); |
| 301 | if (dynamic_cast<MappingType const*>(type)) |
| 302 | return; |
| 303 | else if (auto const* refType = dynamic_cast<ReferenceType const*>(type)) |
| 304 | if (refType->dataStoredIn(DataLocation::Storage) && refType->isPointer()) |
| 305 | return; |
| 306 | |
| 307 | IRVariable zero = zeroValue(*type); |
| 308 | assign(m_context.localVariable(_varDecl), zero); |
| 309 | } |
| 310 | catch (langutil::UnimplementedFeatureError const& _error) |
| 311 | { |
| 312 | if (!boost::get_error_info<langutil::errinfo_sourceLocation>(_error)) |
| 313 | _error << langutil::errinfo_sourceLocation(m_currentLocation); |
| 314 | BOOST_THROW_EXCEPTION(_error); |
| 315 | } |
| 316 | } |
| 317 | |
| 318 | IRVariable IRGeneratorForStatements::evaluateExpression(Expression const& _expression, Type const& _targetType) |
| 319 | { |
no test coverage detected