diff --git a/Changelog.md b/Changelog.md index 288136dd9181..04bfa929530b 100644 --- a/Changelog.md +++ b/Changelog.md @@ -19,6 +19,7 @@ Compiler Features: * Standard JSON Interface: Do not perform IR optimization when only unoptimized IR is requested. * Standard JSON Interface: Add ``transientStorageLayout`` output. * Yul: Drop the deprecated typed Yul dialect that was only accessible via ``--yul`` in the CLI. + * Yul: The presence of types in untyped Yul dialects is now a parser error. * Yul Optimizer: Caching of optimized IR to speed up optimization of contracts with bytecode dependencies. * Yul Optimizer: The optimizer now treats some previously unrecognized identical literals as identical. * Commandline Interface: Allow the use of ``--asm-json`` output option in assembler mode to export EVM assembly of the contracts in JSON format. diff --git a/libsolidity/analysis/ReferencesResolver.cpp b/libsolidity/analysis/ReferencesResolver.cpp index bb3b20e93a50..079bbf33ceab 100644 --- a/libsolidity/analysis/ReferencesResolver.cpp +++ b/libsolidity/analysis/ReferencesResolver.cpp @@ -272,7 +272,7 @@ void ReferencesResolver::operator()(yul::FunctionDefinition const& _function) { solAssert(nativeLocationOf(_function) == originLocationOf(_function), ""); validateYulIdentifierName(_function.name, nativeLocationOf(_function)); - for (yul::TypedName const& varName: _function.parameters + _function.returnVariables) + for (yul::NameWithDebugData const& varName: _function.parameters + _function.returnVariables) { solAssert(nativeLocationOf(varName) == originLocationOf(varName), ""); validateYulIdentifierName(varName.name, nativeLocationOf(varName)); diff --git a/libsolidity/codegen/CompilerContext.cpp b/libsolidity/codegen/CompilerContext.cpp index b1b76a97b8d6..2e94e9f0b8d2 100644 --- a/libsolidity/codegen/CompilerContext.cpp +++ b/libsolidity/codegen/CompilerContext.cpp @@ -491,8 +491,8 @@ void CompilerContext::appendInlineAssembly( { // Store as generated sources, but first re-parse to update the source references. solAssert(m_generatedYulUtilityCode.empty(), ""); - m_generatedYulUtilityCode = yul::AsmPrinter(yul::AsmPrinter::TypePrinting::OmitDefault, dialect)(obj.code()->root()); - std::string code = yul::AsmPrinter{yul::AsmPrinter::TypePrinting::OmitDefault, dialect}(obj.code()->root()); + m_generatedYulUtilityCode = yul::AsmPrinter()(obj.code()->root()); + std::string code = yul::AsmPrinter{}(obj.code()->root()); langutil::CharStream charStream(m_generatedYulUtilityCode, _sourceName); obj.setCode(yul::Parser(errorReporter, dialect).parse(charStream)); obj.analysisInfo = std::make_shared(yul::AsmAnalyzer::analyzeStrictAssertCorrect(dialect, obj)); diff --git a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp index 459959604625..c3cd69f43e22 100644 --- a/libsolidity/codegen/ir/IRGeneratorForStatements.cpp +++ b/libsolidity/codegen/ir/IRGeneratorForStatements.cpp @@ -204,7 +204,7 @@ struct CopyTranslate: public yul::ASTCopier solAssert(false); if (isDigit(value.front())) - return yul::Literal{_identifier.debugData, yul::LiteralKind::Number, yul::valueOfNumberLiteral(value), {}}; + return yul::Literal{_identifier.debugData, yul::LiteralKind::Number, yul::valueOfNumberLiteral(value)}; else return yul::Identifier{_identifier.debugData, yul::YulName{value}}; } @@ -2256,7 +2256,7 @@ bool IRGeneratorForStatements::visit(InlineAssembly const& _inlineAsm) solAssert(std::holds_alternative(modified)); - appendCode() << yul::AsmPrinter(yul::AsmPrinter::TypePrinting::Full, _inlineAsm.dialect())(std::get(modified)) << "\n"; + appendCode() << yul::AsmPrinter()(std::get(modified)) << "\n"; return false; } diff --git a/libsolidity/experimental/codegen/IRGeneratorForStatements.cpp b/libsolidity/experimental/codegen/IRGeneratorForStatements.cpp index 3c8bcc9bbbab..6925a434d0a1 100644 --- a/libsolidity/experimental/codegen/IRGeneratorForStatements.cpp +++ b/libsolidity/experimental/codegen/IRGeneratorForStatements.cpp @@ -132,7 +132,7 @@ bool IRGeneratorForStatements::visit(InlineAssembly const& _assembly) CopyTranslate bodyCopier{m_context, _assembly.dialect(), _assembly.annotation().externalReferences}; yul::Statement modified = bodyCopier(_assembly.operations().root()); solAssert(std::holds_alternative(modified)); - m_code << yul::AsmPrinter(yul::AsmPrinter::TypePrinting::Full, _assembly.dialect())(std::get(modified)) << "\n"; + m_code << yul::AsmPrinter()(std::get(modified)) << "\n"; return false; } diff --git a/libyul/AST.h b/libyul/AST.h index 6b9682580c0a..f51846280a8f 100644 --- a/libyul/AST.h +++ b/libyul/AST.h @@ -36,10 +36,8 @@ namespace solidity::yul { -using Type = YulName; - -struct TypedName { langutil::DebugData::ConstPtr debugData; YulName name; Type type; }; -using TypedNameList = std::vector; +struct NameWithDebugData { langutil::DebugData::ConstPtr debugData; YulName name; }; +using NameWithDebugDataList = std::vector; /// Literal number or string (up to 32 bytes) enum class LiteralKind { Number, Boolean, String }; @@ -68,7 +66,7 @@ class LiteralValue { std::optional m_numericValue; std::shared_ptr m_stringValue; }; -struct Literal { langutil::DebugData::ConstPtr debugData; LiteralKind kind; LiteralValue value; Type type; }; +struct Literal { langutil::DebugData::ConstPtr debugData; LiteralKind kind; LiteralValue value; }; /// External / internal identifier or label reference struct Identifier { langutil::DebugData::ConstPtr debugData; YulName name; }; /// Assignment ("x := mload(20:u256)", expects push-1-expression on the right hand @@ -82,11 +80,11 @@ struct FunctionCall { langutil::DebugData::ConstPtr debugData; Identifier functi /// Statement that contains only a single expression struct ExpressionStatement { langutil::DebugData::ConstPtr debugData; Expression expression; }; /// Block-scope variable declaration ("let x:u256 := mload(20:u256)"), non-hoisted -struct VariableDeclaration { langutil::DebugData::ConstPtr debugData; TypedNameList variables; std::unique_ptr value; }; +struct VariableDeclaration { langutil::DebugData::ConstPtr debugData; NameWithDebugDataList variables; std::unique_ptr value; }; /// Block that creates a scope (frees declared stack variables) struct Block { langutil::DebugData::ConstPtr debugData; std::vector statements; }; /// Function definition ("function f(a, b) -> (d, e) { ... }") -struct FunctionDefinition { langutil::DebugData::ConstPtr debugData; YulName name; TypedNameList parameters; TypedNameList returnVariables; Block body; }; +struct FunctionDefinition { langutil::DebugData::ConstPtr debugData; YulName name; NameWithDebugDataList parameters; NameWithDebugDataList returnVariables; Block body; }; /// Conditional execution without "else" part. struct If { langutil::DebugData::ConstPtr debugData; std::unique_ptr condition; Block body; }; /// Switch case or default case diff --git a/libyul/ASTForward.h b/libyul/ASTForward.h index f6fa09387739..8aba4f248c07 100644 --- a/libyul/ASTForward.h +++ b/libyul/ASTForward.h @@ -48,7 +48,7 @@ struct ExpressionStatement; struct Block; class AST; -struct TypedName; +struct NameWithDebugData; using Expression = std::variant; using Statement = std::variant; diff --git a/libyul/AsmAnalysis.cpp b/libyul/AsmAnalysis.cpp index 22ec8c9944f8..64630fa2bee9 100644 --- a/libyul/AsmAnalysis.cpp +++ b/libyul/AsmAnalysis.cpp @@ -109,9 +109,8 @@ AsmAnalysisInfo AsmAnalyzer::analyzeStrictAssertCorrect( return analysisInfo; } -std::vector AsmAnalyzer::operator()(Literal const& _literal) +size_t AsmAnalyzer::operator()(Literal const& _literal) { - expectValidType(_literal.type, nativeLocationOf(_literal)); bool erroneousLiteralValue = false; if (_literal.kind == LiteralKind::String && !_literal.value.unlimited() && _literal.value.hint() && _literal.value.hint()->size() > 32) { @@ -128,24 +127,14 @@ std::vector AsmAnalyzer::operator()(Literal const& _literal) m_errorReporter.typeError(6708_error, nativeLocationOf(_literal), "Number literal too large (> 256 bits)"); } - if (!m_dialect.validTypeForLiteral(_literal.kind, _literal.value, _literal.type)) - { - m_errorReporter.typeError( - 5170_error, - nativeLocationOf(_literal), - "Invalid type \"" + _literal.type.str() + "\" for literal \"" + formatLiteral(_literal) + "\"." - ); - } - yulAssert(erroneousLiteralValue ^ validLiteral(_literal), "Invalid literal after validating it through AsmAnalyzer."); - return {_literal.type}; + return 1; } -std::vector AsmAnalyzer::operator()(Identifier const& _identifier) +size_t AsmAnalyzer::operator()(Identifier const& _identifier) { yulAssert(!_identifier.name.empty(), ""); auto watcher = m_errorReporter.errorWatcher(); - YulName type = m_dialect.defaultType; if (m_currentScope->lookup(_identifier.name, GenericVisitor{ [&](Scope::Variable const& _var) @@ -156,7 +145,6 @@ std::vector AsmAnalyzer::operator()(Identifier const& _identifier) nativeLocationOf(_identifier), "Variable " + _identifier.name.str() + " used before it was declared." ); - type = _var.type; }, [&](Scope::Function const&) { @@ -193,21 +181,21 @@ std::vector AsmAnalyzer::operator()(Identifier const& _identifier) } - return {type}; + return 1; } void AsmAnalyzer::operator()(ExpressionStatement const& _statement) { auto watcher = m_errorReporter.errorWatcher(); - std::vector types = std::visit(*this, _statement.expression); - if (watcher.ok() && !types.empty()) + size_t numReturns = std::visit(*this, _statement.expression); + if (watcher.ok() && numReturns > 0) m_errorReporter.typeError( 3083_error, nativeLocationOf(_statement), "Top-level expressions are not supposed to return values (this expression returns " + - std::to_string(types.size()) + + std::to_string(numReturns) + " value" + - (types.size() == 1 ? "" : "s") + + (numReturns == 1 ? "" : "s") + "). Use ``pop()`` or assign them." ); } @@ -229,9 +217,9 @@ void AsmAnalyzer::operator()(Assignment const& _assignment) " occurs multiple times on the left-hand side of the assignment." ); - std::vector types = std::visit(*this, *_assignment.value); + size_t numRhsValues = std::visit(*this, *_assignment.value); - if (types.size() != numVariables) + if (numRhsValues != numVariables) m_errorReporter.declarationError( 8678_error, nativeLocationOf(_assignment), @@ -240,13 +228,12 @@ void AsmAnalyzer::operator()(Assignment const& _assignment) "\" does not match number of values (" + std::to_string(numVariables) + " vs. " + - std::to_string(types.size()) + + std::to_string(numRhsValues) + ")" ); for (size_t i = 0; i < numVariables; ++i) - if (i < types.size()) - checkAssignment(_assignment.variableNames[i], types[i]); + checkAssignment(_assignment.variableNames[i]); } void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl) @@ -263,13 +250,12 @@ void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl) for (auto const& variable: _varDecl.variables) { expectValidIdentifier(variable.name, nativeLocationOf(variable)); - expectValidType(variable.type, nativeLocationOf(variable)); } if (_varDecl.value) { - std::vector types = std::visit(*this, *_varDecl.value); - if (types.size() != numVariables) + size_t numValues = std::visit(*this, *_varDecl.value); + if (numValues != numVariables) m_errorReporter.declarationError( 3812_error, nativeLocationOf(_varDecl), @@ -278,26 +264,12 @@ void AsmAnalyzer::operator()(VariableDeclaration const& _varDecl) + "\": " + std::to_string(numVariables) + " variables and " + - std::to_string(types.size()) + + std::to_string(numValues) + " values." ); - - for (size_t i = 0; i < _varDecl.variables.size(); ++i) - { - YulName givenType = m_dialect.defaultType; - if (i < types.size()) - givenType = types[i]; - TypedName const& variable = _varDecl.variables[i]; - if (variable.type != givenType) - m_errorReporter.typeError( - 3947_error, - nativeLocationOf(variable), - "Assigning value of type \"" + givenType.str() + "\" to variable of type \"" + variable.type.str() + "\"." - ); - } } - for (TypedName const& variable: _varDecl.variables) + for (NameWithDebugData const& variable: _varDecl.variables) m_activeVariables.insert(&std::get( m_currentScope->identifiers.at(variable.name)) ); @@ -313,19 +285,18 @@ void AsmAnalyzer::operator()(FunctionDefinition const& _funDef) for (auto const& var: _funDef.parameters + _funDef.returnVariables) { expectValidIdentifier(var.name, nativeLocationOf(var)); - expectValidType(var.type, nativeLocationOf(var)); m_activeVariables.insert(&std::get(varScope.identifiers.at(var.name))); } (*this)(_funDef.body); } -std::vector AsmAnalyzer::operator()(FunctionCall const& _funCall) +size_t AsmAnalyzer::operator()(FunctionCall const& _funCall) { yulAssert(!_funCall.functionName.name.empty(), ""); auto watcher = m_errorReporter.errorWatcher(); - std::vector const* parameterTypes = nullptr; - std::vector const* returnTypes = nullptr; + std::optional numParameters; + std::optional numReturns; std::vector> const* literalArguments = nullptr; if (BuiltinFunction const* f = m_dialect.builtin(_funCall.functionName.name)) @@ -356,8 +327,8 @@ std::vector AsmAnalyzer::operator()(FunctionCall const& _funCall) "The use of transient storage for reentrancy guards that are cleared at the end of the call is safe." ); - parameterTypes = &f->parameters; - returnTypes = &f->returns; + numParameters = f->numParameters; + numReturns = f->numReturns; if (!f->literalArguments.empty()) literalArguments = &f->literalArguments; @@ -375,8 +346,8 @@ std::vector AsmAnalyzer::operator()(FunctionCall const& _funCall) }, [&](Scope::Function const& _fun) { - parameterTypes = &_fun.arguments; - returnTypes = &_fun.returns; + numParameters = _fun.numArguments; + numReturns = _fun.numReturns; } })) { @@ -399,17 +370,16 @@ std::vector AsmAnalyzer::operator()(FunctionCall const& _funCall) yulAssert(!watcher.ok(), "Expected a reported error."); } - if (parameterTypes && _funCall.arguments.size() != parameterTypes->size()) + if (numParameters && _funCall.arguments.size() != *numParameters) m_errorReporter.typeError( 7000_error, nativeLocationOf(_funCall.functionName), "Function \"" + _funCall.functionName.name.str() + "\" expects " + - std::to_string(parameterTypes->size()) + + std::to_string(*numParameters) + " arguments but got " + std::to_string(_funCall.arguments.size()) + "." ); - std::vector argTypes; for (size_t i = _funCall.arguments.size(); i > 0; i--) { Expression const& arg = _funCall.arguments[i - 1]; @@ -455,33 +425,28 @@ std::vector AsmAnalyzer::operator()(FunctionCall const& _funCall) "The \"verbatim_*\" builtins cannot be used with empty bytecode." ); } - argTypes.emplace_back(expectUnlimitedStringLiteral(std::get(arg))); + expectUnlimitedStringLiteral(std::get(arg)); continue; } } - argTypes.emplace_back(expectExpression(arg)); + expectExpression(arg); } - std::reverse(argTypes.begin(), argTypes.end()); - - if (parameterTypes && parameterTypes->size() == argTypes.size()) - for (size_t i = 0; i < parameterTypes->size(); ++i) - expectType((*parameterTypes)[i], argTypes[i], nativeLocationOf(_funCall.arguments[i])); if (watcher.ok()) { - yulAssert(parameterTypes && parameterTypes->size() == argTypes.size(), ""); - yulAssert(returnTypes, ""); - return *returnTypes; + yulAssert(numParameters && numParameters == _funCall.arguments.size()); + yulAssert(numReturns); + return *numReturns; } - else if (returnTypes) - return std::vector(returnTypes->size(), m_dialect.defaultType); + else if (numReturns) + return *numReturns; else return {}; } void AsmAnalyzer::operator()(If const& _if) { - expectBoolExpression(*_if.condition); + expectExpression(*_if.condition); (*this)(_if.body); } @@ -497,7 +462,7 @@ void AsmAnalyzer::operator()(Switch const& _switch) "\"switch\" statement with only a default case." ); - YulName valueType = expectExpression(*_switch.expression); + expectExpression(*_switch.expression); std::set cases; for (auto const& _case: _switch.cases) @@ -506,8 +471,6 @@ void AsmAnalyzer::operator()(Switch const& _switch) { auto watcher = m_errorReporter.errorWatcher(); - expectType(valueType, _case.value->type, nativeLocationOf(*_case.value)); - // We cannot use "expectExpression" here because *_case.value is not an // Expression and would be converted to an Expression otherwise. (*this)(*_case.value); @@ -539,7 +502,7 @@ void AsmAnalyzer::operator()(ForLoop const& _for) // condition, the body and the post part inside. m_currentScope = &scope(&_for.pre); - expectBoolExpression(*_for.condition); + expectExpression(*_for.condition); // backup outer for-loop & create new state auto outerForLoop = m_currentForLoop; m_currentForLoop = &_for; @@ -562,49 +525,30 @@ void AsmAnalyzer::operator()(Block const& _block) m_currentScope = previousScope; } -YulName AsmAnalyzer::expectExpression(Expression const& _expr) +void AsmAnalyzer::expectExpression(Expression const& _expr) { - std::vector types = std::visit(*this, _expr); - if (types.size() != 1) + size_t numValues = std::visit(*this, _expr); + if (numValues != 1) m_errorReporter.typeError( 3950_error, nativeLocationOf(_expr), "Expected expression to evaluate to one value, but got " + - std::to_string(types.size()) + + std::to_string(numValues) + " values instead." ); - return types.empty() ? m_dialect.defaultType : types.front(); } -YulName AsmAnalyzer::expectUnlimitedStringLiteral(Literal const& _literal) +void AsmAnalyzer::expectUnlimitedStringLiteral(Literal const& _literal) { yulAssert(_literal.kind == LiteralKind::String); - yulAssert(m_dialect.validTypeForLiteral(LiteralKind::String, _literal.value, _literal.type)); yulAssert(_literal.value.unlimited()); - - return {_literal.type}; -} - -void AsmAnalyzer::expectBoolExpression(Expression const& _expr) -{ - YulName type = expectExpression(_expr); - if (type != m_dialect.boolType) - m_errorReporter.typeError( - 1733_error, - nativeLocationOf(_expr), - "Expected a value of boolean type \"" + - m_dialect.boolType.str() + - "\" but got \"" + - type.str() + - "\"" - ); } -void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulName _valueType) +void AsmAnalyzer::checkAssignment(Identifier const& _variable) { yulAssert(!_variable.name.empty(), ""); auto watcher = m_errorReporter.errorWatcher(); - YulName const* variableType = nullptr; + bool hasVariable = false; bool found = false; if (Scope::Identifier const* var = m_currentScope->lookup(_variable.name)) { @@ -625,7 +569,7 @@ void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulName _valueTyp "Variable " + _variable.name.str() + " used before it was declared." ); else - variableType = &std::get(*var).type; + hasVariable = true; found = true; } else if (m_resolver) @@ -634,25 +578,15 @@ void AsmAnalyzer::checkAssignment(Identifier const& _variable, YulName _valueTyp if (m_resolver(_variable, yul::IdentifierContext::LValue, insideFunction)) { found = true; - variableType = &m_dialect.defaultType; + hasVariable = true; } } if (!found && watcher.ok()) // Only add message if the callback did not. m_errorReporter.declarationError(4634_error, nativeLocationOf(_variable), "Variable not found or variable not lvalue."); - if (variableType && *variableType != _valueType) - m_errorReporter.typeError( - 9547_error, - nativeLocationOf(_variable), - "Assigning a value of type \"" + - _valueType.str() + - "\" to a variable of type \"" + - variableType->str() + - "\"." - ); - yulAssert(!watcher.ok() || variableType, ""); + yulAssert(!watcher.ok() || hasVariable, ""); } Scope& AsmAnalyzer::scope(Block const* _block) @@ -688,26 +622,6 @@ void AsmAnalyzer::expectValidIdentifier(YulName _identifier, SourceLocation cons ); } -void AsmAnalyzer::expectValidType(YulName _type, SourceLocation const& _location) -{ - if (!m_dialect.types.count(_type)) - m_errorReporter.typeError( - 5473_error, - _location, - fmt::format("\"{}\" is not a valid type (user defined types are not yet supported).", _type.str()) - ); -} - -void AsmAnalyzer::expectType(YulName _expectedType, YulName _givenType, SourceLocation const& _location) -{ - if (_expectedType != _givenType) - m_errorReporter.typeError( - 3781_error, - _location, - fmt::format("Expected a value of type \"{}\" but got \"{}\".", _expectedType.str(), _givenType.str()) - ); -} - bool AsmAnalyzer::validateInstructions(std::string const& _instructionIdentifier, langutil::SourceLocation const& _location) { // NOTE: This function uses the default EVM version instead of the currently selected one. diff --git a/libyul/AsmAnalysis.h b/libyul/AsmAnalysis.h index d479a9970d71..64cab51f54c5 100644 --- a/libyul/AsmAnalysis.h +++ b/libyul/AsmAnalysis.h @@ -84,13 +84,13 @@ class AsmAnalyzer std::set const& _qualifiedDataNames ); - std::vector operator()(Literal const& _literal); - std::vector operator()(Identifier const&); + size_t operator()(Literal const& _literal); + size_t operator()(Identifier const&); void operator()(ExpressionStatement const&); void operator()(Assignment const& _assignment); void operator()(VariableDeclaration const& _variableDeclaration); void operator()(FunctionDefinition const& _functionDefinition); - std::vector operator()(FunctionCall const& _functionCall); + size_t operator()(FunctionCall const& _functionCall); void operator()(If const& _if); void operator()(Switch const& _switch); void operator()(ForLoop const& _forLoop); @@ -102,22 +102,16 @@ class AsmAnalyzer /// @returns the worst side effects encountered during analysis (including within defined functions). SideEffects const& sideEffects() const { return m_sideEffects; } private: - /// Visits the expression, expects that it evaluates to exactly one value and - /// returns the type. Reports errors on errors and returns the default type. - YulName expectExpression(Expression const& _expr); - YulName expectUnlimitedStringLiteral(Literal const& _literal); - /// Visits the expression and expects it to return a single boolean value. - /// Reports an error otherwise. - void expectBoolExpression(Expression const& _expr); - - /// Verifies that a variable to be assigned to exists, can be assigned to - /// and has the same type as the value. - void checkAssignment(Identifier const& _variable, YulName _valueType); + /// Visits the expression, expects that it evaluates to exactly one value. + /// Reports errors otherwise. + void expectExpression(Expression const& _expr); + void expectUnlimitedStringLiteral(Literal const& _literal); + + /// Verifies that a variable to be assigned to exists and can be assigned to. + void checkAssignment(Identifier const& _variable); Scope& scope(Block const* _block); void expectValidIdentifier(YulName _identifier, langutil::SourceLocation const& _location); - void expectValidType(YulName _type, langutil::SourceLocation const& _location); - void expectType(YulName _expectedType, YulName _givenType, langutil::SourceLocation const& _location); bool validateInstructions(evmasm::Instruction _instr, langutil::SourceLocation const& _location); bool validateInstructions(std::string const& _instrIdentifier, langutil::SourceLocation const& _location); diff --git a/libyul/AsmJsonConverter.cpp b/libyul/AsmJsonConverter.cpp index 60475497542a..226ac52a5ac8 100644 --- a/libyul/AsmJsonConverter.cpp +++ b/libyul/AsmJsonConverter.cpp @@ -37,12 +37,15 @@ Json AsmJsonConverter::operator()(Block const& _node) const return ret; } -Json AsmJsonConverter::operator()(TypedName const& _node) const +Json AsmJsonConverter::operator()(NameWithDebugData const& _node) const { yulAssert(!_node.name.empty(), "Invalid variable name."); Json ret = createAstNode(originLocationOf(_node), nativeLocationOf(_node), "YulTypedName"); ret["name"] = _node.name.str(); - ret["type"] = _node.type.str(); + // even though types are removed from Yul, we keep this field in the Json interface to not introduce + // a breaking change + // can be removed with the next breaking version + ret["type"] = ""; return ret; } @@ -63,7 +66,7 @@ Json AsmJsonConverter::operator()(Literal const& _node) const ret["hexValue"] = util::toHex(util::asBytes(formatLiteral(_node))); break; } - ret["type"] = _node.type.str(); + ret["type"] = ""; { auto const formattedLiteral = formatLiteral(_node); if (util::validateUTF8(formattedLiteral)) diff --git a/libyul/AsmJsonConverter.h b/libyul/AsmJsonConverter.h index 9c4b5d5e8ebc..523825830f46 100644 --- a/libyul/AsmJsonConverter.h +++ b/libyul/AsmJsonConverter.h @@ -44,7 +44,7 @@ class AsmJsonConverter: public boost::static_visitor explicit AsmJsonConverter(std::optional _sourceIndex): m_sourceIndex(_sourceIndex) {} Json operator()(Block const& _node) const; - Json operator()(TypedName const& _node) const; + Json operator()(NameWithDebugData const& _node) const; Json operator()(Literal const& _node) const; Json operator()(Identifier const& _node) const; Json operator()(Assignment const& _node) const; diff --git a/libyul/AsmJsonImporter.cpp b/libyul/AsmJsonImporter.cpp index 65ff22999b39..459d9d9becd5 100644 --- a/libyul/AsmJsonImporter.cpp +++ b/libyul/AsmJsonImporter.cpp @@ -74,12 +74,11 @@ Json AsmJsonImporter::member(Json const& _node, std::string const& _name) return _node[_name]; } -TypedName AsmJsonImporter::createTypedName(Json const& _node) +NameWithDebugData AsmJsonImporter::createNameWithDebugData(Json const& _node) { - auto typedName = createAsmNode(_node); - typedName.type = YulName{member(_node, "type").get()}; - typedName.name = YulName{member(_node, "name").get()}; - return typedName; + auto nameWithDebugData = createAsmNode(_node); + nameWithDebugData.name = YulName{member(_node, "name").get()}; + return nameWithDebugData; } Statement AsmJsonImporter::createStatement(Json const& _node) @@ -176,7 +175,16 @@ Literal AsmJsonImporter::createLiteral(Json const& _node) value = util::asString(util::fromHex(member(_node, "hexValue").get())); else value = member(_node, "value").get(); - lit.type = YulName{member(_node, "type").get()}; + { + auto const typeNode = member(_node, "type"); + yulAssert( + typeNode.empty() || typeNode.get().empty(), + fmt::format( + "Expected literal types to be either empty or absent in the JSON. Got \"{}\".", + typeNode.get() + ) + ); + } if (kind == "number") { langutil::CharStream charStream(value, ""); @@ -263,7 +271,7 @@ VariableDeclaration AsmJsonImporter::createVariableDeclaration(Json const& _node { auto varDec = createAsmNode(_node); for (auto const& var: member(_node, "variables")) - varDec.variables.emplace_back(createTypedName(var)); + varDec.variables.emplace_back(createNameWithDebugData(var)); if (_node.contains("value")) varDec.value = std::make_unique(createExpression(member(_node, "value"))); @@ -278,11 +286,11 @@ FunctionDefinition AsmJsonImporter::createFunctionDefinition(Json const& _node) if (_node.contains("parameters")) for (auto const& var: member(_node, "parameters")) - funcDef.parameters.emplace_back(createTypedName(var)); + funcDef.parameters.emplace_back(createNameWithDebugData(var)); if (_node.contains("returnVariables")) for (auto const& var: member(_node, "returnVariables")) - funcDef.returnVariables.emplace_back(createTypedName(var)); + funcDef.returnVariables.emplace_back(createNameWithDebugData(var)); funcDef.body = createBlock(member(_node, "body")); return funcDef; diff --git a/libyul/AsmJsonImporter.h b/libyul/AsmJsonImporter.h index d835e99e39a3..f3df8c178e9d 100644 --- a/libyul/AsmJsonImporter.h +++ b/libyul/AsmJsonImporter.h @@ -57,7 +57,7 @@ class AsmJsonImporter std::vector createStatementVector(Json const& _array); std::vector createExpressionVector(Json const& _array); - yul::TypedName createTypedName(Json const& _node); + yul::NameWithDebugData createNameWithDebugData(Json const& _node); yul::Literal createLiteral(Json const& _node); yul::Leave createLeave(Json const& _node); yul::Identifier createIdentifier(Json const& _node); diff --git a/libyul/AsmParser.cpp b/libyul/AsmParser.cpp index 6223a1a8e1c3..d41b41a36a42 100644 --- a/libyul/AsmParser.cpp +++ b/libyul/AsmParser.cpp @@ -567,18 +567,20 @@ std::variant Parser::parseLiteralOrIdentifier(bool _unlimit break; } + auto const literalLocation = currentLocation(); Literal literal{ createDebugData(), kind, - valueOfLiteral(currentLiteral(), kind, _unlimitedLiteralArgument && kind == LiteralKind::String), - kind == LiteralKind::Boolean ? m_dialect.boolType : m_dialect.defaultType + valueOfLiteral(currentLiteral(), kind, _unlimitedLiteralArgument && kind == LiteralKind::String) }; advance(); if (currentToken() == Token::Colon) { expectToken(Token::Colon); updateLocationEndFrom(literal.debugData, currentLocation()); - literal.type = expectAsmIdentifier(); + auto const typedLiteralLocation = SourceLocation::smallestCovering(literalLocation, currentLocation()); + std::ignore = expectAsmIdentifier(); + raiseUnsupportedTypesError(typedLiteralLocation); } return literal; @@ -599,7 +601,7 @@ VariableDeclaration Parser::parseVariableDeclaration() expectToken(Token::Let); while (true) { - varDecl.variables.emplace_back(parseTypedName()); + varDecl.variables.emplace_back(parseNameWithDebugData()); if (currentToken() == Token::Comma) expectToken(Token::Comma); else @@ -637,7 +639,7 @@ FunctionDefinition Parser::parseFunctionDefinition() expectToken(Token::LParen); while (currentToken() != Token::RParen) { - funDef.parameters.emplace_back(parseTypedName()); + funDef.parameters.emplace_back(parseNameWithDebugData()); if (currentToken() == Token::RParen) break; expectToken(Token::Comma); @@ -648,7 +650,7 @@ FunctionDefinition Parser::parseFunctionDefinition() expectToken(Token::RightArrow); while (true) { - funDef.returnVariables.emplace_back(parseTypedName()); + funDef.returnVariables.emplace_back(parseNameWithDebugData()); if (currentToken() == Token::LBrace) break; expectToken(Token::Comma); @@ -695,19 +697,20 @@ FunctionCall Parser::parseCall(std::variant&& _initialOp) return ret; } -TypedName Parser::parseTypedName() +NameWithDebugData Parser::parseNameWithDebugData() { RecursionGuard recursionGuard(*this); - TypedName typedName = createWithDebugData(); + NameWithDebugData typedName = createWithDebugData(); + auto const nameLocation = currentLocation(); typedName.name = expectAsmIdentifier(); if (currentToken() == Token::Colon) { expectToken(Token::Colon); updateLocationEndFrom(typedName.debugData, currentLocation()); - typedName.type = expectAsmIdentifier(); + auto const typedNameLocation = SourceLocation::smallestCovering(nameLocation, currentLocation()); + std::ignore = expectAsmIdentifier(); + raiseUnsupportedTypesError(typedNameLocation); } - else - typedName.type = m_dialect.defaultType; return typedName; } @@ -756,3 +759,8 @@ bool Parser::isValidNumberLiteral(std::string const& _literal) else return _literal.find_first_not_of("0123456789") == std::string::npos; } + +void Parser::raiseUnsupportedTypesError(SourceLocation const& _location) const +{ + m_errorReporter.parserError(5473_error, _location, "Types are not supported in untyped Yul."); +} diff --git a/libyul/AsmParser.h b/libyul/AsmParser.h index dd206b5b1ee8..d4616a2a9508 100644 --- a/libyul/AsmParser.h +++ b/libyul/AsmParser.h @@ -145,8 +145,9 @@ class Parser: public langutil::ParserBase VariableDeclaration parseVariableDeclaration(); FunctionDefinition parseFunctionDefinition(); FunctionCall parseCall(std::variant&& _initialOp); - TypedName parseTypedName(); + NameWithDebugData parseNameWithDebugData(); YulName expectAsmIdentifier(); + void raiseUnsupportedTypesError(langutil::SourceLocation const& _location) const; /// Reports an error if we are currently not inside the body part of a for loop. void checkBreakContinuePosition(std::string const& _which); diff --git a/libyul/AsmPrinter.cpp b/libyul/AsmPrinter.cpp index 6b840fcfeae4..5841fdfd3249 100644 --- a/libyul/AsmPrinter.cpp +++ b/libyul/AsmPrinter.cpp @@ -24,7 +24,6 @@ #include #include #include -#include #include #include @@ -53,14 +52,13 @@ std::string AsmPrinter::operator()(Literal const& _literal) switch (_literal.kind) { case LiteralKind::Number: - return locationComment + formattedValue + appendTypeName(_literal.type); case LiteralKind::Boolean: - return locationComment + formattedValue + appendTypeName(_literal.type, true); + return locationComment + formattedValue; case LiteralKind::String: break; } - return locationComment + escapeAndQuoteString(formattedValue) + appendTypeName(_literal.type); + return locationComment + escapeAndQuoteString(formattedValue); } std::string AsmPrinter::operator()(Identifier const& _identifier) @@ -95,7 +93,7 @@ std::string AsmPrinter::operator()(VariableDeclaration const& _variableDeclarati out += "let "; out += boost::algorithm::join( _variableDeclaration.variables | ranges::views::transform( - [this](TypedName argument) { return formatTypedName(argument); } + [this](NameWithDebugData argument) { return formatNameWithDebugData(argument); } ), ", " ); @@ -115,7 +113,7 @@ std::string AsmPrinter::operator()(FunctionDefinition const& _functionDefinition out += "function " + _functionDefinition.name.str() + "("; out += boost::algorithm::join( _functionDefinition.parameters | ranges::views::transform( - [this](TypedName argument) { return formatTypedName(argument); } + [this](NameWithDebugData argument) { return formatNameWithDebugData(argument); } ), ", " ); @@ -125,7 +123,7 @@ std::string AsmPrinter::operator()(FunctionDefinition const& _functionDefinition out += " -> "; out += boost::algorithm::join( _functionDefinition.returnVariables | ranges::views::transform( - [this](TypedName argument) { return formatTypedName(argument); } + [this](NameWithDebugData argument) { return formatNameWithDebugData(argument); } ), ", " ); @@ -237,30 +235,10 @@ std::string AsmPrinter::operator()(Block const& _block) } } -std::string AsmPrinter::formatTypedName(TypedName _variable) +std::string AsmPrinter::formatNameWithDebugData(NameWithDebugData _variable) { yulAssert(!_variable.name.empty(), "Invalid variable name."); - return formatDebugData(_variable) + _variable.name.str() + appendTypeName(_variable.type); -} - -std::string AsmPrinter::appendTypeName(YulName _type, bool _isBoolLiteral) const -{ - yulAssert( - m_typePrintingMode == TypePrinting::OmitDefault || m_typePrintingMode == TypePrinting::Full, - "unhandled printing mode" - ); - if (m_typePrintingMode == TypePrinting::OmitDefault && !_type.empty()) - { - if (!_isBoolLiteral && _type == m_dialect.defaultType) - _type = {}; - else if (_isBoolLiteral && _type == m_dialect.boolType && !m_dialect.defaultType.empty()) - // Special case: If we have a bool type but empty default type, do not remove the type. - _type = {}; - } - if (_type.empty()) - return {}; - else - return ":" + _type.str(); + return formatDebugData(_variable) + _variable.name.str(); } std::string AsmPrinter::formatSourceLocation( diff --git a/libyul/AsmPrinter.h b/libyul/AsmPrinter.h index 684ddaacf0d5..cc17c6a04ce3 100644 --- a/libyul/AsmPrinter.h +++ b/libyul/AsmPrinter.h @@ -36,31 +36,19 @@ namespace solidity::yul { -struct Dialect; /** * Converts a parsed Yul AST into readable string representation. * Ignores source locations. - * If a dialect is provided, the dialect's default type is omitted. */ class AsmPrinter { public: - enum class TypePrinting - { - OmitDefault, - Full - }; - explicit AsmPrinter( - TypePrinting const _typePrintingMode, - Dialect const& _dialect, std::optional>> _sourceIndexToName = {}, langutil::DebugInfoSelection const& _debugInfoSelection = langutil::DebugInfoSelection::Default(), langutil::CharStreamProvider const* _soliditySourceProvider = nullptr ): - m_typePrintingMode(_typePrintingMode), - m_dialect(_dialect), m_debugInfoSelection(_debugInfoSelection), m_soliditySourceProvider(_soliditySourceProvider) { @@ -92,8 +80,7 @@ class AsmPrinter ); private: - std::string formatTypedName(TypedName _variable); - std::string appendTypeName(YulName _type, bool _isBoolLiteral = false) const; + std::string formatNameWithDebugData(NameWithDebugData _variable); std::string formatDebugData(langutil::DebugData::ConstPtr const& _debugData, bool _statement); template std::string formatDebugData(T const& _node) @@ -102,8 +89,6 @@ class AsmPrinter return formatDebugData(_node.debugData, !isExpression); } - TypePrinting const m_typePrintingMode{}; - Dialect const& m_dialect; std::map m_nameToSourceIndex; langutil::SourceLocation m_lastLocation = {}; langutil::DebugInfoSelection m_debugInfoSelection = {}; diff --git a/libyul/CMakeLists.txt b/libyul/CMakeLists.txt index dbf3bfdcd6a1..d38d5f27004d 100644 --- a/libyul/CMakeLists.txt +++ b/libyul/CMakeLists.txt @@ -177,8 +177,6 @@ add_library(yul optimiser/Suite.h optimiser/SyntacticalEquality.cpp optimiser/SyntacticalEquality.h - optimiser/TypeInfo.cpp - optimiser/TypeInfo.h optimiser/UnusedFunctionParameterPruner.cpp optimiser/UnusedFunctionParameterPruner.h optimiser/UnusedFunctionsCommon.h diff --git a/libyul/Dialect.cpp b/libyul/Dialect.cpp index 8afd99a2288f..06a53ea5f74b 100644 --- a/libyul/Dialect.cpp +++ b/libyul/Dialect.cpp @@ -25,26 +25,7 @@ using namespace solidity::yul; using namespace solidity::langutil; -Literal Dialect::zeroLiteralForType(solidity::yul::YulName _type) const +Literal Dialect::zeroLiteral() const { - if (_type == boolType && _type != defaultType) - return {DebugData::create(), LiteralKind::Boolean, LiteralValue(false), _type}; - return {DebugData::create(), LiteralKind::Number, LiteralValue(0, std::nullopt), _type}; -} - - -Literal Dialect::trueLiteral() const -{ - if (boolType != defaultType) - return {DebugData::create(), LiteralKind::Boolean, LiteralValue(true), boolType}; - else - return {DebugData::create(), LiteralKind::Number, LiteralValue(1), defaultType}; -} - -bool Dialect::validTypeForLiteral(LiteralKind _kind, LiteralValue const&, YulName _type) const -{ - if (_kind == LiteralKind::Boolean) - return _type == boolType; - else - return true; + return {DebugData::create(), LiteralKind::Number, LiteralValue(0, std::nullopt)}; } diff --git a/libyul/Dialect.h b/libyul/Dialect.h index fcec5fe3f981..3589e953f60f 100644 --- a/libyul/Dialect.h +++ b/libyul/Dialect.h @@ -32,7 +32,6 @@ namespace solidity::yul { -using Type = YulName; enum class LiteralKind; class LiteralValue; struct Literal; @@ -40,8 +39,8 @@ struct Literal; struct BuiltinFunction { YulName name; - std::vector parameters; - std::vector returns; + size_t numParameters; + size_t numReturns; SideEffects sideEffects; ControlFlowSideEffects controlFlowSideEffects; /// If true, this is the msize instruction or might contain it. @@ -61,34 +60,23 @@ struct Dialect Dialect(Dialect const&) = delete; Dialect& operator=(Dialect const&) = delete; - /// Default type, can be omitted. - YulName defaultType; - /// Type used for the literals "true" and "false". - YulName boolType; - std::set types = {{}}; - /// @returns the builtin function of the given name or a nullptr if it is not a builtin function. virtual BuiltinFunction const* builtin(YulName /*_name*/) const { return nullptr; } /// @returns true if the identifier is reserved. This includes the builtins too. virtual bool reservedIdentifier(YulName _name) const { return builtin(_name) != nullptr; } - virtual BuiltinFunction const* discardFunction(YulName /* _type */) const { return nullptr; } - virtual BuiltinFunction const* equalityFunction(YulName /* _type */) const { return nullptr; } + virtual BuiltinFunction const* discardFunction() const { return nullptr; } + virtual BuiltinFunction const* equalityFunction() const { return nullptr; } virtual BuiltinFunction const* booleanNegationFunction() const { return nullptr; } - virtual BuiltinFunction const* memoryStoreFunction(YulName /* _type */) const { return nullptr; } - virtual BuiltinFunction const* memoryLoadFunction(YulName /* _type */) const { return nullptr; } - virtual BuiltinFunction const* storageStoreFunction(YulName /* _type */) const { return nullptr; } - virtual BuiltinFunction const* storageLoadFunction(YulName /* _type */) const { return nullptr; } - virtual YulName hashFunction(YulName /* _type */ ) const { return YulName{}; } - - /// Check whether the given type is legal for the given literal value. - /// Should only be called if the type exists in the dialect at all. - virtual bool validTypeForLiteral(LiteralKind _kind, LiteralValue const& _value, YulName _type) const; + virtual BuiltinFunction const* memoryStoreFunction() const { return nullptr; } + virtual BuiltinFunction const* memoryLoadFunction() const { return nullptr; } + virtual BuiltinFunction const* storageStoreFunction() const { return nullptr; } + virtual BuiltinFunction const* storageLoadFunction() const { return nullptr; } + virtual YulName hashFunction() const { return YulName{}; } - virtual Literal zeroLiteralForType(YulName _type) const; - virtual Literal trueLiteral() const; + Literal zeroLiteral() const; virtual std::set fixedFunctionNames() const { return {}; } diff --git a/libyul/Object.cpp b/libyul/Object.cpp index 57c783b83f39..c6ba5311ad5c 100644 --- a/libyul/Object.cpp +++ b/libyul/Object.cpp @@ -38,14 +38,12 @@ using namespace solidity::langutil; using namespace solidity::util; using namespace solidity::yul; -std::string Data::toString(Dialect const&, AsmPrinter::TypePrinting, DebugInfoSelection const&, CharStreamProvider const*) const +std::string Data::toString(DebugInfoSelection const&, CharStreamProvider const*) const { return "data \"" + name + "\" hex\"" + util::toHex(data) + "\""; } std::string Object::toString( - Dialect const& _dialect, - AsmPrinter::TypePrinting const _printingMode, DebugInfoSelection const& _debugInfoSelection, CharStreamProvider const* _soliditySourceProvider ) const @@ -54,15 +52,13 @@ std::string Object::toString( yulAssert(debugData, "No debug data"); std::string inner = "code " + AsmPrinter( - _printingMode, - _dialect, debugData->sourceNames, _debugInfoSelection, _soliditySourceProvider )(code()->root()); for (auto const& obj: subObjects) - inner += "\n" + obj->toString(_dialect, _printingMode, _debugInfoSelection, _soliditySourceProvider); + inner += "\n" + obj->toString(_debugInfoSelection, _soliditySourceProvider); return debugData->formatUseSrcComment() + diff --git a/libyul/Object.h b/libyul/Object.h index fa9ef96eebc7..230f97866e09 100644 --- a/libyul/Object.h +++ b/libyul/Object.h @@ -54,8 +54,6 @@ struct ObjectNode /// Can be empty since .yul files can also just contain code, without explicitly placing it in an object. std::string name; virtual std::string toString( - Dialect const& _dialect, - AsmPrinter::TypePrinting printingMode, langutil::DebugInfoSelection const& _debugInfoSelection, langutil::CharStreamProvider const* _soliditySourceProvider ) const = 0; @@ -72,8 +70,6 @@ struct Data: public ObjectNode bytes data; std::string toString( - Dialect const& _dialect, - AsmPrinter::TypePrinting printingMode, langutil::DebugInfoSelection const& _debugInfoSelection, langutil::CharStreamProvider const* _soliditySourceProvider ) const override; @@ -97,8 +93,6 @@ struct Object: public ObjectNode public: /// @returns a (parseable) string representation. std::string toString( - Dialect const& _dialect, - AsmPrinter::TypePrinting printingMode = AsmPrinter::TypePrinting::Full, langutil::DebugInfoSelection const& _debugInfoSelection = langutil::DebugInfoSelection::Default(), langutil::CharStreamProvider const* _soliditySourceProvider = nullptr ) const override; diff --git a/libyul/ObjectOptimizer.cpp b/libyul/ObjectOptimizer.cpp index eaaac97d56a4..3694367c5e32 100644 --- a/libyul/ObjectOptimizer.cpp +++ b/libyul/ObjectOptimizer.cpp @@ -142,8 +142,6 @@ std::optional ObjectOptimizer::calculateCacheKey( ) { AsmPrinter asmPrinter( - AsmPrinter::TypePrinting::OmitDefault, - languageToDialect(_settings.language, _settings.evmVersion), _debugData.sourceNames, DebugInfoSelection::All() ); diff --git a/libyul/Scope.cpp b/libyul/Scope.cpp index 89bdfc674c56..a73b2f9fd07e 100644 --- a/libyul/Scope.cpp +++ b/libyul/Scope.cpp @@ -25,22 +25,21 @@ using namespace solidity; using namespace solidity::yul; using namespace solidity::util; -bool Scope::registerVariable(YulName _name, YulType const& _type) +bool Scope::registerVariable(YulName _name) { if (exists(_name)) return false; Variable variable; - variable.type = _type; variable.name = _name; identifiers[_name] = variable; return true; } -bool Scope::registerFunction(YulName _name, std::vector _arguments, std::vector _returns) +bool Scope::registerFunction(YulName _name, size_t _numArguments, size_t _numReturns) { if (exists(_name)) return false; - identifiers[_name] = Function{std::move(_arguments), std::move(_returns), _name}; + identifiers[_name] = Function{_numArguments, _numReturns, _name}; return true; } diff --git a/libyul/Scope.h b/libyul/Scope.h index 027597290063..20850cc56f09 100644 --- a/libyul/Scope.h +++ b/libyul/Scope.h @@ -35,27 +35,24 @@ namespace solidity::yul struct Scope { - using YulType = YulName; - struct Variable { - YulType type; YulName name; }; struct Function { - std::vector arguments; - std::vector returns; + size_t numArguments; + size_t numReturns; YulName name; }; using Identifier = std::variant; - bool registerVariable(YulName _name, YulType const& _type); + bool registerVariable(YulName _name); bool registerFunction( YulName _name, - std::vector _arguments, - std::vector _returns + size_t _numArguments, + size_t _numReturns ); /// Looks up the identifier in this or super scopes and returns a valid pointer if found diff --git a/libyul/ScopeFiller.cpp b/libyul/ScopeFiller.cpp index 22c0d17e3289..7d65a2e95519 100644 --- a/libyul/ScopeFiller.cpp +++ b/libyul/ScopeFiller.cpp @@ -133,9 +133,9 @@ bool ScopeFiller::operator()(Block const& _block) return success; } -bool ScopeFiller::registerVariable(TypedName const& _name, SourceLocation const& _location, Scope& _scope) +bool ScopeFiller::registerVariable(NameWithDebugData const& _name, SourceLocation const& _location, Scope& _scope) { - if (!_scope.registerVariable(_name.name, _name.type)) + if (!_scope.registerVariable(_name.name)) { //@TODO secondary location m_errorReporter.declarationError( @@ -150,13 +150,7 @@ bool ScopeFiller::registerVariable(TypedName const& _name, SourceLocation const& bool ScopeFiller::registerFunction(FunctionDefinition const& _funDef) { - std::vector parameters; - for (auto const& parameter: _funDef.parameters) - parameters.emplace_back(parameter.type); - std::vector returns; - for (auto const& returnVariable: _funDef.returnVariables) - returns.emplace_back(returnVariable.type); - if (!m_currentScope->registerFunction(_funDef.name, std::move(parameters), std::move(returns))) + if (!m_currentScope->registerFunction(_funDef.name, _funDef.parameters.size(), _funDef.returnVariables.size())) { //@TODO secondary location m_errorReporter.declarationError( diff --git a/libyul/ScopeFiller.h b/libyul/ScopeFiller.h index b43910874337..7a4834a483a5 100644 --- a/libyul/ScopeFiller.h +++ b/libyul/ScopeFiller.h @@ -35,7 +35,7 @@ struct SourceLocation; namespace solidity::yul { -struct TypedName; +struct NameWithDebugData; struct Scope; struct AsmAnalysisInfo; @@ -65,7 +65,7 @@ class ScopeFiller private: bool registerVariable( - TypedName const& _name, + NameWithDebugData const& _name, langutil::SourceLocation const& _location, Scope& _scope ); diff --git a/libyul/Utilities.cpp b/libyul/Utilities.cpp index 6a78441cba2a..4bbfb42437b0 100644 --- a/libyul/Utilities.cpp +++ b/libyul/Utilities.cpp @@ -219,8 +219,8 @@ bool solidity::yul::validBoolLiteral(solidity::yul::Literal const& _literal) template<> bool Less::operator()(Literal const& _lhs, Literal const& _rhs) const { - if (std::make_tuple(_lhs.kind, _lhs.type) != std::make_tuple(_rhs.kind, _rhs.type)) - return std::make_tuple(_lhs.kind, _lhs.type) < std::make_tuple(_rhs.kind, _rhs.type); + if (_lhs.kind != _rhs.kind) + return _lhs.kind < _rhs.kind; if (_lhs.value.unlimited() && _rhs.value.unlimited()) yulAssert( diff --git a/libyul/YulStack.cpp b/libyul/YulStack.cpp index eac84ae3a13e..1f57eda48cb3 100644 --- a/libyul/YulStack.cpp +++ b/libyul/YulStack.cpp @@ -351,8 +351,6 @@ std::string YulStack::print( yulAssert(m_parserResult, ""); yulAssert(m_parserResult->hasCode(), ""); return m_parserResult->toString( - languageToDialect(m_language, m_evmVersion), - AsmPrinter::TypePrinting::OmitDefault, m_debugInfoSelection, _soliditySourceProvider ) + "\n"; diff --git a/libyul/backends/evm/ConstantOptimiser.cpp b/libyul/backends/evm/ConstantOptimiser.cpp index 2ab77f84e92d..1bb23cbc9282 100644 --- a/libyul/backends/evm/ConstantOptimiser.cpp +++ b/libyul/backends/evm/ConstantOptimiser.cpp @@ -179,7 +179,7 @@ Representation const& RepresentationFinder::findRepresentation(u256 const& _valu Representation RepresentationFinder::represent(u256 const& _value) const { Representation repr; - repr.expression = std::make_unique(Literal{m_debugData, LiteralKind::Number, LiteralValue{_value, formatNumber(_value)}, {}}); + repr.expression = std::make_unique(Literal{m_debugData, LiteralKind::Number, LiteralValue{_value, formatNumber(_value)}}); repr.cost = m_meter.costs(*repr.expression); return repr; } diff --git a/libyul/backends/evm/ControlFlowGraphBuilder.cpp b/libyul/backends/evm/ControlFlowGraphBuilder.cpp index b4d1cdf15c3a..46ef933ba28e 100644 --- a/libyul/backends/evm/ControlFlowGraphBuilder.cpp +++ b/libyul/backends/evm/ControlFlowGraphBuilder.cpp @@ -268,7 +268,7 @@ StackSlot ControlFlowGraphBuilder::operator()(FunctionCall const& _call) void ControlFlowGraphBuilder::operator()(VariableDeclaration const& _varDecl) { yulAssert(m_currentBlock, ""); - auto declaredVariables = _varDecl.variables | ranges::views::transform([&](TypedName const& _var) { + auto declaredVariables = _varDecl.variables | ranges::views::transform([&](NameWithDebugData const& _var) { return VariableSlot{lookupVariable(_var.name), _var.debugData}; }) | ranges::to>; Stack input; @@ -337,7 +337,7 @@ void ControlFlowGraphBuilder::operator()(Switch const& _switch) auto ghostVariableId = m_graph.ghostVariables.size(); YulName ghostVariableName("GHOST[" + std::to_string(ghostVariableId) + "]"); - auto& ghostVar = m_graph.ghostVariables.emplace_back(Scope::Variable{""_yulname, ghostVariableName}); + auto& ghostVar = m_graph.ghostVariables.emplace_back(Scope::Variable{ghostVariableName}); // Artificially generate: // let := @@ -349,7 +349,7 @@ void ControlFlowGraphBuilder::operator()(Switch const& _switch) CFG::Assignment{_switch.debugData, {ghostVarSlot}} }); - BuiltinFunction const* equalityBuiltin = m_dialect.equalityFunction({}); + BuiltinFunction const* equalityBuiltin = m_dialect.equalityFunction(); yulAssert(equalityBuiltin, ""); // Artificially generate: @@ -527,7 +527,7 @@ Stack const& ControlFlowGraphBuilder::visitFunctionCall(FunctionCall const& _cal // input std::move(inputs), // output - ranges::views::iota(0u, builtin->returns.size()) | ranges::views::transform([&](size_t _i) { + ranges::views::iota(0u, builtin->numReturns) | ranges::views::transform([&](size_t _i) { return TemporarySlot{_call, _i}; }) | ranges::to, // operation @@ -548,7 +548,7 @@ Stack const& ControlFlowGraphBuilder::visitFunctionCall(FunctionCall const& _cal // input std::move(inputs), // output - ranges::views::iota(0u, function.returns.size()) | ranges::views::transform([&](size_t _i) { + ranges::views::iota(0u, function.numReturns) | ranges::views::transform([&](size_t _i) { return TemporarySlot{_call, _i}; }) | ranges::to, // operation diff --git a/libyul/backends/evm/EVMCodeTransform.cpp b/libyul/backends/evm/EVMCodeTransform.cpp index 71872a4e8c57..694639565421 100644 --- a/libyul/backends/evm/EVMCodeTransform.cpp +++ b/libyul/backends/evm/EVMCodeTransform.cpp @@ -56,7 +56,7 @@ CodeTransform::CodeTransform( ExternalIdentifierAccess::CodeGenerator _identifierAccessCodeGen, UseNamedLabels _useNamedLabelsForFunctions, std::shared_ptr _context, - std::vector _delayedReturnVariables, + std::vector _delayedReturnVariables, std::optional _functionExitLabel ): m_assembly(_assembly), @@ -249,13 +249,13 @@ void CodeTransform::operator()(FunctionCall const& _call) [&](Scope::Function& _function) { function = &_function; } }), "Function name not found."); yulAssert(function, ""); - yulAssert(function->arguments.size() == _call.arguments.size(), ""); + yulAssert(function->numArguments == _call.arguments.size(), ""); for (auto const& arg: _call.arguments | ranges::views::reverse) visitExpression(arg); m_assembly.setSourceLocation(originLocationOf(_call)); m_assembly.appendJumpTo( functionEntryID(*function), - static_cast(function->returns.size()) - static_cast(function->arguments.size()) - 1, + static_cast(function->numReturns) - static_cast(function->numArguments) - 1, AbstractAssembly::JumpType::IntoFunction ); m_assembly.appendLabel(returnLabel); @@ -646,10 +646,10 @@ void CodeTransform::setupReturnVariablesAndFunctionExit() } // Allocate slots for return variables as if they were declared as variables in the virtual function scope. - for (TypedName const& var: m_delayedReturnVariables) + for (NameWithDebugData const& var: m_delayedReturnVariables) (*this)(VariableDeclaration{var.debugData, {var}, {}}); - m_functionExitStackHeight = ranges::max(m_delayedReturnVariables | ranges::views::transform([&](TypedName const& _name) { + m_functionExitStackHeight = ranges::max(m_delayedReturnVariables | ranges::views::transform([&](NameWithDebugData const& _name) { return variableStackHeight(_name.name); })) + 1; m_delayedReturnVariables.clear(); @@ -658,7 +658,7 @@ void CodeTransform::setupReturnVariablesAndFunctionExit() namespace { -bool statementNeedsReturnVariableSetup(Statement const& _statement, std::vector const& _returnVariables) +bool statementNeedsReturnVariableSetup(Statement const& _statement, std::vector const& _returnVariables) { if (std::holds_alternative(_statement)) return true; @@ -668,7 +668,7 @@ bool statementNeedsReturnVariableSetup(Statement const& _statement, std::vector< ) { std::map references = VariableReferencesCounter::countReferences(_statement); - auto isReferenced = [&references](TypedName const& _returnVariable) { + auto isReferenced = [&references](NameWithDebugData const& _returnVariable) { return references.count(_returnVariable.name); }; if (ranges::none_of(_returnVariables, isReferenced)) diff --git a/libyul/backends/evm/EVMCodeTransform.h b/libyul/backends/evm/EVMCodeTransform.h index 0e6a9d8be1db..c0bbac81b35e 100644 --- a/libyul/backends/evm/EVMCodeTransform.h +++ b/libyul/backends/evm/EVMCodeTransform.h @@ -114,7 +114,7 @@ class CodeTransform ExternalIdentifierAccess::CodeGenerator _identifierAccessCodeGen, UseNamedLabels _useNamedLabelsForFunctions, std::shared_ptr _context, - std::vector _delayedReturnVariables, + std::vector _delayedReturnVariables, std::optional _functionExitLabel ); @@ -209,7 +209,7 @@ class CodeTransform std::set m_unusedStackSlots; /// A list of return variables for which no stack slots have been assigned yet. - std::vector m_delayedReturnVariables; + std::vector m_delayedReturnVariables; /// Function exit label. Used as jump target for ``leave``. std::optional m_functionExitLabel; diff --git a/libyul/backends/evm/EVMDialect.cpp b/libyul/backends/evm/EVMDialect.cpp index aeb825304009..dd5cad1dd700 100644 --- a/libyul/backends/evm/EVMDialect.cpp +++ b/libyul/backends/evm/EVMDialect.cpp @@ -50,8 +50,8 @@ std::pair createEVMFunction( evmasm::InstructionInfo info = evmasm::instructionInfo(_instruction, _evmVersion); BuiltinFunctionForEVM f; f.name = YulName{_name}; - f.parameters.resize(static_cast(info.args)); - f.returns.resize(static_cast(info.ret)); + f.numParameters = static_cast(info.args); + f.numReturns = static_cast(info.ret); f.sideEffects = EVMDialect::sideEffectsOfInstruction(_instruction); if (evmasm::SemanticInformation::terminatesControlFlow(_instruction)) { @@ -96,8 +96,8 @@ std::pair createFunction( YulName name{std::move(_name)}; BuiltinFunctionForEVM f; f.name = name; - f.parameters.resize(_params); - f.returns.resize(_returns); + f.numParameters = _params; + f.numReturns = _returns; f.sideEffects = std::move(_sideEffects); f.literalArguments = std::move(_literalArguments); f.isMSize = false; diff --git a/libyul/backends/evm/EVMDialect.h b/libyul/backends/evm/EVMDialect.h index 89df944966f0..3627a7fea9b7 100644 --- a/libyul/backends/evm/EVMDialect.h +++ b/libyul/backends/evm/EVMDialect.h @@ -33,7 +33,6 @@ namespace solidity::yul { -using Type = YulName; struct FunctionCall; struct Object; @@ -74,14 +73,14 @@ struct EVMDialect: public Dialect /// @returns true if the identifier is reserved. This includes the builtins too. bool reservedIdentifier(YulName _name) const override; - BuiltinFunctionForEVM const* discardFunction(YulName /*_type*/) const override { return builtin("pop"_yulname); } - BuiltinFunctionForEVM const* equalityFunction(YulName /*_type*/) const override { return builtin("eq"_yulname); } + BuiltinFunctionForEVM const* discardFunction() const override { return builtin("pop"_yulname); } + BuiltinFunctionForEVM const* equalityFunction() const override { return builtin("eq"_yulname); } BuiltinFunctionForEVM const* booleanNegationFunction() const override { return builtin("iszero"_yulname); } - BuiltinFunctionForEVM const* memoryStoreFunction(YulName /*_type*/) const override { return builtin("mstore"_yulname); } - BuiltinFunctionForEVM const* memoryLoadFunction(YulName /*_type*/) const override { return builtin("mload"_yulname); } - BuiltinFunctionForEVM const* storageStoreFunction(YulName /*_type*/) const override { return builtin("sstore"_yulname); } - BuiltinFunctionForEVM const* storageLoadFunction(YulName /*_type*/) const override { return builtin("sload"_yulname); } - YulName hashFunction(YulName /*_type*/) const override { return "keccak256"_yulname; } + BuiltinFunctionForEVM const* memoryStoreFunction() const override { return builtin("mstore"_yulname); } + BuiltinFunctionForEVM const* memoryLoadFunction() const override { return builtin("mload"_yulname); } + BuiltinFunctionForEVM const* storageStoreFunction() const override { return builtin("sstore"_yulname); } + BuiltinFunctionForEVM const* storageLoadFunction() const override { return builtin("sload"_yulname); } + YulName hashFunction() const override { return "keccak256"_yulname; } static EVMDialect const& strictAssemblyForEVM(langutil::EVMVersion _version); static EVMDialect const& strictAssemblyForEVMObjects(langutil::EVMVersion _version); diff --git a/libyul/backends/evm/NoOutputAssembly.cpp b/libyul/backends/evm/NoOutputAssembly.cpp index 71818d2482f4..04324fa06204 100644 --- a/libyul/backends/evm/NoOutputAssembly.cpp +++ b/libyul/backends/evm/NoOutputAssembly.cpp @@ -134,7 +134,7 @@ NoOutputEVMDialect::NoOutputEVMDialect(EVMDialect const& _copyFrom): { for (auto& fun: m_functions) { - size_t returns = fun.second.returns.size(); + size_t returns = fun.second.numReturns; fun.second.generateCode = [=](FunctionCall const& _call, AbstractAssembly& _assembly, BuiltinContext&) { for (size_t i: ranges::views::iota(0u, _call.arguments.size())) diff --git a/libyul/backends/evm/OptimizedEVMCodeTransform.cpp b/libyul/backends/evm/OptimizedEVMCodeTransform.cpp index 7690cf27ca06..8ef01f0b6a86 100644 --- a/libyul/backends/evm/OptimizedEVMCodeTransform.cpp +++ b/libyul/backends/evm/OptimizedEVMCodeTransform.cpp @@ -70,7 +70,7 @@ void OptimizedEVMCodeTransform::operator()(CFG::FunctionCall const& _call) // Validate stack. { yulAssert(m_assembly.stackHeight() == static_cast(m_stack.size()), ""); - yulAssert(m_stack.size() >= _call.function.get().arguments.size() + (_call.canContinue ? 1 : 0), ""); + yulAssert(m_stack.size() >= _call.function.get().numArguments + (_call.canContinue ? 1 : 0), ""); // Assert that we got the correct arguments on stack for the call. for (auto&& [arg, slot]: ranges::zip_view( _call.functionCall.get().arguments | ranges::views::reverse, @@ -92,7 +92,7 @@ void OptimizedEVMCodeTransform::operator()(CFG::FunctionCall const& _call) m_assembly.setSourceLocation(originLocationOf(_call)); m_assembly.appendJumpTo( getFunctionLabel(_call.function), - static_cast(_call.function.get().returns.size()) - static_cast(_call.function.get().arguments.size()) - (_call.canContinue ? 1 : 0), + static_cast(_call.function.get().numReturns) - static_cast(_call.function.get().numArguments) - (_call.canContinue ? 1 : 0), AbstractAssembly::JumpType::IntoFunction ); if (_call.canContinue) @@ -102,10 +102,10 @@ void OptimizedEVMCodeTransform::operator()(CFG::FunctionCall const& _call) // Update stack. { // Remove arguments and return label from m_stack. - for (size_t i = 0; i < _call.function.get().arguments.size() + (_call.canContinue ? 1 : 0); ++i) + for (size_t i = 0; i < _call.function.get().numArguments + (_call.canContinue ? 1 : 0); ++i) m_stack.pop_back(); // Push return values to m_stack. - for (size_t index: ranges::views::iota(0u, _call.function.get().returns.size())) + for (size_t index: ranges::views::iota(0u, _call.function.get().numReturns)) m_stack.emplace_back(TemporarySlot{_call.functionCall, index}); yulAssert(m_assembly.stackHeight() == static_cast(m_stack.size()), ""); } @@ -147,7 +147,7 @@ void OptimizedEVMCodeTransform::operator()(CFG::BuiltinCall const& _call) for (size_t i = 0; i < _call.arguments; ++i) m_stack.pop_back(); // Push return values to m_stack. - for (size_t index: ranges::views::iota(0u, _call.builtin.get().returns.size())) + for (size_t index: ranges::views::iota(0u, _call.builtin.get().numReturns)) m_stack.emplace_back(TemporarySlot{_call.functionCall, index}); yulAssert(m_assembly.stackHeight() == static_cast(m_stack.size()), ""); } @@ -196,8 +196,8 @@ OptimizedEVMCodeTransform::OptimizedEVMCodeTransform( functionLabels[&functionInfo] = useNamedLabel ? m_assembly.namedLabel( function->name.str(), - function->arguments.size(), - function->returns.size(), + function->numArguments, + function->numReturns, functionInfo.debugData ? functionInfo.debugData->astID : std::nullopt ) : m_assembly.newLabelId(); diff --git a/libyul/optimiser/ASTCopier.cpp b/libyul/optimiser/ASTCopier.cpp index 8efe29613e93..269c7adeedff 100644 --- a/libyul/optimiser/ASTCopier.cpp +++ b/libyul/optimiser/ASTCopier.cpp @@ -163,9 +163,9 @@ Literal ASTCopier::translate(Literal const& _literal) return _literal; } -TypedName ASTCopier::translate(TypedName const& _typedName) +NameWithDebugData ASTCopier::translate(NameWithDebugData const& _typedName) { - return TypedName{_typedName.debugData, translateIdentifier(_typedName.name), _typedName.type}; + return NameWithDebugData{_typedName.debugData, translateIdentifier(_typedName.name)}; } YulName FunctionCopier::translateIdentifier(YulName _name) diff --git a/libyul/optimiser/ASTCopier.h b/libyul/optimiser/ASTCopier.h index 88d2a34510ad..04b1c96cd2e1 100644 --- a/libyul/optimiser/ASTCopier.h +++ b/libyul/optimiser/ASTCopier.h @@ -100,7 +100,7 @@ class ASTCopier: public ExpressionCopier, public StatementCopier Case translate(Case const& _case); virtual Identifier translate(Identifier const& _identifier); Literal translate(Literal const& _literal); - TypedName translate(TypedName const& _typedName); + NameWithDebugData translate(NameWithDebugData const& _typedName); virtual void enterScope(Block const&) { } virtual void leaveScope(Block const&) { } diff --git a/libyul/optimiser/BlockHasher.cpp b/libyul/optimiser/BlockHasher.cpp index 9d6db206675f..5470558ce93a 100644 --- a/libyul/optimiser/BlockHasher.cpp +++ b/libyul/optimiser/BlockHasher.cpp @@ -48,7 +48,6 @@ void ASTHasherBase::hashLiteral(solidity::yul::Literal const& _literal) hash64(std::hash{}(_literal.value.value())); else hash64(std::hash{}(_literal.value.builtinStringLiteralValue())); - hash64(_literal.type.hash()); hash8(_literal.value.unlimited()); } diff --git a/libyul/optimiser/ConditionalSimplifier.cpp b/libyul/optimiser/ConditionalSimplifier.cpp index a2656fed390e..f81933f41c6f 100644 --- a/libyul/optimiser/ConditionalSimplifier.cpp +++ b/libyul/optimiser/ConditionalSimplifier.cpp @@ -84,7 +84,7 @@ void ConditionalSimplifier::operator()(Block& _block) Assignment{ debugData, {Identifier{debugData, condition}}, - std::make_unique(m_dialect.zeroLiteralForType(m_dialect.boolType)) + std::make_unique(m_dialect.zeroLiteral()) } ); } diff --git a/libyul/optimiser/ControlFlowSimplifier.cpp b/libyul/optimiser/ControlFlowSimplifier.cpp index 9d56583a0611..c078885e8ba4 100644 --- a/libyul/optimiser/ControlFlowSimplifier.cpp +++ b/libyul/optimiser/ControlFlowSimplifier.cpp @@ -18,7 +18,6 @@ #include #include #include -#include #include #include #include @@ -72,8 +71,7 @@ void removeEmptyCasesFromSwitch(Switch& _switchStmt) void ControlFlowSimplifier::run(OptimiserStepContext& _context, Block& _ast) { - TypeInfo typeInfo(_context.dialect, _ast); - ControlFlowSimplifier{_context.dialect, typeInfo}(_ast); + ControlFlowSimplifier{_context.dialect}(_ast); } void ControlFlowSimplifier::operator()(Block& _block) @@ -138,12 +136,12 @@ void ControlFlowSimplifier::simplify(std::vector& _statements) GenericVisitor visitor{ VisitorFallback{}, [&](If& _ifStmt) -> OptionalStatements { - if (_ifStmt.body.statements.empty() && m_dialect.discardFunction(m_dialect.boolType)) + if (_ifStmt.body.statements.empty() && m_dialect.discardFunction()) { OptionalStatements s = std::vector{}; s->emplace_back(makeDiscardCall( _ifStmt.debugData, - *m_dialect.discardFunction(m_dialect.boolType), + *m_dialect.discardFunction(), std::move(*_ifStmt.condition) )); return s; @@ -180,7 +178,7 @@ OptionalStatements ControlFlowSimplifier::reduceNoCaseSwitch(Switch& _switchStmt { yulAssert(_switchStmt.cases.empty(), "Expected no case!"); BuiltinFunction const* discardFunction = - m_dialect.discardFunction(m_typeInfo.typeOf(*_switchStmt.expression)); + m_dialect.discardFunction(); if (!discardFunction) return {}; @@ -197,16 +195,15 @@ OptionalStatements ControlFlowSimplifier::reduceSingleCaseSwitch(Switch& _switch auto& switchCase = _switchStmt.cases.front(); langutil::DebugData::ConstPtr debugData = debugDataOf(*_switchStmt.expression); - YulName type = m_typeInfo.typeOf(*_switchStmt.expression); if (switchCase.value) { - if (!m_dialect.equalityFunction(type)) + if (!m_dialect.equalityFunction()) return {}; return make_vector(If{ std::move(_switchStmt.debugData), std::make_unique(FunctionCall{ debugData, - Identifier{debugData, m_dialect.equalityFunction(type)->name}, + Identifier{debugData, m_dialect.equalityFunction()->name}, {std::move(*switchCase.value), std::move(*_switchStmt.expression)} }), std::move(switchCase.body) @@ -214,13 +211,13 @@ OptionalStatements ControlFlowSimplifier::reduceSingleCaseSwitch(Switch& _switch } else { - if (!m_dialect.discardFunction(type)) + if (!m_dialect.discardFunction()) return {}; return make_vector( makeDiscardCall( debugData, - *m_dialect.discardFunction(type), + *m_dialect.discardFunction(), std::move(*_switchStmt.expression) ), std::move(switchCase.body) diff --git a/libyul/optimiser/ControlFlowSimplifier.h b/libyul/optimiser/ControlFlowSimplifier.h index 3ebbe7c9aeee..86ebf296c290 100644 --- a/libyul/optimiser/ControlFlowSimplifier.h +++ b/libyul/optimiser/ControlFlowSimplifier.h @@ -24,7 +24,6 @@ namespace solidity::yul { struct Dialect; struct OptimiserStepContext; -class TypeInfo; /** * Simplifies several control-flow structures: @@ -63,9 +62,8 @@ class ControlFlowSimplifier: public ASTModifier void visit(Statement& _st) override; private: - ControlFlowSimplifier(Dialect const& _dialect, TypeInfo const& _typeInfo): - m_dialect(_dialect), - m_typeInfo(_typeInfo) + explicit ControlFlowSimplifier(Dialect const& _dialect): + m_dialect(_dialect) {} void simplify(std::vector& _statements); @@ -74,7 +72,6 @@ class ControlFlowSimplifier: public ASTModifier std::optional> reduceSingleCaseSwitch(Switch& _switchStmt) const; Dialect const& m_dialect; - TypeInfo const& m_typeInfo; size_t m_numBreakStatements = 0; size_t m_numContinueStatements = 0; }; diff --git a/libyul/optimiser/DataFlowAnalyzer.cpp b/libyul/optimiser/DataFlowAnalyzer.cpp index a51ca912399d..bf8952355d1f 100644 --- a/libyul/optimiser/DataFlowAnalyzer.cpp +++ b/libyul/optimiser/DataFlowAnalyzer.cpp @@ -54,13 +54,13 @@ DataFlowAnalyzer::DataFlowAnalyzer( { if (m_analyzeStores) { - if (auto const* builtin = _dialect.memoryStoreFunction(YulName{})) + if (auto const* builtin = _dialect.memoryStoreFunction()) m_storeFunctionName[static_cast(StoreLoadLocation::Memory)] = builtin->name; - if (auto const* builtin = _dialect.memoryLoadFunction(YulName{})) + if (auto const* builtin = _dialect.memoryLoadFunction()) m_loadFunctionName[static_cast(StoreLoadLocation::Memory)] = builtin->name; - if (auto const* builtin = _dialect.storageStoreFunction(YulName{})) + if (auto const* builtin = _dialect.storageStoreFunction()) m_storeFunctionName[static_cast(StoreLoadLocation::Storage)] = builtin->name; - if (auto const* builtin = _dialect.storageLoadFunction(YulName{})) + if (auto const* builtin = _dialect.storageLoadFunction()) m_loadFunctionName[static_cast(StoreLoadLocation::Storage)] = builtin->name; } } @@ -446,7 +446,7 @@ std::optional DataFlowAnalyzer::isSimpleLoad( std::optional> DataFlowAnalyzer::isKeccak(Expression const& _expression) const { if (FunctionCall const* funCall = std::get_if(&_expression)) - if (funCall->functionName.name == m_dialect.hashFunction({})) + if (funCall->functionName.name == m_dialect.hashFunction()) if (Identifier const* start = std::get_if(&funCall->arguments.at(0))) if (Identifier const* length = std::get_if(&funCall->arguments.at(1))) return std::make_pair(start->name, length->name); diff --git a/libyul/optimiser/DataFlowAnalyzer.h b/libyul/optimiser/DataFlowAnalyzer.h index 6b23a86b9c9d..5a4b199caefd 100644 --- a/libyul/optimiser/DataFlowAnalyzer.h +++ b/libyul/optimiser/DataFlowAnalyzer.h @@ -217,7 +217,7 @@ class DataFlowAnalyzer: public ASTModifier }; /// Special expression whose address will be used in m_value. /// YulName does not need to be reset because DataFlowAnalyzer is short-lived. - Expression const m_zero{Literal{{}, LiteralKind::Number, LiteralValue{0, "0"}, {}}}; + Expression const m_zero{Literal{{}, LiteralKind::Number, LiteralValue{0, std::nullopt}}}; /// List of scopes. std::vector m_variableScopes; }; diff --git a/libyul/optimiser/ExpressionSimplifier.cpp b/libyul/optimiser/ExpressionSimplifier.cpp index 482ade8f87d5..598d2e90037d 100644 --- a/libyul/optimiser/ExpressionSimplifier.cpp +++ b/libyul/optimiser/ExpressionSimplifier.cpp @@ -60,7 +60,7 @@ void ExpressionSimplifier::visit(Expression& _expression) !knownToBeZero(startArgument) && !std::holds_alternative(startArgument) ) - startArgument = Literal{debugDataOf(startArgument), LiteralKind::Number, LiteralValue{0, "0"}, {}}; + startArgument = Literal{debugDataOf(startArgument), LiteralKind::Number, LiteralValue{0, std::nullopt}}; } } diff --git a/libyul/optimiser/ExpressionSplitter.cpp b/libyul/optimiser/ExpressionSplitter.cpp index acaa40dbf0e1..9f9bf958f129 100644 --- a/libyul/optimiser/ExpressionSplitter.cpp +++ b/libyul/optimiser/ExpressionSplitter.cpp @@ -23,7 +23,6 @@ #include #include -#include #include #include @@ -37,8 +36,7 @@ using namespace solidity::langutil; void ExpressionSplitter::run(OptimiserStepContext& _context, Block& _ast) { - TypeInfo typeInfo(_context.dialect, _ast); - ExpressionSplitter{_context.dialect, _context.dispenser, typeInfo}(_ast); + ExpressionSplitter{_context.dialect, _context.dispenser}(_ast); } void ExpressionSplitter::operator()(FunctionCall& _funCall) @@ -100,13 +98,11 @@ void ExpressionSplitter::outlineExpression(Expression& _expr) langutil::DebugData::ConstPtr debugData = debugDataOf(_expr); YulName var = m_nameDispenser.newName({}); - YulName type = m_typeInfo.typeOf(_expr); m_statementsToPrefix.emplace_back(VariableDeclaration{ debugData, - {{TypedName{debugData, var, type}}}, + {{NameWithDebugData{debugData, var}}}, std::make_unique(std::move(_expr)) }); _expr = Identifier{debugData, var}; - m_typeInfo.setVariableType(var, type); } diff --git a/libyul/optimiser/ExpressionSplitter.h b/libyul/optimiser/ExpressionSplitter.h index bbde8d6a2df0..0b223e9859b2 100644 --- a/libyul/optimiser/ExpressionSplitter.h +++ b/libyul/optimiser/ExpressionSplitter.h @@ -33,7 +33,6 @@ namespace solidity::yul struct Dialect; struct OptimiserStepContext; -class TypeInfo; /** * Optimiser component that modifies an AST in place, turning complex @@ -71,12 +70,10 @@ class ExpressionSplitter: public ASTModifier private: explicit ExpressionSplitter( Dialect const& _dialect, - NameDispenser& _nameDispenser, - TypeInfo& _typeInfo + NameDispenser& _nameDispenser ): m_dialect(_dialect), - m_nameDispenser(_nameDispenser), - m_typeInfo(_typeInfo) + m_nameDispenser(_nameDispenser) { } /// Replaces the expression by a variable if it is a function call or functional @@ -89,7 +86,6 @@ class ExpressionSplitter: public ASTModifier std::vector m_statementsToPrefix; Dialect const& m_dialect; NameDispenser& m_nameDispenser; - TypeInfo& m_typeInfo; }; } diff --git a/libyul/optimiser/ForLoopConditionIntoBody.cpp b/libyul/optimiser/ForLoopConditionIntoBody.cpp index df9847376af7..d0839e765ee8 100644 --- a/libyul/optimiser/ForLoopConditionIntoBody.cpp +++ b/libyul/optimiser/ForLoopConditionIntoBody.cpp @@ -58,8 +58,7 @@ void ForLoopConditionIntoBody::operator()(ForLoop& _forLoop) Literal { debugData, LiteralKind::Boolean, - LiteralValue{true}, - m_dialect.boolType + LiteralValue{true} } ); } diff --git a/libyul/optimiser/FullInliner.cpp b/libyul/optimiser/FullInliner.cpp index 5cdde8f0fdd5..2f138761fc66 100644 --- a/libyul/optimiser/FullInliner.cpp +++ b/libyul/optimiser/FullInliner.cpp @@ -298,14 +298,14 @@ std::vector InlineModifier::performInline(Statement& _statement, Func // helper function to create a new variable that is supposed to model // an existing variable. - auto newVariable = [&](TypedName const& _existingVariable, Expression* _value) { + auto newVariable = [&](NameWithDebugData const& _existingVariable, Expression* _value) { YulName newName = m_nameDispenser.newName(_existingVariable.name); variableReplacements[_existingVariable.name] = newName; - VariableDeclaration varDecl{_funCall.debugData, {{_funCall.debugData, newName, _existingVariable.type}}, {}}; + VariableDeclaration varDecl{_funCall.debugData, {{_funCall.debugData, newName}}, {}}; if (_value) varDecl.value = std::make_unique(std::move(*_value)); else - varDecl.value = std::make_unique(m_dialect.zeroLiteralForType(varDecl.variables.front().type)); + varDecl.value = std::make_unique(m_dialect.zeroLiteral()); newStatements.emplace_back(std::move(varDecl)); }; diff --git a/libyul/optimiser/FunctionSpecializer.cpp b/libyul/optimiser/FunctionSpecializer.cpp index 49da50032dfe..cb7cd4164b03 100644 --- a/libyul/optimiser/FunctionSpecializer.cpp +++ b/libyul/optimiser/FunctionSpecializer.cpp @@ -104,7 +104,7 @@ FunctionDefinition FunctionSpecializer::specialize( missingVariableDeclarations.emplace_back( VariableDeclaration{ _f.debugData, - std::vector{newFunction.parameters[index]}, + std::vector{newFunction.parameters[index]}, std::make_unique(std::move(*argument)) } ); diff --git a/libyul/optimiser/LoadResolver.cpp b/libyul/optimiser/LoadResolver.cpp index a7ee5dd0b92c..98d938a3621e 100644 --- a/libyul/optimiser/LoadResolver.cpp +++ b/libyul/optimiser/LoadResolver.cpp @@ -62,7 +62,7 @@ void LoadResolver::visit(Expression& _e) tryResolve(_e, StoreLoadLocation::Memory, funCall->arguments); else if (funCall->functionName.name == m_loadFunctionName[static_cast(StoreLoadLocation::Storage)]) tryResolve(_e, StoreLoadLocation::Storage, funCall->arguments); - else if (!m_containsMSize && funCall->functionName.name == m_dialect.hashFunction({})) + else if (!m_containsMSize && funCall->functionName.name == m_dialect.hashFunction()) { Identifier const* start = std::get_if(&funCall->arguments.at(0)); Identifier const* length = std::get_if(&funCall->arguments.at(1)); @@ -125,8 +125,7 @@ void LoadResolver::tryEvaluateKeccak( {}, LiteralKind::Number, // a dummy 256-bit number to represent the Keccak256 hash. - LiteralValue{std::numeric_limits::max()}, - {} + LiteralValue{std::numeric_limits::max()} } ); @@ -150,8 +149,7 @@ void LoadResolver::tryEvaluateKeccak( _e = Literal{ debugDataOf(_e), LiteralKind::Number, - LiteralValue{contentHash}, - m_dialect.defaultType + LiteralValue{contentHash} }; } } diff --git a/libyul/optimiser/NameDisplacer.cpp b/libyul/optimiser/NameDisplacer.cpp index fd813fbfc2f1..c68d52f9a7bb 100644 --- a/libyul/optimiser/NameDisplacer.cpp +++ b/libyul/optimiser/NameDisplacer.cpp @@ -33,7 +33,7 @@ void NameDisplacer::operator()(Identifier& _identifier) void NameDisplacer::operator()(VariableDeclaration& _varDecl) { - for (TypedName& var: _varDecl.variables) + for (NameWithDebugData& var: _varDecl.variables) checkAndReplaceNew(var.name); ASTModifier::operator()(_varDecl); diff --git a/libyul/optimiser/NameSimplifier.cpp b/libyul/optimiser/NameSimplifier.cpp index f03a448f0d92..d57a61332e3e 100644 --- a/libyul/optimiser/NameSimplifier.cpp +++ b/libyul/optimiser/NameSimplifier.cpp @@ -53,9 +53,9 @@ void NameSimplifier::operator()(VariableDeclaration& _varDecl) ASTModifier::operator()(_varDecl); } -void NameSimplifier::renameVariables(std::vector& _variables) +void NameSimplifier::renameVariables(std::vector& _variables) { - for (TypedName& typedName: _variables) + for (NameWithDebugData& typedName: _variables) translate(typedName.name); } diff --git a/libyul/optimiser/NameSimplifier.h b/libyul/optimiser/NameSimplifier.h index 848e61f567ac..0ff5077cc694 100644 --- a/libyul/optimiser/NameSimplifier.h +++ b/libyul/optimiser/NameSimplifier.h @@ -60,7 +60,7 @@ class NameSimplifier: public ASTModifier NameSimplifier(OptimiserStepContext& _context, Block const& _ast); /// Tries to rename a list of variables. - void renameVariables(std::vector& _variables); + void renameVariables(std::vector& _variables); void findSimplification(YulName const& _name); void translate(YulName& _name); diff --git a/libyul/optimiser/SSATransform.cpp b/libyul/optimiser/SSATransform.cpp index 80abdf7e6516..1d5270f8f497 100644 --- a/libyul/optimiser/SSATransform.cpp +++ b/libyul/optimiser/SSATransform.cpp @@ -28,8 +28,6 @@ #include -#include - using namespace solidity; using namespace solidity::yul; using namespace solidity::langutil; @@ -46,12 +44,10 @@ class IntroduceSSA: public ASTModifier public: explicit IntroduceSSA( NameDispenser& _nameDispenser, - std::set const& _variablesToReplace, - TypeInfo& _typeInfo + std::set const& _variablesToReplace ): m_nameDispenser(_nameDispenser), - m_variablesToReplace(_variablesToReplace), - m_typeInfo(_typeInfo) + m_variablesToReplace(_variablesToReplace) { } void operator()(Block& _block) override; @@ -59,7 +55,6 @@ class IntroduceSSA: public ASTModifier private: NameDispenser& m_nameDispenser; std::set const& m_variablesToReplace; - TypeInfo const& m_typeInfo; }; @@ -87,15 +82,15 @@ void IntroduceSSA::operator()(Block& _block) langutil::DebugData::ConstPtr debugData = varDecl.debugData; std::vector statements; statements.emplace_back(VariableDeclaration{debugData, {}, std::move(varDecl.value)}); - TypedNameList newVariables; + NameWithDebugDataList newVariables; for (auto const& var: varDecl.variables) { YulName oldName = var.name; YulName newName = m_nameDispenser.newName(oldName); - newVariables.emplace_back(TypedName{debugData, newName, var.type}); + newVariables.emplace_back(NameWithDebugData{debugData, newName}); statements.emplace_back(VariableDeclaration{ debugData, - {TypedName{debugData, oldName, var.type}}, + {NameWithDebugData{debugData, oldName}}, std::make_unique(Identifier{debugData, newName}) }); } @@ -114,15 +109,12 @@ void IntroduceSSA::operator()(Block& _block) langutil::DebugData::ConstPtr debugData = assignment.debugData; std::vector statements; statements.emplace_back(VariableDeclaration{debugData, {}, std::move(assignment.value)}); - TypedNameList newVariables; + NameWithDebugDataList newVariables; for (auto const& var: assignment.variableNames) { YulName oldName = var.name; YulName newName = m_nameDispenser.newName(oldName); - newVariables.emplace_back(TypedName{debugData, - newName, - m_typeInfo.typeOfVariable(oldName) - }); + newVariables.emplace_back(NameWithDebugData{debugData, newName}); statements.emplace_back(Assignment{ debugData, {Identifier{debugData, oldName}}, @@ -148,12 +140,10 @@ class IntroduceControlFlowSSA: public ASTModifier public: explicit IntroduceControlFlowSSA( NameDispenser& _nameDispenser, - std::set const& _variablesToReplace, - TypeInfo const& _typeInfo + std::set const& _variablesToReplace ): m_nameDispenser(_nameDispenser), - m_variablesToReplace(_variablesToReplace), - m_typeInfo(_typeInfo) + m_variablesToReplace(_variablesToReplace) { } void operator()(FunctionDefinition& _function) override; @@ -168,7 +158,6 @@ class IntroduceControlFlowSSA: public ASTModifier std::set m_variablesInScope; /// Variables that do not have a specific value. util::UniqueVector m_variablesToReassign; - TypeInfo const& m_typeInfo; }; void IntroduceControlFlowSSA::operator()(FunctionDefinition& _function) @@ -232,7 +221,7 @@ void IntroduceControlFlowSSA::operator()(Block& _block) YulName newName = m_nameDispenser.newName(toReassign); toPrepend.emplace_back(VariableDeclaration{ debugDataOf(_s), - {TypedName{debugDataOf(_s), newName, m_typeInfo.typeOfVariable(toReassign)}}, + {NameWithDebugData{debugDataOf(_s), newName}}, std::make_unique(Identifier{debugDataOf(_s), toReassign}) }); assignedVariables.pushBack(toReassign); @@ -379,10 +368,9 @@ void PropagateValues::operator()(Block& _block) void SSATransform::run(OptimiserStepContext& _context, Block& _ast) { - TypeInfo typeInfo(_context.dialect, _ast); std::set assignedVariables = assignedVariableNames(_ast); - IntroduceSSA{_context.dispenser, assignedVariables, typeInfo}(_ast); - IntroduceControlFlowSSA{_context.dispenser, assignedVariables, typeInfo}(_ast); + IntroduceSSA{_context.dispenser, assignedVariables}(_ast); + IntroduceControlFlowSSA{_context.dispenser, assignedVariables}(_ast); PropagateValues{assignedVariables}(_ast); } diff --git a/libyul/optimiser/SSAValueTracker.h b/libyul/optimiser/SSAValueTracker.h index 0196ecc40e99..2448f99a84c4 100644 --- a/libyul/optimiser/SSAValueTracker.h +++ b/libyul/optimiser/SSAValueTracker.h @@ -57,7 +57,7 @@ class SSAValueTracker: public ASTWalker /// Special expression whose address will be used in m_values. /// YulName does not need to be reset because SSAValueTracker is short-lived. - Expression const m_zero{Literal{{}, LiteralKind::Number, LiteralValue(u256{0}), {}}}; + Expression const m_zero{Literal{{}, LiteralKind::Number, LiteralValue(u256{0})}}; std::map m_values; }; diff --git a/libyul/optimiser/SimplificationRules.cpp b/libyul/optimiser/SimplificationRules.cpp index 03e4ccdd0eda..72c0f70ca281 100644 --- a/libyul/optimiser/SimplificationRules.cpp +++ b/libyul/optimiser/SimplificationRules.cpp @@ -241,7 +241,7 @@ Expression Pattern::toExpression(langutil::DebugData::ConstPtr const& _debugData if (m_kind == PatternKind::Constant) { assertThrow(m_data, OptimizerException, "No match group and no constant value given."); - return Literal{_debugData, LiteralKind::Number, LiteralValue{*m_data, formatNumber(*m_data)}, {}}; + return Literal{_debugData, LiteralKind::Number, LiteralValue{*m_data, formatNumber(*m_data)}}; } else if (m_kind == PatternKind::Operation) { diff --git a/libyul/optimiser/StackLimitEvader.cpp b/libyul/optimiser/StackLimitEvader.cpp index 6e6da63e603b..d3cb6418fd30 100644 --- a/libyul/optimiser/StackLimitEvader.cpp +++ b/libyul/optimiser/StackLimitEvader.cpp @@ -77,7 +77,7 @@ struct MemoryOffsetAllocator size_t totalArgCount = functionDefinition->returnVariables.size() + functionDefinition->parameters.size(); totalArgCount > 16 ) - for (TypedName const& var: ranges::concat_view( + for (NameWithDebugData const& var: ranges::concat_view( functionDefinition->parameters, functionDefinition->returnVariables ) | ranges::views::take(totalArgCount - 16)) diff --git a/libyul/optimiser/StackToMemoryMover.cpp b/libyul/optimiser/StackToMemoryMover.cpp index 7ec57903482f..7e3f93475f80 100644 --- a/libyul/optimiser/StackToMemoryMover.cpp +++ b/libyul/optimiser/StackToMemoryMover.cpp @@ -42,14 +42,14 @@ std::vector generateMemoryStore( Expression _value ) { - BuiltinFunction const* memoryStoreFunction = _dialect.memoryStoreFunction(_dialect.defaultType); + BuiltinFunction const* memoryStoreFunction = _dialect.memoryStoreFunction(); yulAssert(memoryStoreFunction, ""); std::vector result; result.emplace_back(ExpressionStatement{_debugData, FunctionCall{ _debugData, Identifier{_debugData, memoryStoreFunction->name}, { - Literal{_debugData, LiteralKind::Number, _mpos, {}}, + Literal{_debugData, LiteralKind::Number, _mpos}, std::move(_value) } }}); @@ -58,7 +58,7 @@ std::vector generateMemoryStore( FunctionCall generateMemoryLoad(Dialect const& _dialect, langutil::DebugData::ConstPtr const& _debugData, LiteralValue const& _mpos) { - BuiltinFunction const* memoryLoadFunction = _dialect.memoryLoadFunction(_dialect.defaultType); + BuiltinFunction const* memoryLoadFunction = _dialect.memoryLoadFunction(); yulAssert(memoryLoadFunction, ""); return FunctionCall{ _debugData, @@ -66,8 +66,7 @@ FunctionCall generateMemoryLoad(Dialect const& _dialect, langutil::DebugData::Co Literal{ _debugData, LiteralKind::Number, - _mpos, - {} + _mpos } } }; @@ -91,7 +90,7 @@ void StackToMemoryMover::run( util::mapTuple([](YulName _name, FunctionDefinition const* _funDef) { return make_pair(_name, _funDef->returnVariables); }), - std::map{} + std::map{} ) ); stackToMemoryMover(_block); @@ -101,7 +100,7 @@ void StackToMemoryMover::run( StackToMemoryMover::StackToMemoryMover( OptimiserStepContext& _context, VariableMemoryOffsetTracker const& _memoryOffsetTracker, - std::map _functionReturnVariables + std::map _functionReturnVariables ): m_context(_context), m_memoryOffsetTracker(_memoryOffsetTracker), @@ -124,7 +123,7 @@ void StackToMemoryMover::operator()(FunctionDefinition& _functionDefinition) std::vector memoryVariableInits; // All function parameters with a memory slot are moved at the beginning of the function body. - for (TypedName const& param: _functionDefinition.parameters) + for (NameWithDebugData const& param: _functionDefinition.parameters) if (auto slot = m_memoryOffsetTracker(param.name)) memoryVariableInits += generateMemoryStore( m_context.dialect, @@ -134,21 +133,21 @@ void StackToMemoryMover::operator()(FunctionDefinition& _functionDefinition) ); // All memory return variables have to be initialized to zero in memory. - for (TypedName const& returnVariable: _functionDefinition.returnVariables) + for (NameWithDebugData const& returnVariable: _functionDefinition.returnVariables) if (auto slot = m_memoryOffsetTracker(returnVariable.name)) memoryVariableInits += generateMemoryStore( m_context.dialect, returnVariable.debugData, *slot, - Literal{returnVariable.debugData, LiteralKind::Number, LiteralValue(u256{0}), {}} + Literal{returnVariable.debugData, LiteralKind::Number, LiteralValue(u256{0})} ); // Special case of a function with a single return argument that needs to move to memory. if (_functionDefinition.returnVariables.size() == 1 && m_memoryOffsetTracker(_functionDefinition.returnVariables.front().name)) { - TypedNameList stackParameters = _functionDefinition.parameters | ranges::views::filter( + NameWithDebugDataList stackParameters = _functionDefinition.parameters | ranges::views::filter( std::not_fn(m_memoryOffsetTracker) - ) | ranges::to; + ) | ranges::to; // Generate new function without return variable and with only the non-moved parameters. YulName newFunctionName = m_context.dispenser.newName(_functionDefinition.name); m_newFunctionDefinitions.emplace_back(FunctionDefinition{ @@ -160,7 +159,7 @@ void StackToMemoryMover::operator()(FunctionDefinition& _functionDefinition) }); // Generate new names for the arguments to maintain disambiguation. std::map newArgumentNames; - for (TypedName const& _var: stackParameters) + for (NameWithDebugData const& _var: stackParameters) newArgumentNames[_var.name] = m_context.dispenser.newName(_var.name); for (auto& parameter: _functionDefinition.parameters) parameter.name = util::valueOrDefault(newArgumentNames, parameter.name, parameter.name); @@ -171,7 +170,7 @@ void StackToMemoryMover::operator()(FunctionDefinition& _functionDefinition) FunctionCall{ _functionDefinition.debugData, Identifier{_functionDefinition.debugData, newFunctionName}, - stackParameters | ranges::views::transform([&](TypedName const& _arg) { + stackParameters | ranges::views::transform([&](NameWithDebugData const& _arg) { return Expression{Identifier{_arg.debugData, newArgumentNames.at(_arg.name)}}; }) | ranges::to> } @@ -193,7 +192,7 @@ void StackToMemoryMover::operator()(FunctionDefinition& _functionDefinition) _functionDefinition.returnVariables = _functionDefinition.returnVariables | ranges::views::filter( std::not_fn(m_memoryOffsetTracker) - ) | ranges::to; + ) | ranges::to; } void StackToMemoryMover::operator()(Block& _block) @@ -214,7 +213,7 @@ void StackToMemoryMover::operator()(Block& _block) m_context.dialect, debugData, *offset, - _stmt.value ? *std::move(_stmt.value) : Literal{debugData, LiteralKind::Number, LiteralValue(u256{0}), {}} + _stmt.value ? *std::move(_stmt.value) : Literal{debugData, LiteralKind::Number, LiteralValue(u256{0})} ); else return {}; @@ -256,7 +255,7 @@ void StackToMemoryMover::operator()(Block& _block) else { YulName tempVarName = m_nameDispenser.newName(lhsVar.name); - tempDecl.variables.emplace_back(TypedName{lhsVar.debugData, tempVarName, {}}); + tempDecl.variables.emplace_back(NameWithDebugData{lhsVar.debugData, tempVarName}); rhs = std::make_unique(Identifier{debugData, tempVarName}); } @@ -322,7 +321,7 @@ std::optional StackToMemoryMover::VariableMemoryOffsetTracker::ope return std::nullopt; } -std::optional StackToMemoryMover::VariableMemoryOffsetTracker::operator()(TypedName const& _variable) const +std::optional StackToMemoryMover::VariableMemoryOffsetTracker::operator()(NameWithDebugData const& _variable) const { return (*this)(_variable.name); } diff --git a/libyul/optimiser/StackToMemoryMover.h b/libyul/optimiser/StackToMemoryMover.h index 7392660311bf..89f11c1fe4f8 100644 --- a/libyul/optimiser/StackToMemoryMover.h +++ b/libyul/optimiser/StackToMemoryMover.h @@ -169,7 +169,7 @@ class StackToMemoryMover: ASTModifier std::optional operator()(YulName const& _variable) const; /// @returns a YulName containing the memory offset to be assigned to @a _variable as number literal /// or std::nullopt if the variable should not be moved. - std::optional operator()(TypedName const& _variable) const; + std::optional operator()(NameWithDebugData const& _variable) const; /// @returns a YulName containing the memory offset to be assigned to @a _variable as number literal /// or std::nullopt if the variable should not be moved. std::optional operator()(Identifier const& _variable) const; @@ -187,14 +187,14 @@ class StackToMemoryMover: ASTModifier StackToMemoryMover( OptimiserStepContext& _context, VariableMemoryOffsetTracker const& _memoryOffsetTracker, - std::map> _functionReturnVariables + std::map> _functionReturnVariables ); OptimiserStepContext& m_context; VariableMemoryOffsetTracker const& m_memoryOffsetTracker; NameDispenser& m_nameDispenser; /// Map from function names to the return variables of the function with that name. - std::map> m_functionReturnVariables; + std::map> m_functionReturnVariables; /// List of functions generated while running this step that are to be appended to the code in the end. std::list m_newFunctionDefinitions; }; diff --git a/libyul/optimiser/Suite.cpp b/libyul/optimiser/Suite.cpp index a06f48a7f236..d7043e42f30f 100644 --- a/libyul/optimiser/Suite.cpp +++ b/libyul/optimiser/Suite.cpp @@ -520,7 +520,7 @@ void OptimiserSuite::runSequence(std::vector const& _steps, Block& else { std::cout << "== Running " << step << " changed the AST." << std::endl; - std::cout << AsmPrinter{AsmPrinter::TypePrinting::Full, m_context.dialect}(_ast) << std::endl; + std::cout << AsmPrinter{}(_ast) << std::endl; copy = std::make_unique(std::get(ASTCopier{}(_ast))); } } diff --git a/libyul/optimiser/SyntacticalEquality.cpp b/libyul/optimiser/SyntacticalEquality.cpp index db562716a2ff..0f4aa6e337e1 100644 --- a/libyul/optimiser/SyntacticalEquality.cpp +++ b/libyul/optimiser/SyntacticalEquality.cpp @@ -67,9 +67,6 @@ bool SyntacticallyEqual::expressionEqual(Literal const& _lhs, Literal const& _rh yulAssert(validLiteral(_lhs), "Invalid lhs literal during syntactical equality check"); yulAssert(validLiteral(_rhs), "Invalid rhs literal during syntactical equality check"); - if (_lhs.type != _rhs.type) - return false; - return _lhs.value == _rhs.value; } @@ -93,14 +90,14 @@ bool SyntacticallyEqual::statementEqual(VariableDeclaration const& _lhs, Variabl // first visit expression, then variable declarations if (!compareUniquePtr(_lhs.value, _rhs.value)) return false; - return util::containerEqual(_lhs.variables, _rhs.variables, [this](TypedName const& _lhsVarName, TypedName const& _rhsVarName) -> bool { + return util::containerEqual(_lhs.variables, _rhs.variables, [this](NameWithDebugData const& _lhsVarName, NameWithDebugData const& _rhsVarName) -> bool { return this->visitDeclaration(_lhsVarName, _rhsVarName); }); } bool SyntacticallyEqual::statementEqual(FunctionDefinition const& _lhs, FunctionDefinition const& _rhs) { - auto compare = [this](TypedName const& _lhsVarName, TypedName const& _rhsVarName) -> bool { + auto compare = [this](NameWithDebugData const& _lhsVarName, NameWithDebugData const& _rhsVarName) -> bool { return this->visitDeclaration(_lhsVarName, _rhsVarName); }; // first visit parameter declarations, then body @@ -157,10 +154,8 @@ bool SyntacticallyEqual::statementEqual(Block const& _lhs, Block const& _rhs) }); } -bool SyntacticallyEqual::visitDeclaration(TypedName const& _lhs, TypedName const& _rhs) +bool SyntacticallyEqual::visitDeclaration(NameWithDebugData const& _lhs, NameWithDebugData const& _rhs) { - if (_lhs.type != _rhs.type) - return false; std::size_t id = m_idsUsed++; m_identifiersLHS[_lhs.name] = id; m_identifiersRHS[_rhs.name] = id; diff --git a/libyul/optimiser/SyntacticalEquality.h b/libyul/optimiser/SyntacticalEquality.h index 0665a5efbe6e..1fd888f7af8c 100644 --- a/libyul/optimiser/SyntacticalEquality.h +++ b/libyul/optimiser/SyntacticalEquality.h @@ -63,7 +63,7 @@ class SyntacticallyEqual bool statementEqual(Leave const&, Leave const&) { return true; } bool statementEqual(Block const& _lhs, Block const& _rhs); private: - bool visitDeclaration(TypedName const& _lhs, TypedName const& _rhs); + bool visitDeclaration(NameWithDebugData const& _lhs, NameWithDebugData const& _rhs); template bool expressionEqual(U const&, V const&, std::enable_if_t::value>* = nullptr) diff --git a/libyul/optimiser/TypeInfo.cpp b/libyul/optimiser/TypeInfo.cpp deleted file mode 100644 index 754c0bad08f8..000000000000 --- a/libyul/optimiser/TypeInfo.cpp +++ /dev/null @@ -1,103 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Helper class that keeps track of the types while performing optimizations. - */ - -#include - -#include - -#include -#include - -#include - -using namespace solidity::yul; -using namespace solidity::util; - -class TypeInfo::TypeCollector: public ASTWalker -{ -public: - explicit TypeCollector(Block const& _block) - { - (*this)(_block); - } - - using ASTWalker::operator(); - void operator()(VariableDeclaration const& _varDecl) override - { - for (auto const& var: _varDecl.variables) - variableTypes[var.name] = var.type; - } - void operator()(FunctionDefinition const& _funDef) override - { - ASTWalker::operator()(_funDef); - - auto& funType = functionTypes[_funDef.name]; - for (auto const& arg: _funDef.parameters) - { - funType.parameters.emplace_back(arg.type); - variableTypes[arg.name] = arg.type; - } - for (auto const& ret: _funDef.returnVariables) - { - funType.returns.emplace_back(ret.type); - variableTypes[ret.name] = ret.type; - } - } - - std::map variableTypes; - std::map functionTypes; -}; - - -TypeInfo::TypeInfo(Dialect const& _dialect, Block const& _ast): - m_dialect(_dialect) -{ - TypeCollector types(_ast); - m_functionTypes = std::move(types.functionTypes); - m_variableTypes = std::move(types.variableTypes); -} - -YulName TypeInfo::typeOf(Expression const& _expression) const -{ - return std::visit(GenericVisitor{ - [&](FunctionCall const& _funCall) { - YulName name = _funCall.functionName.name; - std::vector const* retTypes = nullptr; - if (BuiltinFunction const* fun = m_dialect.builtin(name)) - retTypes = &fun->returns; - else - retTypes = &m_functionTypes.at(name).returns; - yulAssert(retTypes && retTypes->size() == 1, "Call to typeOf for non-single-value expression."); - return retTypes->front(); - }, - [&](Identifier const& _identifier) { - return m_variableTypes.at(_identifier.name); - }, - [&](Literal const& _literal) { - return _literal.type; - } - }, _expression); -} - -YulName TypeInfo::typeOfVariable(YulName _name) const -{ - return m_variableTypes.at(_name); -} diff --git a/libyul/optimiser/TypeInfo.h b/libyul/optimiser/TypeInfo.h deleted file mode 100644 index 96c43875a638..000000000000 --- a/libyul/optimiser/TypeInfo.h +++ /dev/null @@ -1,65 +0,0 @@ -/* - This file is part of solidity. - - solidity is free software: you can redistribute it and/or modify - it under the terms of the GNU General Public License as published by - the Free Software Foundation, either version 3 of the License, or - (at your option) any later version. - - solidity is distributed in the hope that it will be useful, - but WITHOUT ANY WARRANTY; without even the implied warranty of - MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - GNU General Public License for more details. - - You should have received a copy of the GNU General Public License - along with solidity. If not, see . -*/ -// SPDX-License-Identifier: GPL-3.0 -/** - * Helper class that keeps track of the types while performing optimizations. - */ -#pragma once - -#include -#include - -#include -#include - -namespace solidity::yul -{ -struct Dialect; - -/** - * Helper class that keeps track of the types while performing optimizations. - * - * Only works on disambiguated sources! - */ -class TypeInfo -{ -public: - TypeInfo(Dialect const& _dialect, Block const& _ast); - - void setVariableType(YulName _name, YulName _type) { m_variableTypes[_name] = _type; } - - /// @returns the type of an expression that is assumed to return exactly one value. - YulName typeOf(Expression const& _expression) const; - - /// \returns the type of variable - YulName typeOfVariable(YulName _name) const; - -private: - class TypeCollector; - - struct FunctionType - { - std::vector parameters; - std::vector returns; - }; - - Dialect const& m_dialect; - std::map m_variableTypes; - std::map m_functionTypes; -}; - -} diff --git a/libyul/optimiser/UnusedFunctionsCommon.cpp b/libyul/optimiser/UnusedFunctionsCommon.cpp index bd38b33cafd9..a6333a786a5e 100644 --- a/libyul/optimiser/UnusedFunctionsCommon.cpp +++ b/libyul/optimiser/UnusedFunctionsCommon.cpp @@ -35,12 +35,11 @@ FunctionDefinition unusedFunctionsCommon::createLinkingFunction( NameDispenser& _nameDispenser ) { - auto generateTypedName = [&](TypedName t) + auto generateTypedName = [&](NameWithDebugData t) { - return TypedName{ + return NameWithDebugData{ t.debugData, - _nameDispenser.newName(t.name), - t.type + _nameDispenser.newName(t.name) }; }; diff --git a/libyul/optimiser/UnusedPruner.cpp b/libyul/optimiser/UnusedPruner.cpp index 9df51cf7f069..a3b6c0708b6a 100644 --- a/libyul/optimiser/UnusedPruner.cpp +++ b/libyul/optimiser/UnusedPruner.cpp @@ -92,7 +92,7 @@ void UnusedPruner::operator()(Block& _block) if (std::none_of( varDecl.variables.begin(), varDecl.variables.end(), - [&](TypedName const& _typedName) { return used(_typedName.name); } + [&](NameWithDebugData const& _typedName) { return used(_typedName.name); } )) { if (!varDecl.value) @@ -105,10 +105,10 @@ void UnusedPruner::operator()(Block& _block) subtractReferences(ReferencesCounter::countReferences(*varDecl.value)); statement = Block{std::move(varDecl.debugData), {}}; } - else if (varDecl.variables.size() == 1 && m_dialect.discardFunction(varDecl.variables.front().type)) + else if (varDecl.variables.size() == 1 && m_dialect.discardFunction()) statement = ExpressionStatement{varDecl.debugData, FunctionCall{ varDecl.debugData, - {varDecl.debugData, m_dialect.discardFunction(varDecl.variables.front().type)->name}, + {varDecl.debugData, m_dialect.discardFunction()->name}, {*std::move(varDecl.value)} }}; } diff --git a/libyul/optimiser/UnusedStoreEliminator.cpp b/libyul/optimiser/UnusedStoreEliminator.cpp index d049f59a0262..c50ddac14412 100644 --- a/libyul/optimiser/UnusedStoreEliminator.cpp +++ b/libyul/optimiser/UnusedStoreEliminator.cpp @@ -61,9 +61,9 @@ void UnusedStoreEliminator::run(OptimiserStepContext& _context, Block& _ast) std::map values; for (auto const& [name, expression]: ssaValues.values()) values[name] = AssignedValue{expression, {}}; - Expression const zeroLiteral{Literal{{}, LiteralKind::Number, LiteralValue(u256{0}), {}}}; - Expression const oneLiteral{Literal{{}, LiteralKind::Number, LiteralValue(u256{1}), {}}}; - Expression const thirtyTwoLiteral{Literal{{}, LiteralKind::Number, LiteralValue(u256{32}), {}}}; + Expression const zeroLiteral{Literal{{}, LiteralKind::Number, LiteralValue(u256{0})}}; + Expression const oneLiteral{Literal{{}, LiteralKind::Number, LiteralValue(u256{1})}}; + Expression const thirtyTwoLiteral{Literal{{}, LiteralKind::Number, LiteralValue(u256{32})}}; values[YulName{zero}] = AssignedValue{&zeroLiteral, {}}; values[YulName{one}] = AssignedValue{&oneLiteral, {}}; values[YulName{thirtyTwo}] = AssignedValue{&thirtyTwoLiteral, {}}; diff --git a/libyul/optimiser/VarDeclInitializer.cpp b/libyul/optimiser/VarDeclInitializer.cpp index 845c7cc41c96..db6d0127e589 100644 --- a/libyul/optimiser/VarDeclInitializer.cpp +++ b/libyul/optimiser/VarDeclInitializer.cpp @@ -40,7 +40,7 @@ void VarDeclInitializer::operator()(Block& _block) if (_varDecl.variables.size() == 1) { - _varDecl.value = std::make_unique(m_dialect.zeroLiteralForType(_varDecl.variables.front().type)); + _varDecl.value = std::make_unique(m_dialect.zeroLiteral()); return {}; } else @@ -48,7 +48,7 @@ void VarDeclInitializer::operator()(Block& _block) OptionalStatements ret{std::vector{}}; for (auto& var: _varDecl.variables) { - std::unique_ptr expr = std::make_unique(m_dialect.zeroLiteralForType(var.type)); + std::unique_ptr expr = std::make_unique(m_dialect.zeroLiteral()); ret->emplace_back(VariableDeclaration{std::move(_varDecl.debugData), {std::move(var)}, std::move(expr)}); } return ret; diff --git a/libyul/optimiser/VarNameCleaner.cpp b/libyul/optimiser/VarNameCleaner.cpp index 041ebdeaab23..b3a34d283e7e 100644 --- a/libyul/optimiser/VarNameCleaner.cpp +++ b/libyul/optimiser/VarNameCleaner.cpp @@ -72,17 +72,17 @@ void VarNameCleaner::operator()(VariableDeclaration& _varDecl) ASTModifier::operator()(_varDecl); } -void VarNameCleaner::renameVariables(std::vector& _variables) +void VarNameCleaner::renameVariables(std::vector& _variables) { - for (TypedName& typedName: _variables) + for (NameWithDebugData& variable: _variables) { - auto newName = findCleanName(typedName.name); - if (newName != typedName.name) + auto newName = findCleanName(variable.name); + if (newName != variable.name) { - m_translatedNames[typedName.name] = newName; - typedName.name = newName; + m_translatedNames[variable.name] = newName; + variable.name = newName; } - m_usedNames.insert(typedName.name); + m_usedNames.insert(variable.name); } } diff --git a/libyul/optimiser/VarNameCleaner.h b/libyul/optimiser/VarNameCleaner.h index bfb6cfb53369..7f8bb842e9e1 100644 --- a/libyul/optimiser/VarNameCleaner.h +++ b/libyul/optimiser/VarNameCleaner.h @@ -68,7 +68,7 @@ class VarNameCleaner: public ASTModifier ); /// Tries to rename a list of variables. - void renameVariables(std::vector& _variables); + void renameVariables(std::vector& _variables); /// @returns suffix-stripped name, if a suffix was detected, none otherwise. YulName stripSuffix(YulName const& _name) const; diff --git a/test/libyul/Common.cpp b/test/libyul/Common.cpp index a0c00c90d781..8980adcb1821 100644 --- a/test/libyul/Common.cpp +++ b/test/libyul/Common.cpp @@ -96,9 +96,7 @@ yul::Block yul::test::disambiguate(std::string const& _source) std::string yul::test::format(std::string const& _source) { - auto const version = solidity::test::CommonOptions::get().evmVersion(); - Dialect const& dialect = EVMDialect::strictAssemblyForEVMObjects(version); - return yul::AsmPrinter(yul::AsmPrinter::TypePrinting::Full, dialect)(parse(_source).first->root()); + return yul::AsmPrinter()(parse(_source).first->root()); } namespace diff --git a/test/libyul/Parser.cpp b/test/libyul/Parser.cpp index 2a2f2809296b..9b8ce42921b6 100644 --- a/test/libyul/Parser.cpp +++ b/test/libyul/Parser.cpp @@ -139,7 +139,7 @@ BOOST_AUTO_TEST_CASE(builtins_analysis) { return _name == "builtin"_yulname ? &f : nullptr; } - BuiltinFunction f{"builtin"_yulname, std::vector(2), std::vector(3), {}, {}, false, {}}; + BuiltinFunction f{"builtin"_yulname, 2, 3, {}, {}, false, {}}; }; SimpleDialect dialect; diff --git a/test/libyul/StackShufflingTest.cpp b/test/libyul/StackShufflingTest.cpp index 2da445dd4557..40fdcc5b15f4 100644 --- a/test/libyul/StackShufflingTest.cpp +++ b/test/libyul/StackShufflingTest.cpp @@ -102,7 +102,7 @@ bool StackShufflingTest::parse(std::string const& _source) expectToken(Token::LBrack); scanner.next(); // read number of ghost variables as ghostVariableId std::string ghostVariableId = scanner.currentLiteral(); - Scope::Variable ghostVar = Scope::Variable{""_yulname, YulName(literal + "[" + ghostVariableId + "]")}; + Scope::Variable ghostVar = Scope::Variable{YulName(literal + "[" + ghostVariableId + "]")}; stack.emplace_back(VariableSlot{ m_variables.insert(std::make_pair(ghostVar.name, ghostVar)).first->second }); @@ -110,7 +110,7 @@ bool StackShufflingTest::parse(std::string const& _source) } else { - Scope::Variable var = Scope::Variable{""_yulname, YulName(literal)}; + Scope::Variable var = Scope::Variable{YulName(literal)}; stack.emplace_back(VariableSlot{ m_variables.insert( make_pair(literal, var) diff --git a/test/libyul/YulOptimizerTest.cpp b/test/libyul/YulOptimizerTest.cpp index 048eb7145dc0..7f2f5815a675 100644 --- a/test/libyul/YulOptimizerTest.cpp +++ b/test/libyul/YulOptimizerTest.cpp @@ -81,9 +81,9 @@ TestCase::TestResult YulOptimizerTest::run(std::ostream& _stream, std::string co auto optimizedObject = tester.optimizedObject(); std::string printedOptimizedObject; if (optimizedObject->subObjects.empty()) - printedOptimizedObject = AsmPrinter{AsmPrinter::TypePrinting::OmitDefault, *m_dialect}(optimizedObject->code()->root()); + printedOptimizedObject = AsmPrinter{}(optimizedObject->code()->root()); else - printedOptimizedObject = optimizedObject->toString(*m_dialect); + printedOptimizedObject = optimizedObject->toString(); // Re-parse new code for compilability if (!std::get<0>(parse(_stream, _linePrefix, _formatted, printedOptimizedObject))) diff --git a/test/libyul/YulOptimizerTestCommon.cpp b/test/libyul/YulOptimizerTestCommon.cpp index bf374c21fcee..0f94f309dce4 100644 --- a/test/libyul/YulOptimizerTestCommon.cpp +++ b/test/libyul/YulOptimizerTestCommon.cpp @@ -454,9 +454,9 @@ YulOptimizerTestCommon::YulOptimizerTestCommon( { YulName originalFunctionName = m_currentFunction; m_currentFunction = _function.name; - for (TypedName const& _argument: _function.parameters) + for (NameWithDebugData const& _argument: _function.parameters) visitVariableName(_argument.name); - for (TypedName const& _argument: _function.returnVariables) + for (NameWithDebugData const& _argument: _function.returnVariables) visitVariableName(_argument.name); ASTWalker::operator()(_function); m_currentFunction = originalFunctionName; diff --git a/test/libyul/yulSyntaxTests/invalid_type.yul b/test/libyul/yulSyntaxTests/invalid_type.yul index f863816355c6..69f20b7053d9 100644 --- a/test/libyul/yulSyntaxTests/invalid_type.yul +++ b/test/libyul/yulSyntaxTests/invalid_type.yul @@ -2,4 +2,4 @@ let x: invalidType } // ---- -// TypeError 5473: (10-24): "invalidType" is not a valid type (user defined types are not yet supported). +// ParserError 5473: (10-24): Types are not supported in untyped Yul. diff --git a/test/libyul/yulSyntaxTests/invalid_type2.yul b/test/libyul/yulSyntaxTests/invalid_type2.yul index af30bc2eb244..ab26f6925e0d 100644 --- a/test/libyul/yulSyntaxTests/invalid_type2.yul +++ b/test/libyul/yulSyntaxTests/invalid_type2.yul @@ -2,5 +2,4 @@ let x := 1:invalidType } // ---- -// TypeError 5473: (15-28): "invalidType" is not a valid type (user defined types are not yet supported). -// TypeError 3947: (10-11): Assigning value of type "invalidType" to variable of type "". +// ParserError 5473: (15-28): Types are not supported in untyped Yul. diff --git a/test/libyul/yulSyntaxTests/invalid_type3.yul b/test/libyul/yulSyntaxTests/invalid_type3.yul index 6fc0e35e8ce0..866d855adb7f 100644 --- a/test/libyul/yulSyntaxTests/invalid_type3.yul +++ b/test/libyul/yulSyntaxTests/invalid_type3.yul @@ -2,5 +2,5 @@ function f(a: invalidType) -> b: invalidType {} } // ---- -// TypeError 5473: (17-31): "invalidType" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (36-50): "invalidType" is not a valid type (user defined types are not yet supported). +// ParserError 5473: (17-31): Types are not supported in untyped Yul. +// ParserError 5473: (36-50): Types are not supported in untyped Yul. diff --git a/test/libyul/yulSyntaxTests/invalid_type4.yul b/test/libyul/yulSyntaxTests/invalid_type4.yul index 90f00ddaafd2..e6ec73b7a1f3 100644 --- a/test/libyul/yulSyntaxTests/invalid_type4.yul +++ b/test/libyul/yulSyntaxTests/invalid_type4.yul @@ -3,5 +3,4 @@ case 8: invalidType {} } // ---- -// TypeError 3781: (24-38): Expected a value of type "" but got "invalidType". -// TypeError 5473: (24-38): "invalidType" is not a valid type (user defined types are not yet supported). +// ParserError 5473: (24-38): Types are not supported in untyped Yul. diff --git a/test/libyul/yulSyntaxTests/literal_invalid_type.yul b/test/libyul/yulSyntaxTests/literal_invalid_type.yul index fd612a0a5a18..c0e6dccdf696 100644 --- a/test/libyul/yulSyntaxTests/literal_invalid_type.yul +++ b/test/libyul/yulSyntaxTests/literal_invalid_type.yul @@ -2,6 +2,4 @@ let x := true:unhappy } // ---- -// TypeError 5473: (15-27): "unhappy" is not a valid type (user defined types are not yet supported). -// TypeError 5170: (15-27): Invalid type "unhappy" for literal "true". -// TypeError 3947: (10-11): Assigning value of type "unhappy" to variable of type "". +// ParserError 5473: (15-27): Types are not supported in untyped Yul. diff --git a/test/libyul/yulSyntaxTests/more_than_256_analysis_errors.yul b/test/libyul/yulSyntaxTests/more_than_256_analysis_errors.yul index 0ae2fb15a730..031944953e86 100644 --- a/test/libyul/yulSyntaxTests/more_than_256_analysis_errors.yul +++ b/test/libyul/yulSyntaxTests/more_than_256_analysis_errors.yul @@ -1,279 +1,296 @@ { - // There's no type called 'x' so every declaration here should trigger an error. + // Using a variable to initialize itself should trigger a "variable is used before declared" error. // It's only detected during analysis and is not fatal. Any other non-fatal analysis error would do. - let $00:x let $10:x let $20:x let $30:x let $40:x let $50:x let $60:x let $70:x let $80:x let $90:x let $a0:x let $b0:x let $c0:x let $d0:x let $e0:x let $f0:x - let $01:x let $11:x let $21:x let $31:x let $41:x let $51:x let $61:x let $71:x let $81:x let $91:x let $a1:x let $b1:x let $c1:x let $d1:x let $e1:x let $f1:x - let $02:x let $12:x let $22:x let $32:x let $42:x let $52:x let $62:x let $72:x let $82:x let $92:x let $a2:x let $b2:x let $c2:x let $d2:x let $e2:x let $f2:x - let $03:x let $13:x let $23:x let $33:x let $43:x let $53:x let $63:x let $73:x let $83:x let $93:x let $a3:x let $b3:x let $c3:x let $d3:x let $e3:x let $f3:x - let $04:x let $14:x let $24:x let $34:x let $44:x let $54:x let $64:x let $74:x let $84:x let $94:x let $a4:x let $b4:x let $c4:x let $d4:x let $e4:x let $f4:x - let $05:x let $15:x let $25:x let $35:x let $45:x let $55:x let $65:x let $75:x let $85:x let $95:x let $a5:x let $b5:x let $c5:x let $d5:x let $e5:x let $f5:x - let $06:x let $16:x let $26:x let $36:x let $46:x let $56:x let $66:x let $76:x let $86:x let $96:x let $a6:x let $b6:x let $c6:x let $d6:x let $e6:x let $f6:x - let $07:x let $17:x let $27:x let $37:x let $47:x let $57:x let $67:x let $77:x let $87:x let $97:x let $a7:x let $b7:x let $c7:x let $d7:x let $e7:x let $f7:x - let $08:x let $18:x let $28:x let $38:x let $48:x let $58:x let $68:x let $78:x let $88:x let $98:x let $a8:x let $b8:x let $c8:x let $d8:x let $e8:x let $f8:x - let $09:x let $19:x let $29:x let $39:x let $49:x let $59:x let $69:x let $79:x let $89:x let $99:x let $a9:x let $b9:x let $c9:x let $d9:x let $e9:x let $f9:x - let $0a:x let $1a:x let $2a:x let $3a:x let $4a:x let $5a:x let $6a:x let $7a:x let $8a:x let $9a:x let $aa:x let $ba:x let $ca:x let $da:x let $ea:x let $fa:x - let $0b:x let $1b:x let $2b:x let $3b:x let $4b:x let $5b:x let $6b:x let $7b:x let $8b:x let $9b:x let $ab:x let $bb:x let $cb:x let $db:x let $eb:x let $fb:x - let $0c:x let $1c:x let $2c:x let $3c:x let $4c:x let $5c:x let $6c:x let $7c:x let $8c:x let $9c:x let $ac:x let $bc:x let $cc:x let $dc:x let $ec:x let $fc:x - let $0d:x let $1d:x let $2d:x let $3d:x let $4d:x let $5d:x let $6d:x let $7d:x let $8d:x let $9d:x let $ad:x let $bd:x let $cd:x let $dd:x let $ed:x let $fd:x - let $0e:x let $1e:x let $2e:x let $3e:x let $4e:x let $5e:x let $6e:x let $7e:x let $8e:x let $9e:x let $ae:x let $be:x let $ce:x let $de:x let $ee:x let $fe:x - let $0f:x let $1f:x let $2f:x let $3f:x let $4f:x let $5f:x let $6f:x let $7f:x let $8f:x let $9f:x let $af:x let $bf:x let $cf:x let $df:x let $ef:x let $ff:x - let $100:x + let x00:=x00 let x01:=x01 let x02:=x02 let x03:=x03 let x04:=x04 let x05:=x05 let x06:=x06 let x07:=x07 + let x08:=x08 let x09:=x09 let x0a:=x0a let x0b:=x0b let x0c:=x0c let x0d:=x0d let x0e:=x0e let x0f:=x0f + let x10:=x10 let x11:=x11 let x12:=x12 let x13:=x13 let x14:=x14 let x15:=x15 let x16:=x16 let x17:=x17 + let x18:=x18 let x19:=x19 let x1a:=x1a let x1b:=x1b let x1c:=x1c let x1d:=x1d let x1e:=x1e let x1f:=x1f + let x20:=x20 let x21:=x21 let x22:=x22 let x23:=x23 let x24:=x24 let x25:=x25 let x26:=x26 let x27:=x27 + let x28:=x28 let x29:=x29 let x2a:=x2a let x2b:=x2b let x2c:=x2c let x2d:=x2d let x2e:=x2e let x2f:=x2f + let x30:=x30 let x31:=x31 let x32:=x32 let x33:=x33 let x34:=x34 let x35:=x35 let x36:=x36 let x37:=x37 + let x38:=x38 let x39:=x39 let x3a:=x3a let x3b:=x3b let x3c:=x3c let x3d:=x3d let x3e:=x3e let x3f:=x3f + let x40:=x40 let x41:=x41 let x42:=x42 let x43:=x43 let x44:=x44 let x45:=x45 let x46:=x46 let x47:=x47 + let x48:=x48 let x49:=x49 let x4a:=x4a let x4b:=x4b let x4c:=x4c let x4d:=x4d let x4e:=x4e let x4f:=x4f + let x50:=x50 let x51:=x51 let x52:=x52 let x53:=x53 let x54:=x54 let x55:=x55 let x56:=x56 let x57:=x57 + let x58:=x58 let x59:=x59 let x5a:=x5a let x5b:=x5b let x5c:=x5c let x5d:=x5d let x5e:=x5e let x5f:=x5f + let x60:=x60 let x61:=x61 let x62:=x62 let x63:=x63 let x64:=x64 let x65:=x65 let x66:=x66 let x67:=x67 + let x68:=x68 let x69:=x69 let x6a:=x6a let x6b:=x6b let x6c:=x6c let x6d:=x6d let x6e:=x6e let x6f:=x6f + let x70:=x70 let x71:=x71 let x72:=x72 let x73:=x73 let x74:=x74 let x75:=x75 let x76:=x76 let x77:=x77 + let x78:=x78 let x79:=x79 let x7a:=x7a let x7b:=x7b let x7c:=x7c let x7d:=x7d let x7e:=x7e let x7f:=x7f + let x80:=x80 let x81:=x81 let x82:=x82 let x83:=x83 let x84:=x84 let x85:=x85 let x86:=x86 let x87:=x87 + let x88:=x88 let x89:=x89 let x8a:=x8a let x8b:=x8b let x8c:=x8c let x8d:=x8d let x8e:=x8e let x8f:=x8f + let x90:=x90 let x91:=x91 let x92:=x92 let x93:=x93 let x94:=x94 let x95:=x95 let x96:=x96 let x97:=x97 + let x98:=x98 let x99:=x99 let x9a:=x9a let x9b:=x9b let x9c:=x9c let x9d:=x9d let x9e:=x9e let x9f:=x9f + let xa0:=xa0 let xa1:=xa1 let xa2:=xa2 let xa3:=xa3 let xa4:=xa4 let xa5:=xa5 let xa6:=xa6 let xa7:=xa7 + let xa8:=xa8 let xa9:=xa9 let xaa:=xaa let xab:=xab let xac:=xac let xad:=xad let xae:=xae let xaf:=xaf + let xb0:=xb0 let xb1:=xb1 let xb2:=xb2 let xb3:=xb3 let xb4:=xb4 let xb5:=xb5 let xb6:=xb6 let xb7:=xb7 + let xb8:=xb8 let xb9:=xb9 let xba:=xba let xbb:=xbb let xbc:=xbc let xbd:=xbd let xbe:=xbe let xbf:=xbf + let xc0:=xc0 let xc1:=xc1 let xc2:=xc2 let xc3:=xc3 let xc4:=xc4 let xc5:=xc5 let xc6:=xc6 let xc7:=xc7 + let xc8:=xc8 let xc9:=xc9 let xca:=xca let xcb:=xcb let xcc:=xcc let xcd:=xcd let xce:=xce let xcf:=xcf + let xd0:=xd0 let xd1:=xd1 let xd2:=xd2 let xd3:=xd3 let xd4:=xd4 let xd5:=xd5 let xd6:=xd6 let xd7:=xd7 + let xd8:=xd8 let xd9:=xd9 let xda:=xda let xdb:=xdb let xdc:=xdc let xdd:=xdd let xde:=xde let xdf:=xdf + let xe0:=xe0 let xe1:=xe1 let xe2:=xe2 let xe3:=xe3 let xe4:=xe4 let xe5:=xe5 let xe6:=xe6 let xe7:=xe7 + let xe8:=xe8 let xe9:=xe9 let xea:=xea let xeb:=xeb let xec:=xec let xed:=xed let xee:=xee let xef:=xef + let xf0:=xf0 let xf1:=xf1 let xf2:=xf2 let xf3:=xf3 let xf4:=xf4 let xf5:=xf5 let xf6:=xf6 let xf7:=xf7 + let xf8:=xf8 let xf9:=xf9 let xfa:=xfa let xfb:=xfb let xfc:=xfc let xfd:=xfd let xfe:=xfe let xff:=xff + let x100:=x100 + } // ---- -// TypeError 5473: (200-205): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (210-215): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (220-225): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (230-235): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (240-245): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (250-255): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (260-265): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (270-275): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (280-285): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (290-295): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (300-305): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (310-315): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (320-325): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (330-335): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (340-345): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (350-355): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (364-369): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (374-379): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (384-389): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (394-399): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (404-409): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (414-419): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (424-429): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (434-439): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (444-449): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (454-459): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (464-469): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (474-479): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (484-489): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (494-499): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (504-509): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (514-519): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (528-533): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (538-543): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (548-553): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (558-563): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (568-573): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (578-583): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (588-593): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (598-603): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (608-613): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (618-623): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (628-633): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (638-643): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (648-653): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (658-663): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (668-673): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (678-683): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (692-697): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (702-707): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (712-717): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (722-727): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (732-737): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (742-747): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (752-757): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (762-767): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (772-777): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (782-787): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (792-797): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (802-807): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (812-817): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (822-827): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (832-837): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (842-847): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (856-861): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (866-871): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (876-881): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (886-891): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (896-901): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (906-911): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (916-921): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (926-931): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (936-941): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (946-951): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (956-961): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (966-971): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (976-981): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (986-991): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (996-1001): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1006-1011): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1020-1025): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1030-1035): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1040-1045): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1050-1055): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1060-1065): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1070-1075): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1080-1085): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1090-1095): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1100-1105): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1110-1115): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1120-1125): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1130-1135): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1140-1145): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1150-1155): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1160-1165): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1170-1175): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1184-1189): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1194-1199): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1204-1209): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1214-1219): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1224-1229): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1234-1239): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1244-1249): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1254-1259): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1264-1269): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1274-1279): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1284-1289): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1294-1299): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1304-1309): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1314-1319): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1324-1329): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1334-1339): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1348-1353): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1358-1363): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1368-1373): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1378-1383): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1388-1393): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1398-1403): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1408-1413): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1418-1423): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1428-1433): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1438-1443): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1448-1453): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1458-1463): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1468-1473): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1478-1483): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1488-1493): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1498-1503): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1512-1517): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1522-1527): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1532-1537): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1542-1547): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1552-1557): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1562-1567): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1572-1577): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1582-1587): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1592-1597): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1602-1607): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1612-1617): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1622-1627): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1632-1637): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1642-1647): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1652-1657): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1662-1667): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1676-1681): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1686-1691): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1696-1701): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1706-1711): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1716-1721): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1726-1731): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1736-1741): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1746-1751): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1756-1761): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1766-1771): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1776-1781): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1786-1791): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1796-1801): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1806-1811): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1816-1821): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1826-1831): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1840-1845): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1850-1855): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1860-1865): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1870-1875): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1880-1885): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1890-1895): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1900-1905): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1910-1915): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1920-1925): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1930-1935): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1940-1945): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1950-1955): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1960-1965): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1970-1975): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1980-1985): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (1990-1995): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2004-2009): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2014-2019): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2024-2029): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2034-2039): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2044-2049): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2054-2059): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2064-2069): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2074-2079): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2084-2089): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2094-2099): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2104-2109): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2114-2119): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2124-2129): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2134-2139): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2144-2149): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2154-2159): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2168-2173): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2178-2183): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2188-2193): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2198-2203): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2208-2213): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2218-2223): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2228-2233): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2238-2243): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2248-2253): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2258-2263): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2268-2273): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2278-2283): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2288-2293): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2298-2303): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2308-2313): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2318-2323): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2332-2337): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2342-2347): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2352-2357): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2362-2367): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2372-2377): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2382-2387): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2392-2397): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2402-2407): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2412-2417): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2422-2427): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2432-2437): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2442-2447): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2452-2457): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2462-2467): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2472-2477): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2482-2487): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2496-2501): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2506-2511): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2516-2521): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2526-2531): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2536-2541): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2546-2551): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2556-2561): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2566-2571): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2576-2581): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2586-2591): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2596-2601): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2606-2611): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2616-2621): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2626-2631): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2636-2641): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2646-2651): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2660-2665): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2670-2675): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2680-2685): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2690-2695): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2700-2705): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2710-2715): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2720-2725): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2730-2735): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2740-2745): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2750-2755): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2760-2765): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2770-2775): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2780-2785): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2790-2795): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2800-2805): "x" is not a valid type (user defined types are not yet supported). -// TypeError 5473: (2810-2815): "x" is not a valid type (user defined types are not yet supported). +// DeclarationError 4990: (224-227): Variable x00 used before it was declared. +// DeclarationError 4990: (237-240): Variable x01 used before it was declared. +// DeclarationError 4990: (250-253): Variable x02 used before it was declared. +// DeclarationError 4990: (263-266): Variable x03 used before it was declared. +// DeclarationError 4990: (276-279): Variable x04 used before it was declared. +// DeclarationError 4990: (289-292): Variable x05 used before it was declared. +// DeclarationError 4990: (302-305): Variable x06 used before it was declared. +// DeclarationError 4990: (315-318): Variable x07 used before it was declared. +// DeclarationError 4990: (332-335): Variable x08 used before it was declared. +// DeclarationError 4990: (345-348): Variable x09 used before it was declared. +// DeclarationError 4990: (358-361): Variable x0a used before it was declared. +// DeclarationError 4990: (371-374): Variable x0b used before it was declared. +// DeclarationError 4990: (384-387): Variable x0c used before it was declared. +// DeclarationError 4990: (397-400): Variable x0d used before it was declared. +// DeclarationError 4990: (410-413): Variable x0e used before it was declared. +// DeclarationError 4990: (423-426): Variable x0f used before it was declared. +// DeclarationError 4990: (440-443): Variable x10 used before it was declared. +// DeclarationError 4990: (453-456): Variable x11 used before it was declared. +// DeclarationError 4990: (466-469): Variable x12 used before it was declared. +// DeclarationError 4990: (479-482): Variable x13 used before it was declared. +// DeclarationError 4990: (492-495): Variable x14 used before it was declared. +// DeclarationError 4990: (505-508): Variable x15 used before it was declared. +// DeclarationError 4990: (518-521): Variable x16 used before it was declared. +// DeclarationError 4990: (531-534): Variable x17 used before it was declared. +// DeclarationError 4990: (548-551): Variable x18 used before it was declared. +// DeclarationError 4990: (561-564): Variable x19 used before it was declared. +// DeclarationError 4990: (574-577): Variable x1a used before it was declared. +// DeclarationError 4990: (587-590): Variable x1b used before it was declared. +// DeclarationError 4990: (600-603): Variable x1c used before it was declared. +// DeclarationError 4990: (613-616): Variable x1d used before it was declared. +// DeclarationError 4990: (626-629): Variable x1e used before it was declared. +// DeclarationError 4990: (639-642): Variable x1f used before it was declared. +// DeclarationError 4990: (656-659): Variable x20 used before it was declared. +// DeclarationError 4990: (669-672): Variable x21 used before it was declared. +// DeclarationError 4990: (682-685): Variable x22 used before it was declared. +// DeclarationError 4990: (695-698): Variable x23 used before it was declared. +// DeclarationError 4990: (708-711): Variable x24 used before it was declared. +// DeclarationError 4990: (721-724): Variable x25 used before it was declared. +// DeclarationError 4990: (734-737): Variable x26 used before it was declared. +// DeclarationError 4990: (747-750): Variable x27 used before it was declared. +// DeclarationError 4990: (764-767): Variable x28 used before it was declared. +// DeclarationError 4990: (777-780): Variable x29 used before it was declared. +// DeclarationError 4990: (790-793): Variable x2a used before it was declared. +// DeclarationError 4990: (803-806): Variable x2b used before it was declared. +// DeclarationError 4990: (816-819): Variable x2c used before it was declared. +// DeclarationError 4990: (829-832): Variable x2d used before it was declared. +// DeclarationError 4990: (842-845): Variable x2e used before it was declared. +// DeclarationError 4990: (855-858): Variable x2f used before it was declared. +// DeclarationError 4990: (872-875): Variable x30 used before it was declared. +// DeclarationError 4990: (885-888): Variable x31 used before it was declared. +// DeclarationError 4990: (898-901): Variable x32 used before it was declared. +// DeclarationError 4990: (911-914): Variable x33 used before it was declared. +// DeclarationError 4990: (924-927): Variable x34 used before it was declared. +// DeclarationError 4990: (937-940): Variable x35 used before it was declared. +// DeclarationError 4990: (950-953): Variable x36 used before it was declared. +// DeclarationError 4990: (963-966): Variable x37 used before it was declared. +// DeclarationError 4990: (980-983): Variable x38 used before it was declared. +// DeclarationError 4990: (993-996): Variable x39 used before it was declared. +// DeclarationError 4990: (1006-1009): Variable x3a used before it was declared. +// DeclarationError 4990: (1019-1022): Variable x3b used before it was declared. +// DeclarationError 4990: (1032-1035): Variable x3c used before it was declared. +// DeclarationError 4990: (1045-1048): Variable x3d used before it was declared. +// DeclarationError 4990: (1058-1061): Variable x3e used before it was declared. +// DeclarationError 4990: (1071-1074): Variable x3f used before it was declared. +// DeclarationError 4990: (1088-1091): Variable x40 used before it was declared. +// DeclarationError 4990: (1101-1104): Variable x41 used before it was declared. +// DeclarationError 4990: (1114-1117): Variable x42 used before it was declared. +// DeclarationError 4990: (1127-1130): Variable x43 used before it was declared. +// DeclarationError 4990: (1140-1143): Variable x44 used before it was declared. +// DeclarationError 4990: (1153-1156): Variable x45 used before it was declared. +// DeclarationError 4990: (1166-1169): Variable x46 used before it was declared. +// DeclarationError 4990: (1179-1182): Variable x47 used before it was declared. +// DeclarationError 4990: (1196-1199): Variable x48 used before it was declared. +// DeclarationError 4990: (1209-1212): Variable x49 used before it was declared. +// DeclarationError 4990: (1222-1225): Variable x4a used before it was declared. +// DeclarationError 4990: (1235-1238): Variable x4b used before it was declared. +// DeclarationError 4990: (1248-1251): Variable x4c used before it was declared. +// DeclarationError 4990: (1261-1264): Variable x4d used before it was declared. +// DeclarationError 4990: (1274-1277): Variable x4e used before it was declared. +// DeclarationError 4990: (1287-1290): Variable x4f used before it was declared. +// DeclarationError 4990: (1304-1307): Variable x50 used before it was declared. +// DeclarationError 4990: (1317-1320): Variable x51 used before it was declared. +// DeclarationError 4990: (1330-1333): Variable x52 used before it was declared. +// DeclarationError 4990: (1343-1346): Variable x53 used before it was declared. +// DeclarationError 4990: (1356-1359): Variable x54 used before it was declared. +// DeclarationError 4990: (1369-1372): Variable x55 used before it was declared. +// DeclarationError 4990: (1382-1385): Variable x56 used before it was declared. +// DeclarationError 4990: (1395-1398): Variable x57 used before it was declared. +// DeclarationError 4990: (1412-1415): Variable x58 used before it was declared. +// DeclarationError 4990: (1425-1428): Variable x59 used before it was declared. +// DeclarationError 4990: (1438-1441): Variable x5a used before it was declared. +// DeclarationError 4990: (1451-1454): Variable x5b used before it was declared. +// DeclarationError 4990: (1464-1467): Variable x5c used before it was declared. +// DeclarationError 4990: (1477-1480): Variable x5d used before it was declared. +// DeclarationError 4990: (1490-1493): Variable x5e used before it was declared. +// DeclarationError 4990: (1503-1506): Variable x5f used before it was declared. +// DeclarationError 4990: (1520-1523): Variable x60 used before it was declared. +// DeclarationError 4990: (1533-1536): Variable x61 used before it was declared. +// DeclarationError 4990: (1546-1549): Variable x62 used before it was declared. +// DeclarationError 4990: (1559-1562): Variable x63 used before it was declared. +// DeclarationError 4990: (1572-1575): Variable x64 used before it was declared. +// DeclarationError 4990: (1585-1588): Variable x65 used before it was declared. +// DeclarationError 4990: (1598-1601): Variable x66 used before it was declared. +// DeclarationError 4990: (1611-1614): Variable x67 used before it was declared. +// DeclarationError 4990: (1628-1631): Variable x68 used before it was declared. +// DeclarationError 4990: (1641-1644): Variable x69 used before it was declared. +// DeclarationError 4990: (1654-1657): Variable x6a used before it was declared. +// DeclarationError 4990: (1667-1670): Variable x6b used before it was declared. +// DeclarationError 4990: (1680-1683): Variable x6c used before it was declared. +// DeclarationError 4990: (1693-1696): Variable x6d used before it was declared. +// DeclarationError 4990: (1706-1709): Variable x6e used before it was declared. +// DeclarationError 4990: (1719-1722): Variable x6f used before it was declared. +// DeclarationError 4990: (1736-1739): Variable x70 used before it was declared. +// DeclarationError 4990: (1749-1752): Variable x71 used before it was declared. +// DeclarationError 4990: (1762-1765): Variable x72 used before it was declared. +// DeclarationError 4990: (1775-1778): Variable x73 used before it was declared. +// DeclarationError 4990: (1788-1791): Variable x74 used before it was declared. +// DeclarationError 4990: (1801-1804): Variable x75 used before it was declared. +// DeclarationError 4990: (1814-1817): Variable x76 used before it was declared. +// DeclarationError 4990: (1827-1830): Variable x77 used before it was declared. +// DeclarationError 4990: (1844-1847): Variable x78 used before it was declared. +// DeclarationError 4990: (1857-1860): Variable x79 used before it was declared. +// DeclarationError 4990: (1870-1873): Variable x7a used before it was declared. +// DeclarationError 4990: (1883-1886): Variable x7b used before it was declared. +// DeclarationError 4990: (1896-1899): Variable x7c used before it was declared. +// DeclarationError 4990: (1909-1912): Variable x7d used before it was declared. +// DeclarationError 4990: (1922-1925): Variable x7e used before it was declared. +// DeclarationError 4990: (1935-1938): Variable x7f used before it was declared. +// DeclarationError 4990: (1952-1955): Variable x80 used before it was declared. +// DeclarationError 4990: (1965-1968): Variable x81 used before it was declared. +// DeclarationError 4990: (1978-1981): Variable x82 used before it was declared. +// DeclarationError 4990: (1991-1994): Variable x83 used before it was declared. +// DeclarationError 4990: (2004-2007): Variable x84 used before it was declared. +// DeclarationError 4990: (2017-2020): Variable x85 used before it was declared. +// DeclarationError 4990: (2030-2033): Variable x86 used before it was declared. +// DeclarationError 4990: (2043-2046): Variable x87 used before it was declared. +// DeclarationError 4990: (2060-2063): Variable x88 used before it was declared. +// DeclarationError 4990: (2073-2076): Variable x89 used before it was declared. +// DeclarationError 4990: (2086-2089): Variable x8a used before it was declared. +// DeclarationError 4990: (2099-2102): Variable x8b used before it was declared. +// DeclarationError 4990: (2112-2115): Variable x8c used before it was declared. +// DeclarationError 4990: (2125-2128): Variable x8d used before it was declared. +// DeclarationError 4990: (2138-2141): Variable x8e used before it was declared. +// DeclarationError 4990: (2151-2154): Variable x8f used before it was declared. +// DeclarationError 4990: (2168-2171): Variable x90 used before it was declared. +// DeclarationError 4990: (2181-2184): Variable x91 used before it was declared. +// DeclarationError 4990: (2194-2197): Variable x92 used before it was declared. +// DeclarationError 4990: (2207-2210): Variable x93 used before it was declared. +// DeclarationError 4990: (2220-2223): Variable x94 used before it was declared. +// DeclarationError 4990: (2233-2236): Variable x95 used before it was declared. +// DeclarationError 4990: (2246-2249): Variable x96 used before it was declared. +// DeclarationError 4990: (2259-2262): Variable x97 used before it was declared. +// DeclarationError 4990: (2276-2279): Variable x98 used before it was declared. +// DeclarationError 4990: (2289-2292): Variable x99 used before it was declared. +// DeclarationError 4990: (2302-2305): Variable x9a used before it was declared. +// DeclarationError 4990: (2315-2318): Variable x9b used before it was declared. +// DeclarationError 4990: (2328-2331): Variable x9c used before it was declared. +// DeclarationError 4990: (2341-2344): Variable x9d used before it was declared. +// DeclarationError 4990: (2354-2357): Variable x9e used before it was declared. +// DeclarationError 4990: (2367-2370): Variable x9f used before it was declared. +// DeclarationError 4990: (2384-2387): Variable xa0 used before it was declared. +// DeclarationError 4990: (2397-2400): Variable xa1 used before it was declared. +// DeclarationError 4990: (2410-2413): Variable xa2 used before it was declared. +// DeclarationError 4990: (2423-2426): Variable xa3 used before it was declared. +// DeclarationError 4990: (2436-2439): Variable xa4 used before it was declared. +// DeclarationError 4990: (2449-2452): Variable xa5 used before it was declared. +// DeclarationError 4990: (2462-2465): Variable xa6 used before it was declared. +// DeclarationError 4990: (2475-2478): Variable xa7 used before it was declared. +// DeclarationError 4990: (2492-2495): Variable xa8 used before it was declared. +// DeclarationError 4990: (2505-2508): Variable xa9 used before it was declared. +// DeclarationError 4990: (2518-2521): Variable xaa used before it was declared. +// DeclarationError 4990: (2531-2534): Variable xab used before it was declared. +// DeclarationError 4990: (2544-2547): Variable xac used before it was declared. +// DeclarationError 4990: (2557-2560): Variable xad used before it was declared. +// DeclarationError 4990: (2570-2573): Variable xae used before it was declared. +// DeclarationError 4990: (2583-2586): Variable xaf used before it was declared. +// DeclarationError 4990: (2600-2603): Variable xb0 used before it was declared. +// DeclarationError 4990: (2613-2616): Variable xb1 used before it was declared. +// DeclarationError 4990: (2626-2629): Variable xb2 used before it was declared. +// DeclarationError 4990: (2639-2642): Variable xb3 used before it was declared. +// DeclarationError 4990: (2652-2655): Variable xb4 used before it was declared. +// DeclarationError 4990: (2665-2668): Variable xb5 used before it was declared. +// DeclarationError 4990: (2678-2681): Variable xb6 used before it was declared. +// DeclarationError 4990: (2691-2694): Variable xb7 used before it was declared. +// DeclarationError 4990: (2708-2711): Variable xb8 used before it was declared. +// DeclarationError 4990: (2721-2724): Variable xb9 used before it was declared. +// DeclarationError 4990: (2734-2737): Variable xba used before it was declared. +// DeclarationError 4990: (2747-2750): Variable xbb used before it was declared. +// DeclarationError 4990: (2760-2763): Variable xbc used before it was declared. +// DeclarationError 4990: (2773-2776): Variable xbd used before it was declared. +// DeclarationError 4990: (2786-2789): Variable xbe used before it was declared. +// DeclarationError 4990: (2799-2802): Variable xbf used before it was declared. +// DeclarationError 4990: (2816-2819): Variable xc0 used before it was declared. +// DeclarationError 4990: (2829-2832): Variable xc1 used before it was declared. +// DeclarationError 4990: (2842-2845): Variable xc2 used before it was declared. +// DeclarationError 4990: (2855-2858): Variable xc3 used before it was declared. +// DeclarationError 4990: (2868-2871): Variable xc4 used before it was declared. +// DeclarationError 4990: (2881-2884): Variable xc5 used before it was declared. +// DeclarationError 4990: (2894-2897): Variable xc6 used before it was declared. +// DeclarationError 4990: (2907-2910): Variable xc7 used before it was declared. +// DeclarationError 4990: (2924-2927): Variable xc8 used before it was declared. +// DeclarationError 4990: (2937-2940): Variable xc9 used before it was declared. +// DeclarationError 4990: (2950-2953): Variable xca used before it was declared. +// DeclarationError 4990: (2963-2966): Variable xcb used before it was declared. +// DeclarationError 4990: (2976-2979): Variable xcc used before it was declared. +// DeclarationError 4990: (2989-2992): Variable xcd used before it was declared. +// DeclarationError 4990: (3002-3005): Variable xce used before it was declared. +// DeclarationError 4990: (3015-3018): Variable xcf used before it was declared. +// DeclarationError 4990: (3032-3035): Variable xd0 used before it was declared. +// DeclarationError 4990: (3045-3048): Variable xd1 used before it was declared. +// DeclarationError 4990: (3058-3061): Variable xd2 used before it was declared. +// DeclarationError 4990: (3071-3074): Variable xd3 used before it was declared. +// DeclarationError 4990: (3084-3087): Variable xd4 used before it was declared. +// DeclarationError 4990: (3097-3100): Variable xd5 used before it was declared. +// DeclarationError 4990: (3110-3113): Variable xd6 used before it was declared. +// DeclarationError 4990: (3123-3126): Variable xd7 used before it was declared. +// DeclarationError 4990: (3140-3143): Variable xd8 used before it was declared. +// DeclarationError 4990: (3153-3156): Variable xd9 used before it was declared. +// DeclarationError 4990: (3166-3169): Variable xda used before it was declared. +// DeclarationError 4990: (3179-3182): Variable xdb used before it was declared. +// DeclarationError 4990: (3192-3195): Variable xdc used before it was declared. +// DeclarationError 4990: (3205-3208): Variable xdd used before it was declared. +// DeclarationError 4990: (3218-3221): Variable xde used before it was declared. +// DeclarationError 4990: (3231-3234): Variable xdf used before it was declared. +// DeclarationError 4990: (3248-3251): Variable xe0 used before it was declared. +// DeclarationError 4990: (3261-3264): Variable xe1 used before it was declared. +// DeclarationError 4990: (3274-3277): Variable xe2 used before it was declared. +// DeclarationError 4990: (3287-3290): Variable xe3 used before it was declared. +// DeclarationError 4990: (3300-3303): Variable xe4 used before it was declared. +// DeclarationError 4990: (3313-3316): Variable xe5 used before it was declared. +// DeclarationError 4990: (3326-3329): Variable xe6 used before it was declared. +// DeclarationError 4990: (3339-3342): Variable xe7 used before it was declared. +// DeclarationError 4990: (3356-3359): Variable xe8 used before it was declared. +// DeclarationError 4990: (3369-3372): Variable xe9 used before it was declared. +// DeclarationError 4990: (3382-3385): Variable xea used before it was declared. +// DeclarationError 4990: (3395-3398): Variable xeb used before it was declared. +// DeclarationError 4990: (3408-3411): Variable xec used before it was declared. +// DeclarationError 4990: (3421-3424): Variable xed used before it was declared. +// DeclarationError 4990: (3434-3437): Variable xee used before it was declared. +// DeclarationError 4990: (3447-3450): Variable xef used before it was declared. +// DeclarationError 4990: (3464-3467): Variable xf0 used before it was declared. +// DeclarationError 4990: (3477-3480): Variable xf1 used before it was declared. +// DeclarationError 4990: (3490-3493): Variable xf2 used before it was declared. +// DeclarationError 4990: (3503-3506): Variable xf3 used before it was declared. +// DeclarationError 4990: (3516-3519): Variable xf4 used before it was declared. +// DeclarationError 4990: (3529-3532): Variable xf5 used before it was declared. +// DeclarationError 4990: (3542-3545): Variable xf6 used before it was declared. +// DeclarationError 4990: (3555-3558): Variable xf7 used before it was declared. +// DeclarationError 4990: (3572-3575): Variable xf8 used before it was declared. +// DeclarationError 4990: (3585-3588): Variable xf9 used before it was declared. +// DeclarationError 4990: (3598-3601): Variable xfa used before it was declared. +// DeclarationError 4990: (3611-3614): Variable xfb used before it was declared. +// DeclarationError 4990: (3624-3627): Variable xfc used before it was declared. +// DeclarationError 4990: (3637-3640): Variable xfd used before it was declared. +// DeclarationError 4990: (3650-3653): Variable xfe used before it was declared. +// DeclarationError 4990: (3663-3666): Variable xff used before it was declared. // Warning 4013: There are more than 256 errors. Aborting. diff --git a/test/tools/yulopti.cpp b/test/tools/yulopti.cpp index faab89e7923e..891f39c43365 100644 --- a/test/tools/yulopti.cpp +++ b/test/tools/yulopti.cpp @@ -180,7 +180,7 @@ class YulOpti parse(_source); disambiguate(); OptimiserSuite{m_context}.runSequence(_steps, *m_astRoot); - std::cout << AsmPrinter{AsmPrinter::TypePrinting::OmitDefault, m_dialect}(*m_astRoot) << std::endl; + std::cout << AsmPrinter{}(*m_astRoot) << std::endl; } void runInteractive(std::string _source, bool _disambiguated = false) @@ -228,7 +228,7 @@ class YulOpti *m_astRoot ); } - _source = AsmPrinter{AsmPrinter::TypePrinting::OmitDefault, m_dialect}(*m_astRoot); + _source = AsmPrinter{}(*m_astRoot); } catch (...) { diff --git a/tools/yulPhaser/Program.cpp b/tools/yulPhaser/Program.cpp index 14b6406493d7..bb9eebc4badc 100644 --- a/tools/yulPhaser/Program.cpp +++ b/tools/yulPhaser/Program.cpp @@ -105,7 +105,7 @@ void Program::optimise(std::vector const& _optimisationSteps) std::ostream& phaser::operator<<(std::ostream& _stream, Program const& _program) { - return _stream << AsmPrinter(AsmPrinter::TypePrinting::Full, _program.m_dialect)(_program.m_ast->root()); + return _stream << AsmPrinter()(_program.m_ast->root()); } std::string Program::toJson() const