From b118e7d7505d5f5621b7cf269a1b155e6f20588e Mon Sep 17 00:00:00 2001 From: Max Brunsfeld Date: Mon, 30 Nov 2020 15:28:21 -0800 Subject: [PATCH] Make binding.js syntactically valid Put the end of the surrounding closure into a separate file, suffix.js. --- lib/binding_web/binding.js | 5 ----- lib/binding_web/suffix.js | 2 ++ script/build-wasm | 1 + 3 files changed, 3 insertions(+), 5 deletions(-) create mode 100644 lib/binding_web/suffix.js diff --git a/lib/binding_web/binding.js b/lib/binding_web/binding.js index 95bfa828..b060715f 100644 --- a/lib/binding_web/binding.js +++ b/lib/binding_web/binding.js @@ -7,7 +7,6 @@ const SIZE_OF_RANGE = 2 * SIZE_OF_INT + 2 * SIZE_OF_POINT; const ZERO_POINT = {row: 0, column: 0}; const QUERY_WORD_REGEX = /[\w-.]*/g; -const PREDICATE_STEP_TYPE_DONE = 0; const PREDICATE_STEP_TYPE_CAPTURE = 1; const PREDICATE_STEP_TYPE_STRING = 2; @@ -1140,7 +1139,3 @@ function marshalEdit(edit) { } Parser.Language = Language; - -return Parser; - -})); diff --git a/lib/binding_web/suffix.js b/lib/binding_web/suffix.js new file mode 100644 index 00000000..0e9fe021 --- /dev/null +++ b/lib/binding_web/suffix.js @@ -0,0 +1,2 @@ +return Parser; +})); diff --git a/script/build-wasm b/script/build-wasm index 63ec4fe0..b139f6c2 100755 --- a/script/build-wasm +++ b/script/build-wasm @@ -95,6 +95,7 @@ $emcc \ --js-library ${web_dir}/imports.js \ --pre-js ${web_dir}/prefix.js \ --post-js ${web_dir}/binding.js \ + --post-js ${web_dir}/suffix.js \ lib/src/lib.c \ ${web_dir}/binding.c \ -o target/scratch/tree-sitter.js