|
@@ -477,7 +477,40 @@ Void function add_AL_links(model : Element, list : Element, element : Element, t
|
|
|
// The link
|
|
|
if (linkname == "next"):
|
|
|
type = "Statement"
|
|
|
- reuse_element(model, (type + "_") + linkname, "", link)
|
|
|
+ if (expected_type == "param_dict"):
|
|
|
+ // Add the link to param_dict
|
|
|
+ log("In param_dict adder")
|
|
|
+
|
|
|
+ reuse_element(model, "funcdef_params", "", link)
|
|
|
+ link = read_out(link, 0)
|
|
|
+ reuse_element(model, "dict_link_name", "", link)
|
|
|
+ link = read_edge_dst(link)
|
|
|
+ if (bool_not(dict_in(model["model"], "__" + cast_id(link)))):
|
|
|
+ reuse_element(model, "StringAttr", "__" + cast_id(link), link)
|
|
|
+
|
|
|
+ element = element[linkname]
|
|
|
+ reuse_element(model, "param_dict", "", element)
|
|
|
+
|
|
|
+ Element keys
|
|
|
+ String key
|
|
|
+ keys = dict_keys(element)
|
|
|
+ while (set_len(keys) > 0):
|
|
|
+ key = set_pop(keys)
|
|
|
+ log("Adding key " + cast_value(key))
|
|
|
+ link = dict_read_edge(element, key)
|
|
|
+
|
|
|
+ reuse_element(model, "param_dict_link", "", link)
|
|
|
+ reuse_element(model, "Element", "", read_edge_dst(link))
|
|
|
+ link = read_out(link, 0)
|
|
|
+ reuse_element(model, "dict_link_name", "", link)
|
|
|
+ link = read_edge_dst(link)
|
|
|
+ if (bool_not(dict_in(model["model"], "__" + cast_id(link)))):
|
|
|
+ reuse_element(model, "StringAttr", "__" + cast_id(link), link)
|
|
|
+
|
|
|
+ log("Done!")
|
|
|
+ return!
|
|
|
+ else:
|
|
|
+ reuse_element(model, (type + "_") + linkname, "", link)
|
|
|
|
|
|
// The name link
|
|
|
link = read_out(link, 0)
|
|
@@ -561,15 +594,23 @@ String function add_AL(model : Element, element : Element):
|
|
|
add_AL_links(model, todo, elem, type, "value", "")
|
|
|
add_AL_links(model, todo, elem, type, "next_param", "param")
|
|
|
elif (type == "funcdef"):
|
|
|
+ log("Adding param_dict!")
|
|
|
add_AL_links(model, todo, elem, type, "body", "")
|
|
|
- // TODO this should be added, but is not the same as "param"
|
|
|
- //add_AL_links(model, todo, elem, type, "params", "")
|
|
|
+ add_AL_links(model, todo, elem, type, "params", "param_dict")
|
|
|
add_AL_links(model, todo, elem, type, "next", "")
|
|
|
elif (type == "call"):
|
|
|
add_AL_links(model, todo, elem, type, "func", "")
|
|
|
add_AL_links(model, todo, elem, type, "params", "param")
|
|
|
add_AL_links(model, todo, elem, type, "last_param", "param")
|
|
|
add_AL_links(model, todo, elem, type, "next", "")
|
|
|
+ elif (type == "Element"):
|
|
|
+ log("Potential funcdef found!")
|
|
|
+ log(" keys: " + set_to_string(dict_keys(elem)))
|
|
|
+ if (dict_in(elem, "body")):
|
|
|
+ log("Potential next function found!")
|
|
|
+ add_AL_links(model, todo, elem, "funcdef", "body", "")
|
|
|
+ add_AL_links(model, todo, elem, "funcdef", "params", "param_dict")
|
|
|
+ add_AL_links(model, todo, elem, "funcdef", "next", "")
|
|
|
|
|
|
// TODO why isn't declare added here? --> this causes the JIT to crash with a "localXXXXX is undefined" error
|
|
|
|