Throw if set! passed incorrect number of arguments

Description

In the following, the first and last should throw:

1 2 3 4 5 6 7 8 cljs.user=> (set! *print-fn-bodies*) nil cljs.user=> (set! *print-fn-bodies* true) true cljs.user=> (set! target -prop 3) true cljs.user=> (set! *print-fn-bodies* true false true) true

Implementation guidance:

The message thrown should be derived from Clojure, perhaps "Malformed assignment, expecting (set! target val) or (set! target -prop val)"

The check and throw can be added to the analyzer's code which parses 'set!:
https://github.com/clojure/clojurescript/blob/6eedd0a08c49f7b0d4dcb30977b2fb38c90577bd/src/main/clojure/cljs/analyzer.cljc#L2229

An example of a similar throw is in the analyzer code for 'if:
https://github.com/clojure/clojurescript/blob/6eedd0a08c49f7b0d4dcb30977b2fb38c90577bd/src/main/clojure/cljs/analyzer.cljc#L1446-L1449

Tests can be added in cljs.analyzer-tests (which is run via lein test): https://github.com/clojure/clojurescript/blob/master/src/test/clojure/cljs/analyzer_tests.clj

Environment

None

Status

Assignee

David Nolen

Reporter

Mike Fikes

Labels

Approval

None

Patch

Code and Test

Priority

Major
Configure