prettier-plugin-solidity 1.0.0-dev.22 → 1.0.0-dev.24
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +28 -61
- package/coverage/clover.xml +1165 -0
- package/coverage/coverage-final.json +98 -0
- package/coverage/lcov-report/base.css +224 -0
- package/coverage/lcov-report/block-navigation.js +87 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +176 -0
- package/coverage/lcov-report/prettify.css +1 -0
- package/coverage/lcov-report/prettify.js +2 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +196 -0
- package/coverage/lcov-report/src/binary-operator-printers/arithmetic.js.html +244 -0
- package/coverage/lcov-report/src/binary-operator-printers/assignment.js.html +175 -0
- package/coverage/lcov-report/src/binary-operator-printers/bit.js.html +103 -0
- package/coverage/lcov-report/src/binary-operator-printers/comparison.js.html +199 -0
- package/coverage/lcov-report/src/binary-operator-printers/exponentiation.js.html +163 -0
- package/coverage/lcov-report/src/binary-operator-printers/index.html +221 -0
- package/coverage/lcov-report/src/binary-operator-printers/index.js.html +124 -0
- package/coverage/lcov-report/src/binary-operator-printers/logical.js.html +208 -0
- package/coverage/lcov-report/src/binary-operator-printers/shift.js.html +103 -0
- package/coverage/lcov-report/src/clean.js.html +109 -0
- package/coverage/lcov-report/src/comments/handler.js.html +373 -0
- package/coverage/lcov-report/src/comments/handlers/handleContractDefinitionComments.js.html +265 -0
- package/coverage/lcov-report/src/comments/handlers/handleModifierInvocationComments.js.html +292 -0
- package/coverage/lcov-report/src/comments/handlers/index.html +146 -0
- package/coverage/lcov-report/src/comments/handlers/index.js.html +103 -0
- package/coverage/lcov-report/src/comments/ignore.js.html +184 -0
- package/coverage/lcov-report/src/comments/index.html +161 -0
- package/coverage/lcov-report/src/comments/index.js.html +97 -0
- package/coverage/lcov-report/src/comments/printer.js.html +277 -0
- package/coverage/lcov-report/src/index.html +191 -0
- package/coverage/lcov-report/src/index.js.html +268 -0
- package/coverage/lcov-report/src/loc.js.html +133 -0
- package/coverage/lcov-report/src/nodes/ArrayTypeName.js.html +115 -0
- package/coverage/lcov-report/src/nodes/AssemblyAssignment.js.html +133 -0
- package/coverage/lcov-report/src/nodes/AssemblyBlock.js.html +160 -0
- package/coverage/lcov-report/src/nodes/AssemblyCall.js.html +133 -0
- package/coverage/lcov-report/src/nodes/AssemblyCase.js.html +112 -0
- package/coverage/lcov-report/src/nodes/AssemblyFor.js.html +139 -0
- package/coverage/lcov-report/src/nodes/AssemblyFunctionDefinition.js.html +184 -0
- package/coverage/lcov-report/src/nodes/AssemblyIf.js.html +115 -0
- package/coverage/lcov-report/src/nodes/AssemblyLocalDefinition.js.html +160 -0
- package/coverage/lcov-report/src/nodes/AssemblyMemberAccess.js.html +112 -0
- package/coverage/lcov-report/src/nodes/AssemblySwitch.js.html +133 -0
- package/coverage/lcov-report/src/nodes/BinaryOperation.js.html +127 -0
- package/coverage/lcov-report/src/nodes/Block.js.html +166 -0
- package/coverage/lcov-report/src/nodes/BooleanLiteral.js.html +100 -0
- package/coverage/lcov-report/src/nodes/Break.js.html +100 -0
- package/coverage/lcov-report/src/nodes/BreakStatement.js.html +100 -0
- package/coverage/lcov-report/src/nodes/CatchClause.js.html +148 -0
- package/coverage/lcov-report/src/nodes/Conditional.js.html +151 -0
- package/coverage/lcov-report/src/nodes/Continue.js.html +100 -0
- package/coverage/lcov-report/src/nodes/ContinueStatement.js.html +100 -0
- package/coverage/lcov-report/src/nodes/ContractDefinition.js.html +226 -0
- package/coverage/lcov-report/src/nodes/CustomErrorDefinition.js.html +139 -0
- package/coverage/lcov-report/src/nodes/DecimalNumber.js.html +100 -0
- package/coverage/lcov-report/src/nodes/DoWhileStatement.js.html +157 -0
- package/coverage/lcov-report/src/nodes/ElementaryTypeName.js.html +115 -0
- package/coverage/lcov-report/src/nodes/EmitStatement.js.html +100 -0
- package/coverage/lcov-report/src/nodes/EnumDefinition.js.html +151 -0
- package/coverage/lcov-report/src/nodes/EnumValue.js.html +100 -0
- package/coverage/lcov-report/src/nodes/EventDefinition.js.html +145 -0
- package/coverage/lcov-report/src/nodes/ExpressionStatement.js.html +181 -0
- package/coverage/lcov-report/src/nodes/FileLevelConstant.js.html +121 -0
- package/coverage/lcov-report/src/nodes/ForStatement.js.html +223 -0
- package/coverage/lcov-report/src/nodes/FunctionCall.js.html +280 -0
- package/coverage/lcov-report/src/nodes/FunctionDefinition.js.html +457 -0
- package/coverage/lcov-report/src/nodes/FunctionTypeName.js.html +217 -0
- package/coverage/lcov-report/src/nodes/HexLiteral.js.html +133 -0
- package/coverage/lcov-report/src/nodes/HexNumber.js.html +100 -0
- package/coverage/lcov-report/src/nodes/Identifier.js.html +100 -0
- package/coverage/lcov-report/src/nodes/IfStatement.js.html +265 -0
- package/coverage/lcov-report/src/nodes/ImportDirective.js.html +247 -0
- package/coverage/lcov-report/src/nodes/IndexAccess.js.html +199 -0
- package/coverage/lcov-report/src/nodes/IndexRangeAccess.js.html +121 -0
- package/coverage/lcov-report/src/nodes/InheritanceSpecifier.js.html +130 -0
- package/coverage/lcov-report/src/nodes/InlineAssemblyStatement.js.html +148 -0
- package/coverage/lcov-report/src/nodes/LabelDefinition.js.html +118 -0
- package/coverage/lcov-report/src/nodes/Mapping.js.html +118 -0
- package/coverage/lcov-report/src/nodes/MemberAccess.js.html +466 -0
- package/coverage/lcov-report/src/nodes/ModifierDefinition.js.html +259 -0
- package/coverage/lcov-report/src/nodes/ModifierInvocation.js.html +190 -0
- package/coverage/lcov-report/src/nodes/NameValueExpression.js.html +115 -0
- package/coverage/lcov-report/src/nodes/NameValueList.js.html +148 -0
- package/coverage/lcov-report/src/nodes/NewExpression.js.html +100 -0
- package/coverage/lcov-report/src/nodes/NumberLiteral.js.html +109 -0
- package/coverage/lcov-report/src/nodes/PragmaDirective.js.html +100 -0
- package/coverage/lcov-report/src/nodes/ReturnStatement.js.html +157 -0
- package/coverage/lcov-report/src/nodes/RevertStatement.js.html +100 -0
- package/coverage/lcov-report/src/nodes/SourceUnit.js.html +133 -0
- package/coverage/lcov-report/src/nodes/StateVariableDeclaration.js.html +166 -0
- package/coverage/lcov-report/src/nodes/StringLiteral.js.html +148 -0
- package/coverage/lcov-report/src/nodes/StructDefinition.js.html +154 -0
- package/coverage/lcov-report/src/nodes/ThrowStatement.js.html +100 -0
- package/coverage/lcov-report/src/nodes/TryStatement.js.html +214 -0
- package/coverage/lcov-report/src/nodes/TupleExpression.js.html +160 -0
- package/coverage/lcov-report/src/nodes/TypeDefinition.js.html +100 -0
- package/coverage/lcov-report/src/nodes/UnaryOperation.js.html +121 -0
- package/coverage/lcov-report/src/nodes/UncheckedStatement.js.html +118 -0
- package/coverage/lcov-report/src/nodes/UserDefinedTypeName.js.html +100 -0
- package/coverage/lcov-report/src/nodes/UsingForDeclaration.js.html +166 -0
- package/coverage/lcov-report/src/nodes/VariableDeclaration.js.html +253 -0
- package/coverage/lcov-report/src/nodes/VariableDeclarationStatement.js.html +217 -0
- package/coverage/lcov-report/src/nodes/WhileStatement.js.html +154 -0
- package/coverage/lcov-report/src/nodes/index.html +1241 -0
- package/coverage/lcov-report/src/nodes/index.js.html +316 -0
- package/coverage/lcov-report/src/nodes/print-comments.js.html +166 -0
- package/coverage/lcov-report/src/nodes/print-preserving-empty-lines.js.html +244 -0
- package/coverage/lcov-report/src/nodes/print-separated-item.js.html +148 -0
- package/coverage/lcov-report/src/nodes/print-separated-list.js.html +154 -0
- package/coverage/lcov-report/src/options.js.html +238 -0
- package/coverage/lcov-report/src/parser.js.html +643 -0
- package/coverage/lcov-report/src/printer.js.html +214 -0
- package/coverage/lcov.info +2658 -0
- package/package.json +5 -5
- package/src/binary-operator-printers/index.js +1 -1
- package/src/comments/handler.js +15 -12
- package/src/comments/handlers/{ContractDefinition.js → handleContractDefinitionComments.js} +3 -3
- package/src/comments/handlers/handleModifierInvocationComments.js +69 -0
- package/src/comments/handlers/index.js +6 -0
- package/src/comments/printer.js +3 -3
- package/src/nodes/AssemblyBlock.js +1 -1
- package/src/nodes/AssemblyFunctionDefinition.js +10 -12
- package/src/nodes/Continue.js +5 -0
- package/src/nodes/ContractDefinition.js +1 -1
- package/src/nodes/DoWhileStatement.js +3 -1
- package/src/nodes/FunctionCall.js +2 -2
- package/src/nodes/FunctionDefinition.js +4 -10
- package/src/nodes/IfStatement.js +1 -3
- package/src/nodes/IndexAccess.js +2 -2
- package/src/nodes/ModifierInvocation.js +16 -3
- package/src/nodes/TryStatement.js +4 -6
- package/src/nodes/VariableDeclarationStatement.js +2 -2
- package/src/nodes/WhileStatement.js +3 -1
- package/src/nodes/index.js +2 -1
- package/src/nodes/print-separated-item.js +10 -6
- package/src/nodes/print-separated-list.js +6 -5
- package/src/options.js +0 -20
- package/src/parser.js +0 -10
- package/.github/FUNDING.yml +0 -1
- package/.github/dependabot.yml +0 -23
- package/.github/workflows/CI.yml +0 -83
- package/assets/telegram-badge.svg +0 -29
- package/scripts/generateIndexes.js +0 -16
- package/scripts/makeData.js +0 -23
- package/tests/config/.prettierrc +0 -5
- package/tests/config/format-test.js +0 -458
- package/tests/config/require-prettier.js +0 -5
- package/tests/config/require-standalone.js +0 -25
- package/tests/config/setup.js +0 -7
- package/tests/config/utils/check-parsers.js +0 -207
- package/tests/config/utils/compile-contract.js +0 -36
- package/tests/config/utils/consistent-end-of-line.js +0 -13
- package/tests/config/utils/create-snapshot.js +0 -98
- package/tests/config/utils/stringify-options-for-title.js +0 -15
- package/tests/config/utils/visualize-end-of-line.js +0 -18
- package/tests/config/utils/visualize-range.js +0 -40
- package/tests/format/AddressPayable/AddressPayable.sol +0 -10
- package/tests/format/AddressPayable/__snapshots__/jsfmt.spec.js.snap +0 -37
- package/tests/format/AddressPayable/jsfmt.spec.js +0 -1
- package/tests/format/AllSolidityFeatures/AllSolidityFeatures.sol +0 -534
- package/tests/format/AllSolidityFeatures/__snapshots__/jsfmt.spec.js.snap +0 -1148
- package/tests/format/AllSolidityFeatures/jsfmt.spec.js +0 -1
- package/tests/format/Arrays/Arrays.sol +0 -17
- package/tests/format/Arrays/__snapshots__/jsfmt.spec.js.snap +0 -63
- package/tests/format/Arrays/jsfmt.spec.js +0 -1
- package/tests/format/Assembly/Assembly.sol +0 -187
- package/tests/format/Assembly/__snapshots__/jsfmt.spec.js.snap +0 -422
- package/tests/format/Assembly/jsfmt.spec.js +0 -1
- package/tests/format/BasicIterator/BasicIterator.sol +0 -44
- package/tests/format/BasicIterator/__snapshots__/jsfmt.spec.js.snap +0 -102
- package/tests/format/BasicIterator/jsfmt.spec.js +0 -1
- package/tests/format/BinaryOperators/BinaryOperators.sol +0 -186
- package/tests/format/BinaryOperators/Parentheses.sol +0 -132
- package/tests/format/BinaryOperators/__snapshots__/jsfmt.spec.js.snap +0 -952
- package/tests/format/BinaryOperators/jsfmt.spec.js +0 -1
- package/tests/format/BreakingChangesV0.7.4/BreakingChangesV0.7.4.sol +0 -9
- package/tests/format/BreakingChangesV0.7.4/__snapshots__/jsfmt.spec.js.snap +0 -198
- package/tests/format/BreakingChangesV0.7.4/jsfmt.spec.js +0 -14
- package/tests/format/BreakingChangesV0.8.0/BreakingChangesV0.8.0.sol +0 -43
- package/tests/format/BreakingChangesV0.8.0/__snapshots__/jsfmt.spec.js.snap +0 -815
- package/tests/format/BreakingChangesV0.8.0/jsfmt.spec.js +0 -26
- package/tests/format/Comments/Comments.sol +0 -116
- package/tests/format/Comments/__snapshots__/jsfmt.spec.js.snap +0 -270
- package/tests/format/Comments/jsfmt.spec.js +0 -1
- package/tests/format/Conditional/Conditional.sol +0 -26
- package/tests/format/Conditional/__snapshots__/jsfmt.spec.js.snap +0 -80
- package/tests/format/Conditional/jsfmt.spec.js +0 -1
- package/tests/format/Constructors/Constructors.sol +0 -8
- package/tests/format/Constructors/__snapshots__/jsfmt.spec.js.snap +0 -54
- package/tests/format/Constructors/jsfmt.spec.js +0 -1
- package/tests/format/ContractDefinitions/ContractDefinitions.sol +0 -2
- package/tests/format/ContractDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -22
- package/tests/format/ContractDefinitions/jsfmt.spec.js +0 -1
- package/tests/format/CustomErrors/CustomErrors.sol +0 -20
- package/tests/format/CustomErrors/__snapshots__/jsfmt.spec.js.snap +0 -50
- package/tests/format/CustomErrors/jsfmt.spec.js +0 -1
- package/tests/format/EnumDefinitions/EnumDefinitions.sol +0 -4
- package/tests/format/EnumDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -72
- package/tests/format/EnumDefinitions/jsfmt.spec.js +0 -2
- package/tests/format/Etc/Etc.sol +0 -48
- package/tests/format/Etc/__snapshots__/jsfmt.spec.js.snap +0 -134
- package/tests/format/Etc/jsfmt.spec.js +0 -1
- package/tests/format/ExplicitVariableTypes/ExplicitVariableTypes.sol +0 -36
- package/tests/format/ExplicitVariableTypes/__snapshots__/jsfmt.spec.js.snap +0 -258
- package/tests/format/ExplicitVariableTypes/jsfmt.spec.js +0 -9
- package/tests/format/ForStatements/ForStatements.sol +0 -43
- package/tests/format/ForStatements/__snapshots__/jsfmt.spec.js.snap +0 -108
- package/tests/format/ForStatements/jsfmt.spec.js +0 -1
- package/tests/format/FunctionCalls/FunctionCalls.sol +0 -40
- package/tests/format/FunctionCalls/__snapshots__/jsfmt.spec.js.snap +0 -310
- package/tests/format/FunctionCalls/jsfmt.spec.js +0 -2
- package/tests/format/FunctionDefinitions/FunctionDefinitions.sol +0 -169
- package/tests/format/FunctionDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -875
- package/tests/format/FunctionDefinitions/jsfmt.spec.js +0 -1
- package/tests/format/HexLiteral/HexLiteral.sol +0 -7
- package/tests/format/HexLiteral/__snapshots__/jsfmt.spec.js.snap +0 -57
- package/tests/format/HexLiteral/jsfmt.spec.js +0 -8
- package/tests/format/IfStatements/IfStatements.sol +0 -112
- package/tests/format/IfStatements/__snapshots__/jsfmt.spec.js.snap +0 -534
- package/tests/format/IfStatements/jsfmt.spec.js +0 -1
- package/tests/format/Immutable/Immutable.sol +0 -20
- package/tests/format/Immutable/__snapshots__/jsfmt.spec.js.snap +0 -53
- package/tests/format/Immutable/jsfmt.spec.js +0 -1
- package/tests/format/ImportDirective/ImportDirectives.sol +0 -5
- package/tests/format/ImportDirective/__snapshots__/jsfmt.spec.js.snap +0 -46
- package/tests/format/ImportDirective/jsfmt.spec.js +0 -2
- package/tests/format/Inbox/Inbox.sol +0 -33
- package/tests/format/Inbox/__snapshots__/jsfmt.spec.js.snap +0 -79
- package/tests/format/Inbox/jsfmt.spec.js +0 -1
- package/tests/format/IndexOf/IndexOf.sol +0 -67
- package/tests/format/IndexOf/__snapshots__/jsfmt.spec.js.snap +0 -144
- package/tests/format/IndexOf/jsfmt.spec.js +0 -1
- package/tests/format/IndexRangeAccess/IndexRangeAccess.sol +0 -9
- package/tests/format/IndexRangeAccess/__snapshots__/jsfmt.spec.js.snap +0 -31
- package/tests/format/IndexRangeAccess/jsfmt.spec.js +0 -1
- package/tests/format/InheritanceSpecifier/InheritanceSpecifier.sol +0 -2
- package/tests/format/InheritanceSpecifier/__snapshots__/jsfmt.spec.js.snap +0 -24
- package/tests/format/InheritanceSpecifier/jsfmt.spec.js +0 -1
- package/tests/format/Issues/Issue205.sol +0 -12
- package/tests/format/Issues/Issue289.sol +0 -6
- package/tests/format/Issues/Issue355.sol +0 -12
- package/tests/format/Issues/Issue385.sol +0 -13
- package/tests/format/Issues/Issue564.sol +0 -9
- package/tests/format/Issues/__snapshots__/jsfmt.spec.js.snap +0 -174
- package/tests/format/Issues/jsfmt.spec.js +0 -1
- package/tests/format/Libraries/Libraries.sol +0 -10
- package/tests/format/Libraries/__snapshots__/jsfmt.spec.js.snap +0 -102
- package/tests/format/Libraries/jsfmt.spec.js +0 -2
- package/tests/format/MemberAccess/MemberAccess.sol +0 -102
- package/tests/format/MemberAccess/__snapshots__/jsfmt.spec.js.snap +0 -243
- package/tests/format/MemberAccess/jsfmt.spec.js +0 -1
- package/tests/format/ModifierDefinitions/ModifierDefinitions.sol +0 -8
- package/tests/format/ModifierDefinitions/__snapshots__/jsfmt.spec.js.snap +0 -33
- package/tests/format/ModifierDefinitions/jsfmt.spec.js +0 -1
- package/tests/format/ModifierInvocations/ModifierInvocations.sol +0 -17
- package/tests/format/ModifierInvocations/__snapshots__/jsfmt.spec.js.snap +0 -51
- package/tests/format/ModifierInvocations/jsfmt.spec.js +0 -1
- package/tests/format/MultipartStrings/MultipartStrings.sol +0 -10
- package/tests/format/MultipartStrings/__snapshots__/jsfmt.spec.js.snap +0 -39
- package/tests/format/MultipartStrings/jsfmt.spec.js +0 -1
- package/tests/format/NameValueExpression/NameValueExpression.sol +0 -6
- package/tests/format/NameValueExpression/__snapshots__/jsfmt.spec.js.snap +0 -68
- package/tests/format/NameValueExpression/jsfmt.spec.js +0 -2
- package/tests/format/Ownable/Ownable.sol +0 -75
- package/tests/format/Ownable/__snapshots__/jsfmt.spec.js.snap +0 -163
- package/tests/format/Ownable/jsfmt.spec.js +0 -1
- package/tests/format/Parentheses/AddNoParentheses.sol +0 -92
- package/tests/format/Parentheses/BitAndNoParentheses.sol +0 -92
- package/tests/format/Parentheses/BitOrNoParentheses.sol +0 -92
- package/tests/format/Parentheses/BitXorNoParentheses.sol +0 -92
- package/tests/format/Parentheses/DivNoParentheses.sol +0 -92
- package/tests/format/Parentheses/ExpNoParentheses.sol +0 -92
- package/tests/format/Parentheses/LogicNoParentheses.sol +0 -20
- package/tests/format/Parentheses/ModNoParentheses.sol +0 -92
- package/tests/format/Parentheses/MulNoParentheses.sol +0 -92
- package/tests/format/Parentheses/ShiftLNoParentheses.sol +0 -92
- package/tests/format/Parentheses/ShiftRNoParentheses.sol +0 -92
- package/tests/format/Parentheses/SubNoParentheses.sol +0 -92
- package/tests/format/Parentheses/__snapshots__/jsfmt.spec.js.snap +0 -2237
- package/tests/format/Parentheses/jsfmt.spec.js +0 -1
- package/tests/format/Pragma/Pragma.sol +0 -8
- package/tests/format/Pragma/__snapshots__/jsfmt.spec.js.snap +0 -29
- package/tests/format/Pragma/jsfmt.spec.js +0 -1
- package/tests/format/PrettierIgnore/PrettierIgnore.sol +0 -39
- package/tests/format/PrettierIgnore/__snapshots__/jsfmt.spec.js.snap +0 -87
- package/tests/format/PrettierIgnore/jsfmt.spec.js +0 -1
- package/tests/format/Proxy/Proxy.sol +0 -52
- package/tests/format/Proxy/__snapshots__/jsfmt.spec.js.snap +0 -127
- package/tests/format/Proxy/jsfmt.spec.js +0 -1
- package/tests/format/RespectDefaultOptions/__snapshots__/jsfmt.spec.js.snap +0 -19
- package/tests/format/RespectDefaultOptions/jsfmt.spec.js +0 -5
- package/tests/format/RespectDefaultOptions/respect-default-options.js +0 -3
- package/tests/format/SampleCrowdsale/SampleCrowdsale.sol +0 -48
- package/tests/format/SampleCrowdsale/__snapshots__/jsfmt.spec.js.snap +0 -113
- package/tests/format/SampleCrowdsale/jsfmt.spec.js +0 -1
- package/tests/format/SimpleAuction/SimpleAuction.sol +0 -123
- package/tests/format/SimpleAuction/__snapshots__/jsfmt.spec.js.snap +0 -250
- package/tests/format/SimpleAuction/jsfmt.spec.js +0 -1
- package/tests/format/SimpleStorage/SimpleStorage.sol +0 -14
- package/tests/format/SimpleStorage/__snapshots__/jsfmt.spec.js.snap +0 -41
- package/tests/format/SimpleStorage/jsfmt.spec.js +0 -1
- package/tests/format/SplittableCommodity/SplittableCommodity.sol +0 -57
- package/tests/format/SplittableCommodity/__snapshots__/jsfmt.spec.js.snap +0 -135
- package/tests/format/SplittableCommodity/jsfmt.spec.js +0 -1
- package/tests/format/StateVariableDeclarations/StateVariableDeclarations.sol +0 -3
- package/tests/format/StateVariableDeclarations/__snapshots__/jsfmt.spec.js.snap +0 -20
- package/tests/format/StateVariableDeclarations/jsfmt.spec.js +0 -1
- package/tests/format/StringLiteral/StringLiteral.sol +0 -11
- package/tests/format/StringLiteral/__snapshots__/jsfmt.spec.js.snap +0 -36
- package/tests/format/StringLiteral/jsfmt.spec.js +0 -1
- package/tests/format/StyleGuide/BlankLines.sol +0 -19
- package/tests/format/StyleGuide/ControlStructures.sol +0 -57
- package/tests/format/StyleGuide/FunctionDeclaration.sol +0 -135
- package/tests/format/StyleGuide/Mappings.sol +0 -9
- package/tests/format/StyleGuide/MaximumLineLength.sol +0 -67
- package/tests/format/StyleGuide/OtherRecommendations.sol +0 -29
- package/tests/format/StyleGuide/VariableDeclarations.sol +0 -6
- package/tests/format/StyleGuide/WhitespaceInExpressions.sol +0 -13
- package/tests/format/StyleGuide/__snapshots__/jsfmt.spec.js.snap +0 -772
- package/tests/format/StyleGuide/jsfmt.spec.js +0 -1
- package/tests/format/TryCatch/TryCatch.sol +0 -103
- package/tests/format/TryCatch/__snapshots__/jsfmt.spec.js.snap +0 -241
- package/tests/format/TryCatch/jsfmt.spec.js +0 -1
- package/tests/format/Tupples/Tupples.sol +0 -25
- package/tests/format/Tupples/__snapshots__/jsfmt.spec.js.snap +0 -74
- package/tests/format/Tupples/jsfmt.spec.js +0 -1
- package/tests/format/TypeDefinition/TypeDefinition.sol +0 -12
- package/tests/format/TypeDefinition/__snapshots__/jsfmt.spec.js.snap +0 -74
- package/tests/format/TypeDefinition/jsfmt.spec.js +0 -1
- package/tests/format/WhileStatements/WhileStatements.sol +0 -37
- package/tests/format/WhileStatements/__snapshots__/jsfmt.spec.js.snap +0 -110
- package/tests/format/WhileStatements/jsfmt.spec.js +0 -1
- package/tests/format/WrongCompiler/WrongCompiler.sol +0 -3
- package/tests/format/WrongCompiler/__snapshots__/jsfmt.spec.js.snap +0 -55
- package/tests/format/WrongCompiler/jsfmt.spec.js +0 -10
- package/tests/format/quotes/Quotes.sol +0 -24
- package/tests/format/quotes/__snapshots__/jsfmt.spec.js.snap +0 -135
- package/tests/format/quotes/jsfmt.spec.js +0 -2
- package/tests/format/strings/__snapshots__/jsfmt.spec.js.snap +0 -1579
- package/tests/format/strings/jsfmt.spec.js +0 -1
- package/tests/format/strings/strings.sol +0 -717
- package/tests/unit/binary-operator-printers/__snapshots__/index.test.js.snap +0 -13
- package/tests/unit/binary-operator-printers/index.test.js +0 -5
- package/tests/unit/comments/printer.test.js +0 -9
- package/tests/unit/prettier-version.test.js +0 -26
- package/tests/unit/printer.test.js +0 -9
|
@@ -1 +0,0 @@
|
|
|
1
|
-
run_spec(__dirname, ['solidity-parse']);
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
pragma solidity ^0.5.2;
|
|
2
|
-
|
|
3
|
-
contract Arrays {
|
|
4
|
-
bytes32[] public permissions = [bytes32("addPartner"), bytes32("removePartner"), bytes32("addGroup"), bytes32("removeGroup"), bytes32("addUserToGroup"), bytes32("removeUserFromGroup"), bytes32("addSolution"), bytes32("removeSolution"), bytes32("addLibrary"), bytes32("removeLibrary"), bytes32("addPermissionToGroup"), bytes32("removePermissionFromGroup")];
|
|
5
|
-
|
|
6
|
-
function a() {
|
|
7
|
-
Outcome.OutcomeItem[] memory outcomeFrom = abi.decode(fromPart.outcome, (Outcome.OutcomeItem[]));
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
contract ArraySlices {
|
|
12
|
-
function f(bytes calldata x) public {
|
|
13
|
-
bytes memory a1 = abi.decode(x[:], (bytes));
|
|
14
|
-
bytes4 a2 = abi.decode(x[:4], (bytes4));
|
|
15
|
-
address a3 = abi.decode(x[4:], (address));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Arrays.sol format 1`] = `
|
|
4
|
-
====================================options=====================================
|
|
5
|
-
parsers: ["solidity-parse"]
|
|
6
|
-
printWidth: 80
|
|
7
|
-
| printWidth
|
|
8
|
-
=====================================input======================================
|
|
9
|
-
pragma solidity ^0.5.2;
|
|
10
|
-
|
|
11
|
-
contract Arrays {
|
|
12
|
-
bytes32[] public permissions = [bytes32("addPartner"), bytes32("removePartner"), bytes32("addGroup"), bytes32("removeGroup"), bytes32("addUserToGroup"), bytes32("removeUserFromGroup"), bytes32("addSolution"), bytes32("removeSolution"), bytes32("addLibrary"), bytes32("removeLibrary"), bytes32("addPermissionToGroup"), bytes32("removePermissionFromGroup")];
|
|
13
|
-
|
|
14
|
-
function a() {
|
|
15
|
-
Outcome.OutcomeItem[] memory outcomeFrom = abi.decode(fromPart.outcome, (Outcome.OutcomeItem[]));
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
contract ArraySlices {
|
|
20
|
-
function f(bytes calldata x) public {
|
|
21
|
-
bytes memory a1 = abi.decode(x[:], (bytes));
|
|
22
|
-
bytes4 a2 = abi.decode(x[:4], (bytes4));
|
|
23
|
-
address a3 = abi.decode(x[4:], (address));
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
=====================================output=====================================
|
|
28
|
-
pragma solidity ^0.5.2;
|
|
29
|
-
|
|
30
|
-
contract Arrays {
|
|
31
|
-
bytes32[] public permissions = [
|
|
32
|
-
bytes32("addPartner"),
|
|
33
|
-
bytes32("removePartner"),
|
|
34
|
-
bytes32("addGroup"),
|
|
35
|
-
bytes32("removeGroup"),
|
|
36
|
-
bytes32("addUserToGroup"),
|
|
37
|
-
bytes32("removeUserFromGroup"),
|
|
38
|
-
bytes32("addSolution"),
|
|
39
|
-
bytes32("removeSolution"),
|
|
40
|
-
bytes32("addLibrary"),
|
|
41
|
-
bytes32("removeLibrary"),
|
|
42
|
-
bytes32("addPermissionToGroup"),
|
|
43
|
-
bytes32("removePermissionFromGroup")
|
|
44
|
-
];
|
|
45
|
-
|
|
46
|
-
function a() {
|
|
47
|
-
Outcome.OutcomeItem[] memory outcomeFrom = abi.decode(
|
|
48
|
-
fromPart.outcome,
|
|
49
|
-
(Outcome.OutcomeItem[])
|
|
50
|
-
);
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
contract ArraySlices {
|
|
55
|
-
function f(bytes calldata x) public {
|
|
56
|
-
bytes memory a1 = abi.decode(x[:], (bytes));
|
|
57
|
-
bytes4 a2 = abi.decode(x[:4], (bytes4));
|
|
58
|
-
address a3 = abi.decode(x[4:], (address));
|
|
59
|
-
}
|
|
60
|
-
}
|
|
61
|
-
|
|
62
|
-
================================================================================
|
|
63
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
run_spec(__dirname, ['solidity-parse']);
|
|
@@ -1,187 +0,0 @@
|
|
|
1
|
-
contract Assembly {
|
|
2
|
-
function ifAssembly() {
|
|
3
|
-
assembly {
|
|
4
|
-
if
|
|
5
|
-
returndatasize {
|
|
6
|
-
success := 0
|
|
7
|
-
}
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
|
|
11
|
-
function caseAssembly() {
|
|
12
|
-
assembly {
|
|
13
|
-
switch value
|
|
14
|
-
case 0 {
|
|
15
|
-
mstore(0, 0x0000000000000000000000000000000000000000000000000000000000000000)
|
|
16
|
-
}
|
|
17
|
-
case 1 {
|
|
18
|
-
mstore(0, 0x1111111111111111111111111111111111111111111111111111111111111111)
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
function forAssembly() {
|
|
24
|
-
assembly {
|
|
25
|
-
for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }
|
|
26
|
-
}
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
function callWithComments() {
|
|
30
|
-
assembly {
|
|
31
|
-
f(
|
|
32
|
-
1, // one
|
|
33
|
-
2, // two
|
|
34
|
-
3 // three
|
|
35
|
-
)
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
|
|
39
|
-
function assemblyFunctionNoParameters() {
|
|
40
|
-
assembly {
|
|
41
|
-
function getAnswer ()
|
|
42
|
-
-> answer {
|
|
43
|
-
answer:= 42
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
function assemblyFunctionOneParameter() {
|
|
49
|
-
assembly {
|
|
50
|
-
function inc (x)
|
|
51
|
-
-> result {
|
|
52
|
-
result := add(x,
|
|
53
|
-
1)
|
|
54
|
-
}
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function assemblyFunctionThreeParameters() {
|
|
59
|
-
assembly {
|
|
60
|
-
function sum (a, b, c)
|
|
61
|
-
-> result {
|
|
62
|
-
result := add(a,
|
|
63
|
-
add(b, c))
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
}
|
|
67
|
-
|
|
68
|
-
function assemblyFunctionLongParameters() {
|
|
69
|
-
assembly {
|
|
70
|
-
function sum (thisIs, aFunctionWithVery, veryLongParameterNames, andItAlsoHasALotOfParameters, soItShouldBeSplitInMultipleLines)
|
|
71
|
-
-> result {
|
|
72
|
-
result := 0
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
function assemblyFunctionLongReturnParameters() {
|
|
78
|
-
assembly {
|
|
79
|
-
function sum (a, b, c, d, e)
|
|
80
|
-
-> thisIs, aFunctionWithVery, veryLongParameterNames, andItAlsoHasALotOfParameters, soItShouldBeSplitInMultipleLines {
|
|
81
|
-
thisIs := 0
|
|
82
|
-
aFunctionWithVery := 0
|
|
83
|
-
veryLongParameterNames := 0
|
|
84
|
-
andItAlsoHasALotOfParameters := 0
|
|
85
|
-
soItShouldBeSplitInMultipleLines := 0
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
}
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
function assemblyFunctionLongParametersAndReturnParameters() {
|
|
92
|
-
assembly {
|
|
93
|
-
function sum (a,veryLong, listof, parameters, thatShould,splitForSure)
|
|
94
|
-
-> thisIs, aFunctionWithVery, veryLongParameterNames, andItAlsoHasALotOfParameters, soItShouldBeSplitInMultipleLines {
|
|
95
|
-
thisIs := 0
|
|
96
|
-
aFunctionWithVery := 0
|
|
97
|
-
veryLongParameterNames := 0
|
|
98
|
-
andItAlsoHasALotOfParameters := 0
|
|
99
|
-
soItShouldBeSplitInMultipleLines := 0
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
function assemblyNoParameterCalls() {
|
|
105
|
-
assembly {
|
|
106
|
-
call(gas(), to, value, inputData, inputDataSize, 0, 0)
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
|
|
110
|
-
function assemblyLabels() {
|
|
111
|
-
assembly {
|
|
112
|
-
let n := calldataload(4)
|
|
113
|
-
let a := 1
|
|
114
|
-
let b := a
|
|
115
|
-
loop:
|
|
116
|
-
jumpi(loopend, eq(n, 0))
|
|
117
|
-
a add swap1
|
|
118
|
-
n := sub(n, 1)
|
|
119
|
-
jump(loop)
|
|
120
|
-
|
|
121
|
-
loopend:
|
|
122
|
-
mstore(0, a)
|
|
123
|
-
return(0, 0x20)
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
assembly{
|
|
127
|
-
let x := 8
|
|
128
|
-
jump(two)
|
|
129
|
-
one:
|
|
130
|
-
// Here the stack height is 2 (because we pushed x and 7),
|
|
131
|
-
// but the assembler thinks it is 1 because it reads
|
|
132
|
-
// from top to bottom.
|
|
133
|
-
// Accessing the stack variable x here will lead to errors.
|
|
134
|
-
x := 9
|
|
135
|
-
jump(three)
|
|
136
|
-
two:
|
|
137
|
-
7 // push something onto the stack
|
|
138
|
-
jump(one)
|
|
139
|
-
three:
|
|
140
|
-
}
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
function assemblyFunctionNoReturn () {
|
|
144
|
-
|
|
145
|
-
assembly {
|
|
146
|
-
|
|
147
|
-
function $somefn(somearg) {
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
function letWithoutValue ( ) {
|
|
153
|
-
|
|
154
|
-
assembly { let result }
|
|
155
|
-
}
|
|
156
|
-
|
|
157
|
-
function memberAccess ( ) {
|
|
158
|
-
|
|
159
|
-
assembly {
|
|
160
|
-
ds.slot := position
|
|
161
|
-
offset := x.offset
|
|
162
|
-
}
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function commentsInAssemblyBlock () {
|
|
166
|
-
|
|
167
|
-
assembly {
|
|
168
|
-
/* foo bar baz */
|
|
169
|
-
/* foobbbbbb */
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function withBreak() {
|
|
174
|
-
assembly {
|
|
175
|
-
for {} 1 {} {
|
|
176
|
-
break
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function memorySafe() {
|
|
182
|
-
assembly ("memory-safe") {
|
|
183
|
-
}
|
|
184
|
-
assembly "evmasm" ("memory-safe") {
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
@@ -1,422 +0,0 @@
|
|
|
1
|
-
// Jest Snapshot v1, https://goo.gl/fbAQLP
|
|
2
|
-
|
|
3
|
-
exports[`Assembly.sol format 1`] = `
|
|
4
|
-
====================================options=====================================
|
|
5
|
-
parsers: ["solidity-parse"]
|
|
6
|
-
printWidth: 80
|
|
7
|
-
| printWidth
|
|
8
|
-
=====================================input======================================
|
|
9
|
-
contract Assembly {
|
|
10
|
-
function ifAssembly() {
|
|
11
|
-
assembly {
|
|
12
|
-
if
|
|
13
|
-
returndatasize {
|
|
14
|
-
success := 0
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
}
|
|
18
|
-
|
|
19
|
-
function caseAssembly() {
|
|
20
|
-
assembly {
|
|
21
|
-
switch value
|
|
22
|
-
case 0 {
|
|
23
|
-
mstore(0, 0x0000000000000000000000000000000000000000000000000000000000000000)
|
|
24
|
-
}
|
|
25
|
-
case 1 {
|
|
26
|
-
mstore(0, 0x1111111111111111111111111111111111111111111111111111111111111111)
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
function forAssembly() {
|
|
32
|
-
assembly {
|
|
33
|
-
for { let i := 0 } lt(i, x) { i := add(i, 1) } { y := mul(2, y) }
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
function callWithComments() {
|
|
38
|
-
assembly {
|
|
39
|
-
f(
|
|
40
|
-
1, // one
|
|
41
|
-
2, // two
|
|
42
|
-
3 // three
|
|
43
|
-
)
|
|
44
|
-
}
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
function assemblyFunctionNoParameters() {
|
|
48
|
-
assembly {
|
|
49
|
-
function getAnswer ()
|
|
50
|
-
-> answer {
|
|
51
|
-
answer:= 42
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
}
|
|
55
|
-
|
|
56
|
-
function assemblyFunctionOneParameter() {
|
|
57
|
-
assembly {
|
|
58
|
-
function inc (x)
|
|
59
|
-
-> result {
|
|
60
|
-
result := add(x,
|
|
61
|
-
1)
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
|
|
66
|
-
function assemblyFunctionThreeParameters() {
|
|
67
|
-
assembly {
|
|
68
|
-
function sum (a, b, c)
|
|
69
|
-
-> result {
|
|
70
|
-
result := add(a,
|
|
71
|
-
add(b, c))
|
|
72
|
-
}
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
function assemblyFunctionLongParameters() {
|
|
77
|
-
assembly {
|
|
78
|
-
function sum (thisIs, aFunctionWithVery, veryLongParameterNames, andItAlsoHasALotOfParameters, soItShouldBeSplitInMultipleLines)
|
|
79
|
-
-> result {
|
|
80
|
-
result := 0
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function assemblyFunctionLongReturnParameters() {
|
|
86
|
-
assembly {
|
|
87
|
-
function sum (a, b, c, d, e)
|
|
88
|
-
-> thisIs, aFunctionWithVery, veryLongParameterNames, andItAlsoHasALotOfParameters, soItShouldBeSplitInMultipleLines {
|
|
89
|
-
thisIs := 0
|
|
90
|
-
aFunctionWithVery := 0
|
|
91
|
-
veryLongParameterNames := 0
|
|
92
|
-
andItAlsoHasALotOfParameters := 0
|
|
93
|
-
soItShouldBeSplitInMultipleLines := 0
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
}
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
function assemblyFunctionLongParametersAndReturnParameters() {
|
|
100
|
-
assembly {
|
|
101
|
-
function sum (a,veryLong, listof, parameters, thatShould,splitForSure)
|
|
102
|
-
-> thisIs, aFunctionWithVery, veryLongParameterNames, andItAlsoHasALotOfParameters, soItShouldBeSplitInMultipleLines {
|
|
103
|
-
thisIs := 0
|
|
104
|
-
aFunctionWithVery := 0
|
|
105
|
-
veryLongParameterNames := 0
|
|
106
|
-
andItAlsoHasALotOfParameters := 0
|
|
107
|
-
soItShouldBeSplitInMultipleLines := 0
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
function assemblyNoParameterCalls() {
|
|
113
|
-
assembly {
|
|
114
|
-
call(gas(), to, value, inputData, inputDataSize, 0, 0)
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
function assemblyLabels() {
|
|
119
|
-
assembly {
|
|
120
|
-
let n := calldataload(4)
|
|
121
|
-
let a := 1
|
|
122
|
-
let b := a
|
|
123
|
-
loop:
|
|
124
|
-
jumpi(loopend, eq(n, 0))
|
|
125
|
-
a add swap1
|
|
126
|
-
n := sub(n, 1)
|
|
127
|
-
jump(loop)
|
|
128
|
-
|
|
129
|
-
loopend:
|
|
130
|
-
mstore(0, a)
|
|
131
|
-
return(0, 0x20)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
assembly{
|
|
135
|
-
let x := 8
|
|
136
|
-
jump(two)
|
|
137
|
-
one:
|
|
138
|
-
// Here the stack height is 2 (because we pushed x and 7),
|
|
139
|
-
// but the assembler thinks it is 1 because it reads
|
|
140
|
-
// from top to bottom.
|
|
141
|
-
// Accessing the stack variable x here will lead to errors.
|
|
142
|
-
x := 9
|
|
143
|
-
jump(three)
|
|
144
|
-
two:
|
|
145
|
-
7 // push something onto the stack
|
|
146
|
-
jump(one)
|
|
147
|
-
three:
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
function assemblyFunctionNoReturn () {
|
|
152
|
-
|
|
153
|
-
assembly {
|
|
154
|
-
|
|
155
|
-
function $somefn(somearg) {
|
|
156
|
-
}
|
|
157
|
-
}
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
function letWithoutValue ( ) {
|
|
161
|
-
|
|
162
|
-
assembly { let result }
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
function memberAccess ( ) {
|
|
166
|
-
|
|
167
|
-
assembly {
|
|
168
|
-
ds.slot := position
|
|
169
|
-
offset := x.offset
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
|
|
173
|
-
function commentsInAssemblyBlock () {
|
|
174
|
-
|
|
175
|
-
assembly {
|
|
176
|
-
/* foo bar baz */
|
|
177
|
-
/* foobbbbbb */
|
|
178
|
-
}
|
|
179
|
-
}
|
|
180
|
-
|
|
181
|
-
function withBreak() {
|
|
182
|
-
assembly {
|
|
183
|
-
for {} 1 {} {
|
|
184
|
-
break
|
|
185
|
-
}
|
|
186
|
-
}
|
|
187
|
-
}
|
|
188
|
-
|
|
189
|
-
function memorySafe() {
|
|
190
|
-
assembly ("memory-safe") {
|
|
191
|
-
}
|
|
192
|
-
assembly "evmasm" ("memory-safe") {
|
|
193
|
-
}
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
=====================================output=====================================
|
|
198
|
-
contract Assembly {
|
|
199
|
-
function ifAssembly() {
|
|
200
|
-
assembly {
|
|
201
|
-
if returndatasize {
|
|
202
|
-
success := 0
|
|
203
|
-
}
|
|
204
|
-
}
|
|
205
|
-
}
|
|
206
|
-
|
|
207
|
-
function caseAssembly() {
|
|
208
|
-
assembly {
|
|
209
|
-
switch value
|
|
210
|
-
case 0 {
|
|
211
|
-
mstore(
|
|
212
|
-
0,
|
|
213
|
-
0x0000000000000000000000000000000000000000000000000000000000000000
|
|
214
|
-
)
|
|
215
|
-
}
|
|
216
|
-
case 1 {
|
|
217
|
-
mstore(
|
|
218
|
-
0,
|
|
219
|
-
0x1111111111111111111111111111111111111111111111111111111111111111
|
|
220
|
-
)
|
|
221
|
-
}
|
|
222
|
-
}
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
function forAssembly() {
|
|
226
|
-
assembly {
|
|
227
|
-
for {
|
|
228
|
-
let i := 0
|
|
229
|
-
} lt(i, x) {
|
|
230
|
-
i := add(i, 1)
|
|
231
|
-
} {
|
|
232
|
-
y := mul(2, y)
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
}
|
|
236
|
-
|
|
237
|
-
function callWithComments() {
|
|
238
|
-
assembly {
|
|
239
|
-
f(
|
|
240
|
-
1, // one
|
|
241
|
-
2, // two
|
|
242
|
-
3 // three
|
|
243
|
-
)
|
|
244
|
-
}
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
function assemblyFunctionNoParameters() {
|
|
248
|
-
assembly {
|
|
249
|
-
function getAnswer() -> answer {
|
|
250
|
-
answer := 42
|
|
251
|
-
}
|
|
252
|
-
}
|
|
253
|
-
}
|
|
254
|
-
|
|
255
|
-
function assemblyFunctionOneParameter() {
|
|
256
|
-
assembly {
|
|
257
|
-
function inc(x) -> result {
|
|
258
|
-
result := add(x, 1)
|
|
259
|
-
}
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function assemblyFunctionThreeParameters() {
|
|
264
|
-
assembly {
|
|
265
|
-
function sum(a, b, c) -> result {
|
|
266
|
-
result := add(a, add(b, c))
|
|
267
|
-
}
|
|
268
|
-
}
|
|
269
|
-
}
|
|
270
|
-
|
|
271
|
-
function assemblyFunctionLongParameters() {
|
|
272
|
-
assembly {
|
|
273
|
-
function sum(
|
|
274
|
-
thisIs,
|
|
275
|
-
aFunctionWithVery,
|
|
276
|
-
veryLongParameterNames,
|
|
277
|
-
andItAlsoHasALotOfParameters,
|
|
278
|
-
soItShouldBeSplitInMultipleLines
|
|
279
|
-
) -> result {
|
|
280
|
-
result := 0
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
}
|
|
284
|
-
|
|
285
|
-
function assemblyFunctionLongReturnParameters() {
|
|
286
|
-
assembly {
|
|
287
|
-
function sum(a, b, c, d, e)
|
|
288
|
-
->
|
|
289
|
-
thisIs,
|
|
290
|
-
aFunctionWithVery,
|
|
291
|
-
veryLongParameterNames,
|
|
292
|
-
andItAlsoHasALotOfParameters,
|
|
293
|
-
soItShouldBeSplitInMultipleLines
|
|
294
|
-
{
|
|
295
|
-
thisIs := 0
|
|
296
|
-
aFunctionWithVery := 0
|
|
297
|
-
veryLongParameterNames := 0
|
|
298
|
-
andItAlsoHasALotOfParameters := 0
|
|
299
|
-
soItShouldBeSplitInMultipleLines := 0
|
|
300
|
-
}
|
|
301
|
-
}
|
|
302
|
-
}
|
|
303
|
-
|
|
304
|
-
function assemblyFunctionLongParametersAndReturnParameters() {
|
|
305
|
-
assembly {
|
|
306
|
-
function sum(
|
|
307
|
-
a,
|
|
308
|
-
veryLong,
|
|
309
|
-
listof,
|
|
310
|
-
parameters,
|
|
311
|
-
thatShould,
|
|
312
|
-
splitForSure
|
|
313
|
-
)
|
|
314
|
-
->
|
|
315
|
-
thisIs,
|
|
316
|
-
aFunctionWithVery,
|
|
317
|
-
veryLongParameterNames,
|
|
318
|
-
andItAlsoHasALotOfParameters,
|
|
319
|
-
soItShouldBeSplitInMultipleLines
|
|
320
|
-
{
|
|
321
|
-
thisIs := 0
|
|
322
|
-
aFunctionWithVery := 0
|
|
323
|
-
veryLongParameterNames := 0
|
|
324
|
-
andItAlsoHasALotOfParameters := 0
|
|
325
|
-
soItShouldBeSplitInMultipleLines := 0
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
}
|
|
329
|
-
|
|
330
|
-
function assemblyNoParameterCalls() {
|
|
331
|
-
assembly {
|
|
332
|
-
call(gas(), to, value, inputData, inputDataSize, 0, 0)
|
|
333
|
-
}
|
|
334
|
-
}
|
|
335
|
-
|
|
336
|
-
function assemblyLabels() {
|
|
337
|
-
assembly {
|
|
338
|
-
let n := calldataload(4)
|
|
339
|
-
let a := 1
|
|
340
|
-
let b := a
|
|
341
|
-
loop:
|
|
342
|
-
jumpi(loopend, eq(n, 0))
|
|
343
|
-
a
|
|
344
|
-
add
|
|
345
|
-
swap1
|
|
346
|
-
n := sub(n, 1)
|
|
347
|
-
jump(loop)
|
|
348
|
-
|
|
349
|
-
loopend:
|
|
350
|
-
mstore(0, a)
|
|
351
|
-
return(0, 0x20)
|
|
352
|
-
}
|
|
353
|
-
|
|
354
|
-
assembly {
|
|
355
|
-
let x := 8
|
|
356
|
-
jump(two)
|
|
357
|
-
one:
|
|
358
|
-
// Here the stack height is 2 (because we pushed x and 7),
|
|
359
|
-
// but the assembler thinks it is 1 because it reads
|
|
360
|
-
// from top to bottom.
|
|
361
|
-
// Accessing the stack variable x here will lead to errors.
|
|
362
|
-
x := 9
|
|
363
|
-
jump(three)
|
|
364
|
-
two:
|
|
365
|
-
7 // push something onto the stack
|
|
366
|
-
jump(one)
|
|
367
|
-
three:
|
|
368
|
-
}
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
function assemblyFunctionNoReturn() {
|
|
372
|
-
assembly {
|
|
373
|
-
function $somefn(somearg) {
|
|
374
|
-
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}
|
|
378
|
-
|
|
379
|
-
function letWithoutValue() {
|
|
380
|
-
assembly {
|
|
381
|
-
let result
|
|
382
|
-
}
|
|
383
|
-
}
|
|
384
|
-
|
|
385
|
-
function memberAccess() {
|
|
386
|
-
assembly {
|
|
387
|
-
ds.slot := position
|
|
388
|
-
offset := x.offset
|
|
389
|
-
}
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
function commentsInAssemblyBlock() {
|
|
393
|
-
assembly {
|
|
394
|
-
/* foo bar baz */
|
|
395
|
-
/* foobbbbbb */
|
|
396
|
-
}
|
|
397
|
-
}
|
|
398
|
-
|
|
399
|
-
function withBreak() {
|
|
400
|
-
assembly {
|
|
401
|
-
for {
|
|
402
|
-
|
|
403
|
-
} 1 {
|
|
404
|
-
|
|
405
|
-
} {
|
|
406
|
-
break
|
|
407
|
-
}
|
|
408
|
-
}
|
|
409
|
-
}
|
|
410
|
-
|
|
411
|
-
function memorySafe() {
|
|
412
|
-
assembly ("memory-safe") {
|
|
413
|
-
|
|
414
|
-
}
|
|
415
|
-
assembly "evmasm" ("memory-safe") {
|
|
416
|
-
|
|
417
|
-
}
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
|
|
421
|
-
================================================================================
|
|
422
|
-
`;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
run_spec(__dirname, ['solidity-parse']);
|