diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b96a4ee..d869e8d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,7 +12,7 @@ jobs: - name: setup nodejs uses: actions/setup-node@v1 with: - node-version: 16.x + node-version: 16.5 - name: install dependencies env: diff --git a/src/ast/analyze.test.fnk b/src/ast/analyze.test.fnk index adf1696..97ed81f 100644 --- a/src/ast/analyze.test.fnk +++ b/src/ast/analyze.test.fnk @@ -82,9 +82,6 @@ source = ' - try: - foo - [ni, ..., nu] = [1234, "spam"] na = [...ni, false, true] fn foo: {foo} diff --git a/src/ast/analyze.test.fnk.snap b/src/ast/analyze.test.fnk.snap index af566fb..b4141d8 100644 --- a/src/ast/analyze.test.fnk.snap +++ b/src/ast/analyze.test.fnk.snap @@ -14,18 +14,18 @@ Array [ "ident:ni@12:4-12:6", "ident:Spam@18:0-18:4", "ident:children@18:11-18:19", - "ident:ni@27:1-27:3", - "ident:nu@27:10-27:12", - "ident:na@28:0-28:2", - "ident:foo@29:3-29:6", - "ident:ham@31:7-31:10", + "ident:ni@24:1-24:3", + "ident:nu@24:10-24:12", + "ident:na@25:0-25:2", + "ident:foo@26:3-26:6", + "ident:ham@28:7-28:10", ] `; exports[`analyze gets duplicate bindings 1`] = ` Array [ - "ident:ni@27:1-27:3 module@1:0-33:0", - "ident:nu@27:10-27:12 module@1:0-33:0", + "ident:ni@24:1-24:3 module@1:0-30:0", + "ident:nu@24:10-24:12 module@1:0-30:0", ] `; @@ -35,7 +35,6 @@ Array [ "ident:foo@7:18-7:21 -> ident:foo@1:0-1:3", "ident:foo@10:10-10:13 -> ident:foo@1:0-1:3", "ident:foo@12:9-12:12 -> ident:foo@1:0-1:3", - "ident:foo@25:2-25:5 -> ident:foo@1:0-1:3", "ident:bar@8:39-8:42 -> ident:bar@3:0-3:3", "ident:bar@10:6-10:9 -> ident:bar@3:0-3:3", "ident:spam@4:7-4:11 -> ident:spam@3:9-3:13", @@ -44,7 +43,7 @@ Array [ "ident:undef@5:7-5:12 -> unbound", "ident:div@16:1-16:4 -> unbound", "ident:ham@21:24-21:27 -> unbound", - "ident:map@31:0-31:3 -> unbound", + "ident:map@28:0-28:3 -> unbound", "ident:ni@8:2-8:4 -> ident:ni@7:1-7:3", "ident:ni@8:45-8:47 -> ident:ni@7:1-7:3", "ident:ni@21:6-21:8 -> ident:ni@7:1-7:3", @@ -55,30 +54,30 @@ Array [ "ident:ni@13:8-13:10 -> ident:ni@12:4-12:6", "ident:Spam@21:1-21:5 -> ident:Spam@18:0-18:4", "ident:children@19:5-19:13 -> ident:children@18:11-18:19", - "ident:ni@28:9-28:11 -> ident:ni@27:1-27:3", - "ident:foo@29:9-29:12 -> ident:foo@29:3-29:6", - "ident:ham@32:2-32:5 -> ident:ham@31:7-31:10", + "ident:ni@25:9-25:11 -> ident:ni@24:1-24:3", + "ident:foo@26:9-26:12 -> ident:foo@26:3-26:6", + "ident:ham@29:2-29:5 -> ident:ham@28:7-28:10", ] `; exports[`analyze gets scopes 1`] = ` Array [ - "ident:foo@1:0-1:3 module@1:0-33:0", - "ident:bar@3:0-3:3 module@1:0-33:0", + "ident:foo@1:0-1:3 module@1:0-30:0", + "ident:bar@3:0-3:3 module@1:0-30:0", "ident:spam@3:9-3:13 block:fn@3:6-5:12", "ident:ham@3:19-3:22 block:fn@3:6-5:12", "ident:ni@4:2-4:4 block:fn@3:6-5:12", - "ident:ni@7:1-7:3 module@1:0-33:0", - "ident:nu@7:10-7:12 module@1:0-33:0", - "ident:nini@8:7-8:11 module@1:0-33:0", - "ident:spam@8:25-8:29 module@1:0-33:0", + "ident:ni@7:1-7:3 module@1:0-30:0", + "ident:nu@7:10-7:12 module@1:0-30:0", + "ident:nini@8:7-8:11 module@1:0-30:0", + "ident:spam@8:25-8:29 module@1:0-30:0", "ident:ni@12:4-12:6 match:expr@11:2-13:11", - "ident:Spam@18:0-18:4 module@1:0-33:0", + "ident:Spam@18:0-18:4 module@1:0-30:0", "ident:children@18:11-18:19 block:fn@18:7-19:17", - "ident:ni@27:1-27:3 module@1:0-33:0", - "ident:nu@27:10-27:12 module@1:0-33:0", - "ident:na@28:0-28:2 module@1:0-33:0", - "ident:foo@29:3-29:6 block:fn@29:0-29:13", - "ident:ham@31:7-31:10 block:fn@31:4-33:0", + "ident:ni@24:1-24:3 module@1:0-30:0", + "ident:nu@24:10-24:12 module@1:0-30:0", + "ident:na@25:0-25:2 module@1:0-30:0", + "ident:foo@26:3-26:6 block:fn@26:0-26:13", + "ident:ham@28:7-28:10 block:fn@28:4-30:0", ] `; diff --git a/src/lang/init.fnk b/src/lang/init.fnk index c63b0c1..8d32800 100644 --- a/src/lang/init.fnk +++ b/src/lang/init.fnk @@ -16,7 +16,6 @@ {add_import} = import './import/init.fnk' {add_prop_access} = import './prop-access/init.fnk' {add_ignorable_tokens} = import './whitespace/init.fnk' -{add_js_ops} = import './js-compat/init.fnk' {add_partial} = import './partial/init.fnk' {add_ident} = import './identifier/init.fnk' @@ -49,8 +48,6 @@ init_language = fn ctx: add_literals - add_js_ops - add_call_operators add_group diff --git a/src/lang/js-compat/init.fnk b/src/lang/js-compat/init.fnk deleted file mode 100644 index 53efdea..0000000 --- a/src/lang/js-compat/init.fnk +++ /dev/null @@ -1,12 +0,0 @@ -{add_operator} = import '@fink/prattler/expressions.fnk' - -{prefix} = import '../expressions.fnk' -{add_named_block} = import '../block/init.fnk' - - - -# TODO: do we want exceptions or should this live in @fink/js-interop? -add_js_ops = fn ctx: - pipe ctx: - add_operator prefix 'throw', 'js-compat' - add_named_block 'try', 'js-compat' diff --git a/src/lang/js-compat/init.test.fnk b/src/lang/js-compat/init.test.fnk deleted file mode 100644 index 1a32255..0000000 --- a/src/lang/js-compat/init.test.fnk +++ /dev/null @@ -1,23 +0,0 @@ -{describe, it, expect, to_match_snapshot} = import '@fink/jest/test.fnk' - -{parse_expr, parse} = import '../../parser.fnk' - - - -describe 'js-compat operators', fn: - it 'parses throw', fn: - expect - parse_expr "throw_foo = foo or throw err 'foobar'" - to_match_snapshot - - - -describe 'try ...:', fn: - - it 'parses', fn: - expect - parse " - [err, result] = try: - throw error 'foobar' - " - to_match_snapshot diff --git a/src/lang/js-compat/init.test.fnk.snap b/src/lang/js-compat/init.test.fnk.snap deleted file mode 100644 index 9faa77b..0000000 --- a/src/lang/js-compat/init.test.fnk.snap +++ /dev/null @@ -1,27 +0,0 @@ -// Jest Snapshot v1, https://goo.gl/fbAQLP - -exports[`js-compat operators parses throw 1`] = ` -assign = (1:0-1:37) - ident (1:0-1:9) throw_foo - logical or (1:12-1:37) - ident (1:12-1:15) foo - js-compat throw (1:19-1:37) - call (1:25-1:37) - ident (1:25-1:28) err - string ' (1:29-1:37) - 'foobar' -`; - -exports[`try ...: parses 1`] = ` -module (1:0-3:0) - assign = (1:0-3:0) - list (1:0-1:13) - ident (1:1-1:4) err - ident (1:6-1:12) result - js-compat try (1:16-3:0): - js-compat throw (2:2-3:0) - call (2:8-3:0) - ident (2:8-2:13) error - string ' (2:14-2:22) - 'foobar' -`;