diff options
Diffstat (limited to 'compute_scripts.awk')
-rw-r--r-- | compute_scripts.awk | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/compute_scripts.awk b/compute_scripts.awk index 3f237e1..3d8a5b0 100644 --- a/compute_scripts.awk +++ b/compute_scripts.awk @@ -88,12 +88,12 @@ function print_file(filename, line) { close(filename) } -function print_imports_code(filename, i, count, import_name) { +function print_imports_code(filename, declarator, i, count, import_name) { count = import_counts[filename] for (i = 1; i <= count; i++) { import_name = imports[filename,i] - printf "const %s = window.haketilo_exports.%s;\n", - import_name, import_name + printf "%s %s = window.haketilo_exports.%s;\n", + declarator, import_name, import_name } } @@ -105,8 +105,11 @@ function print_exports_code(filename, i, count, export_name) { } } -function partially_wrap_file(filename) { - print_imports_code(filename) +function partially_wrap_file(filename, declarator) { + if (!declarator) + declarator = "const" + + print_imports_code(filename, declarator) printf "\n\n" print_file(filename) @@ -197,7 +200,7 @@ BEGIN { if (compute_dependencies(root_filename) > 0) exit 1 } else if (operation == "partially_wrapped_code") { - partially_wrap_file(root_filename) + partially_wrap_file(root_filename, "let") } else if (operation == "wrapped_code") { wrap_file(root_filename) } else { |