From 3fc0ea9bec27c498ecd16bcc8b90eb62f0092dc4 Mon Sep 17 00:00:00 2001 From: Nathan Braswell Date: Sat, 4 Feb 2017 01:29:22 -0500 Subject: [PATCH] baby steps --- stdlib/function_value_lower.krak | 11 ++++++++++- stdlib/pass_common.krak | 2 +- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/stdlib/function_value_lower.krak b/stdlib/function_value_lower.krak index 0610dd2..0425016 100644 --- a/stdlib/function_value_lower.krak +++ b/stdlib/function_value_lower.krak @@ -75,6 +75,15 @@ fun function_value_lower(name_ast_map: *map,*ast_node println(string("there are ") + function_value_creation_points.size + " function value creation points in the program.") println(string("there are ") + function_types_needed_wo_lambdas.size() + " function types needed wo lambdas in the program.") println(string("there are ") + function_types_needed_for_lambdas.size() + " function types needed for lambdas in the program.") - println(string("there are ") + (function_types_needed_wo_lambdas + function_types_needed_for_lambdas).size() + " total (set union, not addition) in the program.") + println(string("there are ") + (function_types_needed_wo_lambdas + function_types_needed_for_lambdas).size() + " total (set union, not addition) in the program."); // darn vexing parse + + (function_types_needed_wo_lambdas + function_types_needed_for_lambdas).for_each(fun(t: type) { + var new_type_def_name = t.to_string() + "_function_value_struct" + var new_type_def = ast_type_def_ptr(new_type_def_name) + add_to_scope("~enclosing_scope", name_ast_map->values.first().second, new_type_def) + add_to_scope(new_type_def_name, new_type_def, name_ast_map->values.first().second) + name_ast_map->values.first().second->translation_unit.children.add(new_type_def) + }) + } diff --git a/stdlib/pass_common.krak b/stdlib/pass_common.krak index 3f526bb..155f009 100644 --- a/stdlib/pass_common.krak +++ b/stdlib/pass_common.krak @@ -22,7 +22,7 @@ fun error(source: *tree, message: *char) error(source, string(message)); fun error(source: *tree, message: string) { source = get_first_terminal(source) if (source) - error(source->data.source + ": " + source->data.position + " " + message) + error("***error |" + concat_symbol_tree(source) + "| *** " + source->data.source + ": " + source->data.position + " " + message) error(message) } fun method_in_object(method: *ast_node, enclosing_object: *ast_node): bool {