Commit 6866d265 authored by yann300's avatar yann300

return array instead of object

parent 8351bdf6
......@@ -168,7 +168,7 @@ function findNodeAtSourceLocation (astNodeType, sourceLocation, ast) {
function nodesAtPosition (astNodeType, position, ast) {
var astWalker = new AstWalker()
var callback = {}
var found = {}
var found = []
callback['*'] = function (node) {
var nodeLocation = sourceLocationFromAstNode(node)
if (!nodeLocation) {
......@@ -176,7 +176,7 @@ function nodesAtPosition (astNodeType, position, ast) {
}
if (nodeLocation.start <= position && nodeLocation.start + nodeLocation.length >= position) {
if (!astNodeType || astNodeType === node.name) {
found[node.name] = node
found.push(node)
if (astNodeType) return false
}
return true
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment