1
0
mirror of https://github.com/robertkrimen/otto synced 2025-10-12 20:27:30 +08:00
Commit Graph

35 Commits

Author SHA1 Message Date
Steven Hartland
ddcbf14a26
chore: improve error messages (#482)
Improve error messages so we don't just get TypeError with no clue what
the issue was.
2022-12-07 00:13:42 +00:00
Steven Hartland
026a1d9a9c
chore: lint and naming refactor (#475)
Enable more linters, address the issues and do a major naming refactor
to use golang lower camelCase identifiers for types, functions, methods
and variable names.

Also: 
* Clean up inline generation so it doesn't rely on temporary variables.
* Remove unused functions generated by inline.pl.
2022-12-04 21:49:38 +00:00
deoxxa
eb255cd1e9 implemet Function.caller 2017-10-03 09:46:37 +11:00
deoxxa
a4fda0adbc implement Function.name 2017-10-02 19:01:12 +11:00
deoxxa
46dbeab683 test Function.length 2017-10-02 18:52:13 +11:00
Robert Krimen
e6768252c2 Improve error reporting
* Delay entering global scope on code evaluation, not runtime creation

This fixes #66
2014-06-12 21:27:32 -07:00
Robert Krimen
9cd045ef04 Simplification & refactor of (parts of) the runtime
* Proper lowercasing for internal stuff
* *Environment => *_stash
* ExecutionContext => _scope
* Simpler & shallower call/construct mechanics
* Remove unnecessary fields & methods
* Better scoping (no more stack): []*_scope => _scope.outer
* Some speed improvements

In preparation for #66
2014-05-27 22:05:35 -07:00
Robert Krimen
470b8c3b73 terst
* Update to latest github.com/robertkrimen/terst
* Clean up testing
2014-04-25 22:48:25 -07:00
Robert Krimen
bf7b16f4a3 Add internal compilation step
* Streamline what we get from "otto/parser"
* Get rid of some "otto/parser" cruft
* FunctionExpression => FunctionLiteral
* The debugger statement (debugger) should do nothing (not panic)
* Fix aspects of function expression call evaluation
2014-04-19 14:05:51 -07:00
Robert Krimen
9561f66959 Tighten test comparisons instead of squashing everything to a string 2014-04-13 18:09:46 -07:00
Robert Krimen
7721396b67 Fix Date tests to always mock UTC 2014-04-13 15:07:29 -07:00
Robert Krimen
ad8a97c028 New parser
* Faster, more straightforward, etc.
* More advanced object literals (get ..., set ...)
* More tests using JavaScript from the wild (http://cdnjs.com/)
2014-04-10 20:42:25 -07:00
Robert Krimen
21cd663185 Allow .bind to bind [[Construct]] 2014-01-20 18:04:34 -08:00
Robert Krimen
73b83020ce Add caller and arguments properties to functions via .bind 2014-01-20 13:25:41 -08:00
Robert Krimen
4fd197197d Add test for .binding something that is not callable 2014-01-20 13:13:44 -08:00
Robert Krimen
2d6125ee2c Fix .length property of functions via .bind 2014-01-20 12:58:00 -08:00
Robert Krimen
a36c19873f Fix Function.prototype.call .length 2014-01-20 12:42:23 -08:00
Robert Krimen
dace228dc8 Remove superfluous test 2014-01-20 12:32:08 -08:00
Robert Krimen
975b815b58 Fix: Function.prototype.toString (Should not be generic) 2014-01-20 12:27:05 -08:00
Robert Krimen
7d9809b2ec Fix: Function(null)
Should throw a SyntaxError for any keyword
2014-01-20 11:47:36 -08:00
Robert Krimen
6daecbf17e Fix: Function("z;x", ...)
Should throw a SyntaxError
2014-01-20 11:27:37 -08:00
Robert Krimen
514ac5ab9c Fix parsing: body, parameters => parameters, body
We were parsing in revese order...
2014-01-20 10:59:56 -08:00
Robert Krimen
e40549dbd2 Fix: Function("abc, def", "ghi", ...) 2014-01-20 10:30:02 -08:00
Robert Krimen
89a849c136 Fix: "[object Object]" (Should be a SyntaxError) 2014-01-20 10:29:41 -08:00
Robert Krimen
4860ef573b Fix Function.bind to use newBoundFunction...
...instead of newBoundFunctionObject

Basically, newBoundFunctionObject returns an incomplete object (without a prototype, __prototype__, etc.)
2014-01-20 08:27:19 -08:00
Robert Krimen
c47cf7be6e Improve arguments property handling
Also, fix an issue with double enumeration of arguments
2014-01-19 21:08:05 -08:00
Robert Krimen
ea621687a4 Add Otto.Copy() 2013-07-14 14:20:01 -07:00
Robert Krimen
81de6c8f02 Fix writable/enumerable/configurable of *.prototype to be false
Number, String, Array, RegExp, Error, etc.
2013-06-15 17:38:16 -07:00
Robert Krimen
70045edc65 Fix Function.prototype to have a length property 2013-06-15 11:01:57 -07:00
Robert Krimen
9184233705 Bundle terst dependency (github.com/robertkrimen/terst) 2013-04-15 10:20:34 -07:00
Robert Krimen
fef122900f Add Function.bind 2013-03-01 13:08:10 -08:00
Robert Krimen
03cd7ef8f7 Functions declared in a function should replace parameters 2013-02-24 14:28:16 -08:00
Robert Krimen
321cc0dca8 Add _argumentsStash, with better conforming arguments behavior:
1. Can not delete a function parameter
    2. Deleting the index of an arguments object simply
       removes the link to that function parameter
2013-02-24 14:28:07 -08:00
Robert Krimen
840fde7610 Switch function environment to be declarative...
...instead of object.
Also, make sure arguments passed through to function are not deletable.
2013-02-23 14:47:18 -08:00
Robert Krimen
809a0a0ba6 Split tests out of one big massive file 2013-02-05 08:56:08 -08:00