summaryrefslogtreecommitdiff
path: root/test-suite/tests/elisp-compiler.test
AgeCommit message (Collapse)AuthorFilesLines
2017-04-19Fix test suite for constant literals changeAndy Wingo1-1/+1
* test-suite/tests/elisp-compiler.test ("List Built-Ins"): Avoid mutating a literal pair. If this turns out to be necessary for elisp, the compiler will have to compile literals to calls to run-time heap allocations rather than constants.
2012-02-03fix `flet' syntaxBT Templeton1-3/+4
* module/language/elisp/compile-tree-il.scm (process-let-bindings): Remove. (parse-let-binding, parse-flet-binding): New procedures. (generate-let, generate-let*): Now takes an association list mapping symbols to values for the `bindings' argument. (compile-let, compile-let*, compile-lexical-let) (compile-lexical-let*): Parse the bindings list with `parse-let-binding'. (compile-flet): Parse the bindings list with `parse-flet-binding'.
2012-02-03elisp binding declarationsBT Templeton1-1/+10
* module/language/elisp/compile-tree-il.scm (bind-lexically?): Accept a new `decls' argument and check it for `lexical' declarations. Establish the same kind of binding whether or not a lexical binding for `sym' exists, whereas previously the presence of a lexical binding would cause newly-established bindings to be lexical bindings as well. (split-let-bindings): Remove. All callers changed. (generate-let, generate-let*, compile-lambda): Pass the declarations list to `bind-lexically?'. * test-suite/tests/elisp-compiler.test: Explicitly disable the lexical-binding mode. Add `lexical' declarations where necessary.
2012-02-03elisp lambda list parsingBT Templeton1-2/+2
* module/language/elisp/compile-tree-il.scm (split-lambda-arguments): Remove. (parse-lambda-list, make-simple-lambda): New procedures. (compile-lambda): Use `parse-lambda-list' and `make-simple-lambda'. Set empty rest arguments to the empty list instead of `#nil'. * test-suite/tests/elisp-compiler.test ("Lambda Expressions")["rest argument"]: Use Elisp `null' instead of a Scheme equality check.
2012-02-03evaluate the function position correctlyBT Templeton1-1/+1
* module/language/elisp/compile-tree-il (compile-pair): Use `function' to perform functional evaluation. Previously, if the operator of a compound form was not a symbol, the operator would be evaluated as a normal expression. This happened to work only because there is a `lambda' macro. The compiler will now signal an error if the operator is neither a function name nor a lambda expression. * test-suite/tests/elisp-compiler.test ("Lambda Expressions")["optional argument"]: Remove an erroneous use of `function' in the function position.
2012-02-03remove `flet*' elisp special formBT Templeton1-4/+1
* module/language/elisp/compile-tree-il.scm (compile-flet*): Remove. * module/language/elisp/runtime/function-slot.scm: Update module definition. * test-suite/tests/elisp-compiler.test ("Lambda Expressions")["flet and flet*"]: Remove `flet*' test.
2012-02-03remove `with-always-lexical' elisp special formBT Templeton1-24/+2
* module/language/elisp/compile-tree-il.scm: (always-lexical): Remove. All uses changed. (with-added-symbols): Remove. (compile-with-always-lexical): Remove. (process-options!): Remove support for the `#:always-lexical' option. * module/language/elisp/runtime/function-slot.scm: Update import and re-export lists. * test-suite/tests/elisp-compiler.test: Remove or update tests using `with-always-lexical'.
2012-02-03emacs-compatible lexical bindingBT Templeton1-1/+1
* module/language/elisp/bindings.scm (global?): New function. * module/language/elisp/compile-tree-il.scm (lexical-binding): New variable. (bind-lexically?): If lexical binding is enabled, bind lexically unless a special binding exists. (compile-%set-lexical-binding-mode): New function. * module/language/elisp/lexer.scm (lexical-binding-regexp): New variable. (lex): Return a `set-lexical-binding-mode!' token if a comment is found while reading the first line. * module/language/elisp/parser.scm (get-expression): Add support for `set-lexical-binding-mode!' tokens. * module/language/elisp/runtime/function-slot.scm: Import and re-export the `%set-lexical-binding-mode' special form. * test-suite/tests/elisp-compiler.test ("Let and Let*")["lambda args inside lexical-let"]: Update.
2012-02-03fix compilation of elisp forms with empty bodiesBT Templeton1-1/+15
* module/language/elisp/compile-tree-il.scm (generate-let) (generate-let*, compile-lambda, compile-with-added-symbols) (compile-progn, compile-if): Return nil if the form's body is empty. * test-suite/tests/elisp-compiler.test ("Sequencing")["empty progn"]: New test. ("Conditionals")["if with no else"]: New test. ("Let and Let*")["empty let, empty let*"]: New test. ("Lambda Expressions")["empty lambda"]: New test.
2012-02-03remove unnecessary elisp macrosBT Templeton1-42/+1
* module/language/elisp/runtime/macros.scm (when, unless, dotimes) (dolist, pop, push): Remove. (They are not special forms in Emacs.) * module/language/elisp/runtime/function-slot.scm: Update import and export lists. * test-suite/tests/elisp-compiler.test ("Conditionals")["failing when"] ["succeeding when", "failing unless", "succeeding unless"]: Remove. ("Iteration")["dotimes", "dolist"]: Remove. ("List Built-Ins")["pop", "push"]: Remove.
2012-02-03elisp test fixesBT Templeton1-3/+3
* test-suite/tests/elisp-compiler.test ("Exceptions")["catch and throw"]: Use a freshly-consed object instead of a literal object. This test previously assumed that similar literal objects are never identical, which no longer true. ("Equivalence Predifcates")["eq"]: Likewise.
2012-02-03remove unnecessary elisp subrsBT Templeton1-14/+0
* module/language/elisp/runtime/subrs.scm (copy-tree, number-sequence): Remove. (They are not subrs in Emacs.) * test-suite/tests/elisp-compiler.test ("List Built-ins")["copy-tree", "number-sequence"]: Remove.
2012-02-03`atomp' -> `atom'BT Templeton1-3/+3
* module/language/elisp/runtime/subrs.scm (atomp) Rename to... (atom): ...this. All callers changed.
2010-12-07lexical function binding for elispBrian Templeton1-3/+3
* module/language/elisp/compile-tree-il.scm (access-variable) (reference-variable, set-variable!): Handle globally-bound non-special variables. (bind-lexically?): Create lexical bindings for flet and flet*. * module/language/elisp/runtime.scm (reference-variable, set-variable!): Handle globally-bound non-special variables. (built-in-func): Set the variable directly instead of storing the function in a fluid. * module/language/elisp/runtime/subrs.scm (funcall): Call apply directly. * test-suite/tests/elisp-compiler.test ("Function Definitions")["flet and flet*"]: Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07use unbound fluids instead of `void' sentinel valueBrian Templeton1-11/+1
* module/language/elisp/compile-tree-il.scm (reference-with-check) (compile-without-void-checks, want-void-check?): Remove. (compile-function, compile-pair): Use `reference-variable' instead of `reference-with-check'. (compile-defvar): Only set `sym' if `sym' is not bound to a bound fluid, rather than requiring that its value be `void'. (process-options!): Remove `#:disable-void-check' option handling. * module/language/elisp/runtime.scm (void) (reference-variable-with-check): Remove. (ensure-fluid!): Use an undefined fluid as the initial value for global variables. * module/language/elisp/runtime/function-slot.scm (without-void-checks): Don't import or re-export. * module/language/elisp/runtime/macros.scm (prog1, cond, or, dolist): Don't use `without-void-checks'. * module/language/elisp/runtime/subrs.scm (symbol-value) (symbol-function, apply): Use `reference-variable' instead of `reference-variable-with-check'. (makunbound, fmakunbound, boundp, fboundp): Unset the variable's fluid (or the variable itself, if it isn't bound to a fluid). * test-suite/tests/elisp-compiler.test ("Variable Setting/Referencing")["disabled void check (all)", "disabled void check (symbol list)", "without-void-checks"]: Remove. Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-12-07use correct names for quasiquotation operatorsBrian Templeton1-9/+9
Use #{`}#, #{,}# and #{,@}# as the quasiquote, unquote and unquote-splicing operators, respectively. Previously they were named escaping. * module/language/elisp/compile-tree-il.scm (unquote?): Change "\," to "#{,}#". (unquote-splicing): Change "\,@" to "#{,@}#". (#{compile-`}#): Rename from #{compile-\`}#. * module/language/elisp/runtime/function-slot.scm: Import #{compile-`}# instead of #{compile-\`}#, and re-export as #{`}# instead of as #{\`}#. * module/language/elisp/parser.scm (quotation-symbols): * test-suite/tests/elisp-compiler.test ("Eval", "Quotation"): * test-suite/tests/elisp-reader.test ("Parser"): Change "\`", "\,", and "\,@" to "#{`}#", "#{,}#" and "#{,@}#", respectively.
2010-12-07make `pass-if-equal' literal in `compile-test'Brian Templeton1-1/+1
* test-suite/tests/elisp-compiler.test (compile-test): Add `pass-if-equal' to the list of literal identifiers Signed-off-by: Andy Wingo <wingo@pobox.com>
2010-04-09change remaining %nil -> #nilAndy Wingo1-2/+2
* doc/ref/vm.texi: * libguile/boolean.h: * libguile/pairs.h: * module/language/elisp/README: * test-suite/tests/elisp-compiler.test: * test-suite/tests/load.test: Change remaining mentions of %nil to #nil.
2009-08-01Allow lexical binding of lambda arguments.Daniel Kraft1-1/+33
* module/language/elisp/compile-tree-il.scm: Rework lambda compiler to allow opional lexical binding of (some) lambda arguments. * test-suite/tests/elisp-compiler.test: Check this.
2009-07-31Compiler option to always bind certain symbols lexically.Daniel Kraft1-1/+23
Affects so far let-bound symbols, lambda arguments to come in the future. * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Add :always-lexical option. * test-suite/tests/elisp-compiler.test: Test it.
2009-07-30Switch use of guile-primitive to now available funcall in test.Daniel Kraft1-7/+7
2009-07-30without-void-checks as new extension for fine-controlDaniel Kraft1-1/+4
* module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Handle without-void-checks. * test-suite/tests/elisp-compiler.test: Test it.
2009-07-29funcall, apply and eval built-ins.Daniel Kraft1-1/+46
* module/language/elisp/README: Document new features. * module/language/elisp/runtime/function-slot.scm: Implement funcall, apply and eval by using the existing compiler code. * test-suite/tests/elisp-compiler.test: Test those.
2009-07-29Added guile-primitive construct for references to primitives from Elisp.Daniel Kraft1-7/+7
* module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Implement guile-primitive. * test-suite/tests/elisp-compiler.test: Switched a usage of guile-ref to the now available guile-primitive.
2009-07-29Added length built-in.Daniel Kraft1-0/+5
* module/language/elisp/runtime/function-slot.scm: Add length built-in. * test-suite/tests/elisp-compiler.test: Test length.
2009-07-29Implemented lexical-let and lexical-let* for elisp.Daniel Kraft1-0/+69
* module/language/elisp/README: Document it. * module/language/elisp/bindings.scm: New fields in bindings data structure to keep track of lexical bindings for symbols. * module/language/elisp/compile-tree-il.scm: Implement lexical-let(*). * test-suite/tests/elisp-compiler.test: Test lexical scoping with lexical-let.
2009-07-27In elisp-compiler.test, check that let* works without values given, too.Daniel Kraft1-4/+10
2009-07-24Compiler option to disable void-checks in elisp.Daniel Kraft1-1/+10
* module/language/elisp/README: Document the change. * module/language/elisp/compile-tree-il.scm: Add disable-void-check option. * test-suite/tests/elisp-compiler.test: Test it.
2009-07-24Implemented the flet and flet* extensions.Daniel Kraft1-1/+17
* module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Implement flet and flet*. * test-suite/tests/elisp-compiler.test: Test flet and flet*.
2009-07-23Implemented dynamic symbol access built-ins (set, fset, symbol-value, ↵Daniel Kraft1-5/+29
makunbound...) * module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Moved ensure-fluid! to runtime function. * module/language/elisp/runtime.scm: Runtime functions to support dynamic value access. * module/language/elisp/runtime/function-slot.scm: Defined the built-ins. * test-suite/tests/elisp-compiler.test: Test them.
2009-07-22Added guile-ref extension construct, change throw implementation to easier ↵Daniel Kraft1-2/+13
one using a built-in function and implement unwind-protect. * module/language/elisp/README: Document the changes. * module/language/elisp/compile-tree-il.scm: Implement unwind-protect. * module/language/elisp/runtime/function-slot.scm: throw as built-in. * test-suite/tests/elisp-compiler.test: Test unwind-protect.
2009-07-22Implemented catch and throw in elisp.Daniel Kraft1-0/+22
* module/language/elisp/README: Document this. * module/language/elisp/compile-tree-il.scm: Implement catch and throw. * test-suite/tests/elisp-compiler.test: Test catch/throw.
2009-07-20Implemented prog1, prog2, dotimes, dolist control structures.Daniel Kraft1-2/+25
* module/language/elisp/README: Document it and some further ideas written down. * module/language/elisp/compile-tree-il.scm: Implement prog1, dolist. * module/language/elisp/runtime/macro-slot.scm: prog2 and dotimes. * test-suite/tests/elisp-compiler.test: Test prog1, prog2, dotimes, dolist.
2009-07-18Implemented some important list built-ins.Daniel Kraft1-0/+74
* module/language/elisp/runtime.scm: Updated/added convenience macros. * module/language/elisp/runtime/function-slot.scm: Implement list built-ins. * module/language/elisp/runtime/macro-slot.scm: Implement list built-ins. * test-suite/tests/elisp-compiler.test: Test the implemented built-ins.
2009-07-18Implemented unless, when and dotimes using built-in macros.Daniel Kraft1-7/+28
* module/language/elisp/README: Document that. * module/language/elisp/runtime.scm: Defined built-in-macro macro. * module/language/elisp/runtime/macro-slot.scm: Implement unless, when, dotimes. * test-suite/tests/elisp-compiler.test: Test for those constructs.
2009-07-18Return correct value for setq form.Daniel Kraft1-4/+5
* module/language/elisp/compile-tree-il.scm: Fix implementation of setq. * test-suite/tests/elisp-compiler.test: Check for value of setq form.
2009-07-18Implemented real quotation (added support for backquotation).Daniel Kraft1-0/+28
* module/language/elisp/README: Document that. * module/language/elisp/compile-tree-il.scm: Implement backquote. * test-suite/tests/elisp-compiler.test: Test quotation and backquotes.
2009-07-18Implemented eq and equal built-in predicates.Daniel Kraft1-0/+17
* module/language/elisp/runtime/function-slot.scm: Implement eq and equal. * test-suite/tests/elisp-compiler.test: Test them.
2009-07-16Implemented macros in elisp compiler.Daniel Kraft1-0/+13
* module/language/elisp/README: Document it. * module/language/elisp/compile-tree-il.scm: Implement defmacro and expansion. * module/language/elisp/runtime/macro-slot.scm: New module to keep definitions. * test-suite/Makefile.am: Add elisp-compiler.test to list of tests. * test-suite/tests/elisp-compiler.test: Basic macro tests.
2009-07-16Extended test-suite to cover already implemented built-ins and fixed errors ↵Daniel Kraft1-1/+47
found. * module/language/elisp/runtime/function-slot.scm: Fixed errors in number preds. * test-suite/tests/elisp-compiler.test: Test built-ins already implemented.
2009-07-15Test-suite for elisp compiler so far, excluding the built-ins.Daniel Kraft1-0/+208
* test-suite/tests/elisp-compiler.test: Tests for compiler so far.