Utilities/ClassBrowsers/jsclbr.py

changeset 6650
1dd52aa8897c
parent 6645
ad476851d7e0
equal deleted inserted replaced
6649:f1b3a73831c9 6650:1dd52aa8897c
9 It uses the JavaScript parser contained in the jasy web framework. 9 It uses the JavaScript parser contained in the jasy web framework.
10 """ 10 """
11 11
12 from __future__ import unicode_literals 12 from __future__ import unicode_literals
13 13
14 import jasy.js.parse.Parser as jsParser 14 import jasy.script.parse.Parser as jsParser
15 import jasy.js.tokenize.Tokenizer as jsTokenizer 15 import jasy.script.tokenize.Tokenizer as jsTokenizer
16 16
17 import Utilities 17 import Utilities
18 import Utilities.ClassBrowsers as ClassBrowsers 18 import Utilities.ClassBrowsers as ClassBrowsers
19 from . import ClbrBaseClasses 19 from . import ClbrBaseClasses
20 20
140 140
141 def visit_noop(self, node): 141 def visit_noop(self, node):
142 """ 142 """
143 Public method to ignore the given node. 143 Public method to ignore the given node.
144 144
145 @param node reference to the node (jasy.js.parse.Node.Node) 145 @param node reference to the node (jasy.script.parse.Node.Node)
146 """ 146 """
147 pass 147 pass
148 148
149 def visit_function(self, node): 149 def visit_function(self, node):
150 """ 150 """
151 Public method to treat a function node. 151 Public method to treat a function node.
152 152
153 @param node reference to the node (jasy.js.parse.Node.Node) 153 @param node reference to the node (jasy.script.parse.Node.Node)
154 """ 154 """
155 if node.type == "function" and \ 155 if node.type == "function" and \
156 getattr(node, "name", None) and \ 156 getattr(node, "name", None) and \
157 node.functionForm == "declared_form": 157 node.functionForm == "declared_form":
158 if self.__stack and self.__stack[-1].endlineno < node.line: 158 if self.__stack and self.__stack[-1].endlineno < node.line:
186 186
187 def visit_property_init(self, node): 187 def visit_property_init(self, node):
188 """ 188 """
189 Public method to treat a property_init node. 189 Public method to treat a property_init node.
190 190
191 @param node reference to the node (jasy.js.parse.Node.Node) 191 @param node reference to the node (jasy.script.parse.Node.Node)
192 """ 192 """
193 if node.type == "property_init" and node[1].type == "function": 193 if node.type == "property_init" and node[1].type == "function":
194 if self.__stack and self.__stack[-1].endlineno < node[0].line: 194 if self.__stack and self.__stack[-1].endlineno < node[0].line:
195 del self.__stack[-1] 195 del self.__stack[-1]
196 endline = node[0].line + self.__source.count( 196 endline = node[0].line + self.__source.count(
222 222
223 def visit_var(self, node): 223 def visit_var(self, node):
224 """ 224 """
225 Public method to treat a variable node. 225 Public method to treat a variable node.
226 226
227 @param node reference to the node (jasy.js.parse.Node.Node) 227 @param node reference to the node (jasy.script.parse.Node.Node)
228 """ 228 """
229 if node.type == "var" and \ 229 if node.type == "var" and \
230 node.parent.type == "script" and \ 230 node.parent.type == "script" and \
231 node.getChildrenLength(): 231 node.getChildrenLength():
232 if self.__stack and self.__stack[-1].endlineno < node[0].line: 232 if self.__stack and self.__stack[-1].endlineno < node[0].line:
248 248
249 def visit_const(self, node): 249 def visit_const(self, node):
250 """ 250 """
251 Public method to treat a constant node. 251 Public method to treat a constant node.
252 252
253 @param node reference to the node (jasy.js.parse.Node.Node) 253 @param node reference to the node (jasy.script.parse.Node.Node)
254 """ 254 """
255 if node.type == "const" and \ 255 if node.type == "const" and \
256 node.parent.type == "script" and \ 256 node.parent.type == "script" and \
257 node.getChildrenLength(): 257 node.getChildrenLength():
258 if self.__stack and self.__stack[-1].endlineno < node[0].line: 258 if self.__stack and self.__stack[-1].endlineno < node[0].line:

eric ide

mercurial