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

16 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
Andrew Montgomery-Hurrell
45c7a8df39 Add Context method to aid debugging
This change introduces a Context method to otto that allows developers to get
information about the current execution context. The method returns a Context
struct that contains information such as the filename, line and column of the
current execution, the current value of this, the stacktrace and the available
symbols at the current context.
2015-12-05 18:03:36 +00: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
de36a84a51 Fix cloning of _fnStash
This may help #71
2014-06-04 21:53:31 -07:00
Robert Krimen
918abeb8d8 The zero value of Value is now defined to be undefined
Previously, it was a publically accessible but invalid value (valueEmpty).

* Deprecate internal use of UndefinedValue(), NullValue(), FalseValue(), TrueValue()
* Guard against Empty, Result, Reference values from escaping the package
2014-05-28 21:23:32 -07:00
Robert Krimen
526d3b2fd5 Minor cloning adjustments
Mostly cosmetic.
2014-05-27 22:09:57 -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
7e2b4f2063 Rewrite of property handling to be more robust and compliant
* No more _stash
* Now using a "virtual table" system via _objectClass
* Make Array.concat GoArray compatible (via .isArray())

Fix #16
2013-05-12 14:14:51 -07:00
Robert Krimen
bef32b9223 Enumerate (consistently) in definition order 2013-02-28 14:41:48 -08:00
Robert Krimen
db913468da If a property is defined without a value (nil interface), define it as undefined 2012-11-14 15:48:19 -08:00
Robert Krimen
ce6f552b87 Corect spelling of configurable, writable
From configureable, writeable
And enumerarable?
2012-10-27 14:25:29 -07:00
Robert Krimen
6f5ca7cc0d Beef up _property, remove _defineProperty
Remove uneeded _valueProperty
Rename to propertyMode_{write,enumerate,configure}
.Can* => writeable, enumerable, configureable
Privatize _property
Get rid of _defineProperty
2012-10-27 08:59:38 -07:00
Robert Krimen
36edc1f921 Move defineOwnProperty back into _object 2012-10-26 16:09:42 -07:00
Robert Krimen
3c93384f5c Cleanup of stash, property, and object
Use octal to designate write/enumerate/configure (experimental)
Move extensibility responsibility into the stash
Rename propertyStash => objectStash (be congruent with arrayStash, etc.)
Get rid of a bunch of useless methods
Privatize everything ([A-Z] => [a-z_])
gofmt
2012-10-26 15:47:19 -07:00
Robert Krimen
4a8c7ffc00 Initial commit 2012-10-05 18:47:53 -07:00