- Added
EnumValue.documentation, available since Solidity 0.8.30.
- Added
ContractDefinition.storageLayout, available since Solidity 0.8.29, corresponding tolayout at.
- Added
'transient'as a possible value forVariableDeclaration.storageLocation, available since Solidity 0.8.27. - Added
'prague'as a possible value forInlineAssembly.evmVersion.
- Fixed
YulFunctionDefinition.parametersandreturnVariables: made optional, used when empty. - Fixed
InlineAssembly.externalReferences[].suffix: added'length'option.
- Fixed
ModifierDefinition.body: made nullable to support Solidity 0.6.7 virtual modifiers with empty body.
- Added
'cancun'as a possible value forInlineAssembly.evmVersion.
- Fixed
TupleExpression.components: array members are nullable.
- Fixed
Literal.subdenomination, previously typed asnull, now typed with values'seconds','minutes', etc. - Added
EnumDefinition.documentation.
- Added
ForStatement.isSimpleCounterLoop, available since Solidity 0.8.22.
- Fixed behavior of
findAll('*', ...)aroundUsingForDirective.functionListandImportDirective.symbolAliases, which missed some identifiers and returned non-nodes.
- Fixed bug in AST dereferencer reading a property of null.
- Fixed
findAllexhaustivity around objects in the AST that are not AST nodes. Affected queries forIdentifierPathnodes underUsingForDirective.functionListand forIdentifiernodes underImportDirective.symbolAliases.foreign. - Significantly optimized
findAllandastDereferencer. - Added ability to enumerate all nodes with
findAll('*', node)or dereference an unknown node type withderef('*', id). - Added
SourceUnit.experimentalSolidity, available since Solidity 0.8.21. - Added
ContractDefinition.usedEventsandContractDefinition.internalFunctionIDs, available since Solidity 0.8.20. - Added
StructDefinition.documentation, available since Solidity 0.8.20. - Added
'shanghai'as a possible value forInlineAssembly.evmVersion. - Added
nativeSrcto Yul AST nodes.
- Added a custom Error subclass for ASTDereferencer errors.
- Fixed return type of
ASTDereferencer.withSourceUnit.
- Added
ASTDereferencer.withSourceUnitto be able to obtain the source unit that contains a node with a given id.
- Added new variant of
UsingForDirectivefor user-defined operators. - Added
BinaryOperation.functionandUnaryOperation.functionfor user-defined operators.
- Added
'paris'as a possible value forInlineAssembly.evmVersion. - Added new
MappingfieldskeyName,keyNameLocation,valueName,valueNameLocationfrom Solidity 0.8.18.
- Added
'~'as a possible value forUnaryOperation.operator.
- Added
FunctionCall.nameLocationsandIdentifierPath.nameLocationsfrom Solidity 0.8.16. - Added
MemberAccess.memberLocationfrom Solidity 0.8.16.
- Reverted optimizations to
findAllfrom 0.4.40.
- Optimized AST dereferencer.
- Further optimized
findAllfor multiple wanted node types.
- Optimized
findAllfor multiple wanted node types.
- Added missing types for
srcDecoder.
- Added
srcDecoder, a new util to decode source locations in AST nodes.
- Fixed error in
findAllwhen the code contains user defined value types.
- Made
IndexAccess.indexExpressionnullable, which shows up when array types are used withabi.decode.
- Added missing files to package.
- Removed circular dependency from utils.
- Added
EventDefinition.eventSelectorandErrorDefinition.errorSelector. - Added
InlineAssembly.flagswhich can now indicate assembly as memory safe. - Added
UsingForDirective.global. - In
UsingForDirectiveaddedfunctionListand madelibraryNameoptional. These properties are exclusive: exactly one of them should be present, though this is not encoded in the type. - Fixed
UsingForDirective.typeName: it should have always been nullable to account forusing ... for *.
- Added
SolcInputinterface.
- Added support for an array of node types in
isNodeType.
- Made input array types
readonlyinutilsmodule.
- Added
DoWhileStatement,Continue, andBreak. All of them kinds ofStatement.
- Added
UserDefinedValueTypeDefinitionwhich can appear inSourceUnitandContractDefinition. - Added
ContractDefinition.canonicalNamefrom Solidity 0.8.9. - Added new EVM version
'london'.
- Added a new utility for looking up AST nodes based on their id and type.
- Removed Yul nodes from
NodeandNodeType, export them separately asYulNodeandYulNodeType.
- Fixed duplicate type name in generated declaration file.
- Added missing values for
Assignment.operator:>>=,<<= - Added missing values for
BinaryOperation.operator:&,| - Added missing kind of
Expression:IndexRangeAccess(e.g.msg.data[start:end]) - Added missing field in members of
InlineAssembly.externalReferences:suffix('slot'and'offset')
- Added Yul types for typing
InlineAssembly.AST. - Fixed
Identifier.overloadedDeclarations: wasunknownand is nownumber.
- Rewrote schema in JavaScript in a more modular way.
- Fixed
IndexAccess.baseExpression: was optional but is required. - Added missing values for
Assignment.operator:-=,*=,%=,|=,&=,^=. - Added statement-level
documentationavailable since Solidity 0.8.2.
- Added new Solidity 0.8.4 constructs:
ErrorDefinitionas a new child ofSourceUnitandContractDefinitionRevertStatementas a new kind of statementContractDefinition.usedErrors
- Added new Solidity 0.8.3 field
ModifierInvocation.kind.
Note that there is a bug in 0.8.3 where kind never actually has the value
"baseConstructorSpecifier". This will presumably be fixed in the next
release.
- Added new Solidity 0.8.2 field
nameLocationin:EnumValueEnumDefinitionEventDefinitionFunctionDefinitionModifierDefinitionImportDirective(and entries ofImportDirective.symbolAliases)ContractDefinitionStructDefinitionVariableDeclaration
- Added missing override-related types and fields:
ModifierDefinition.baseModifiers: number[]ModifierDefinition.overrides?: OverrideSpecifierVariableDeclaration.baseFunctions: number[]VariableDeclaration.overrides?: OverrideSpecifier
- Added
Blockas a possible kind ofStatement. - Added new Solidity 0.8 constructs:
UncheckedBlockis a new kind ofStatement.IdentifierPathis a new node type that replaces some instances ofUserDefinedTypeNameandIdentifier, used in the following places:InheritanceSpecifier.baseNameModifierInvocation.modifierNameOverrideSpecifier.overridesUsingForDirective.libraryNameUserDefinedTypeName.pathNode(new)
- Extended
findAllto enumerate multiple node types simultaneously.
- Added
hexString,unicodeStringas possible values forLiteral.kind. Available since Solidity 0.7.0.
- Fixed
findAllcrash when used with node type'SourceUnit'.
- Added an optional argument
prunetofindAll.
If the optional
prune: (node: Node) => booleanargument is specified,findAllwill apply the function to each node, if the return value is truthy the node will be ignored, neither yielding the node nor recursing into it. Note thatpruneis not available when curried.
- Added support for file-level constant
VariableDeclarationnodes, available since Solidity 0.7.4.
- Added
VariableDeclaration.documentation, which is available since Solidity 0.6.9.
- Added
TryStatementas a new type of statement node.
- Fixed types of
ForStatementpropertiescondition,initializationExpression,loopExpression, allowing them to be empty. - Fixed type of
ForStatement.initializationExpressionto also potentially contain anExpressionStatement.
NewExpression.isLValueandFunctionCallOptions.isLValueare now optional.
Due to a bug in Solidity 0.7.2, these two properties are missing in the ASTs produced by that version. In order for the types to remain accurate, they have been made optional. When the property is missing its value should be assumed to be false (see ethereum/solidity#9953).
- Fixed type of
ModifierInvocation.arguments.
- Disabled
additionalPropertiesinConditionalnode. - Fixed
Returnnode for empty return statements.
- Fixed
bodyproperty ofForStatement: wasBlock, can also beStatement. - Added support for Solidity 0.7.1.
- Made nullable properties optional. For TypeScript this means that
nullvalues can now beundefined. - Added support for free functions:
FunctionDefinitionis now a potential child inSourceUnit.nodes.
- Made nullable properties optional. For TypeScript this means that
- Fixed
bodyproperty ofWhileStatement: wasBlock, can also beStatement.
- Fixed
lengthproperty ofArrayTypeName: wasnull, can be anyExpression.
- Added all EVM versions to
InlineAssemblynode. - Fixed
findAllto check for null property values.
- Added
solidity-ast/utilswith the following utility functions:isNodeType(nodeType, node): a type predicate for type-safe filtering or any kind of narrowing.findAll(nodeType, node): a generator function that recursively enumerates all of a node's descendents of typenodeType.- Both of these functions can be partially applied by supplying only the
nodeTypeargument. This is useful for higher order functions likefilterormap, as innodes.filter(isNodeType('ContractDefinition')).
- Removed
solidity-ast/predicates. UseisNodeTypefromsolidity-ast/utilsinstead.
- Fixed type for
ImportDirective.symbolAliases.
- Added missing type for
ImportDirective.symbolAliases.
- Added
solidity-ast/predicateswith type guards for type-safe filtering.
import { isContractDefinition } from "solidity-ast/predicates";
const contractDefs = sourceUnit.nodes.filter(isContractDefinition);
// : ContractDefinition[]- Removed
ParameterTypes, which was a duplicate ofParameterList. The latter should be used instead. - Removed
ParameterTypeName, which wasn't referenced anywhere.
- Added missing
>>operator.
- Completed schema to successfully validate OpenZeppelin Contracts.
- Initial release with incomplete schema.