- Added
'transient'
as a possible value forVariableDeclaration.storageLocation
, available since Solidity 0.8.27. - Added
'prague'
as a possible value forInlineAssembly.evmVersion
.
- Fixed
YulFunctionDefinition.parameters
andreturnVariables
: 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.functionList
andImportDirective.symbolAliases
, which missed some identifiers and returned non-nodes.
- Fixed bug in AST dereferencer reading a property of null.
- Fixed
findAll
exhaustivity around objects in the AST that are not AST nodes. Affected queries forIdentifierPath
nodes underUsingForDirective.functionList
and forIdentifier
nodes underImportDirective.symbolAliases.foreign
. - Significantly optimized
findAll
andastDereferencer
. - 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.usedEvents
andContractDefinition.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
nativeSrc
to Yul AST nodes.
- Added a custom Error subclass for ASTDereferencer errors.
- Fixed return type of
ASTDereferencer.withSourceUnit
.
- Added
ASTDereferencer.withSourceUnit
to be able to obtain the source unit that contains a node with a given id.
- Added new variant of
UsingForDirective
for user-defined operators. - Added
BinaryOperation.function
andUnaryOperation.function
for user-defined operators.
- Added
'paris'
as a possible value forInlineAssembly.evmVersion
. - Added new
Mapping
fieldskeyName
,keyNameLocation
,valueName
,valueNameLocation
from Solidity 0.8.18.
- Added
'~'
as a possible value forUnaryOperation.operator
.
- Added
FunctionCall.nameLocations
andIdentifierPath.nameLocations
from Solidity 0.8.16. - Added
MemberAccess.memberLocation
from Solidity 0.8.16.
- Reverted optimizations to
findAll
from 0.4.40.
- Optimized AST dereferencer.
- Further optimized
findAll
for multiple wanted node types.
- Optimized
findAll
for multiple wanted node types.
- Added missing types for
srcDecoder
.
- Added
srcDecoder
, a new util to decode source locations in AST nodes.
- Fixed error in
findAll
when the code contains user defined value types.
- Made
IndexAccess.indexExpression
nullable, which shows up when array types are used withabi.decode
.
- Added missing files to package.
- Removed circular dependency from utils.
- Added
EventDefinition.eventSelector
andErrorDefinition.errorSelector
. - Added
InlineAssembly.flags
which can now indicate assembly as memory safe. - Added
UsingForDirective.global
. - In
UsingForDirective
addedfunctionList
and madelibraryName
optional. 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
SolcInput
interface.
- Added support for an array of node types in
isNodeType
.
- Made input array types
readonly
inutils
module.
- Added
DoWhileStatement
,Continue
, andBreak
. All of them kinds ofStatement
.
- Added
UserDefinedValueTypeDefinition
which can appear inSourceUnit
andContractDefinition
. - Added
ContractDefinition.canonicalName
from 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
Node
andNodeType
, export them separately asYulNode
andYulNodeType
.
- 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
: wasunknown
and 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
documentation
available since Solidity 0.8.2.
- Added new Solidity 0.8.4 constructs:
ErrorDefinition
as a new child ofSourceUnit
andContractDefinition
RevertStatement
as 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
nameLocation
in:EnumValue
EnumDefinition
EventDefinition
FunctionDefinition
ModifierDefinition
ImportDirective
(and entries ofImportDirective.symbolAliases
)ContractDefinition
StructDefinition
VariableDeclaration
- Added missing override-related types and fields:
ModifierDefinition.baseModifiers: number[]
ModifierDefinition.overrides?: OverrideSpecifier
VariableDeclaration.baseFunctions: number[]
VariableDeclaration.overrides?: OverrideSpecifier
- Added
Block
as a possible kind ofStatement
. - Added new Solidity 0.8 constructs:
UncheckedBlock
is a new kind ofStatement
.IdentifierPath
is a new node type that replaces some instances ofUserDefinedTypeName
andIdentifier
, used in the following places:InheritanceSpecifier.baseName
ModifierInvocation.modifierName
OverrideSpecifier.overrides
UsingForDirective.libraryName
UserDefinedTypeName.pathNode
(new)
- Extended
findAll
to enumerate multiple node types simultaneously.
- Added
hexString
,unicodeString
as possible values forLiteral.kind
. Available since Solidity 0.7.0.
- Fixed
findAll
crash when used with node type'SourceUnit'
.
- Added an optional argument
prune
tofindAll
.
If the optional
prune: (node: Node) => boolean
argument is specified,findAll
will 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 thatprune
is not available when curried.
- Added support for file-level constant
VariableDeclaration
nodes, available since Solidity 0.7.4.
- Added
VariableDeclaration.documentation
, which is available since Solidity 0.6.9.
- Added
TryStatement
as a new type of statement node.
- Fixed types of
ForStatement
propertiescondition
,initializationExpression
,loopExpression
, allowing them to be empty. - Fixed type of
ForStatement.initializationExpression
to also potentially contain anExpressionStatement
.
NewExpression.isLValue
andFunctionCallOptions.isLValue
are 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
additionalProperties
inConditional
node. - Fixed
Return
node for empty return statements.
- Fixed
body
property ofForStatement
: wasBlock
, can also beStatement
. - Added support for Solidity 0.7.1.
- Made nullable properties optional. For TypeScript this means that
null
values can now beundefined
. - Added support for free functions:
FunctionDefinition
is now a potential child inSourceUnit.nodes
.
- Made nullable properties optional. For TypeScript this means that
- Fixed
body
property ofWhileStatement
: wasBlock
, can also beStatement
.
- Fixed
length
property ofArrayTypeName
: wasnull
, can be anyExpression
.
- Added all EVM versions to
InlineAssembly
node. - Fixed
findAll
to check for null property values.
- Added
solidity-ast/utils
with 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
nodeType
argument. This is useful for higher order functions likefilter
ormap
, as innodes.filter(isNodeType('ContractDefinition'))
.
- Removed
solidity-ast/predicates
. UseisNodeType
fromsolidity-ast/utils
instead.
- Fixed type for
ImportDirective.symbolAliases
.
- Added missing type for
ImportDirective.symbolAliases
.
- Added
solidity-ast/predicates
with 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.