Given an AST for the subgroup (a class), generate that subgroup. In this function, we will also need to generate all of the nodes internal to the group. :param tree ast: :param parent Group: :rtype: Group
(tree, parent)
| 377 | |
| 378 | @staticmethod |
| 379 | def make_class_group(tree, parent): |
| 380 | """ |
| 381 | Given an AST for the subgroup (a class), generate that subgroup. |
| 382 | In this function, we will also need to generate all of the nodes internal |
| 383 | to the group. |
| 384 | |
| 385 | :param tree ast: |
| 386 | :param parent Group: |
| 387 | :rtype: Group |
| 388 | """ |
| 389 | assert tree['type'] == 'ClassDeclaration' |
| 390 | subgroup_trees, node_trees, body_trees = Javascript.separate_namespaces(tree) |
| 391 | assert not subgroup_trees |
| 392 | |
| 393 | group_type = GROUP_TYPE.CLASS |
| 394 | token = tree['id']['name'] |
| 395 | display_name = 'Class' |
| 396 | line_number = lineno(tree) |
| 397 | inherits = get_inherits(tree) |
| 398 | class_group = Group(token, group_type, display_name, |
| 399 | inherits=inherits, line_number=line_number, parent=parent) |
| 400 | |
| 401 | for node_tree in node_trees: |
| 402 | for new_node in Javascript.make_nodes(node_tree, parent=class_group): |
| 403 | class_group.add_node(new_node) |
| 404 | |
| 405 | return class_group |
| 406 | |
| 407 | @staticmethod |
| 408 | def file_import_tokens(filename): |
nothing calls this directly
no test coverage detected