summaryrefslogtreecommitdiff
path: root/Libraries/LibJS
AgeCommit message (Collapse)Author
2020-06-06LibJS: Value.in uses has_property instead of get().is_empty()Matthew Olsson
2020-06-06LibJS: Object.setPrototypeOf throws error on too few argumentsMatthew Olsson
2020-06-06LibJS: Add PropertyDescriptor objectMatthew Olsson
This new struct is now returned from get_own_property_descriptor. To preserve the old functionality of returning an object, there is now a get_own_property_descriptor_object method, for use in {Object,Reflect}.getOwnPropertyDescriptor(). This change will be useful for the implementation of Proxies, which do a lot of descriptor checks. We want to avoid as many object gets and puts as possible.
2020-06-06LibJS: Distinguish between omitted descriptor attributes and false onesMatthew Olsson
When calling Object.defineProperty, there is now a difference between omitting a descriptor attribute and specifying that it is false. For example, "{}" and "{ configurable: false }" will have different attribute values.
2020-06-06LibJS: Fix rest-params test to take function hoisting into accountMarcin Gasperowicz
2020-06-06LibJS: Hoist function declarationsMarcin Gasperowicz
This patch adds function declaration hoisting. The mechanism is similar to var hoisting. Hoisted function declarations are to be put before the hoisted var declarations, hence they have to be treated separately.
2020-06-04LibM: Add INFINITY macroLinus Groh
2020-06-04LibM: Add NAN macroLinus Groh
2020-06-04LibJS: Fix Parser.parse_template_literal looping foreverMatthew Olsson
parse_template_literal now breaks out of the loop if it sees something it doesn't expect. Additionally, it now checks for EOFs.
2020-06-03LibJS: Make typeof return undefined for undefined variablesMarcin Gasperowicz
This makes `typeof i_dont_exist` return `undefined` instead of throwing an error.
2020-06-03LibJS: Allow null or undefined as a bound |this| value in strict modeJack Karamanian
2020-06-02LibJS: Store basic traceback in ExceptionLinus Groh
Nothing fancy like line numbers, but Exception now stores a list of function names up to the current call frame.
2020-06-02LibJS: Move Interpreter::get_trace() to ConsoleClientLinus Groh
Having it globally on the interpreter is confusing as the last call frame is skipped, which is specific to console.trace().
2020-06-02LibJS: Remove dummy implementations from Console methodsLinus Groh
Having these duplicated is not really useful, either we want console output to go somewhere then implementing a console client is the way to go, or we don't care about console output - in that case we don't need to dbg() either.
2020-06-02LibJS: Consider non-extensible objects in Reflect.setPrototypeOf()Linus Groh
2020-06-02LibJS: Implement Reflect.{isExtensible,preventExtensions}()Linus Groh
2020-06-02LibJS: Disallow changing the prototype of non-extensible objectsLinus Groh
Object::set_prototype() now returns a boolean indicating success. Setting the prototype to an identical object is always considered successful, even if the object is non-extensible.
2020-06-02LibJS: Don't assume Object.setPrototypeOf() prototype value is an objectLinus Groh
We're crashing otherwise. Also it was not possible to set the prototype to null.
2020-06-02LibJS: Return specified object from Object.setPrototypeOf()Linus Groh
We were leaking an empty value.
2020-06-02LibJS: Add Object.{isExtensible,preventExtensions}()Matthew Olsson
2020-06-01LibJS: Replace some parser assertions by syntax errorsSergey Bugaev
When parsing JavaScript, we can get pretty much any sequnce of tokens, and we shouldn't crash if it's not something that we normally expect. Instead, emit syntax errors.
2020-06-01LibJS: Fix undefined behavior in HeapBlockSergey Bugaev
In C++, it's invalid to cast a block of memory to a complex type without invoking its constructor. It's even more invalid to simply cast a pointer to a block of memory to a pointer to *an abstract type*. To fix this, make sure FreelistEntry is a concrete type, and call its constructor whenever appropriate.
2020-06-01LibJS: Fix casting a value to ScriptFunction without checking it's oneSergey Bugaev
2020-06-01LibJS: Fix out-of-bounds read when parsing escape sequencesSergey Bugaev
We cannot look at i+1'th character until we verify it's there.
2020-06-01LibJS: Rewrite Parser.parse_object_expression()Matthew Olsson
This rewrite drastically increases the accuracy of object literals. Additionally, an "assertIsSyntaxError" function has been added to test-common.js to assist in testing syntax errors.
2020-05-31LibJS: Add String.fromCharCode()Linus Groh
2020-05-30LibJS: Show run-tests progress in the taskbarAndreas Kling
Use the window progress escape sequence to indicate how far along in the test collection we are while running tests. :^)
2020-05-30LibJS: Use a non-arrow function to check the |this| value in theJack Karamanian
callback for Array.prototype.{reduce,reduceRight} Arrow functions always retain the |this| binding. Running this code in Node: [1, 2].reduce(() => { "use strict"; console.log(this === undefined) } Output: false
2020-05-30LibJS: Add tests ensuring the |this| value can't be set for arrowJack Karamanian
functions in Function.prototype.{call,apply}
2020-05-30LibJS: Use the function's bound |this| and bound arguments inJack Karamanian
Interpreter::call()
2020-05-30LibJS: Throw a TypeError when an arrow function is used as a constructorJack Karamanian
2020-05-30LibJS: Don't define the "prototype" property for arrow functionsJack Karamanian
2020-05-30LibJS: Set the bound |this| value to the |this| value of the currentJack Karamanian
scope for arrow functions
2020-05-30LibJS: Track whether ScriptFunctions and FunctionExpressions are arrowJack Karamanian
functions
2020-05-30LibJS: Remove unnecessary explicit from the 3 argument FunctionJack Karamanian
constructor
2020-05-30LibJS: Object.getOwnPropertyDescriptor works properly with accessorsMatthew Olsson
2020-05-30LibJS: Parse arrow function expression with correct precedenceMarcin Gasperowicz
The parser was chomping on commas present after the arrow function expression. eg. [x=>x,2] would parse as [x=>(x,2)] instead of [(x=>x),2]. This is not the case anymore. I've added a small test to prove this.
2020-05-29LibJS: Add all remaining tokens to MarkupGenerator's style converterFalseHonesty
2020-05-29LibJS: Integrate labels into the InterpreterMatthew Olsson
The interpreter now considers a statement or block's label when considering whether or not to break. All statements can be labelled.
2020-05-29LibJS: Parse labels in continue and break statementsMatthew Olsson
2020-05-29LibJS: Parse labelled statementsMatthew Olsson
All statements now have an optional label string that can be null.
2020-05-29LibJS: New expressions look for expressions with correct precedenceMatthew Olsson
2020-05-29LibJS: Make Object::invoke() non-constLinus Groh
As suggested in #2431's code review.
2020-05-29LibJS: Add Array.prototype.toLocaleString()Linus Groh
2020-05-29LibJS: Add Object.prototype.toLocaleString()Linus Groh
2020-05-29LibJS: Add Object::invoke()Linus Groh
2020-05-29Meta: Add a script check the presence of "#pragma once" in header filesEmanuele Torre
.. and make travis run it. I renamed check-license-headers.sh to check-style.sh and expanded it so that it now also checks for the presence of "#pragma once" in .h files. It also checks the presence of a (single) blank line above and below the "#pragma once" line. I also added "#pragma once" to all the files that need it: even the ones we are not check. I also added/removed blank lines in order to make the script not fail. I also ran clang-format on the files I modified.
2020-05-29LibJS: Fix conditional expression precedenceMatthew Olsson
This fixes the following from parsing incorrectly due to the comma that occurs after the conditional: let o = { foo: true ? 1 : 2, bar: 'baz', };
2020-05-29LibJS: Throw in strict mode when assigning property to primitive valueLinus Groh
2020-05-28LibJS: Implement standard semantics for relational operators (#2417)Marcin Gasperowicz
Previously, the relational operators where casting any value to double and comparing the results according to C++ semantics. This patch makes the relational operators in JS behave according to the standard specification. Since we don't have BigInt yet, the implementation doesn't take it into account. Moved PreferredType from Object to Value. Value::to_primitive now passes preferred_type to Object::to_primitive.