Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #9 from ddlsmurf/master

requirejs support (thanks frostedcheerios and ddlsmurf)
  • Loading branch information...
commit e10935c6c679a5c3e336e5639c592de91d37dae9 2 parents c3a4e83 + 8cca3c2
@omarkhan omarkhan authored
View
4 package.json
@@ -25,5 +25,7 @@
"bin": {
"coffeedoc": "./bin/coffeedoc"
},
- "devDependencies": {}
+ "devDependencies": {
+ "jasmine-node": ">=1.0.6"
+ }
}
View
448 spec/requirejsspec.coffee
@@ -0,0 +1,448 @@
+parsers = require(__dirname + '/../src/parsers')
+coffeedoc = require(__dirname + '/../src/coffeedoc')
+helpers = require(__dirname + '/../src/helpers')
+parser = new parsers.RequireJSParser()
+
+parseNodes = (script) ->
+ return coffeedoc.documentModule(script, parser)
+
+objLength = (obj) ->
+ return (k for k of obj).length
+
+describe 'RequireJSParser', ->
+
+ describe 'provides a getDependencies method and', ->
+
+ it "parses module = require('module')", ->
+ script = """
+ var1 = require('mod1')
+ define ->
+ var2 = require('mod2')
+ require ->
+ var3 = require('mod3')
+ """
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.var1).toBe('mod1')
+ expect(deps.var2).toBe('mod2')
+ expect(deps.var3).toBe('mod3')
+ expect(objLength(deps)).toBe(3)
+
+ it "parses module = require(__dirname + '/module')", ->
+ script = """
+ var1 = require(__dirname + '/mod1')
+ define ->
+ var2 = require(__dirname + '/mod2')
+ require ->
+ var3 = require(__dirname + '/mod3')
+ """
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.var1).toBe('./mod1')
+ expect(deps.var2).toBe('./mod2')
+ expect(deps.var3).toBe('./mod3')
+ expect(objLength(deps)).toBe(3)
+
+ it "parses require = {}", ->
+ script = "require = {}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses require = {deps: []}", ->
+ script = "require = {deps: []}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses require = {deps: ['mod']}", ->
+ script = "require = {deps: ['mod']}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses require = {deps: ['mod1', 'mod2']}", ->
+ script = "require = {deps: ['mod1', 'mod2']}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod1).toBe('mod1')
+ expect(deps.mod2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses require = {callback: (->)}", ->
+ script = "require = {callback: (->)}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses require = {deps: [], callback: (->)}", ->
+ script = "require = {deps: [], callback: (->)}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses require = {deps: ['mod'], callback: (->)}", ->
+ script = "require = {deps: ['mod'], callback: (->)}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses require = {deps: ['mod1', 'mod2'], callback: (->)}", ->
+ script = "require = {deps: ['mod1', 'mod2'], callback: (->)}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod1).toBe('mod1')
+ expect(deps.mod2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses require = {deps: ['mod'], callback: ((arg)->)}", ->
+ script = "require = {deps: ['mod'], callback: ((arg)->)}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses require = {deps: ['mod'], callback: (arg)->}", ->
+ script = "require = {deps: ['mod'], callback: (arg)->}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses require = {deps: ['mod1', 'mod2'], callback: ((arg1)->)}", ->
+ script = "require = {deps: ['mod1', 'mod2'], callback: ((arg1)->)}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg1).toBe('mod1')
+ expect(deps.mod2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses require = {deps: ['mod1', 'mod2'], callback: ((arg1, arg2)->)}", ->
+ script = "require = {deps: ['mod1', 'mod2'], callback: ((arg1, arg2)->)}"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg1).toBe('mod1')
+ expect(deps.arg2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses require((->))", ->
+ script = "require((->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses require([], (->))", ->
+ script = "require([], (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses require(['mod'], (->))", ->
+ script = "require ['mod'], ->"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses require(['mod'], ((arg)->))", ->
+ script = "require(['mod'], ((arg)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses require(['mod1', 'mod2'], (->))", ->
+ script = "require(['mod1', 'mod2'], (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod1).toBe('mod1')
+ expect(deps.mod2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses require(['mod1', 'mod2'], ((arg1)->))", ->
+ script = "require(['mod1', 'mod2'], ((arg1)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg1).toBe('mod1')
+ expect(deps.mod2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses require(['mod1', 'mod2'], ((arg1, arg2)->))", ->
+ script = "require(['mod1', 'mod2'], ((arg1, arg2)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg1).toBe('mod1')
+ expect(deps.arg2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses require({}, (->))", ->
+ script = "require({}, (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses require({}, [], (->))", ->
+ script = "require({}, [], (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses require({}, ['mod'], (->))", ->
+ script = "require({}, ['mod'], (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses require({}, ['mod'], ((arg)->))", ->
+ script = "require({}, ['mod'], ((arg)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses require({}, ['mod1', 'mod2'], (->))", ->
+ script = "require({}, ['mod1', 'mod2'], (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod1).toBe('mod1')
+ expect(deps.mod2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses require({}, ['mod1', 'mod2'], ((arg1)->))", ->
+ script = "require({}, ['mod1', 'mod2'], ((arg1)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg1).toBe('mod1')
+ expect(deps.mod2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses require({}, ['mod1', 'mod2'], ((arg1, arg2)->))", ->
+ script = "require({}, ['mod1', 'mod2'], ((arg1, arg2)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg1).toBe('mod1')
+ expect(deps.arg2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses define((->))", ->
+ script = "define((->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses define([], (->))", ->
+ script = "define([], (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses define(['mod'], (->))", ->
+ script = "define(['mod'], (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses define(['mod'], ((arg)->))", ->
+ script = "define(['mod'], ((arg)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses define(['mod1', 'mod2'], (->))", ->
+ script = "define(['mod1', 'mod2'], (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod1).toBe('mod1')
+ expect(deps.mod2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses define(['mod1', 'mod2'], ((arg1)->))", ->
+ script = "define(['mod1', 'mod2'], ((arg1)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg1).toBe('mod1')
+ expect(deps.mod2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses define(['mod1', 'mod2'], ((arg1, arg2)->))", ->
+ script = "define(['mod1', 'mod2'], ((arg1, arg2)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg1).toBe('mod1')
+ expect(deps.arg2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses define('', (->))", ->
+ script = "define('', (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses define('', [], (->))", ->
+ script = "define('', [], (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(objLength(deps)).toBe(0)
+
+ it "parses define('', ['mod'], (->))", ->
+ script = "define('', ['mod'], (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses define('', ['mod'], ((arg)->))", ->
+ script = "define('', ['mod'], ((arg)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ it "parses define('', ['mod1', 'mod2'], (->))", ->
+ script = "define('', ['mod1', 'mod2'], (->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.mod1).toBe('mod1')
+ expect(deps.mod2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses define('', ['mod1', 'mod2'], ((arg1)->))", ->
+ script = "define('', ['mod1', 'mod2'], ((arg1)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg1).toBe('mod1')
+ expect(deps.mod2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses define('', ['mod1', 'mod2'], ((arg1, arg2)->))", ->
+ script = "define('', ['mod1', 'mod2'], ((arg1, arg2)->))"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg1).toBe('mod1')
+ expect(deps.arg2).toBe('mod2')
+ expect(objLength(deps)).toBe(2)
+
+ it "parses define ['mod'], (arg) ->", ->
+ script = "define ['mod'], (arg) ->"
+ nodes = parseNodes(script)
+ deps = nodes.deps
+ expect(deps.arg).toBe('mod')
+ expect(objLength(deps)).toBe(1)
+
+ describe 'provides a getClasses method and', ->
+
+ it 'handles top-level classes', ->
+ script = """
+ class Test
+ constructor: ->
+ method1: ->
+ method2: ->
+ """
+ nodes = parseNodes(script)
+ classes = nodes.classes
+ expect(classes.length).toBe(1)
+ expect(classes[0].name).toBe('Test')
+
+ it 'handles classes inside of define', ->
+ script = """
+ define ['mod'], (arg) ->
+ class Test
+ constructor: ->
+ method1: ->
+ method2: ->
+ """
+ nodes = parseNodes(script)
+ classes = nodes.classes
+ expect(classes.length).toBe(1)
+ expect(classes[0].name).toBe('Test')
+
+ it 'handles classes inside of require', ->
+ script = """
+ require ['mod'], (arg) ->
+ class Test
+ constructor: ->
+ method1: ->
+ method2: ->
+ """
+ nodes = parseNodes(script)
+ classes = nodes.classes
+ expect(classes.length).toBe(1)
+ expect(classes[0].name).toBe('Test')
+
+ describe 'provides a getObjects method and', ->
+
+ it 'handles top-level objects', ->
+ script = """
+ test1 =
+ val: true
+
+ test2 = {val: false}
+ """
+ nodes = parser.getNodes(helpers.getNodes(script))
+ objs = parser.getObjects(nodes)
+ expect(objs.length).toBe(2)
+ expect(objs[0].variable.base.value).toBe('test1')
+ expect(objs[1].variable.base.value).toBe('test2')
+
+ it 'handles objects inside of define', ->
+ script = """
+ define ['mod'], (arg) ->
+ test1 =
+ val: true
+
+ test2 = {val: false}
+ """
+ nodes = parser.getNodes(helpers.getNodes(script))
+ objs = parser.getObjects(nodes)
+ expect(objs.length).toBe(2)
+ expect(objs[0].variable.base.value).toBe('test1')
+ expect(objs[1].variable.base.value).toBe('test2')
+
+ it 'handles objects inside of require', ->
+ script = """
+ require ['mod'], (arg) ->
+ test1 =
+ val: true
+
+ test2 = {val: false}
+ """
+ nodes = parser.getNodes(helpers.getNodes(script))
+ objs = parser.getObjects(nodes)
+ expect(objs.length).toBe(2)
+ expect(objs[0].variable.base.value).toBe('test1')
+ expect(objs[1].variable.base.value).toBe('test2')
+
+ describe 'provides a getFunctions method and', ->
+
+ it 'handles top-level functions', ->
+ script = "test = ->"
+ nodes = parseNodes(script)
+ funcs = nodes.functions
+ expect(funcs.length).toBe(1)
+ expect(funcs[0].name).toBe('test')
+
+ it 'handles functions inside of define', ->
+ script = """
+ define ['mod'], (arg) ->
+ test = ->
+ """
+ nodes = parseNodes(script)
+ funcs = nodes.functions
+ expect(funcs.length).toBe(1)
+ expect(funcs[0].name).toBe('test')
+
+ it 'handles functions inside of require', ->
+ script = """
+ require ['mod'], (arg) ->
+ test = ->
+ """
+ nodes = parseNodes(script)
+ funcs = nodes.functions
+ expect(funcs.length).toBe(1)
+ expect(funcs[0].name).toBe('test')
+
View
1  src/coffeedoc.coffee
@@ -24,6 +24,7 @@ exports.documentModule = (script, parser) ->
AST parsers are defined in the `parsers.coffee` module
###
nodes = getNodes(script)
+ nodes = parser.getNodes(nodes) if parser.getNodes
first_obj = nodes[0]
if first_obj?.type == 'Comment'
docstring = formatDocstring(first_obj.comment)
View
8 src/docgen.coffee
@@ -18,7 +18,7 @@ parsers = require(__dirname + '/parsers')
OPTIONS =
'-o, --output': 'Set output directory (default: ./docs)'
'--commonjs ': 'Use if target scripts use CommonJS for module loading (default)'
-# '--requirejs ': 'Use if target scripts use RequireJS for module loading'
+ '--requirejs ': 'Use if target scripts use RequireJS for module loading'
help = ->
### Show help message and exit ###
@@ -42,9 +42,9 @@ if '-h' in opts or '--help' in opts
if '--commonjs' in opts
opts.shift()
parser = new parsers.CommonJSParser()
-#else if '--requirejs' in opts
-# opts.shift()
-# parser = new parsers.RequireJSParser()
+else if '--requirejs' in opts
+ opts.shift()
+ parser = new parsers.RequireJSParser()
else
parser = new parsers.CommonJSParser()
if opts.length == 0
View
24 src/helpers.coffee
@@ -16,7 +16,7 @@ exports.getNodes = (script) ->
root_node = coffeescript.nodes(script)
root_node.traverseChildren false, (node) ->
node.type = node.constructor.name
- return root_node.expressions
+ return [root_node].concat(root_node.expressions)
exports.getFullName = (variable) ->
###
@@ -27,3 +27,25 @@ exports.getFullName = (variable) ->
name += '.' + (p.name.value for p in variable.properties).join('.')
return name
+exports.getAttr = (node, path) ->
+ ###
+ Safe function for looking up paths in the AST. If an attribute is
+ undefined at any part of the path, an object with is returned with the
+ type attribute set to null
+ ###
+ path = path.split('.')
+ nullObj = {type: null}
+ for attr in path
+ index = null
+ if '[' in attr
+ [attr, index] = attr.split('[')
+ index = index[..-2]
+
+ node = node[attr]
+ if not node?
+ return nullObj
+ if index?
+ node = node[parseInt(index)]
+ if not node?
+ return nullObj
+ return node
View
157 src/parsers.coffee
@@ -85,6 +85,157 @@ exports.CommonJSParser = class CommonJSParser extends BaseParser
exports.RequireJSParser = class RequireJSParser extends BaseParser
- ###
- Not yet implemented
- ###
+ ###
+ Not yet tested
+ ###
+ getNodes: (nodes, debug=false) ->
+ result_nodes = []
+ moduleLdrs = ['define', 'require']
+ for root_node in nodes
+ root_node.traverseChildren false, (node) ->
+ node.type = node.constructor.name
+ node.level = 1
+ if node.type is 'Call' and node.variable.base.value in moduleLdrs
+ for arg in node.args
+ if arg.constructor.name is 'Code'
+ arg.body.traverseChildren false, (node) ->
+ node.type = node.constructor.name
+ node.level = 2
+ if debug
+ console.log(node)
+ result_nodes = result_nodes.concat(arg.body.expressions)
+ # TODO: Support objects passed to require or define
+ if debug
+ console.log(node)
+ return nodes.concat(result_nodes)
+
+ _parseCall: (node, deps) ->
+ ### Parse require([], ->) and define([], ->) ###
+ mods = []
+ args = []
+
+ for arg in node.args
+ val1 = helpers.getAttr(arg, 'base')
+ val2 = helpers.getAttr(arg, 'base.body.expressions[0]')
+ if val1.type is 'Arr'
+ mods = @_parseModuleArray(val1)
+ else if val2.type is 'Code'
+ args = @_parseFuncArgs(val2)
+ else if arg.type is 'Code'
+ args = @_parseFuncArgs(arg)
+
+ @_matchArgs(deps, mods, args)
+
+ _parseAssign: (node, deps) ->
+ ### Parse module = require("path/to/module") ###
+ arg = node.value.args[0]
+ module_path = @_getModulePath(arg)
+ if module_path?
+ local_name = helpers.getFullName(node.variable)
+ deps[local_name] = module_path
+
+ _parseObject: (node, deps) ->
+ ### Parse require = {} ###
+ obj = node.value.base
+ mods = []
+ args = []
+ for attr in obj.properties
+ name = helpers.getAttr(attr, 'variable.base.value')
+ val1 = helpers.getAttr(attr, 'value.base')
+ val2 = helpers.getAttr(attr, 'value.base.body.expressions[0]')
+ if name is 'deps' and val1.type is 'Arr'
+ mods = @_parseModuleArray(val1)
+ else if name is 'callback'
+ if val2.type is 'Code'
+ args = @_parseFuncArgs(val2)
+ else if attr.value.type is 'Code'
+ args = @_parseFuncArgs(attr.value)
+
+ @_matchArgs(deps, mods, args)
+
+ _matchArgs: (deps, mods, args) ->
+ ###
+ Match the list of modules to the list of local variable names and
+ add them to the dependencies object given.
+ ###
+ index = 0
+ for mod in mods
+ local_name = if index < args.length then args[index] else mod
+ deps[local_name] = mod
+ index++
+
+ _stripQuotes: (str) ->
+ return str.replace(/('|\")/g, '')
+
+ _parseFuncArgs: (func) ->
+ ###
+ Given a node of type 'Code', gathers the names of each of the function
+ arguments and return them in an array.
+ ###
+ args = []
+ for arg in func.params
+ args.push(arg.name.value)
+ return args
+
+ _parseModuleArray: (arr) ->
+ ###
+ Given a node of type 'Arr', gathers the module paths represented by
+ each object in the array and returns them in an array.
+ ###
+ modules = []
+ for module in arr.objects
+ mod_path = @_getModulePath(module)
+ if mod_path?
+ modules.push(mod_path)
+ return modules
+
+ _getModulePath: (mod) ->
+ if mod.type is 'Value'
+ return @_stripQuotes(mod.base.value)
+ else if mod.type is 'Op' and mod.operator is '+'
+ return '.' + @_stripQuotes(mod.second.base.value)
+ return null
+
+ getDependencies: (nodes) ->
+ ###
+ This currently works with the following `require` calls:
+
+ local_name = require("path/to/module")
+ local_name = require(__dirname + "/path/to/module")
+
+ The following `require` object assignments:
+
+ require = {deps: ["path/to/module"]}
+ require = {deps: ["path/to/module"], callback: (module) ->}
+
+ And the following `require and `define` calls:
+
+ require(["path/to/module"], (module) -> ...)
+ require({}, ["path/to/module"], (module) -> ...)
+ define(["path/to/module"], (module) -> ...)
+ define('', ["path/to/module"], (module) -> ...)
+
+ ###
+ deps = {}
+ for n in nodes
+ if n.type is 'Call' and n.variable.base.value in ['define', 'require']
+ @_parseCall(n, deps)
+ else if n.type is 'Assign'
+ if n.value.type is 'Call' and n.value.variable.base.value is 'require'
+ @_parseAssign(n, deps)
+ else if (n.level is 1 and n.variable.base.value is 'require' \
+ and n.value.base.type is 'Obj')
+ @_parseObject(n, deps)
+ return deps
+
+ getClasses: (nodes) ->
+ return (n for n in nodes when n.type == 'Class' \
+ or n.type == 'Assign' and n.value.type == 'Class')
+
+ getObjects: (nodes) ->
+ return (n for n in nodes when n.type == 'Assign' \
+ and helpers.getAttr(n, 'value.base').type == 'Obj')
+
+ getFunctions: (nodes) ->
+ return (n for n in nodes \
+ when n.type == 'Assign' and n.value.type == 'Code')
Please sign in to comment.
Something went wrong with that request. Please try again.