Skip to content

Commit

Permalink
solUnimplementedAssert in codegen
Browse files Browse the repository at this point in the history
  • Loading branch information
matheusaaguiar committed May 20, 2024
1 parent 4e2f72a commit 2892ee4
Show file tree
Hide file tree
Showing 10 changed files with 33 additions and 1 deletion.
15 changes: 15 additions & 0 deletions libsolidity/interface/CompilerStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1467,6 +1467,11 @@ void CompilerStack::compileContract(
solUnimplementedAssert(!m_eofVersion.has_value(), "Experimental EOF support is only available for via-IR compilation.");
solAssert(m_stackState >= AnalysisSuccessful, "");

solUnimplementedAssert(ranges::all_of(
_contract.stateVariables(),
[](auto const* _stateVar) { return _stateVar->referenceLocation() != VariableDeclaration::Location::Transient; }
));

if (_otherCompilers.count(&_contract))
return;

Expand Down Expand Up @@ -1496,6 +1501,11 @@ void CompilerStack::generateIR(ContractDefinition const& _contract)
{
solAssert(m_stackState >= AnalysisSuccessful, "");

solUnimplementedAssert(ranges::all_of(
_contract.stateVariables(),
[](auto const* _stateVar) { return _stateVar->referenceLocation() != VariableDeclaration::Location::Transient; }
));

Contract& compiledContract = m_contracts.at(_contract.fullyQualifiedName());
if (!compiledContract.yulIR.empty())
return;
Expand Down Expand Up @@ -1579,6 +1589,11 @@ void CompilerStack::generateEVMFromIR(ContractDefinition const& _contract)
{
solAssert(m_stackState >= AnalysisSuccessful, "");

solUnimplementedAssert(ranges::all_of(
_contract.stateVariables(),
[](auto const* _stateVar) { return _stateVar->referenceLocation() != VariableDeclaration::Location::Transient; }
));

if (!_contract.canBeDeployed())
return;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ contract C {
function () internal transient internal fiti;
function () internal internal transient fiit;
}
// ====
// stopAfter: analysis
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,7 @@ contract C {
S transient s;
mapping(uint => uint) transient y;
}
// ====
// stopAfter: analysis
// ----
// UnimplementedFeatureError: Transient data location is only supported for value types.
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ contract C {
uint transient internal ti;
uint transient private tprv;
}
// ====
// stopAfter: parsing
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,6 @@ contract C {
uint transient x;
bytes32 transient y;
}
// ====
// stopAfter: parsing
// ----
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,6 @@ contract C {
address transient a = address(0xABC);
bool transient b = x > 0 ? false : true;
}
// ====
// stopAfter: parsing
// ----
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
contract C {
function (uint transient) external transient y;
}
// ====
// stopAfter: parsing
// ----
// Warning 6162: (27-41): Naming function type parameters is deprecated.
Original file line number Diff line number Diff line change
Expand Up @@ -6,4 +6,6 @@ contract C {
return (x + w) * (y / x);
}
}
// ====
// stopAfter: parsing
// ----
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
contract C {
address payable transient a;
}
// ====
// stopAfter: parsing
// ----
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
contract C {
uint transient transient;
}
// ====
// stopAfter: parsing
// ----

0 comments on commit 2892ee4

Please sign in to comment.