node/lib/metasm/metasm/decompile.rb
# yields each statement (recursive)
yields each statement (recursive)
yields each statement ( recursive )
def walk(scope, post=false, &b)
		case scope
		when ::Array; scope.each { |s| walk(s, post, &b) }
		when C::Statement
			yield scope if not post
			case scope
			when C::Block; walk(scope.statements, post, &b)
			when C::If
				yield scope.test
				walk(scope.bthen, post, &b)
				walk(scope.belse, post, &b) if scope.belse
			when C::While, C::DoWhile
				yield scope.test
				walk(scope.body, post, &b)
			when C::Return
				yield scope.value
			end
			yield scope if post
		when C::Declaration
			walk(scope.var.initializer, post, &b) if scope.var.initializer
		end
	end
def walk ( scope , post = false , & b ) case scope when :: Array ; scope . each { | s | walk ( s , post , & b ) } when C :: Statement yield scope if not post case scope when C :: Block ; walk ( scope . statements , post , & b ) when C :: If yield scope . test walk ( scope . bthen , post , & b ) walk ( scope . belse , post , & b ) if scope . belse when C :: While , C :: DoWhile yield scope . test walk ( scope . body , post , & b ) when C :: Return yield scope . value end yield scope if post when C :: Declaration walk ( scope . var . initializer , post , & b ) if scope . var . initializer end end
yields each statement (recursive)
yields each statement ( recursive )
scope
post
b