@@ -98,7 +98,7 @@ AsmAnalysisInfo AsmAnalyzer::analyzeStrictAssertCorrect(Dialect const& _dialect,
98
98
return analysisInfo;
99
99
}
100
100
101
- std::vector<YulString > AsmAnalyzer::operator ()(Literal const & _literal)
101
+ std::vector<YulName > AsmAnalyzer::operator ()(Literal const & _literal)
102
102
{
103
103
expectValidType (_literal.type , nativeLocationOf (_literal));
104
104
if (_literal.kind == LiteralKind::String && _literal.value .str ().size () > 32 )
@@ -122,11 +122,11 @@ std::vector<YulString> AsmAnalyzer::operator()(Literal const& _literal)
122
122
return {_literal.type };
123
123
}
124
124
125
- std::vector<YulString > AsmAnalyzer::operator ()(Identifier const & _identifier)
125
+ std::vector<YulName > AsmAnalyzer::operator ()(Identifier const & _identifier)
126
126
{
127
127
yulAssert (!_identifier.name .empty (), " " );
128
128
auto watcher = m_errorReporter.errorWatcher ();
129
- YulString type = m_dialect.defaultType ;
129
+ YulName type = m_dialect.defaultType ;
130
130
131
131
if (m_currentScope->lookup (_identifier.name , GenericVisitor{
132
132
[&](Scope::Variable const & _var)
@@ -180,7 +180,7 @@ std::vector<YulString> AsmAnalyzer::operator()(Identifier const& _identifier)
180
180
void AsmAnalyzer::operator ()(ExpressionStatement const & _statement)
181
181
{
182
182
auto watcher = m_errorReporter.errorWatcher ();
183
- std::vector<YulString > types = std::visit (*this , _statement.expression );
183
+ std::vector<YulName > types = std::visit (*this , _statement.expression );
184
184
if (watcher.ok () && !types.empty ())
185
185
m_errorReporter.typeError (
186
186
3083_error,
@@ -199,7 +199,7 @@ void AsmAnalyzer::operator()(Assignment const& _assignment)
199
199
size_t const numVariables = _assignment.variableNames .size ();
200
200
yulAssert (numVariables >= 1 , " " );
201
201
202
- std::set<YulString > variables;
202
+ std::set<YulName > variables;
203
203
for (auto const & _variableName: _assignment.variableNames )
204
204
if (!variables.insert (_variableName.name ).second )
205
205
m_errorReporter.declarationError (
@@ -210,7 +210,7 @@ void AsmAnalyzer::operator()(Assignment const& _assignment)
210
210
" occurs multiple times on the left-hand side of the assignment."
211
211
);
212
212
213
- std::vector<YulString > types = std::visit (*this , *_assignment.value );
213
+ std::vector<YulName > types = std::visit (*this , *_assignment.value );
214
214
215
215
if (types.size () != numVariables)
216
216
m_errorReporter.declarationError (
@@ -249,7 +249,7 @@ void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl)
249
249
250
250
if (_varDecl.value )
251
251
{
252
- std::vector<YulString > types = std::visit (*this , *_varDecl.value );
252
+ std::vector<YulName > types = std::visit (*this , *_varDecl.value );
253
253
if (types.size () != numVariables)
254
254
m_errorReporter.declarationError (
255
255
3812_error,
@@ -265,7 +265,7 @@ void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl)
265
265
266
266
for (size_t i = 0 ; i < _varDecl.variables .size (); ++i)
267
267
{
268
- YulString givenType = m_dialect.defaultType ;
268
+ YulName givenType = m_dialect.defaultType ;
269
269
if (i < types.size ())
270
270
givenType = types[i];
271
271
TypedName const & variable = _varDecl.variables [i];
@@ -301,12 +301,12 @@ void AsmAnalyzer::operator()(FunctionDefinition const& _funDef)
301
301
(*this )(_funDef.body );
302
302
}
303
303
304
- std::vector<YulString > AsmAnalyzer::operator ()(FunctionCall const & _funCall)
304
+ std::vector<YulName > AsmAnalyzer::operator ()(FunctionCall const & _funCall)
305
305
{
306
306
yulAssert (!_funCall.functionName .name .empty (), " " );
307
307
auto watcher = m_errorReporter.errorWatcher ();
308
- std::vector<YulString > const * parameterTypes = nullptr ;
309
- std::vector<YulString > const * returnTypes = nullptr ;
308
+ std::vector<YulName > const * parameterTypes = nullptr ;
309
+ std::vector<YulName > const * returnTypes = nullptr ;
310
310
std::vector<std::optional<LiteralKind>> const * literalArguments = nullptr ;
311
311
312
312
if (BuiltinFunction const * f = m_dialect.builtin (_funCall.functionName .name ))
@@ -390,7 +390,7 @@ std::vector<YulString> AsmAnalyzer::operator()(FunctionCall const& _funCall)
390
390
std::to_string (_funCall.arguments .size ()) + " ."
391
391
);
392
392
393
- std::vector<YulString > argTypes;
393
+ std::vector<YulName > argTypes;
394
394
for (size_t i = _funCall.arguments .size (); i > 0 ; i--)
395
395
{
396
396
Expression const & arg = _funCall.arguments [i - 1 ];
@@ -453,7 +453,7 @@ std::vector<YulString> AsmAnalyzer::operator()(FunctionCall const& _funCall)
453
453
return *returnTypes;
454
454
}
455
455
else if (returnTypes)
456
- return std::vector<YulString >(returnTypes->size (), m_dialect.defaultType );
456
+ return std::vector<YulName >(returnTypes->size (), m_dialect.defaultType );
457
457
else
458
458
return {};
459
459
}
@@ -476,7 +476,7 @@ void AsmAnalyzer::operator()(Switch const& _switch)
476
476
" \" switch\" statement with only a default case."
477
477
);
478
478
479
- YulString valueType = expectExpression (*_switch.expression );
479
+ YulName valueType = expectExpression (*_switch.expression );
480
480
481
481
std::set<u256> cases;
482
482
for (auto const & _case: _switch.cases )
@@ -541,9 +541,9 @@ void AsmAnalyzer::operator()(Block const& _block)
541
541
m_currentScope = previousScope;
542
542
}
543
543
544
- YulString AsmAnalyzer::expectExpression (Expression const & _expr)
544
+ YulName AsmAnalyzer::expectExpression (Expression const & _expr)
545
545
{
546
- std::vector<YulString > types = std::visit (*this , _expr);
546
+ std::vector<YulName > types = std::visit (*this , _expr);
547
547
if (types.size () != 1 )
548
548
m_errorReporter.typeError (
549
549
3950_error,
@@ -555,7 +555,7 @@ YulString AsmAnalyzer::expectExpression(Expression const& _expr)
555
555
return types.empty () ? m_dialect.defaultType : types.front ();
556
556
}
557
557
558
- YulString AsmAnalyzer::expectUnlimitedStringLiteral (Literal const & _literal)
558
+ YulName AsmAnalyzer::expectUnlimitedStringLiteral (Literal const & _literal)
559
559
{
560
560
yulAssert (_literal.kind == LiteralKind::String, " " );
561
561
yulAssert (m_dialect.validTypeForLiteral (LiteralKind::String, _literal.value , _literal.type ), " " );
@@ -565,7 +565,7 @@ YulString AsmAnalyzer::expectUnlimitedStringLiteral(Literal const& _literal)
565
565
566
566
void AsmAnalyzer::expectBoolExpression (Expression const & _expr)
567
567
{
568
- YulString type = expectExpression (_expr);
568
+ YulName type = expectExpression (_expr);
569
569
if (type != m_dialect.boolType )
570
570
m_errorReporter.typeError (
571
571
1733_error,
@@ -578,11 +578,11 @@ void AsmAnalyzer::expectBoolExpression(Expression const& _expr)
578
578
);
579
579
}
580
580
581
- void AsmAnalyzer::checkAssignment (Identifier const & _variable, YulString _valueType)
581
+ void AsmAnalyzer::checkAssignment (Identifier const & _variable, YulName _valueType)
582
582
{
583
583
yulAssert (!_variable.name .empty (), " " );
584
584
auto watcher = m_errorReporter.errorWatcher ();
585
- YulString const * variableType = nullptr ;
585
+ YulName const * variableType = nullptr ;
586
586
bool found = false ;
587
587
if (Scope::Identifier const * var = m_currentScope->lookup (_variable.name ))
588
588
{
@@ -641,7 +641,7 @@ Scope& AsmAnalyzer::scope(Block const* _block)
641
641
return *scopePtr;
642
642
}
643
643
644
- void AsmAnalyzer::expectValidIdentifier (YulString _identifier, SourceLocation const & _location)
644
+ void AsmAnalyzer::expectValidIdentifier (YulName _identifier, SourceLocation const & _location)
645
645
{
646
646
// NOTE: the leading dot case is handled by the parser not allowing it.
647
647
if (boost::ends_with (_identifier.str (), " ." ))
@@ -666,7 +666,7 @@ void AsmAnalyzer::expectValidIdentifier(YulString _identifier, SourceLocation co
666
666
);
667
667
}
668
668
669
- void AsmAnalyzer::expectValidType (YulString _type, SourceLocation const & _location)
669
+ void AsmAnalyzer::expectValidType (YulName _type, SourceLocation const & _location)
670
670
{
671
671
if (!m_dialect.types .count (_type))
672
672
m_errorReporter.typeError (
@@ -676,7 +676,7 @@ void AsmAnalyzer::expectValidType(YulString _type, SourceLocation const& _locati
676
676
);
677
677
}
678
678
679
- void AsmAnalyzer::expectType (YulString _expectedType, YulString _givenType, SourceLocation const & _location)
679
+ void AsmAnalyzer::expectType (YulName _expectedType, YulName _givenType, SourceLocation const & _location)
680
680
{
681
681
if (_expectedType != _givenType)
682
682
m_errorReporter.typeError (
@@ -689,7 +689,7 @@ void AsmAnalyzer::expectType(YulString _expectedType, YulString _givenType, Sour
689
689
bool AsmAnalyzer::validateInstructions (std::string const & _instructionIdentifier, langutil::SourceLocation const & _location)
690
690
{
691
691
// NOTE: This function uses the default EVM version instead of the currently selected one.
692
- auto const builtin = EVMDialect::strictAssemblyForEVM (EVMVersion{}).builtin (YulString (_instructionIdentifier));
692
+ auto const builtin = EVMDialect::strictAssemblyForEVM (EVMVersion{}).builtin (YulName (_instructionIdentifier));
693
693
if (builtin && builtin->instruction .has_value ())
694
694
return validateInstructions (builtin->instruction .value (), _location);
695
695
else
0 commit comments