@@ -162,6 +162,12 @@ removeChild()
162162isExpression()
163163 bool = parser.isExpression( astNode )
164164 Returns true for expression nodes and false for statements.
165+ Note that call nodes count as expressions for this function, i.e. return true.
166+
167+ isStatement()
168+ bool = parser.isStatement( astNode )
169+ Returns true for statements and false for expression nodes.
170+ Note that call nodes count as statements for this function, i.e. return true.
165171
166172validateTree()
167173 isValid, errorMessages = validateTree( astNode )
@@ -186,7 +192,7 @@ updateReferences()
186192 parser.updateReferences( astNode [, updateTopNodePositionInfo=true ] )
187193 Update references between nodes in the tree.
188194 This function sets 'parent'+'container'+'key' for all nodes, 'declaration' for identifiers and vararg nodes, and 'label' for goto nodes.
189- If 'updateTopNodePositionInfo' is false then 'parent', 'container' and 'key' will remain as-it for 'astNode' specifically.
195+ If 'updateTopNodePositionInfo' is false then 'parent', 'container' and 'key' will remain as-is for 'astNode' specifically.
190196
191197simplify()
192198 stats = simplify( astNode )
@@ -6428,6 +6434,10 @@ local function isExpression(node)
64286434 return EXPRESSION_TYPES [node .type ] == true
64296435end
64306436
6437+ local function isStatement (node )
6438+ return EXPRESSION_TYPES [node .type ] == nil or node .type == " call"
6439+ end
6440+
64316441
64326442
64336443local function resetNextId ()
@@ -6520,6 +6530,7 @@ parser = {
65206530 removeChild = removeChild ,
65216531
65226532 isExpression = isExpression ,
6533+ isStatement = isStatement ,
65236534 validateTree = validateTree ,
65246535
65256536 traverseTree = traverseTree ,
@@ -6554,7 +6565,7 @@ return parser
65546565
65556566--[=[ ===========================================================
65566567
6557- Copyright © 2020-2021 Marcus 'ReFreezed' Thunström
6568+ Copyright © 2020-2022 Marcus 'ReFreezed' Thunström
65586569
65596570Permission is hereby granted, free of charge, to any person obtaining a copy
65606571of this software and associated documentation files (the "Software"), to deal
0 commit comments