aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.clang-format87
-rw-r--r--.github/workflows/gh-actions.yml9
-rw-r--r--docs/00.GETTING-STARTED.md8
-rw-r--r--docs/08.CODING-STANDARDS.md2
-rw-r--r--jerry-core/CMakeLists.txt2
-rw-r--r--jerry-core/api/jerry-debugger-transport.c12
-rw-r--r--jerry-core/api/jerry-debugger.c3
-rw-r--r--jerry-core/api/jerry-snapshot.c201
-rw-r--r--jerry-core/api/jerryscript.c (renamed from jerry-core/api/jerry.c)414
-rw-r--r--jerry-core/config.h514
-rw-r--r--jerry-core/debugger/debugger.c88
-rw-r--r--jerry-core/debugger/debugger.h12
-rw-r--r--jerry-core/ecma/base/ecma-alloc.c22
-rw-r--r--jerry-core/ecma/base/ecma-errors.c74
-rw-r--r--jerry-core/ecma/base/ecma-errors.h68
-rw-r--r--jerry-core/ecma/base/ecma-extended-info.c18
-rw-r--r--jerry-core/ecma/base/ecma-extended-info.h4
-rw-r--r--jerry-core/ecma/base/ecma-gc.c110
-rw-r--r--jerry-core/ecma/base/ecma-gc.h1
-rw-r--r--jerry-core/ecma/base/ecma-globals.h306
-rw-r--r--jerry-core/ecma/base/ecma-helpers-collection.c1
-rw-r--r--jerry-core/ecma/base/ecma-helpers-conversion.c279
-rw-r--r--jerry-core/ecma/base/ecma-helpers-external-pointers.c16
-rw-r--r--jerry-core/ecma/base/ecma-helpers-number.c104
-rw-r--r--jerry-core/ecma/base/ecma-helpers-string.c152
-rw-r--r--jerry-core/ecma/base/ecma-helpers-value.c67
-rw-r--r--jerry-core/ecma/base/ecma-helpers.c126
-rw-r--r--jerry-core/ecma/base/ecma-helpers.h186
-rw-r--r--jerry-core/ecma/base/ecma-init-finalize.c9
-rw-r--r--jerry-core/ecma/base/ecma-lcache.c20
-rw-r--r--jerry-core/ecma/base/ecma-lcache.h2
-rw-r--r--jerry-core/ecma/base/ecma-line-info.c9
-rw-r--r--jerry-core/ecma/base/ecma-line-info.h6
-rw-r--r--jerry-core/ecma/base/ecma-literal-storage.c53
-rw-r--r--jerry-core/ecma/base/ecma-literal-storage.h18
-rw-r--r--jerry-core/ecma/base/ecma-module.c121
-rw-r--r--jerry-core/ecma/base/ecma-module.h37
-rw-r--r--jerry-core/ecma/base/ecma-property-hashmap.c50
-rw-r--r--jerry-core/ecma/base/ecma-property-hashmap.h15
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.c13
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h44
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c217
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.inc.h17
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-array.c45
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-array.inc.h16
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c7
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c7
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h16
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c37
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-function.c6
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-function.inc.h16
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c25
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-atomics.c5
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-atomics.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-bigint.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h6
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-boolean.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c7
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-dataview.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c16
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.inc.h10
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-date.c56
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-date.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c21
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-error.c13
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-error.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.c13
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c54
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.h7
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-function.c7
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-function.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.c4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c31
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-generator.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-generator.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-global.c60
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h180
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-handlers.c8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-handlers.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c89
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-helpers-error.c6
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-helpers-json.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c73
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h94
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h270
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c28
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-json.c125
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.inc.h18
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-map.c4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-map.inc.h16
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-math.c39
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-math.inc.h36
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c59
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-number.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-number.inc.h44
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-object.c68
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-object.h16
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-object.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-promise.c31
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-promise.inc.h16
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-proxy.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-proxy.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.c9
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.c9
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c16
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c58
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h44
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c7
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c11
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-regexp.inc.h16
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.inc.h21
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-set.c4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-set.inc.h16
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c7
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c5
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c99
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.inc.h24
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-string.c15
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-string.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.c23
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h17
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c33
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-symbol.inc.h51
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.c9
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.c13
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.c3
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-urierror.c13
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-urierror.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.c14
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakref.c13
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakref.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h8
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c4
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtin-weakset.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtins-internal.h46
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtins.c220
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtins.h80
-rw-r--r--jerry-core/ecma/builtin-objects/ecma-builtins.inc.h60
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.inc.h2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c19
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.inc.h2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c19
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.inc.h2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c15
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.inc.h2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c15
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.inc.h2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c15
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.inc.h2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c15
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.inc.h2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c7
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c3
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.h7
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype-template.inc.h12
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c105
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.inc.h15
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-template.inc.h22
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c12
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.inc.h16
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.inc.h2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c15
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.inc.h2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c15
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.inc.h2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c15
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.inc.h4
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.inc.h2
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c15
-rw-r--r--jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.inc.h4
-rw-r--r--jerry-core/ecma/operations/ecma-arguments-object.c33
-rw-r--r--jerry-core/ecma/operations/ecma-arguments-object.h31
-rw-r--r--jerry-core/ecma/operations/ecma-array-object.c78
-rw-r--r--jerry-core/ecma/operations/ecma-array-object.h59
-rw-r--r--jerry-core/ecma/operations/ecma-arraybuffer-object.c32
-rw-r--r--jerry-core/ecma/operations/ecma-arraybuffer-object.h42
-rw-r--r--jerry-core/ecma/operations/ecma-async-generator-object.c21
-rw-r--r--jerry-core/ecma/operations/ecma-async-generator-object.h25
-rw-r--r--jerry-core/ecma/operations/ecma-atomics-object.c18
-rw-r--r--jerry-core/ecma/operations/ecma-atomics-object.h17
-rw-r--r--jerry-core/ecma/operations/ecma-big-uint.c92
-rw-r--r--jerry-core/ecma/operations/ecma-big-uint.h29
-rw-r--r--jerry-core/ecma/operations/ecma-bigint-object.c10
-rw-r--r--jerry-core/ecma/operations/ecma-bigint.c43
-rw-r--r--jerry-core/ecma/operations/ecma-bigint.h5
-rw-r--r--jerry-core/ecma/operations/ecma-boolean-object.c15
-rw-r--r--jerry-core/ecma/operations/ecma-comparison.c89
-rw-r--r--jerry-core/ecma/operations/ecma-container-object.c77
-rw-r--r--jerry-core/ecma/operations/ecma-container-object.h36
-rw-r--r--jerry-core/ecma/operations/ecma-conversion.c121
-rw-r--r--jerry-core/ecma/operations/ecma-conversion.h2
-rw-r--r--jerry-core/ecma/operations/ecma-dataview-object.c23
-rw-r--r--jerry-core/ecma/operations/ecma-dataview-object.h6
-rw-r--r--jerry-core/ecma/operations/ecma-eval.c9
-rw-r--r--jerry-core/ecma/operations/ecma-eval.h6
-rw-r--r--jerry-core/ecma/operations/ecma-exceptions.c33
-rw-r--r--jerry-core/ecma/operations/ecma-exceptions.h1
-rw-r--r--jerry-core/ecma/operations/ecma-function-object.c155
-rw-r--r--jerry-core/ecma/operations/ecma-function-object.h112
-rw-r--r--jerry-core/ecma/operations/ecma-get-put-value.c30
-rw-r--r--jerry-core/ecma/operations/ecma-iterator-object.c42
-rw-r--r--jerry-core/ecma/operations/ecma-iterator-object.h54
-rw-r--r--jerry-core/ecma/operations/ecma-jobqueue.c51
-rw-r--r--jerry-core/ecma/operations/ecma-jobqueue.h5
-rw-r--r--jerry-core/ecma/operations/ecma-lex-env.c56
-rw-r--r--jerry-core/ecma/operations/ecma-lex-env.h18
-rw-r--r--jerry-core/ecma/operations/ecma-number-arithmetic.c11
-rw-r--r--jerry-core/ecma/operations/ecma-number-object.c13
-rw-r--r--jerry-core/ecma/operations/ecma-objects-general.c113
-rw-r--r--jerry-core/ecma/operations/ecma-objects-general.h3
-rw-r--r--jerry-core/ecma/operations/ecma-objects.c228
-rw-r--r--jerry-core/ecma/operations/ecma-objects.h67
-rw-r--r--jerry-core/ecma/operations/ecma-promise-object.c138
-rw-r--r--jerry-core/ecma/operations/ecma-promise-object.h36
-rw-r--r--jerry-core/ecma/operations/ecma-proxy-object.c74
-rw-r--r--jerry-core/ecma/operations/ecma-proxy-object.h86
-rw-r--r--jerry-core/ecma/operations/ecma-reference.c9
-rw-r--r--jerry-core/ecma/operations/ecma-reference.h1
-rw-r--r--jerry-core/ecma/operations/ecma-regexp-object.c177
-rw-r--r--jerry-core/ecma/operations/ecma-regexp-object.h88
-rw-r--r--jerry-core/ecma/operations/ecma-shared-arraybuffer-object.c6
-rw-r--r--jerry-core/ecma/operations/ecma-shared-arraybuffer-object.h12
-rw-r--r--jerry-core/ecma/operations/ecma-string-object.c16
-rw-r--r--jerry-core/ecma/operations/ecma-string-object.h11
-rw-r--r--jerry-core/ecma/operations/ecma-symbol-object.c11
-rw-r--r--jerry-core/ecma/operations/ecma-symbol-object.h21
-rw-r--r--jerry-core/ecma/operations/ecma-typedarray-object.c236
-rw-r--r--jerry-core/ecma/operations/ecma-typedarray-object.h29
-rw-r--r--jerry-core/include/jerryscript-compiler.h44
-rw-r--r--jerry-core/include/jerryscript-core.h112
-rw-r--r--jerry-core/include/jerryscript-debugger-transport.h23
-rw-r--r--jerry-core/include/jerryscript-debugger.h16
-rw-r--r--jerry-core/include/jerryscript-port.h23
-rw-r--r--jerry-core/include/jerryscript-snapshot.h37
-rw-r--r--jerry-core/include/jerryscript-types.h257
-rw-r--r--jerry-core/jcontext/jcontext.h58
-rw-r--r--jerry-core/jmem/jmem-allocator-internal.h34
-rw-r--r--jerry-core/jmem/jmem-allocator.c7
-rw-r--r--jerry-core/jmem/jmem-heap.c29
-rw-r--r--jerry-core/jmem/jmem-poolman.c6
-rw-r--r--jerry-core/jmem/jmem.h93
-rw-r--r--jerry-core/jrt/jrt-bit-fields.h3
-rw-r--r--jerry-core/jrt/jrt-fatals.c13
-rw-r--r--jerry-core/jrt/jrt.h140
-rw-r--r--jerry-core/lit/lit-char-helpers.c198
-rw-r--r--jerry-core/lit/lit-char-helpers.h76
-rw-r--r--jerry-core/lit/lit-magic-strings.c49
-rw-r--r--jerry-core/lit/lit-magic-strings.h17
-rw-r--r--jerry-core/lit/lit-magic-strings.inc.h940
-rw-r--r--jerry-core/lit/lit-strings.c45
-rw-r--r--jerry-core/lit/lit-strings.h63
-rw-r--r--jerry-core/lit/lit-unicode-conversions-sup.inc.h13
-rw-r--r--jerry-core/lit/lit-unicode-conversions.inc.h169
-rw-r--r--jerry-core/lit/lit-unicode-folding.inc.h37
-rw-r--r--jerry-core/lit/lit-unicode-ranges-sup.inc.h151
-rw-r--r--jerry-core/lit/lit-unicode-ranges.inc.h282
-rw-r--r--jerry-core/parser/js/byte-code.c35
-rw-r--r--jerry-core/parser/js/byte-code.h1283
-rw-r--r--jerry-core/parser/js/common.c38
-rw-r--r--jerry-core/parser/js/common.h77
-rw-r--r--jerry-core/parser/js/js-lexer.c572
-rw-r--r--jerry-core/parser/js/js-lexer.h337
-rw-r--r--jerry-core/parser/js/js-parser-expr.c293
-rw-r--r--jerry-core/parser/js/js-parser-internal.h451
-rw-r--r--jerry-core/parser/js/js-parser-line-info-create.c19
-rw-r--r--jerry-core/parser/js/js-parser-mem.c67
-rw-r--r--jerry-core/parser/js/js-parser-module.c51
-rw-r--r--jerry-core/parser/js/js-parser-statm.c275
-rw-r--r--jerry-core/parser/js/js-parser-tagged-template-literal.c30
-rw-r--r--jerry-core/parser/js/js-parser-tagged-template-literal.h16
-rw-r--r--jerry-core/parser/js/js-parser-util.c52
-rw-r--r--jerry-core/parser/js/js-parser.c212
-rw-r--r--jerry-core/parser/js/js-parser.h287
-rw-r--r--jerry-core/parser/js/js-scanner-internal.h176
-rw-r--r--jerry-core/parser/js/js-scanner-ops.c36
-rw-r--r--jerry-core/parser/js/js-scanner-util.c200
-rw-r--r--jerry-core/parser/js/js-scanner.c228
-rw-r--r--jerry-core/parser/js/js-scanner.h7
-rw-r--r--jerry-core/parser/regexp/re-bytecode.c8
-rw-r--r--jerry-core/parser/regexp/re-bytecode.h73
-rw-r--r--jerry-core/parser/regexp/re-compiler-context.h22
-rw-r--r--jerry-core/parser/regexp/re-compiler.c13
-rw-r--r--jerry-core/parser/regexp/re-compiler.h8
-rw-r--r--jerry-core/parser/regexp/re-parser.c80
-rw-r--r--jerry-core/parser/regexp/re-parser.h4
-rw-r--r--jerry-core/parser/regexp/re-token.h42
-rw-r--r--jerry-core/vm/opcodes-ecma-arithmetics.c9
-rw-r--r--jerry-core/vm/opcodes-ecma-bitwise.c4
-rw-r--r--jerry-core/vm/opcodes-ecma-relational-equality.c24
-rw-r--r--jerry-core/vm/opcodes.c75
-rw-r--r--jerry-core/vm/opcodes.h102
-rw-r--r--jerry-core/vm/vm-defines.h70
-rw-r--r--jerry-core/vm/vm-stack.c38
-rw-r--r--jerry-core/vm/vm-stack.h59
-rw-r--r--jerry-core/vm/vm-utils.c5
-rw-r--r--jerry-core/vm/vm.c530
-rw-r--r--jerry-core/vm/vm.h529
-rw-r--r--jerry-ext/arg/arg-js-iterator-helper.c6
-rw-r--r--jerry-ext/arg/arg-transform-functions.c104
-rw-r--r--jerry-ext/arg/arg.c18
-rw-r--r--jerry-ext/common/jext-common.h58
-rw-r--r--jerry-ext/debugger/debugger-common.c2
-rw-r--r--jerry-ext/debugger/debugger-rp.c2
-rw-r--r--jerry-ext/debugger/debugger-serial.c12
-rw-r--r--jerry-ext/debugger/debugger-sha1.c46
-rw-r--r--jerry-ext/debugger/debugger-sha1.h8
-rw-r--r--jerry-ext/debugger/debugger-tcp.c33
-rw-r--r--jerry-ext/debugger/debugger-ws.c26
-rw-r--r--jerry-ext/handle-scope/handle-scope-allocator.c22
-rw-r--r--jerry-ext/handle-scope/handle-scope-internal.h43
-rw-r--r--jerry-ext/handle-scope/handle-scope.c36
-rw-r--r--jerry-ext/handler/handler-assert.c16
-rw-r--r--jerry-ext/handler/handler-gc.c4
-rw-r--r--jerry-ext/handler/handler-print.c16
-rw-r--r--jerry-ext/handler/handler-register.c2
-rw-r--r--jerry-ext/include/jerryscript-ext/arg.h55
-rw-r--r--jerry-ext/include/jerryscript-ext/arg.impl.h157
-rw-r--r--jerry-ext/include/jerryscript-ext/autorelease.h10
-rw-r--r--jerry-ext/include/jerryscript-ext/autorelease.impl.h2
-rw-r--r--jerry-ext/include/jerryscript-ext/debugger.h12
-rw-r--r--jerry-ext/include/jerryscript-ext/handle-scope.h46
-rw-r--r--jerry-ext/include/jerryscript-ext/handler.h98
-rw-r--r--jerry-ext/include/jerryscript-ext/module.h68
-rw-r--r--jerry-ext/module/module.c43
-rw-r--r--jerry-main/benchmarking.c7
-rw-r--r--jerry-main/cli.c20
-rw-r--r--jerry-main/cli.h9
-rw-r--r--jerry-main/libfuzzer.c3
-rw-r--r--jerry-main/main-jerry-snapshot.c97
-rw-r--r--jerry-main/main-jerry-test.c45
-rw-r--r--jerry-main/main-jerry.c38
-rw-r--r--jerry-main/main-options.c87
-rw-r--r--jerry-main/main-options.h15
-rw-r--r--jerry-main/main-utils.c28
-rw-r--r--jerry-main/main-utils.h22
-rw-r--r--jerry-math/acos.c20
-rw-r--r--jerry-math/asin.c30
-rw-r--r--jerry-math/asinh.c4
-rw-r--r--jerry-math/atan.c18
-rw-r--r--jerry-math/atanh.c4
-rw-r--r--jerry-math/cbrt.c10
-rw-r--r--jerry-math/cosh.c5
-rw-r--r--jerry-math/exp.c25
-rw-r--r--jerry-math/expm1.c24
-rw-r--r--jerry-math/fmod.c5
-rw-r--r--jerry-math/include/math.h31
-rw-r--r--jerry-math/jerry-math-internal.h24
-rw-r--r--jerry-math/log10.c8
-rw-r--r--jerry-math/log1p.c25
-rw-r--r--jerry-math/log2.c20
-rw-r--r--jerry-math/nextafter.c5
-rw-r--r--jerry-math/pow.c55
-rw-r--r--jerry-math/sinh.c4
-rw-r--r--jerry-math/tanh.c4
-rw-r--r--jerry-math/trig.c103
-rw-r--r--jerry-port/default/default-date.c27
-rw-r--r--jerry-port/default/default-debugger.c9
-rw-r--r--jerry-port/default/default-external-context.c2
-rw-r--r--jerry-port/default/default-fatal.c8
-rw-r--r--jerry-port/default/default-io.c12
-rw-r--r--jerry-port/default/default-module.c38
-rw-r--r--jerry-port/default/include/jerryscript-port-default.h12
-rw-r--r--targets/esp8266/include/jerry_extapi.h13
-rw-r--r--targets/esp8266/include/jerry_run.h12
-rw-r--r--targets/esp8266/include/user_config.h2
-rw-r--r--targets/mbedos5/jerryscript-mbed/jerryscript-mbed-util/logging.h4
-rw-r--r--targets/nuttx-stm32f4/jerry_main.c4
-rw-r--r--tests/unit-core/test-abort.c76
-rw-r--r--tests/unit-core/test-api-binary-operations-arithmetics.c28
-rw-r--r--tests/unit-core/test-api-binary-operations-comparisons.c85
-rw-r--r--tests/unit-core/test-api-binary-operations-instanceof.c18
-rw-r--r--tests/unit-core/test-api-errortype.c26
-rw-r--r--tests/unit-core/test-api-functiontype.c18
-rw-r--r--tests/unit-core/test-api-iteratortype.c18
-rw-r--r--tests/unit-core/test-api-object-property-names.c48
-rw-r--r--tests/unit-core/test-api-objecttype.c20
-rw-r--r--tests/unit-core/test-api-promise.c9
-rw-r--r--tests/unit-core/test-api-set-and-clear-error-flag.c1
-rw-r--r--tests/unit-core/test-api-strings.c29
-rw-r--r--tests/unit-core/test-api-value-type.c17
-rw-r--r--tests/unit-core/test-api.c240
-rw-r--r--tests/unit-core/test-arraybuffer.c71
-rw-r--r--tests/unit-core/test-backtrace.c22
-rw-r--r--tests/unit-core/test-bigint.c1
-rw-r--r--tests/unit-core/test-common.h79
-rw-r--r--tests/unit-core/test-container-operation.c15
-rw-r--r--tests/unit-core/test-container.c34
-rw-r--r--tests/unit-core/test-context-data.c37
-rw-r--r--tests/unit-core/test-dataview.c14
-rw-r--r--tests/unit-core/test-date-helpers.c16
-rw-r--r--tests/unit-core/test-error-callback.c4
-rw-r--r--tests/unit-core/test-from-property-descriptor.c3
-rw-r--r--tests/unit-core/test-get-own-property.c2
-rw-r--r--tests/unit-core/test-has-property.c3
-rw-r--r--tests/unit-core/test-internal-properties.c14
-rw-r--r--tests/unit-core/test-is-eval-code.c2
-rw-r--r--tests/unit-core/test-jmem.c2
-rw-r--r--tests/unit-core/test-json.c2
-rw-r--r--tests/unit-core/test-lit-char-helpers.c9
-rw-r--r--tests/unit-core/test-literal-storage.c1
-rw-r--r--tests/unit-core/test-mem-stats.c16
-rw-r--r--tests/unit-core/test-module-dynamic.c9
-rw-r--r--tests/unit-core/test-module-import-meta.c12
-rw-r--r--tests/unit-core/test-module.c42
-rw-r--r--tests/unit-core/test-native-callback-nested.c17
-rw-r--r--tests/unit-core/test-native-instanceof.c13
-rw-r--r--tests/unit-core/test-native-pointer.c23
-rw-r--r--tests/unit-core/test-newtarget.c29
-rw-r--r--tests/unit-core/test-number-converter.c6
-rw-r--r--tests/unit-core/test-number-to-int32.c14
-rw-r--r--tests/unit-core/test-number-to-string.c40
-rw-r--r--tests/unit-core/test-objects-foreach.c22
-rw-r--r--tests/unit-core/test-poolman.c5
-rw-r--r--tests/unit-core/test-promise-callback.c17
-rw-r--r--tests/unit-core/test-promise.c34
-rw-r--r--tests/unit-core/test-proxy.c17
-rw-r--r--tests/unit-core/test-realm.c4
-rw-r--r--tests/unit-core/test-regexp-dotall-unicode.c2
-rw-r--r--tests/unit-core/test-regression-3588.c30
-rw-r--r--tests/unit-core/test-resource-name.c32
-rw-r--r--tests/unit-core/test-script-user-value.c18
-rw-r--r--tests/unit-core/test-snapshot.c186
-rw-r--r--tests/unit-core/test-source-info.c18
-rw-r--r--tests/unit-core/test-string-to-number.c65
-rw-r--r--tests/unit-core/test-stringbuilder.c8
-rw-r--r--tests/unit-core/test-strings.c54
-rw-r--r--tests/unit-core/test-symbol.c78
-rw-r--r--tests/unit-core/test-to-integer.c17
-rw-r--r--tests/unit-core/test-to-length.c9
-rw-r--r--tests/unit-core/test-to-property-descriptor.c3
-rw-r--r--tests/unit-core/test-typedarray.c162
-rw-r--r--tests/unit-core/test-unicode.c5
-rw-r--r--tests/unit-core/test-vm-exec-stop.c16
-rw-r--r--tests/unit-core/test-vm-throw.c14
-rw-r--r--tests/unit-ext/module/jerry-module-test.c120
-rw-r--r--tests/unit-ext/module/my-broken-module.c1
-rw-r--r--tests/unit-ext/module/my-custom-module.c1
-rw-r--r--tests/unit-ext/test-common.h24
-rw-r--r--tests/unit-ext/test-ext-arg.c279
-rw-r--r--tests/unit-ext/test-ext-autorelease.c4
-rw-r--r--tests/unit-ext/test-ext-handle-scope-escape.c4
-rw-r--r--tests/unit-ext/test-ext-handle-scope-handle-prelist-escape.c8
-rw-r--r--tests/unit-ext/test-ext-handle-scope-handle-prelist.c8
-rw-r--r--tests/unit-ext/test-ext-handle-scope-nested.c4
-rw-r--r--tests/unit-ext/test-ext-handle-scope-remove.c4
-rw-r--r--tests/unit-ext/test-ext-handle-scope-root.c4
-rw-r--r--tests/unit-ext/test-ext-handle-scope.c4
-rw-r--r--tests/unit-ext/test-ext-method-register.c34
-rw-r--r--tests/unit-ext/test-ext-module-canonical.c12
-rw-r--r--tests/unit-ext/test-ext-module-empty.c3
-rw-r--r--tests/unit-math/test-math.c9
-rwxr-xr-xtools/amalgam.py2
-rwxr-xr-xtools/apt-get-install-deps.sh2
-rwxr-xr-xtools/brew-install-deps.sh2
-rwxr-xr-xtools/check-format.py137
-rwxr-xr-xtools/check-vera.sh31
-rwxr-xr-xtools/gen-magic-strings.py16
-rwxr-xr-xtools/run-tests.py6
-rwxr-xr-xtools/settings.py2
-rw-r--r--tools/vera++/profiles/jerry19
-rw-r--r--tools/vera++/scripts/rules/jerry_always_curly.tcl87
-rw-r--r--tools/vera++/scripts/rules/jerry_braces_on_separate_line.tcl115
-rw-r--r--tools/vera++/scripts/rules/jerry_braces_same_line_or_column.tcl61
-rw-r--r--tools/vera++/scripts/rules/jerry_comment_function_end.tcl52
-rw-r--r--tools/vera++/scripts/rules/jerry_funcname_space_parentheses.tcl60
-rw-r--r--tools/vera++/scripts/rules/jerry_identifier_no_space_bracket.tcl56
-rw-r--r--tools/vera++/scripts/rules/jerry_indentation.tcl126
-rw-r--r--tools/vera++/scripts/rules/jerry_max_line_length.tcl27
-rw-r--r--tools/vera++/scripts/rules/jerry_no_consecutive_empty_lines.tcl36
-rw-r--r--tools/vera++/scripts/rules/jerry_no_leading_or_trailing_empty_line.tcl30
-rw-r--r--tools/vera++/scripts/rules/jerry_no_space_after_opening_parentheses.tcl56
-rw-r--r--tools/vera++/scripts/rules/jerry_no_space_before_closing_parentheses.tcl56
-rw-r--r--tools/vera++/scripts/rules/jerry_no_tabs.tcl25
-rw-r--r--tools/vera++/scripts/rules/jerry_no_trailing_spaces.tcl25
-rw-r--r--tools/vera++/scripts/rules/jerry_pointer_declarator_space.tcl58
-rw-r--r--tools/vera++/scripts/rules/jerry_switch_case.tcl282
-rw-r--r--tools/vera++/scripts/rules/jerry_typecast_space_parentheses.tcl56
564 files changed, 10218 insertions, 15113 deletions
diff --git a/.clang-format b/.clang-format
new file mode 100644
index 00000000..dd47a730
--- /dev/null
+++ b/.clang-format
@@ -0,0 +1,87 @@
+---
+Language: Cpp
+AlignAfterOpenBracket: Align
+AlignConsecutiveMacros: true
+AlignConsecutiveAssignments: false
+AlignConsecutiveDeclarations: false
+AlignEscapedNewlines: Left
+AlignOperands: true
+AlignTrailingComments: false
+AllowAllArgumentsOnNextLine: false
+AllowAllParametersOfDeclarationOnNextLine: false
+AllowShortBlocksOnASingleLine: Never
+AllowShortCaseLabelsOnASingleLine: false
+AllowShortFunctionsOnASingleLine: None
+AllowShortIfStatementsOnASingleLine: Never
+AllowShortLoopsOnASingleLine: false
+AlwaysBreakAfterReturnType: AllDefinitions
+AlwaysBreakBeforeMultilineStrings: false
+BinPackArguments: false
+BinPackParameters: false
+BraceWrapping:
+ AfterCaseLabel: true
+ AfterControlStatement: Always
+ AfterEnum: true
+ AfterFunction: true
+ AfterStruct: true
+ AfterUnion: true
+ AfterExternBlock: false
+ BeforeElse: true
+ IndentBraces: false
+ SplitEmptyFunction: true
+BreakBeforeBinaryOperators: NonAssignment
+BreakBeforeBraces: Custom
+BreakBeforeTernaryOperators: true
+BreakStringLiterals: true
+ColumnLimit: 120
+ContinuationIndentWidth: 2
+Cpp11BracedListStyle: false
+DeriveLineEnding: true
+DerivePointerAlignment: true
+DisableFormat: false
+ExperimentalAutoDetectBinPacking: true
+IncludeBlocks: Regroup
+IncludeCategories:
+ - Regex: '<windows.h>'
+ Priority: 0
+ - Regex: '<[-.a-z]*>'
+ Priority: 1
+ - Regex: '"jerryscript[-.a-z]*"'
+ Priority: 2
+ - Regex: '"ecma[-.a-z]*"'
+ Priority: 3
+ - Regex: '.*'
+ Priority: 4
+IndentCaseLabels: true
+IndentGotoLabels: true
+IndentPPDirectives: None
+IndentWidth: 2
+IndentWrappedFunctionNames: false
+KeepEmptyLinesAtTheStartOfBlocks: false
+MacroBlockBegin: ''
+MacroBlockEnd: ''
+MaxEmptyLinesToKeep: 1
+PointerAlignment: Right
+ReflowComments: true
+SortIncludes: true
+SpaceAfterCStyleCast: true
+SpaceAfterLogicalNot: false
+SpaceBeforeAssignmentOperators: true
+SpaceBeforeParens: Always
+SpaceInEmptyBlock: false
+SpaceInEmptyParentheses: false
+SpacesBeforeTrailingComments: 1
+SpacesInConditionalStatement: false
+SpacesInCStyleCastParentheses: false
+SpacesInParentheses: false
+SpacesInSquareBrackets: false
+SpaceBeforeSquareBrackets: false
+Standard: Auto
+StatementMacros:
+ - JERRY_ASSERT
+ - JERRY_STATIC_ASSERT
+ - JERRY_UNREACHABLE
+TabWidth: 0
+UseCRLF: false
+UseTab: Never
+...
diff --git a/.github/workflows/gh-actions.yml b/.github/workflows/gh-actions.yml
index 8d79364e..f435eee2 100644
--- a/.github/workflows/gh-actions.yml
+++ b/.github/workflows/gh-actions.yml
@@ -12,13 +12,16 @@ jobs:
- uses: actions/checkout@v2
with:
fetch-depth: 0
+ - uses: actions/setup-python@v2
+ with:
+ python-version: '3.8'
- run: sudo apt update
- - run: sudo apt install doxygen vera++ cppcheck pylint python-serial
+ - run: sudo apt install doxygen clang-format-10 cppcheck pylint python-serial
- run: $RUNNER --check-signed-off=gh-actions
if: ${{ always() }}
- run: $RUNNER --check-doxygen
if: ${{ always() }}
- - run: $RUNNER --check-vera
+ - run: $RUNNER --check-format
if: ${{ always() }}
- run: $RUNNER --check-license
if: ${{ always() }}
@@ -145,7 +148,7 @@ jobs:
- run: sudo apt update
- run: sudo apt install gcc-multilib
- run: $RUNNER -q --unittests
- # clang has bug in supporting lto
+ # clang has bug in supporting lto
- run: $RUNNER -q --buildoption-test --buildoptions=--lto=off
ASAN_Tests:
diff --git a/docs/00.GETTING-STARTED.md b/docs/00.GETTING-STARTED.md
index f34ff7eb..f8c01cc7 100644
--- a/docs/00.GETTING-STARTED.md
+++ b/docs/00.GETTING-STARTED.md
@@ -11,11 +11,11 @@ Several scripts and tools help the building and development process, thus it is
- `bash` >= `4.3.11`
- `cppcheck` >= `1.61`
-- `vera++` >= `1.2.1`
+- `clang-format-10` >= `10.0.0`
- `python` >= `2.7.6`
```bash
-sudo apt-get install gcc gcc-arm-none-eabi cmake cppcheck vera++ python
+sudo apt-get install gcc gcc-arm-none-eabi cmake cppcheck clang-format-10 python
```
To make our scripts run correctly, several shell utilities should be available on the system:
@@ -173,10 +173,10 @@ python tools/run-tests.py --check-signed-off
python tools/run-tests.py --check-cppcheck
```
-**To run vera check**
+**To run format check**
```bash
-python tools/run-tests.py --check-vera
+python tools/run-tests.py --check-format
```
**To get a list of all the available test options**
diff --git a/docs/08.CODING-STANDARDS.md b/docs/08.CODING-STANDARDS.md
index df92e692..1cc495d9 100644
--- a/docs/08.CODING-STANDARDS.md
+++ b/docs/08.CODING-STANDARDS.md
@@ -12,7 +12,7 @@ review.
* Tab characters are not allowed.
* Maximum line length is 120 characters (excluding newline).
* No trailing white space is allowed.
-* Run `tools/run-tests.py --check-vera` to check several
+* Run `tools/run-tests.py --check-format` to check several
of the coding conventions automatically.
## Comments
diff --git a/jerry-core/CMakeLists.txt b/jerry-core/CMakeLists.txt
index 3c54a7e5..e8d6a8bf 100644
--- a/jerry-core/CMakeLists.txt
+++ b/jerry-core/CMakeLists.txt
@@ -132,7 +132,7 @@ set(SOURCE_CORE_FILES
api/jerry-debugger-transport.c
api/jerry-debugger.c
api/jerry-snapshot.c
- api/jerry.c
+ api/jerryscript.c
debugger/debugger.c
ecma/base/ecma-alloc.c
ecma/base/ecma-gc.c
diff --git a/jerry-core/api/jerry-debugger-transport.c b/jerry-core/api/jerry-debugger-transport.c
index f3afd888..0d2ec6c9 100644
--- a/jerry-core/api/jerry-debugger-transport.c
+++ b/jerry-core/api/jerry-debugger-transport.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
+#include "jerryscript.h"
+
#include "debugger.h"
#include "jcontext.h"
-#include "jerryscript.h"
#if JERRY_DEBUGGER
@@ -137,8 +138,7 @@ jerry_debugger_transport_close (void)
current_p->close (current_p);
current_p = next_p;
- }
- while (current_p != NULL);
+ } while (current_p != NULL);
jerry_port_log (JERRY_LOG_LEVEL_DEBUG, "Debugger client connection closed.\n");
@@ -164,8 +164,7 @@ jerry_debugger_transport_send (const uint8_t *message_p, /**< message to be sent
do
{
- size_t fragment_length = (message_length <= max_send_size ? message_length
- : max_send_size);
+ size_t fragment_length = (message_length <= max_send_size ? message_length : max_send_size);
memcpy (payload_p, message_p, fragment_length);
@@ -176,8 +175,7 @@ jerry_debugger_transport_send (const uint8_t *message_p, /**< message to be sent
message_p += fragment_length;
message_length -= fragment_length;
- }
- while (message_length > 0);
+ } while (message_length > 0);
return true;
} /* jerry_debugger_transport_send */
diff --git a/jerry-core/api/jerry-debugger.c b/jerry-core/api/jerry-debugger.c
index 12afd041..1ced5029 100644
--- a/jerry-core/api/jerry-debugger.c
+++ b/jerry-core/api/jerry-debugger.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
+#include "jerryscript.h"
+
#include "debugger.h"
#include "jcontext.h"
-#include "jerryscript.h"
/**
* Checks whether the debugger is connected.
diff --git a/jerry-core/api/jerry-snapshot.c b/jerry-core/api/jerry-snapshot.c
index e166ab58..04c33f45 100644
--- a/jerry-core/api/jerry-snapshot.c
+++ b/jerry-core/api/jerry-snapshot.c
@@ -13,6 +13,10 @@
* limitations under the License.
*/
+#include "jerry-snapshot.h"
+
+#include "jerryscript.h"
+
#include "ecma-conversion.h"
#include "ecma-errors.h"
#include "ecma-exceptions.h"
@@ -20,12 +24,11 @@
#include "ecma-helpers.h"
#include "ecma-lex-env.h"
#include "ecma-literal-storage.h"
+
#include "jcontext.h"
-#include "jerryscript.h"
-#include "jerry-snapshot.h"
+#include "js-parser-internal.h"
#include "js-parser.h"
#include "lit-char-helpers.h"
-#include "js-parser-internal.h"
#include "re-compiler.h"
#if JERRY_SNAPSHOT_SAVE || JERRY_SNAPSHOT_EXEC
@@ -103,8 +106,8 @@ typedef struct
static inline bool JERRY_ATTR_ALWAYS_INLINE
snapshot_write_to_buffer_by_offset (uint8_t *buffer_p, /**< buffer */
size_t buffer_size, /**< size of buffer */
- size_t *in_out_buffer_offset_p, /**< [in,out] offset to write to
- * incremented with data_size */
+ size_t *in_out_buffer_offset_p, /**< [in,out] offset to write to
+ * incremented with data_size */
const void *data_p, /**< data */
size_t data_size) /**< size of the writable data */
{
@@ -150,8 +153,8 @@ snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, /**< co
if (globals_p->snapshot_buffer_write_offset > JERRY_SNAPSHOT_MAXIMUM_WRITE_OFFSET)
{
- globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
- (const jerry_char_t *) ecma_error_maximum_snapshot_size);
+ globals_p->snapshot_error =
+ jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) ecma_error_maximum_snapshot_size);
return 0;
}
@@ -165,8 +168,8 @@ snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, /**< co
#if JERRY_ESNEXT
if (compiled_code_p->status_flags & CBC_CODE_FLAGS_HAS_TAGGED_LITERALS)
{
- globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
- (const jerry_char_t *) ecma_error_tagged_template_literals);
+ globals_p->snapshot_error =
+ jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) ecma_error_tagged_template_literals);
return 0;
}
@@ -182,8 +185,8 @@ snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, /**< co
/* Regular expression. */
if (globals_p->snapshot_buffer_write_offset + sizeof (ecma_compiled_code_t) > snapshot_buffer_size)
{
- globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
- (const jerry_char_t *) error_buffer_too_small_p);
+ globals_p->snapshot_error =
+ jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_buffer_too_small_p);
return 0;
}
@@ -204,8 +207,8 @@ snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, /**< co
buffer_p,
buffer_size))
{
- globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
- (const jerry_char_t *) error_buffer_too_small_p);
+ globals_p->snapshot_error =
+ jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_buffer_too_small_p);
/* cannot return inside ECMA_FINALIZE_UTF8_STRING */
}
@@ -217,8 +220,7 @@ snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, /**< co
}
globals_p->regex_found = true;
- globals_p->snapshot_buffer_write_offset = JERRY_ALIGNUP (globals_p->snapshot_buffer_write_offset,
- JMEM_ALIGNMENT);
+ globals_p->snapshot_buffer_write_offset = JERRY_ALIGNUP (globals_p->snapshot_buffer_write_offset, JMEM_ALIGNMENT);
/* Regexp character size is stored in refs. */
copied_code_p->refs = (uint16_t) pattern_size;
@@ -274,8 +276,7 @@ snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, /**< co
for (uint32_t i = const_literal_end; i < literal_end; i++)
{
- ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- literal_start_p[i]);
+ ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_start_p[i]);
if (bytecode_p == compiled_code_p)
{
@@ -283,10 +284,7 @@ snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, /**< co
}
else
{
- uint32_t offset = snapshot_add_compiled_code (bytecode_p,
- snapshot_buffer_p,
- snapshot_buffer_size,
- globals_p);
+ uint32_t offset = snapshot_add_compiled_code (bytecode_p, snapshot_buffer_p, snapshot_buffer_size, globals_p);
JERRY_ASSERT (!ecma_is_value_empty (globals_p->snapshot_error) || offset > start_offset);
@@ -316,8 +314,7 @@ static_snapshot_error_unsupported_literal (snapshot_globals_t *globals_p, /**< s
ecma_deref_ecma_string (literal_string_p);
- ecma_object_t *error_object_p = ecma_new_standard_error (JERRY_ERROR_RANGE,
- ecma_stringbuilder_finalize (&builder));
+ ecma_object_t *error_object_p = ecma_new_standard_error (JERRY_ERROR_RANGE, ecma_stringbuilder_finalize (&builder));
globals_p->snapshot_error = ecma_create_error_object_reference (error_object_p);
} /* static_snapshot_error_unsupported_literal */
@@ -342,8 +339,8 @@ static_snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p,
if (globals_p->snapshot_buffer_write_offset >= JERRY_SNAPSHOT_MAXIMUM_WRITE_OFFSET)
{
- globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
- (const jerry_char_t *) ecma_error_maximum_snapshot_size);
+ globals_p->snapshot_error =
+ jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) ecma_error_maximum_snapshot_size);
return 0;
}
@@ -357,8 +354,8 @@ static_snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p,
if (!CBC_IS_FUNCTION (compiled_code_p->status_flags))
{
/* Regular expression literals are not supported. */
- globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
- (const jerry_char_t *) ecma_error_regular_expression_not_supported);
+ globals_p->snapshot_error =
+ jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) ecma_error_regular_expression_not_supported);
return 0;
}
@@ -368,8 +365,8 @@ static_snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p,
compiled_code_p,
((size_t) compiled_code_p->size) << JMEM_ALIGNMENT_LOG))
{
- globals_p->snapshot_error = jerry_create_error (JERRY_ERROR_RANGE,
- (const jerry_char_t *) ecma_error_snapshot_buffer_small);
+ globals_p->snapshot_error =
+ jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) ecma_error_snapshot_buffer_small);
return 0;
}
@@ -404,8 +401,7 @@ static_snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p,
for (uint32_t i = 0; i < const_literal_end; i++)
{
- if (!ecma_is_value_direct (literal_start_p[i])
- && !ecma_is_value_direct_string (literal_start_p[i]))
+ if (!ecma_is_value_direct (literal_start_p[i]) && !ecma_is_value_direct_string (literal_start_p[i]))
{
static_snapshot_error_unsupported_literal (globals_p, literal_start_p[i]);
return 0;
@@ -414,8 +410,7 @@ static_snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p,
for (uint32_t i = const_literal_end; i < literal_end; i++)
{
- ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- literal_start_p[i]);
+ ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_start_p[i]);
if (bytecode_p == compiled_code_p)
{
@@ -423,10 +418,8 @@ static_snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p,
}
else
{
- uint32_t offset = static_snapshot_add_compiled_code (bytecode_p,
- snapshot_buffer_p,
- snapshot_buffer_size,
- globals_p);
+ uint32_t offset =
+ static_snapshot_add_compiled_code (bytecode_p, snapshot_buffer_p, snapshot_buffer_size, globals_p);
JERRY_ASSERT (!ecma_is_value_empty (globals_p->snapshot_error) || offset > start_offset);
@@ -439,8 +432,7 @@ static_snapshot_add_compiled_code (const ecma_compiled_code_t *compiled_code_p,
while (literal_start_p < (ecma_value_t *) buffer_p)
{
- if (!ecma_is_value_direct_string (*literal_start_p)
- && !ecma_is_value_empty (*literal_start_p))
+ if (!ecma_is_value_direct_string (*literal_start_p) && !ecma_is_value_empty (*literal_start_p))
{
static_snapshot_error_unsupported_literal (globals_p, *literal_start_p);
return 0;
@@ -535,8 +527,7 @@ jerry_snapshot_set_offsets (uint32_t *buffer_p, /**< buffer */
JERRY_ASSERT ((code_size % sizeof (uint32_t)) == 0);
buffer_p += code_size / sizeof (uint32_t);
size -= code_size;
- }
- while (size > 0);
+ } while (size > 0);
} /* jerry_snapshot_set_offsets */
#endif /* JERRY_SNAPSHOT_SAVE */
@@ -571,11 +562,9 @@ snapshot_load_compiled_code (const uint8_t *base_addr_p, /**< base address of th
const uint8_t *regex_start_p = ((const uint8_t *) bytecode_p) + sizeof (ecma_compiled_code_t);
/* Real size is stored in refs. */
- ecma_string_t *pattern_str_p = ecma_new_ecma_string_from_utf8 (regex_start_p,
- bytecode_p->refs);
+ ecma_string_t *pattern_str_p = ecma_new_ecma_string_from_utf8 (regex_start_p, bytecode_p->refs);
- const re_compiled_code_t *re_bytecode_p = re_compile_bytecode (pattern_str_p,
- bytecode_p->status_flags);
+ const re_compiled_code_t *re_bytecode_p = re_compile_bytecode (pattern_str_p, bytecode_p->status_flags);
ecma_deref_ecma_string (pattern_str_p);
return (ecma_compiled_code_t *) re_bytecode_p;
@@ -622,8 +611,7 @@ snapshot_load_compiled_code (const uint8_t *base_addr_p, /**< base address of th
ECMA_SET_INTERNAL_VALUE_POINTER (args_p->script_value, script_p);
}
- if (copy_bytecode
- || (header_size + (literal_end * sizeof (uint16_t)) + BYTECODE_NO_COPY_THRESHOLD > code_size))
+ if (copy_bytecode || (header_size + (literal_end * sizeof (uint16_t)) + BYTECODE_NO_COPY_THRESHOLD > code_size))
{
bytecode_p = (ecma_compiled_code_t *) jmem_heap_alloc_block (code_size);
@@ -716,19 +704,15 @@ snapshot_load_compiled_code (const uint8_t *base_addr_p, /**< base address of th
if (literal_offset == 0)
{
/* Self reference */
- ECMA_SET_INTERNAL_VALUE_POINTER (literal_start_p[i],
- bytecode_p);
+ ECMA_SET_INTERNAL_VALUE_POINTER (literal_start_p[i], bytecode_p);
}
else
{
ecma_compiled_code_t *literal_bytecode_p;
- literal_bytecode_p = snapshot_load_compiled_code (base_addr_p + literal_offset,
- literal_base_p,
- script_p,
- copy_bytecode);
+ literal_bytecode_p =
+ snapshot_load_compiled_code (base_addr_p + literal_offset, literal_base_p, script_p, copy_bytecode);
- ECMA_SET_INTERNAL_VALUE_POINTER (literal_start_p[i],
- literal_bytecode_p);
+ ECMA_SET_INTERNAL_VALUE_POINTER (literal_start_p[i], literal_bytecode_p);
}
}
@@ -805,8 +789,7 @@ jerry_generate_snapshot (jerry_value_t compiled_code, /**< parsed script or func
}
snapshot_globals_t globals;
- const uint32_t aligned_header_size = JERRY_ALIGNUP (sizeof (jerry_snapshot_header_t),
- JMEM_ALIGNMENT);
+ const uint32_t aligned_header_size = JERRY_ALIGNUP (sizeof (jerry_snapshot_header_t), JMEM_ALIGNMENT);
globals.snapshot_buffer_write_offset = aligned_header_size;
globals.snapshot_error = ECMA_VALUE_EMPTY;
@@ -862,11 +845,7 @@ jerry_generate_snapshot (jerry_value_t compiled_code, /**< parsed script or func
size_t header_offset = 0;
- snapshot_write_to_buffer_by_offset ((uint8_t *) buffer_p,
- buffer_size,
- &header_offset,
- &header,
- sizeof (header));
+ snapshot_write_to_buffer_by_offset ((uint8_t *) buffer_p, buffer_size, &header_offset, &header, sizeof (header));
if (lit_map_p != NULL)
{
@@ -904,11 +883,9 @@ jerry_exec_snapshot (const uint32_t *snapshot_p, /**< snapshot */
#if JERRY_SNAPSHOT_EXEC
JERRY_ASSERT (snapshot_p != NULL);
- uint32_t allowed_opts = (JERRY_SNAPSHOT_EXEC_COPY_DATA
- | JERRY_SNAPSHOT_EXEC_ALLOW_STATIC
- | JERRY_SNAPSHOT_EXEC_LOAD_AS_FUNCTION
- | JERRY_SNAPSHOT_EXEC_HAS_RESOURCE
- | JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE);
+ uint32_t allowed_opts =
+ (JERRY_SNAPSHOT_EXEC_COPY_DATA | JERRY_SNAPSHOT_EXEC_ALLOW_STATIC | JERRY_SNAPSHOT_EXEC_LOAD_AS_FUNCTION
+ | JERRY_SNAPSHOT_EXEC_HAS_RESOURCE | JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE);
if ((exec_snapshot_opts & ~(allowed_opts)) != 0)
{
@@ -916,8 +893,8 @@ jerry_exec_snapshot (const uint32_t *snapshot_p, /**< snapshot */
return ecma_create_error_reference_from_context ();
}
- const char * const invalid_version_error_p = "Invalid snapshot version or unsupported features present";
- const char * const invalid_format_error_p = "Invalid snapshot format";
+ const char *const invalid_version_error_p = "Invalid snapshot version or unsupported features present";
+ const char *const invalid_format_error_p = "Invalid snapshot format";
const uint8_t *snapshot_data_p = (uint8_t *) snapshot_p;
if (snapshot_size <= sizeof (jerry_snapshot_header_t))
@@ -928,8 +905,7 @@ jerry_exec_snapshot (const uint32_t *snapshot_p, /**< snapshot */
const jerry_snapshot_header_t *header_p = (const jerry_snapshot_header_t *) snapshot_data_p;
- if (header_p->magic != JERRY_SNAPSHOT_MAGIC
- || header_p->version != JERRY_SNAPSHOT_VERSION
+ if (header_p->magic != JERRY_SNAPSHOT_MAGIC || header_p->version != JERRY_SNAPSHOT_VERSION
|| !snapshot_check_global_flags (header_p->global_flags))
{
ecma_raise_type_error (invalid_version_error_p);
@@ -971,8 +947,7 @@ jerry_exec_snapshot (const uint32_t *snapshot_p, /**< snapshot */
{
ecma_value_t user_value = ECMA_VALUE_EMPTY;
- if ((exec_snapshot_opts & JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE)
- && option_values_p != NULL)
+ if ((exec_snapshot_opts & JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE) && option_values_p != NULL)
{
user_value = option_values_p->user_value;
}
@@ -995,8 +970,7 @@ jerry_exec_snapshot (const uint32_t *snapshot_p, /**< snapshot */
#if JERRY_RESOURCE_NAME
ecma_value_t resource_name = ecma_make_magic_string_value (LIT_MAGIC_STRING_RESOURCE_ANON);
- if ((exec_snapshot_opts & JERRY_SNAPSHOT_EXEC_HAS_RESOURCE)
- && option_values_p != NULL
+ if ((exec_snapshot_opts & JERRY_SNAPSHOT_EXEC_HAS_RESOURCE) && option_values_p != NULL
&& ecma_is_value_string (option_values_p->resource_name) > 0)
{
ecma_ref_ecma_string (ecma_get_string_from_value (option_values_p->resource_name));
@@ -1113,8 +1087,7 @@ scan_snapshot_functions (const uint8_t *buffer_p, /**< snapshot buffer start */
const ecma_compiled_code_t *bytecode_p = (ecma_compiled_code_t *) buffer_p;
uint32_t code_size = ((uint32_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG;
- if (CBC_IS_FUNCTION (bytecode_p->status_flags)
- && !(bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
+ if (CBC_IS_FUNCTION (bytecode_p->status_flags) && !(bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
{
const ecma_value_t *literal_start_p;
uint32_t const_literal_end;
@@ -1159,8 +1132,7 @@ scan_snapshot_functions (const uint8_t *buffer_p, /**< snapshot buffer start */
}
buffer_p += code_size;
- }
- while (buffer_p < buffer_end_p);
+ } while (buffer_p < buffer_end_p);
} /* scan_snapshot_functions */
/**
@@ -1179,8 +1151,7 @@ update_literal_offsets (uint8_t *buffer_p, /**< [in,out] snapshot buffer start *
const ecma_compiled_code_t *bytecode_p = (ecma_compiled_code_t *) buffer_p;
uint32_t code_size = ((uint32_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG;
- if (CBC_IS_FUNCTION (bytecode_p->status_flags)
- && !(bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
+ if (CBC_IS_FUNCTION (bytecode_p->status_flags) && !(bytecode_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION))
{
ecma_value_t *literal_start_p;
uint32_t const_literal_end;
@@ -1239,8 +1210,7 @@ update_literal_offsets (uint8_t *buffer_p, /**< [in,out] snapshot buffer start *
}
buffer_p += code_size;
- }
- while (buffer_p < buffer_end_p);
+ } while (buffer_p < buffer_end_p);
} /* update_literal_offsets */
#endif /* JERRY_SNAPSHOT_SAVE */
@@ -1283,8 +1253,7 @@ jerry_merge_snapshots (const uint32_t **inp_buffers_p, /**< array of (pointers t
const jerry_snapshot_header_t *header_p = (const jerry_snapshot_header_t *) inp_buffers_p[i];
- if (header_p->magic != JERRY_SNAPSHOT_MAGIC
- || header_p->version != JERRY_SNAPSHOT_VERSION
+ if (header_p->magic != JERRY_SNAPSHOT_MAGIC || header_p->version != JERRY_SNAPSHOT_VERSION
|| !snapshot_check_global_flags (header_p->global_flags))
{
*error_p = "invalid snapshot version or unsupported features present";
@@ -1303,10 +1272,7 @@ jerry_merge_snapshots (const uint32_t **inp_buffers_p, /**< array of (pointers t
number_of_funcs += header_p->number_of_funcs;
functions_size += header_p->lit_table_offset - start_offset;
- scan_snapshot_functions (data_p + start_offset,
- literal_base_p,
- lit_pool_p,
- literal_base_p);
+ scan_snapshot_functions (data_p + start_offset, literal_base_p, lit_pool_p, literal_base_p);
}
JERRY_ASSERT (number_of_funcs > 0);
@@ -1436,14 +1402,12 @@ jerry_save_literals_heap_max (ecma_string_t *literals[], /**< array of literals
{
lit_utf8_size_t max_idx = node_idx;
- if (child_idx1 < num_of_nodes
- && jerry_save_literals_compare (literals[max_idx], literals[child_idx1]))
+ if (child_idx1 < num_of_nodes && jerry_save_literals_compare (literals[max_idx], literals[child_idx1]))
{
max_idx = child_idx1;
}
- if (child_idx2 < num_of_nodes
- && jerry_save_literals_compare (literals[max_idx], literals[child_idx2]))
+ if (child_idx2 < num_of_nodes && jerry_save_literals_compare (literals[max_idx], literals[child_idx2]))
{
max_idx = child_idx2;
}
@@ -1461,17 +1425,14 @@ jerry_save_literals_down_heap (ecma_string_t *literals[], /**< array of literals
{
while (true)
{
- lit_utf8_size_t max_idx = jerry_save_literals_heap_max (literals,
- num_of_nodes,
- node_idx,
- 2 * node_idx + 1,
- 2 * node_idx + 2);
+ lit_utf8_size_t max_idx =
+ jerry_save_literals_heap_max (literals, num_of_nodes, node_idx, 2 * node_idx + 1, 2 * node_idx + 2);
if (max_idx == node_idx)
{
break;
}
- ecma_string_t *tmp_str_p = literals[node_idx];
+ ecma_string_t *tmp_str_p = literals[node_idx];
literals[node_idx] = literals[max_idx];
literals[max_idx] = tmp_str_p;
@@ -1555,10 +1516,8 @@ jerry_append_ecma_string_to_buffer (uint8_t *buffer_p, /**< buffer */
ECMA_STRING_TO_UTF8_STRING (string_p, str_buffer_p, str_buffer_size);
/* Append the string to the buffer. */
- uint8_t *new_buffer_p = jerry_append_chars_to_buffer (buffer_p,
- buffer_end_p,
- (const char *) str_buffer_p,
- str_buffer_size);
+ uint8_t *new_buffer_p =
+ jerry_append_chars_to_buffer (buffer_p, buffer_end_p, (const char *) str_buffer_p, str_buffer_size);
ECMA_FINALIZE_UTF8_STRING (str_buffer_p, str_buffer_size);
@@ -1576,16 +1535,12 @@ jerry_append_number_to_buffer (uint8_t *buffer_p, /**< buffer */
lit_utf8_size_t number) /**< number */
{
lit_utf8_byte_t uint32_to_str_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];
- lit_utf8_size_t utf8_str_size = ecma_uint32_to_utf8_string (number,
- uint32_to_str_buffer,
- ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);
+ lit_utf8_size_t utf8_str_size =
+ ecma_uint32_to_utf8_string (number, uint32_to_str_buffer, ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);
JERRY_ASSERT (utf8_str_size <= ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32);
- return jerry_append_chars_to_buffer (buffer_p,
- buffer_end_p,
- (const char *) uint32_to_str_buffer,
- utf8_str_size);
+ return jerry_append_chars_to_buffer (buffer_p, buffer_end_p, (const char *) uint32_to_str_buffer, utf8_str_size);
} /* jerry_append_number_to_buffer */
#endif /* JERRY_SNAPSHOT_SAVE */
@@ -1612,10 +1567,8 @@ jerry_get_literals_from_snapshot (const uint32_t *snapshot_p, /**< input snapsho
const uint8_t *snapshot_data_p = (uint8_t *) snapshot_p;
const jerry_snapshot_header_t *header_p = (const jerry_snapshot_header_t *) snapshot_data_p;
- if (snapshot_size <= sizeof (jerry_snapshot_header_t)
- || header_p->magic != JERRY_SNAPSHOT_MAGIC
- || header_p->version != JERRY_SNAPSHOT_VERSION
- || !snapshot_check_global_flags (header_p->global_flags))
+ if (snapshot_size <= sizeof (jerry_snapshot_header_t) || header_p->magic != JERRY_SNAPSHOT_MAGIC
+ || header_p->version != JERRY_SNAPSHOT_VERSION || !snapshot_check_global_flags (header_p->global_flags))
{
/* Invalid snapshot format */
return 0;
@@ -1625,10 +1578,7 @@ jerry_get_literals_from_snapshot (const uint32_t *snapshot_p, /**< input snapsho
const uint8_t *literal_base_p = snapshot_data_p + header_p->lit_table_offset;
ecma_collection_t *lit_pool_p = ecma_new_collection ();
- scan_snapshot_functions (snapshot_data_p + header_p->func_offsets[0],
- literal_base_p,
- lit_pool_p,
- literal_base_p);
+ scan_snapshot_functions (snapshot_data_p + header_p->func_offsets[0], literal_base_p, lit_pool_p, literal_base_p);
lit_utf8_size_t literal_count = 0;
ecma_value_t *buffer_p = lit_pool_p->buffer_p;
@@ -1683,18 +1633,12 @@ jerry_get_literals_from_snapshot (const uint32_t *snapshot_p, /**< input snapsho
if (is_c_format)
{
/* Save literal count. */
- lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p,
- buffer_end_p,
- "jerry_length_t literal_count = ",
- 0);
+ lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, "jerry_length_t literal_count = ", 0);
lit_buf_p = jerry_append_number_to_buffer (lit_buf_p, buffer_end_p, literal_count);
/* Save the array of literals. */
- lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p,
- buffer_end_p,
- ";\n\njerry_char_t *literals[",
- 0);
+ lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, ";\n\njerry_char_t *literals[", 0);
lit_buf_p = jerry_append_number_to_buffer (lit_buf_p, buffer_end_p, literal_count);
lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, "] =\n{\n", 0);
@@ -1735,10 +1679,7 @@ jerry_get_literals_from_snapshot (const uint32_t *snapshot_p, /**< input snapsho
lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, "\n", 0);
}
- lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p,
- buffer_end_p,
- "};\n\njerry_length_t literal_sizes[",
- 0);
+ lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, "};\n\njerry_length_t literal_sizes[", 0);
lit_buf_p = jerry_append_number_to_buffer (lit_buf_p, buffer_end_p, literal_count);
lit_buf_p = jerry_append_chars_to_buffer (lit_buf_p, buffer_end_p, "] =\n{\n", 0);
diff --git a/jerry-core/api/jerry.c b/jerry-core/api/jerryscript.c
index c5131618..43b1d11e 100644
--- a/jerry-core/api/jerry.c
+++ b/jerry-core/api/jerryscript.c
@@ -13,10 +13,13 @@
* limitations under the License.
*/
-#include <stdio.h>
+#include "jerryscript.h"
+
#include <math.h>
+#include <stdio.h>
+
+#include "jerryscript-debugger-transport.h"
-#include "debugger.h"
#include "ecma-alloc.h"
#include "ecma-array-object.h"
#include "ecma-arraybuffer-object.h"
@@ -37,17 +40,17 @@
#include "ecma-lex-env.h"
#include "ecma-line-info.h"
#include "ecma-literal-storage.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
-#include "ecma-regexp-object.h"
+#include "ecma-objects.h"
#include "ecma-promise-object.h"
#include "ecma-proxy-object.h"
+#include "ecma-regexp-object.h"
#include "ecma-shared-arraybuffer-object.h"
#include "ecma-symbol-object.h"
#include "ecma-typedarray-object.h"
+
+#include "debugger.h"
#include "jcontext.h"
-#include "jerryscript.h"
-#include "jerryscript-debugger-transport.h"
#include "jmem.h"
#include "js-parser.h"
#include "lit-char-helpers.h"
@@ -59,18 +62,18 @@ JERRY_STATIC_ASSERT (sizeof (jerry_value_t) == sizeof (ecma_value_t),
#if JERRY_BUILTIN_REGEXP
JERRY_STATIC_ASSERT ((int) RE_FLAG_GLOBAL == (int) JERRY_REGEXP_FLAG_GLOBAL
- && (int) RE_FLAG_MULTILINE == (int) JERRY_REGEXP_FLAG_MULTILINE
- && (int) RE_FLAG_IGNORE_CASE == (int) JERRY_REGEXP_FLAG_IGNORE_CASE
- && (int) RE_FLAG_STICKY== (int) JERRY_REGEXP_FLAG_STICKY
- && (int) RE_FLAG_UNICODE == (int) JERRY_REGEXP_FLAG_UNICODE
- && (int) RE_FLAG_DOTALL == (int) JERRY_REGEXP_FLAG_DOTALL,
+ && (int) RE_FLAG_MULTILINE == (int) JERRY_REGEXP_FLAG_MULTILINE
+ && (int) RE_FLAG_IGNORE_CASE == (int) JERRY_REGEXP_FLAG_IGNORE_CASE
+ && (int) RE_FLAG_STICKY == (int) JERRY_REGEXP_FLAG_STICKY
+ && (int) RE_FLAG_UNICODE == (int) JERRY_REGEXP_FLAG_UNICODE
+ && (int) RE_FLAG_DOTALL == (int) JERRY_REGEXP_FLAG_DOTALL,
re_flags_t_must_be_equal_to_jerry_regexp_flags_t);
#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_ESNEXT
/* The internal ECMA_PROMISE_STATE_* values are "one byte away" from the API values */
JERRY_STATIC_ASSERT ((int) ECMA_PROMISE_IS_PENDING == (int) JERRY_PROMISE_STATE_PENDING
- && (int) ECMA_PROMISE_IS_FULFILLED == (int) JERRY_PROMISE_STATE_FULFILLED,
+ && (int) ECMA_PROMISE_IS_FULFILLED == (int) JERRY_PROMISE_STATE_FULFILLED,
promise_internal_state_matches_external);
#endif /* JERRY_ESNEXT */
@@ -80,9 +83,10 @@ JERRY_STATIC_ASSERT ((int) ECMA_PROMISE_IS_PENDING == (int) JERRY_PROMISE_STATE_
#define ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET (JERRY_BIN_OP_SUB - NUMBER_ARITHMETIC_SUBTRACTION)
JERRY_STATIC_ASSERT (((NUMBER_ARITHMETIC_SUBTRACTION + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_SUB)
- && ((NUMBER_ARITHMETIC_MULTIPLICATION + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_MUL)
- && ((NUMBER_ARITHMETIC_DIVISION + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_DIV)
- && ((NUMBER_ARITHMETIC_REMAINDER + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_REM),
+ && ((NUMBER_ARITHMETIC_MULTIPLICATION + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET)
+ == JERRY_BIN_OP_MUL)
+ && ((NUMBER_ARITHMETIC_DIVISION + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_DIV)
+ && ((NUMBER_ARITHMETIC_REMAINDER + ECMA_NUMBER_ARITHMETIC_OP_API_OFFSET) == JERRY_BIN_OP_REM),
number_arithmetics_operation_type_matches_external);
#if !JERRY_PARSER && !JERRY_SNAPSHOT_EXEC
@@ -172,7 +176,8 @@ jerry_init (jerry_init_flag_t flags) /**< combination of Jerry flags */
JERRY_ASSERT (!(JERRY_CONTEXT (status_flags) & ECMA_STATUS_API_AVAILABLE));
/* Zero out all non-external members. */
- memset ((char *) &JERRY_CONTEXT_STRUCT + offsetof (jerry_context_t, JERRY_CONTEXT_FIRST_MEMBER), 0,
+ memset ((char *) &JERRY_CONTEXT_STRUCT + offsetof (jerry_context_t, JERRY_CONTEXT_FIRST_MEMBER),
+ 0,
sizeof (jerry_context_t) - offsetof (jerry_context_t, JERRY_CONTEXT_FIRST_MEMBER));
JERRY_CONTEXT (jerry_init_flags) = flags;
@@ -200,9 +205,7 @@ jerry_cleanup (void)
}
#endif /* JERRY_DEBUGGER */
- for (jerry_context_data_header_t *this_p = JERRY_CONTEXT (context_data_p);
- this_p != NULL;
- this_p = this_p->next_p)
+ for (jerry_context_data_header_t *this_p = JERRY_CONTEXT (context_data_p); this_p != NULL; this_p = this_p->next_p)
{
if (this_p->manager_p->deinit_cb)
{
@@ -217,8 +220,7 @@ jerry_cleanup (void)
ecma_finalize ();
jerry_make_api_unavailable ();
- for (jerry_context_data_header_t *this_p = JERRY_CONTEXT (context_data_p), *next_p = NULL;
- this_p != NULL;
+ for (jerry_context_data_header_t *this_p = JERRY_CONTEXT (context_data_p), *next_p = NULL; this_p != NULL;
this_p = next_p)
{
next_p = this_p->next_p;
@@ -278,14 +280,14 @@ jerry_get_context_data (const jerry_context_data_manager_t *manager_p)
* Register external magic string array
*/
void
-jerry_register_magic_strings (const jerry_char_t * const *ex_str_items_p, /**< character arrays, representing
- * external magic strings' contents */
+jerry_register_magic_strings (const jerry_char_t *const *ex_str_items_p, /**< character arrays, representing
+ * external magic strings' contents */
uint32_t count, /**< number of the strings */
const jerry_length_t *str_lengths_p) /**< lengths of all strings */
{
jerry_assert_api_available ();
- lit_magic_strings_ex_set ((const lit_utf8_byte_t * const *) ex_str_items_p,
+ lit_magic_strings_ex_set ((const lit_utf8_byte_t *const *) ex_str_items_p,
count,
(const lit_utf8_size_t *) str_lengths_p);
} /* jerry_register_magic_strings */
@@ -327,13 +329,10 @@ jerry_get_memory_stats (jerry_heap_stats_t *out_stats_p) /**< [out] heap memory
memset (&jmem_heap_stats, 0, sizeof (jmem_heap_stats));
jmem_heap_get_stats (&jmem_heap_stats);
- *out_stats_p = (jerry_heap_stats_t)
- {
- .version = 1,
- .size = jmem_heap_stats.size,
- .allocated_bytes = jmem_heap_stats.allocated_bytes,
- .peak_allocated_bytes = jmem_heap_stats.peak_allocated_bytes
- };
+ *out_stats_p = (jerry_heap_stats_t){ .version = 1,
+ .size = jmem_heap_stats.size,
+ .allocated_bytes = jmem_heap_stats.allocated_bytes,
+ .peak_allocated_bytes = jmem_heap_stats.peak_allocated_bytes };
return true;
#else /* !JERRY_MEM_STATS */
@@ -394,30 +393,22 @@ jerry_parse_common (void *source_p, /**< script source */
if (options_p != NULL)
{
- const uint32_t allowed_options = (JERRY_PARSE_STRICT_MODE
- | JERRY_PARSE_MODULE
- | JERRY_PARSE_HAS_ARGUMENT_LIST
- | JERRY_PARSE_HAS_RESOURCE
- | JERRY_PARSE_HAS_START
- | JERRY_PARSE_HAS_USER_VALUE);
+ const uint32_t allowed_options = (JERRY_PARSE_STRICT_MODE | JERRY_PARSE_MODULE | JERRY_PARSE_HAS_ARGUMENT_LIST
+ | JERRY_PARSE_HAS_RESOURCE | JERRY_PARSE_HAS_START | JERRY_PARSE_HAS_USER_VALUE);
uint32_t options = options_p->options;
if ((options & ~allowed_options) != 0
|| ((options_p->options & JERRY_PARSE_HAS_ARGUMENT_LIST)
- && ((options_p->options & JERRY_PARSE_MODULE)
- || !ecma_is_value_string (options_p->argument_list)))
- || ((options_p->options & JERRY_PARSE_HAS_RESOURCE)
- && !ecma_is_value_string (options_p->resource_name)))
+ && ((options_p->options & JERRY_PARSE_MODULE) || !ecma_is_value_string (options_p->argument_list)))
+ || ((options_p->options & JERRY_PARSE_HAS_RESOURCE) && !ecma_is_value_string (options_p->resource_name)))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
}
#if JERRY_DEBUGGER
- if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
- && options_p != NULL
- && (options_p->options & JERRY_PARSE_HAS_RESOURCE)
- && ecma_is_value_string (options_p->resource_name))
+ if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) && options_p != NULL
+ && (options_p->options & JERRY_PARSE_HAS_RESOURCE) && ecma_is_value_string (options_p->resource_name))
{
ECMA_STRING_TO_UTF8_STRING (ecma_get_string_from_value (options_p->resource_name),
resource_name_start_p,
@@ -471,8 +462,7 @@ jerry_parse_common (void *source_p, /**< script source */
}
#endif /* JERRY_MODULE_SYSTEM */
- if (JERRY_UNLIKELY (options_p != NULL
- && (options_p->options & JERRY_PARSE_HAS_ARGUMENT_LIST)))
+ if (JERRY_UNLIKELY (options_p != NULL && (options_p->options & JERRY_PARSE_HAS_ARGUMENT_LIST)))
{
ecma_object_t *global_object_p = ecma_builtin_get_global ();
@@ -906,8 +896,8 @@ jerry_module_set_import_callback (jerry_module_import_callback_t callback_p, /**
jerry_value_t
jerry_native_module_create (jerry_native_module_evaluate_callback_t callback, /**< evaluation callback for
* native modules */
- const jerry_value_t * const exports_p, /**< list of the exported bindings of the module,
- * must be valid string identifiers */
+ const jerry_value_t *const exports_p, /**< list of the exported bindings of the module,
+ * must be valid string identifiers */
size_t number_of_exports) /**< number of exports in the exports_p list */
{
jerry_assert_api_available ();
@@ -1033,14 +1023,13 @@ jerry_native_module_get_export (const jerry_value_t native_module_val, /**< a na
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_not_module_p)));
}
- if (!(module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE)
- || !ecma_is_value_string (export_name_val))
+ if (!(module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE) || !ecma_is_value_string (export_name_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
- ecma_property_t *property_p = ecma_find_named_property (module_p->scope_p,
- ecma_get_string_from_value (export_name_val));
+ ecma_property_t *property_p =
+ ecma_find_named_property (module_p->scope_p, ecma_get_string_from_value (export_name_val));
if (property_p == NULL)
{
@@ -1080,24 +1069,21 @@ jerry_native_module_set_export (const jerry_value_t native_module_val, /**< a na
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_not_module_p)));
}
- if (!(module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE)
- || !ecma_is_value_string (export_name_val)
+ if (!(module_p->header.u.cls.u2.module_flags & ECMA_MODULE_IS_NATIVE) || !ecma_is_value_string (export_name_val)
|| ecma_is_value_error_reference (value_to_set))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
- ecma_property_t *property_p = ecma_find_named_property (module_p->scope_p,
- ecma_get_string_from_value (export_name_val));
+ ecma_property_t *property_p =
+ ecma_find_named_property (module_p->scope_p, ecma_get_string_from_value (export_name_val));
if (property_p == NULL)
{
return jerry_throw (ecma_raise_reference_error (ECMA_ERR_MSG (ecma_error_unknown_export_p)));
}
- ecma_named_data_property_assign_value (module_p->scope_p,
- ECMA_PROPERTY_VALUE_PTR (property_p),
- value_to_set);
+ ecma_named_data_property_assign_value (module_p->scope_p, ECMA_PROPERTY_VALUE_PTR (property_p), value_to_set);
return ECMA_VALUE_TRUE;
#else /* !JERRY_MODULE_SYSTEM */
JERRY_UNUSED (native_module_val);
@@ -1287,9 +1273,7 @@ jerry_value_is_async_function (const jerry_value_t value) /**< api value */
bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) obj_p);
uint16_t type = CBC_FUNCTION_GET_TYPE (bytecode_data_p->status_flags);
- return (type == CBC_FUNCTION_ASYNC
- || type == CBC_FUNCTION_ASYNC_ARROW
- || type == CBC_FUNCTION_ASYNC_GENERATOR);
+ return (type == CBC_FUNCTION_ASYNC || type == CBC_FUNCTION_ASYNC_ARROW || type == CBC_FUNCTION_ASYNC_GENERATOR);
}
}
#else /* !JERRY_ESNEXT */
@@ -1352,8 +1336,7 @@ jerry_value_is_promise (const jerry_value_t value) /**< api value */
{
jerry_assert_api_available ();
#if JERRY_ESNEXT
- return (ecma_is_value_object (value)
- && ecma_is_promise (ecma_get_object_from_value (value)));
+ return (ecma_is_value_object (value) && ecma_is_promise (ecma_get_object_from_value (value)));
#else /* !JERRY_ESNEXT */
JERRY_UNUSED (value);
return false;
@@ -1371,8 +1354,7 @@ jerry_value_is_proxy (const jerry_value_t value) /**< api value */
{
jerry_assert_api_available ();
#if JERRY_BUILTIN_PROXY
- return (ecma_is_value_object (value)
- && ECMA_OBJECT_IS_PROXY (ecma_get_object_from_value (value)));
+ return (ecma_is_value_object (value) && ECMA_OBJECT_IS_PROXY (ecma_get_object_from_value (value)));
#else /* !JERRY_BUILTIN_PROXY */
JERRY_UNUSED (value);
return false;
@@ -1513,8 +1495,7 @@ jerry_value_get_type (const jerry_value_t value) /**< input value to check */
/**
* Used by jerry_object_get_type to get the type of class objects
*/
-static const uint8_t jerry_class_object_type[] =
-{
+static const uint8_t jerry_class_object_type[] = {
/* These objects require custom property resolving. */
JERRY_OBJECT_TYPE_STRING, /**< type of ECMA_OBJECT_CLASS_STRING */
JERRY_OBJECT_TYPE_ARGUMENTS, /**< type of ECMA_OBJECT_CLASS_ARGUMENTS */
@@ -1523,9 +1504,9 @@ static const uint8_t jerry_class_object_type[] =
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_MODULE_SYSTEM
JERRY_OBJECT_TYPE_MODULE_NAMESPACE, /**< type of ECMA_OBJECT_CLASS_MODULE_NAMESPACE */
-#endif
+#endif /* JERRY_MODULE_SYSTEM */
- /* These objects are marked by Garbage Collector. */
+/* These objects are marked by Garbage Collector. */
#if JERRY_ESNEXT
JERRY_OBJECT_TYPE_GENERATOR, /**< type of ECMA_OBJECT_CLASS_GENERATOR */
JERRY_OBJECT_TYPE_GENERATOR, /**< type of ECMA_OBJECT_CLASS_ASYNC_GENERATOR */
@@ -1538,7 +1519,7 @@ static const uint8_t jerry_class_object_type[] =
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
JERRY_OBJECT_TYPE_MODULE, /**< type of ECMA_OBJECT_CLASS_MODULE */
-#endif
+#endif /* JERRY_MODULE_SYSTEM */
#if JERRY_ESNEXT
JERRY_OBJECT_TYPE_PROMISE, /**< type of ECMA_OBJECT_CLASS_PROMISE */
JERRY_OBJECT_TYPE_GENERIC, /**< type of ECMA_OBJECT_CLASS_PROMISE_CAPABILITY */
@@ -1808,8 +1789,7 @@ jerry_is_feature_enabled (const jerry_feature_t feature) /**< feature to check *
|| feature == JERRY_FEATURE_JSON
#endif /* JERRY_BUILTIN_JSON */
#if JERRY_ESNEXT
- || feature == JERRY_FEATURE_PROMISE
- || feature == JERRY_FEATURE_SYMBOL
+ || feature == JERRY_FEATURE_PROMISE || feature == JERRY_FEATURE_SYMBOL
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_TYPEDARRAY
|| feature == JERRY_FEATURE_TYPEDARRAY
@@ -1836,9 +1816,7 @@ jerry_is_feature_enabled (const jerry_feature_t feature) /**< feature to check *
|| feature == JERRY_FEATURE_GLOBAL_THIS
#endif /* JERRY_BUILTIN_GLOBAL_THIS */
#if JERRY_BUILTIN_CONTAINER
- || feature == JERRY_FEATURE_MAP
- || feature == JERRY_FEATURE_SET
- || feature == JERRY_FEATURE_WEAKMAP
+ || feature == JERRY_FEATURE_MAP || feature == JERRY_FEATURE_SET || feature == JERRY_FEATURE_WEAKMAP
|| feature == JERRY_FEATURE_WEAKSET
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_WEAKREF
@@ -1859,7 +1837,7 @@ jerry_is_feature_enabled (const jerry_feature_t feature) /**< feature to check *
#if JERRY_FUNCTION_TO_STRING
|| feature == JERRY_FEATURE_FUNCTION_TO_STRING
#endif /* JERRY_FUNCTION_TO_STRING */
- );
+ );
} /* jerry_is_feature_enabled */
/**
@@ -1908,8 +1886,7 @@ jerry_binary_operation (jerry_binary_operation_t op, /**< operation */
}
case JERRY_BIN_OP_INSTANCEOF:
{
- if (!ecma_is_value_object (lhs)
- || !ecma_op_is_callable (rhs))
+ if (!ecma_is_value_object (lhs) || !ecma_op_is_callable (rhs))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
@@ -2054,8 +2031,9 @@ jerry_set_error_object_created_callback (jerry_error_object_created_callback_t c
* When JERRY_VM_THROW is enabled, the callback passed to this
* function is called when an error is thrown in ECMAScript code.
*/
-void jerry_set_vm_throw_callback (jerry_vm_throw_callback_t throw_cb, /**< callback which is called on throws */
- void *user_p) /**< pointer passed to the function */
+void
+jerry_set_vm_throw_callback (jerry_vm_throw_callback_t throw_cb, /**< callback which is called on throws */
+ void *user_p) /**< pointer passed to the function */
{
#if JERRY_VM_THROW
JERRY_CONTEXT (vm_throw_callback_p) = throw_cb;
@@ -2270,7 +2248,6 @@ jerry_value_to_primitive (const jerry_value_t value) /**< input value */
jerry_value_t
jerry_value_to_string (const jerry_value_t value) /**< input value */
{
-
jerry_assert_api_available ();
if (ecma_is_value_error_reference (value))
@@ -2474,9 +2451,7 @@ jerry_create_error (jerry_error_t error_type, /**< type of error */
const jerry_char_t *message_p) /**< value of 'message' property
* of constructed error object */
{
- return jerry_create_error_sz (error_type,
- (lit_utf8_byte_t *) message_p,
- lit_zt_utf8_string_size (message_p));
+ return jerry_create_error_sz (error_type, (lit_utf8_byte_t *) message_p, lit_zt_utf8_string_size (message_p));
} /* jerry_create_error */
/**
@@ -2502,11 +2477,10 @@ jerry_create_error_sz (jerry_error_t error_type, /**< type of error */
}
else
{
- ecma_string_t *message_string_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) message_p,
- (lit_utf8_size_t) message_size);
+ ecma_string_t *message_string_p =
+ ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) message_p, (lit_utf8_size_t) message_size);
- ecma_object_t *error_object_p = ecma_new_standard_error ((jerry_error_t) error_type,
- message_string_p);
+ ecma_object_t *error_object_p = ecma_new_standard_error ((jerry_error_t) error_type, message_string_p);
ecma_deref_ecma_string (message_string_p);
@@ -2660,8 +2634,7 @@ jerry_create_proxy (const jerry_value_t target, /**< target argument */
{
jerry_assert_api_available ();
- if (ecma_is_value_error_reference (target)
- || ecma_is_value_error_reference (handler))
+ if (ecma_is_value_error_reference (target) || ecma_is_value_error_reference (handler))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
@@ -2696,8 +2669,7 @@ jerry_create_special_proxy (const jerry_value_t target, /**< target argument */
{
jerry_assert_api_available ();
- if (ecma_is_value_error_reference (target)
- || ecma_is_value_error_reference (handler))
+ if (ecma_is_value_error_reference (target) || ecma_is_value_error_reference (handler))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
@@ -2741,8 +2713,8 @@ jerry_create_string_sz_from_utf8 (const jerry_char_t *str_p, /**< pointer to str
{
jerry_assert_api_available ();
- ecma_string_t *ecma_str_p = ecma_new_ecma_string_from_utf8_converted_to_cesu8 ((lit_utf8_byte_t *) str_p,
- (lit_utf8_size_t) str_size);
+ ecma_string_t *ecma_str_p =
+ ecma_new_ecma_string_from_utf8_converted_to_cesu8 ((lit_utf8_byte_t *) str_p, (lit_utf8_size_t) str_size);
return ecma_make_string_value (ecma_str_p);
} /* jerry_create_string_sz_from_utf8 */
@@ -2775,8 +2747,7 @@ jerry_create_string_sz (const jerry_char_t *str_p, /**< pointer to string */
{
jerry_assert_api_available ();
- ecma_string_t *ecma_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) str_p,
- (lit_utf8_size_t) str_size);
+ ecma_string_t *ecma_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) str_p, (lit_utf8_size_t) str_size);
return ecma_make_string_value (ecma_str_p);
} /* jerry_create_string_sz */
@@ -2810,9 +2781,8 @@ jerry_create_external_string_sz (const jerry_char_t *str_p, /**< pointer to stri
{
jerry_assert_api_available ();
- ecma_string_t *ecma_str_p = ecma_new_ecma_external_string_from_cesu8 ((lit_utf8_byte_t *) str_p,
- (lit_utf8_size_t) str_size,
- user_p);
+ ecma_string_t *ecma_str_p =
+ ecma_new_ecma_external_string_from_cesu8 ((lit_utf8_byte_t *) str_p, (lit_utf8_size_t) str_size, user_p);
return ecma_make_string_value (ecma_str_p);
} /* jerry_create_external_string_sz */
@@ -2905,9 +2875,7 @@ jerry_create_regexp_sz (const jerry_char_t *pattern_p, /**< zero-terminated UTF-
ecma_string_t *ecma_pattern = ecma_new_ecma_string_from_utf8 (pattern_p, pattern_size);
- jerry_value_t ret_val = ecma_op_create_regexp_with_flags (regexp_obj_p,
- ecma_make_string_value (ecma_pattern),
- flags);
+ jerry_value_t ret_val = ecma_op_create_regexp_with_flags (regexp_obj_p, ecma_make_string_value (ecma_pattern), flags);
ecma_deref_ecma_string (ecma_pattern);
return ret_val;
@@ -3085,9 +3053,7 @@ jerry_string_to_char_buffer (const jerry_value_t value, /**< input string value
return 0;
}
- return ecma_string_copy_to_cesu8_buffer (str_p,
- (lit_utf8_byte_t *) buffer_p,
- buffer_size);
+ return ecma_string_copy_to_cesu8_buffer (str_p, (lit_utf8_byte_t *) buffer_p, buffer_size);
} /* jerry_string_to_char_buffer */
/**
@@ -3124,9 +3090,7 @@ jerry_string_to_utf8_char_buffer (const jerry_value_t value, /**< input string v
return 0;
}
- return ecma_string_copy_to_utf8_buffer (str_p,
- (lit_utf8_byte_t *) buffer_p,
- buffer_size);
+ return ecma_string_copy_to_utf8_buffer (str_p, (lit_utf8_byte_t *) buffer_p, buffer_size);
} /* jerry_string_to_utf8_char_buffer */
/**
@@ -3156,11 +3120,7 @@ jerry_substring_to_char_buffer (const jerry_value_t value, /**< input string val
ecma_string_t *str_p = ecma_get_string_from_value (value);
- return ecma_substring_copy_to_cesu8_buffer (str_p,
- start_pos,
- end_pos,
- (lit_utf8_byte_t *) buffer_p,
- buffer_size);
+ return ecma_substring_copy_to_cesu8_buffer (str_p, start_pos, end_pos, (lit_utf8_byte_t *) buffer_p, buffer_size);
} /* jerry_substring_to_char_buffer */
/**
@@ -3190,11 +3150,7 @@ jerry_substring_to_utf8_char_buffer (const jerry_value_t value, /**< input strin
ecma_string_t *str_p = ecma_get_string_from_value (value);
- return ecma_substring_copy_to_utf8_buffer (str_p,
- start_pos,
- end_pos,
- (lit_utf8_byte_t *) buffer_p,
- buffer_size);
+ return ecma_substring_copy_to_utf8_buffer (str_p, start_pos, end_pos, (lit_utf8_byte_t *) buffer_p, buffer_size);
} /* jerry_substring_to_utf8_char_buffer */
/**
@@ -3262,14 +3218,15 @@ jerry_has_property (const jerry_value_t obj_val, /**< object value */
{
jerry_assert_api_available ();
- if (!ecma_is_value_object (obj_val)
- || !ecma_is_value_prop_name (prop_name_val))
+ if (!ecma_is_value_object (obj_val) || !ecma_is_value_prop_name (prop_name_val))
{
return ECMA_VALUE_FALSE;
}
- return jerry_return (ecma_op_object_has_property (ecma_get_object_from_value (obj_val),
- ecma_get_prop_name_from_value (prop_name_val)));
+ ecma_object_t *obj_p = ecma_get_object_from_value (obj_val);
+ ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (prop_name_val);
+
+ return jerry_return (ecma_op_object_has_property (obj_p, prop_name_p));
} /* jerry_has_property */
/**
@@ -3284,8 +3241,7 @@ jerry_has_own_property (const jerry_value_t obj_val, /**< object value */
{
jerry_assert_api_available ();
- if (!ecma_is_value_object (obj_val)
- || !ecma_is_value_prop_name (prop_name_val))
+ if (!ecma_is_value_object (obj_val) || !ecma_is_value_prop_name (prop_name_val))
{
return ECMA_VALUE_FALSE;
}
@@ -3328,8 +3284,7 @@ jerry_has_internal_property (const jerry_value_t obj_val, /**< object value */
{
jerry_assert_api_available ();
- if (!ecma_is_value_object (obj_val)
- || !ecma_is_value_prop_name (prop_name_val))
+ if (!ecma_is_value_object (obj_val) || !ecma_is_value_prop_name (prop_name_val))
{
return false;
}
@@ -3368,15 +3323,13 @@ jerry_delete_property (const jerry_value_t obj_val, /**< object value */
{
jerry_assert_api_available ();
- if (!ecma_is_value_object (obj_val)
- || !ecma_is_value_prop_name (prop_name_val))
+ if (!ecma_is_value_object (obj_val) || !ecma_is_value_prop_name (prop_name_val))
{
return false;
}
- ecma_value_t ret_value = ecma_op_object_delete (ecma_get_object_from_value (obj_val),
- ecma_get_prop_name_from_value (prop_name_val),
- false);
+ ecma_value_t ret_value =
+ ecma_op_object_delete (ecma_get_object_from_value (obj_val), ecma_get_prop_name_from_value (prop_name_val), false);
#if JERRY_BUILTIN_PROXY
if (ECMA_IS_VALUE_ERROR (ret_value))
@@ -3407,9 +3360,7 @@ jerry_delete_property_by_index (const jerry_value_t obj_val, /**< object value *
}
ecma_string_t *str_idx_p = ecma_new_ecma_string_from_uint32 (index);
- ecma_value_t ret_value = ecma_op_object_delete (ecma_get_object_from_value (obj_val),
- str_idx_p,
- false);
+ ecma_value_t ret_value = ecma_op_object_delete (ecma_get_object_from_value (obj_val), str_idx_p, false);
ecma_deref_ecma_string (str_idx_p);
#if JERRY_BUILTIN_PROXY
@@ -3435,8 +3386,7 @@ jerry_delete_internal_property (const jerry_value_t obj_val, /**< object value *
{
jerry_assert_api_available ();
- if (!ecma_is_value_object (obj_val)
- || !ecma_is_value_prop_name (prop_name_val))
+ if (!ecma_is_value_object (obj_val) || !ecma_is_value_prop_name (prop_name_val))
{
return false;
}
@@ -3485,14 +3435,13 @@ jerry_get_property (const jerry_value_t obj_val, /**< object value */
{
jerry_assert_api_available ();
- if (!ecma_is_value_object (obj_val)
- || !ecma_is_value_prop_name (prop_name_val))
+ if (!ecma_is_value_object (obj_val) || !ecma_is_value_prop_name (prop_name_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
- jerry_value_t ret_value = ecma_op_object_get (ecma_get_object_from_value (obj_val),
- ecma_get_prop_name_from_value (prop_name_val));
+ jerry_value_t ret_value =
+ ecma_op_object_get (ecma_get_object_from_value (obj_val), ecma_get_prop_name_from_value (prop_name_val));
return jerry_return (ret_value);
} /* jerry_get_property */
@@ -3544,8 +3493,7 @@ jerry_get_own_property (const jerry_value_t obj_val, /**< object value */
*found_p = false;
}
- if (!ecma_is_value_object (obj_val)
- || !ecma_is_value_prop_name (prop_name_val)
+ if (!ecma_is_value_object (obj_val) || !ecma_is_value_prop_name (prop_name_val)
|| !ecma_is_value_object (receiver_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
@@ -3597,8 +3545,7 @@ jerry_get_internal_property (const jerry_value_t obj_val, /**< object value */
{
jerry_assert_api_available ();
- if (!ecma_is_value_object (obj_val)
- || !ecma_is_value_prop_name (prop_name_val))
+ if (!ecma_is_value_object (obj_val) || !ecma_is_value_prop_name (prop_name_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
@@ -3646,8 +3593,7 @@ jerry_set_property (const jerry_value_t obj_val, /**< object value */
{
jerry_assert_api_available ();
- if (ecma_is_value_error_reference (value_to_set)
- || !ecma_is_value_object (obj_val)
+ if (ecma_is_value_error_reference (value_to_set) || !ecma_is_value_object (obj_val)
|| !ecma_is_value_prop_name (prop_name_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
@@ -3675,16 +3621,13 @@ jerry_set_property_by_index (const jerry_value_t obj_val, /**< object value */
{
jerry_assert_api_available ();
- if (ecma_is_value_error_reference (value_to_set)
- || !ecma_is_value_object (obj_val))
+ if (ecma_is_value_error_reference (value_to_set) || !ecma_is_value_object (obj_val))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
- ecma_value_t ret_value = ecma_op_object_put_by_index (ecma_get_object_from_value (obj_val),
- index,
- value_to_set,
- true);
+ ecma_value_t ret_value =
+ ecma_op_object_put_by_index (ecma_get_object_from_value (obj_val), index, value_to_set, true);
return jerry_return (ret_value);
} /* jerry_set_property_by_index */
@@ -3706,8 +3649,7 @@ jerry_set_internal_property (const jerry_value_t obj_val, /**< object value */
{
jerry_assert_api_available ();
- if (ecma_is_value_error_reference (value_to_set)
- || !ecma_is_value_object (obj_val)
+ if (ecma_is_value_error_reference (value_to_set) || !ecma_is_value_object (obj_val)
|| !ecma_is_value_prop_name (prop_name_val))
{
return false;
@@ -3727,14 +3669,10 @@ jerry_set_internal_property (const jerry_value_t obj_val, /**< object value */
if (property_p == NULL)
{
- ecma_property_value_t *value_p = ecma_create_named_data_property (obj_p,
- internal_string_p,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,
- NULL);
+ ecma_property_value_t *value_p =
+ ecma_create_named_data_property (obj_p, internal_string_p, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL);
- internal_object_p = ecma_create_object (NULL,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ internal_object_p = ecma_create_object (NULL, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
{
ecma_extended_object_t *container_p = (ecma_extended_object_t *) internal_object_p;
container_p->u.cls.type = ECMA_OBJECT_CLASS_INTERNAL_OBJECT;
@@ -3954,8 +3892,7 @@ jerry_define_own_property (const jerry_value_t obj_val, /**< object value */
{
jerry_assert_api_available ();
- if (!ecma_is_value_object (obj_val)
- || !ecma_is_value_prop_name (prop_name_val))
+ if (!ecma_is_value_object (obj_val) || !ecma_is_value_prop_name (prop_name_val))
{
return jerry_type_error_or_false (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p), prop_desc_p->flags);
}
@@ -3985,14 +3922,13 @@ jerry_define_own_property (const jerry_value_t obj_val, /**< object value */
* false - otherwise, the prop_desc_p is unchanged
*/
jerry_value_t
-jerry_get_own_property_descriptor (const jerry_value_t obj_val, /**< object value */
+jerry_get_own_property_descriptor (const jerry_value_t obj_val, /**< object value */
const jerry_value_t prop_name_val, /**< property name (string value) */
jerry_property_descriptor_t *prop_desc_p) /**< property descriptor */
{
jerry_assert_api_available ();
- if (!ecma_is_value_object (obj_val)
- || !ecma_is_value_prop_name (prop_name_val))
+ if (!ecma_is_value_object (obj_val) || !ecma_is_value_prop_name (prop_name_val))
{
return ECMA_VALUE_FALSE;
}
@@ -4016,10 +3952,9 @@ jerry_get_own_property_descriptor (const jerry_value_t obj_val, /**< object val
}
/* The flags are always filled in the returned descriptor. */
- JERRY_ASSERT ((prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED)
- && (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE_DEFINED)
- && ((prop_desc.flags & JERRY_PROP_IS_WRITABLE_DEFINED)
- || !(prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED)));
+ JERRY_ASSERT (
+ (prop_desc.flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED) && (prop_desc.flags & JERRY_PROP_IS_ENUMERABLE_DEFINED)
+ && ((prop_desc.flags & JERRY_PROP_IS_WRITABLE_DEFINED) || !(prop_desc.flags & JERRY_PROP_IS_VALUE_DEFINED)));
prop_desc_p->flags = prop_desc.flags;
prop_desc_p->value = ECMA_VALUE_UNDEFINED;
@@ -4110,10 +4045,7 @@ jerry_call_function (const jerry_value_t func_obj_val, /**< function object to c
}
}
- return jerry_return (ecma_op_function_validated_call (func_obj_val,
- this_val,
- args_p,
- args_count));
+ return jerry_return (ecma_op_function_validated_call (func_obj_val, this_val, args_p, args_count));
} /* jerry_call_function */
/**
@@ -4171,8 +4103,8 @@ jerry_get_object_keys (const jerry_value_t obj_val) /**< object value */
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
- ecma_collection_t *prop_names = ecma_op_object_get_enumerable_property_names (ecma_get_object_from_value (obj_val),
- ECMA_ENUMERABLE_PROPERTY_KEYS);
+ ecma_collection_t *prop_names =
+ ecma_op_object_get_enumerable_property_names (ecma_get_object_from_value (obj_val), ECMA_ENUMERABLE_PROPERTY_KEYS);
#if JERRY_BUILTIN_PROXY
if (JERRY_UNLIKELY (prop_names == NULL))
@@ -4235,8 +4167,7 @@ jerry_set_prototype (const jerry_value_t obj_val, /**< object value */
{
jerry_assert_api_available ();
- if (!ecma_is_value_object (obj_val)
- || ecma_is_value_error_reference (proto_obj_val)
+ if (!ecma_is_value_object (obj_val) || ecma_is_value_error_reference (proto_obj_val)
|| (!ecma_is_value_object (proto_obj_val) && !ecma_is_value_null (proto_obj_val)))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
@@ -4262,8 +4193,8 @@ jerry_set_prototype (const jerry_value_t obj_val, /**< object value */
* @returns true - if the user can access the object in the callback.
* false - if the object is an internal object which should no be accessed by the user.
*/
-static
-bool jerry_object_is_valid_foreach (ecma_object_t *object_p) /**< object to test */
+static bool
+jerry_object_is_valid_foreach (ecma_object_t *object_p) /**< object to test */
{
if (ecma_is_lexical_environment (object_p))
{
@@ -4308,8 +4239,7 @@ jerry_objects_foreach (jerry_objects_foreach_t foreach_p, /**< function pointer
{
ecma_object_t *iter_p = ECMA_GET_NON_NULL_POINTER (ecma_object_t, iter_cp);
- if (jerry_object_is_valid_foreach (iter_p)
- && !foreach_p (ecma_make_object_value (iter_p), user_data_p))
+ if (jerry_object_is_valid_foreach (iter_p) && !foreach_p (ecma_make_object_value (iter_p), user_data_p))
{
return true;
}
@@ -4349,8 +4279,7 @@ jerry_objects_foreach_by_native_info (const jerry_object_native_info_t *native_i
if (jerry_object_is_valid_foreach (iter_p))
{
native_pointer_p = ecma_get_native_pointer_value (iter_p, (void *) native_info_p);
- if (native_pointer_p
- && !foreach_p (ecma_make_object_value (iter_p), native_pointer_p->native_p, user_data_p))
+ if (native_pointer_p && !foreach_p (ecma_make_object_value (iter_p), native_pointer_p->native_p, user_data_p))
{
return true;
}
@@ -4647,9 +4576,9 @@ jerry_object_get_property_names (const jerry_value_t obj_val, /**< object */
uint32_t index = ecma_string_get_array_index (key_p);
/* Step 2. Filter by key type */
- if (filter & (JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS
- | JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS
- | JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES))
+ if (filter
+ & (JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS | JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS
+ | JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES))
{
if (ecma_is_value_symbol (key))
{
@@ -4674,9 +4603,9 @@ jerry_object_get_property_names (const jerry_value_t obj_val, /**< object */
}
/* Step 3. Filter property attributes */
- if (filter & (JERRY_PROPERTY_FILTER_EXCLUDE_NON_CONFIGURABLE
- | JERRY_PROPERTY_FILTER_EXCLUDE_NON_ENUMERABLE
- | JERRY_PROPERTY_FILTER_EXCLUDE_NON_WRITABLE))
+ if (filter
+ & (JERRY_PROPERTY_FILTER_EXCLUDE_NON_CONFIGURABLE | JERRY_PROPERTY_FILTER_EXCLUDE_NON_ENUMERABLE
+ | JERRY_PROPERTY_FILTER_EXCLUDE_NON_WRITABLE))
{
ecma_property_descriptor_t prop_desc;
ecma_value_t status = ecma_op_object_get_own_property_descriptor (obj_iter_p, key_p, &prop_desc);
@@ -4695,19 +4624,15 @@ jerry_object_get_property_names (const jerry_value_t obj_val, /**< object */
uint16_t flags = prop_desc.flags;
ecma_free_property_descriptor (&prop_desc);
- if ((!(flags & JERRY_PROP_IS_CONFIGURABLE)
- && (filter & JERRY_PROPERTY_FILTER_EXCLUDE_NON_CONFIGURABLE))
- || (!(flags & JERRY_PROP_IS_ENUMERABLE)
- && (filter & JERRY_PROPERTY_FILTER_EXCLUDE_NON_ENUMERABLE))
- || (!(flags & JERRY_PROP_IS_WRITABLE)
- && (filter & JERRY_PROPERTY_FILTER_EXCLUDE_NON_WRITABLE)))
+ if ((!(flags & JERRY_PROP_IS_CONFIGURABLE) && (filter & JERRY_PROPERTY_FILTER_EXCLUDE_NON_CONFIGURABLE))
+ || (!(flags & JERRY_PROP_IS_ENUMERABLE) && (filter & JERRY_PROPERTY_FILTER_EXCLUDE_NON_ENUMERABLE))
+ || (!(flags & JERRY_PROP_IS_WRITABLE) && (filter & JERRY_PROPERTY_FILTER_EXCLUDE_NON_WRITABLE)))
{
continue;
}
}
- if (index != ECMA_STRING_NOT_ARRAY_INDEX
- && (filter & JERRY_PROPERTY_FILTER_INTEGER_INDICES_AS_NUMBER))
+ if (index != ECMA_STRING_NOT_ARRAY_INDEX && (filter & JERRY_PROPERTY_FILTER_INTEGER_INDICES_AS_NUMBER))
{
ecma_deref_ecma_string (key_p);
key = ecma_make_uint32_value (index);
@@ -4930,9 +4855,10 @@ jerry_get_promise_state (const jerry_value_t promise) /**< promise object to get
* Note:
* the previous callback is overwritten
*/
-void jerry_promise_set_callback (jerry_promise_event_filter_t filters, /**< combination of event filters */
- jerry_promise_callback_t callback, /**< notification callback */
- void *user_p) /**< user pointer passed to the callback */
+void
+jerry_promise_set_callback (jerry_promise_event_filter_t filters, /**< combination of event filters */
+ jerry_promise_callback_t callback, /**< notification callback */
+ void *user_p) /**< user pointer passed to the callback */
{
jerry_assert_api_available ();
@@ -4981,7 +4907,7 @@ jerry_get_well_known_symbol (jerry_well_known_symbol_t symbol) /**< jerry_well_k
return ECMA_VALUE_UNDEFINED;
#endif /* JERRY_ESNEXT */
-} /** jerry_get_well_known_symbol */
+} /* jerry_get_well_known_symbol */
/**
* Returns the description internal property of a symbol.
@@ -5039,7 +4965,7 @@ jerry_get_symbol_descriptive_string (const jerry_value_t symbol) /**< symbol val
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_symbol_not_supported_p)));
#endif /* JERRY_ESNEXT */
-} /** jerry_get_symbol_descriptive_string */
+} /* jerry_get_symbol_descriptive_string */
/**
* Get the number of uint64 digits of a BigInt value
@@ -5173,9 +5099,7 @@ bool
jerry_is_valid_utf8_string (const jerry_char_t *utf8_buf_p, /**< UTF-8 string */
jerry_size_t buf_size) /**< string size */
{
- return lit_is_valid_utf8_string ((lit_utf8_byte_t *) utf8_buf_p,
- (lit_utf8_size_t) buf_size,
- true);
+ return lit_is_valid_utf8_string ((lit_utf8_byte_t *) utf8_buf_p, (lit_utf8_size_t) buf_size, true);
} /* jerry_is_valid_utf8_string */
/**
@@ -5188,8 +5112,7 @@ bool
jerry_is_valid_cesu8_string (const jerry_char_t *cesu8_buf_p, /**< CESU-8 string */
jerry_size_t buf_size) /**< string size */
{
- return lit_is_valid_cesu8_string ((lit_utf8_byte_t *) cesu8_buf_p,
- (lit_utf8_size_t) buf_size);
+ return lit_is_valid_cesu8_string ((lit_utf8_byte_t *) cesu8_buf_p, (lit_utf8_size_t) buf_size);
} /* jerry_is_valid_cesu8_string */
/**
@@ -5580,8 +5503,7 @@ jerry_get_source_info (const jerry_value_t value) /**< jerry api value */
if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_SCRIPT)
{
- bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- ext_object_p->u.cls.u3.value);
+ bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);
}
#if JERRY_MODULE_SYSTEM
else if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_MODULE)
@@ -5657,8 +5579,8 @@ jerry_get_source_info (const jerry_value_t value) /**< jerry api value */
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
- object_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- ext_object_p->u.bound_function.target_function);
+ object_p =
+ ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_object_p->u.bound_function.target_function);
continue;
}
#if JERRY_ESNEXT
@@ -6382,12 +6304,9 @@ jerry_create_dataview (const jerry_value_t array_buffer, /**< arraybuffer to cre
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
}
- ecma_value_t arguments_p[3] =
- {
- array_buffer,
- ecma_make_uint32_value (byte_offset),
- ecma_make_uint32_value (byte_length)
- };
+ ecma_value_t arguments_p[3] = { array_buffer,
+ ecma_make_uint32_value (byte_offset),
+ ecma_make_uint32_value (byte_length) };
ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target_p);
if (old_new_target_p == NULL)
{
@@ -6516,26 +6435,21 @@ typedef struct
/**
* List of TypedArray mappings
*/
-static jerry_typedarray_mapping_t jerry_typedarray_mappings[] =
-{
-#define TYPEDARRAY_ENTRY(NAME, LIT_NAME, SIZE_SHIFT) \
- { JERRY_TYPEDARRAY_ ## NAME, ECMA_BUILTIN_ID_ ## NAME ## ARRAY_PROTOTYPE, \
- ECMA_ ## LIT_NAME ## _ARRAY, SIZE_SHIFT }
+static jerry_typedarray_mapping_t jerry_typedarray_mappings[] = {
+#define TYPEDARRAY_ENTRY(NAME, LIT_NAME, SIZE_SHIFT) \
+ { \
+ JERRY_TYPEDARRAY_##NAME, ECMA_BUILTIN_ID_##NAME##ARRAY_PROTOTYPE, ECMA_##LIT_NAME##_ARRAY, SIZE_SHIFT \
+ }
- TYPEDARRAY_ENTRY (UINT8, UINT8, 0),
- TYPEDARRAY_ENTRY (UINT8CLAMPED, UINT8_CLAMPED, 0),
- TYPEDARRAY_ENTRY (INT8, INT8, 0),
- TYPEDARRAY_ENTRY (UINT16, UINT16, 1),
- TYPEDARRAY_ENTRY (INT16, INT16, 1),
- TYPEDARRAY_ENTRY (UINT32, UINT32, 2),
- TYPEDARRAY_ENTRY (INT32, INT32, 2),
- TYPEDARRAY_ENTRY (FLOAT32, FLOAT32, 2),
+ TYPEDARRAY_ENTRY (UINT8, UINT8, 0), TYPEDARRAY_ENTRY (UINT8CLAMPED, UINT8_CLAMPED, 0),
+ TYPEDARRAY_ENTRY (INT8, INT8, 0), TYPEDARRAY_ENTRY (UINT16, UINT16, 1),
+ TYPEDARRAY_ENTRY (INT16, INT16, 1), TYPEDARRAY_ENTRY (UINT32, UINT32, 2),
+ TYPEDARRAY_ENTRY (INT32, INT32, 2), TYPEDARRAY_ENTRY (FLOAT32, FLOAT32, 2),
#if JERRY_NUMBER_TYPE_FLOAT64
TYPEDARRAY_ENTRY (FLOAT64, FLOAT64, 3),
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_BIGINT
- TYPEDARRAY_ENTRY (BIGINT64, BIGINT64, 3),
- TYPEDARRAY_ENTRY (BIGUINT64, BIGUINT64, 3),
+ TYPEDARRAY_ENTRY (BIGINT64, BIGINT64, 3), TYPEDARRAY_ENTRY (BIGUINT64, BIGUINT64, 3),
#endif /* JERRY_BUILTIN_BIGINT */
#undef TYPEDARRAY_ENTRY
};
@@ -6601,11 +6515,8 @@ jerry_create_typedarray (jerry_typedarray_type_t type_name, /**< type of TypedAr
ecma_object_t *prototype_obj_p = ecma_builtin_get (prototype_id);
- ecma_value_t array_value = ecma_typedarray_create_object_with_length (length,
- NULL,
- prototype_obj_p,
- element_size_shift,
- id);
+ ecma_value_t array_value =
+ ecma_typedarray_create_object_with_length (length, NULL, prototype_obj_p, element_size_shift, id);
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (array_value));
@@ -6655,12 +6566,7 @@ jerry_create_typedarray_for_arraybuffer_sz (jerry_typedarray_type_t type_name, /
}
ecma_object_t *prototype_obj_p = ecma_builtin_get (prototype_id);
- ecma_value_t arguments_p[3] =
- {
- arraybuffer,
- ecma_make_uint32_value (byte_offset),
- ecma_make_uint32_value (length)
- };
+ ecma_value_t arguments_p[3] = { arraybuffer, ecma_make_uint32_value (byte_offset), ecma_make_uint32_value (length) };
ecma_value_t array_value = ecma_op_create_typedarray (arguments_p, 3, prototype_obj_p, element_size_shift, id);
ecma_free_value (arguments_p[1]);
@@ -6946,17 +6852,14 @@ jerry_create_container (jerry_container_type_t container_type, /**< Type of the
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG ("Invalid container type")));
}
}
- ecma_object_t * old_new_target_p = JERRY_CONTEXT (current_new_target_p);
+ ecma_object_t *old_new_target_p = JERRY_CONTEXT (current_new_target_p);
if (old_new_target_p == NULL)
{
JERRY_CONTEXT (current_new_target_p) = ecma_builtin_get (ctor_id);
}
- ecma_value_t container_value = ecma_op_container_create (arguments_list_p,
- arguments_list_len,
- lit_id,
- proto_id);
+ ecma_value_t container_value = ecma_op_container_create (arguments_list_p, arguments_list_len, lit_id, proto_id);
JERRY_CONTEXT (current_new_target_p) = old_new_target_p;
return container_value;
@@ -7123,11 +7026,11 @@ jerry_get_array_from_container (jerry_value_t value, /**< the container or itera
}
}
return ecma_op_new_array_object_from_collection (collection_buffer, false);
-#else /* JERRY_BUILTIN_CONTAINER */
+#else /* !JERRY_BUILTIN_CONTAINER */
JERRY_UNUSED (value);
JERRY_UNUSED (is_key_value_p);
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_container_not_supported_p)));
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER */
} /* jerry_get_array_from_container */
/**
@@ -7178,8 +7081,7 @@ jerry_container_operation (jerry_container_operation_t operation, /**< container
}
case JERRY_CONTAINER_OP_SET:
{
- if (arguments_number != 2
- || ecma_is_value_error_reference (arguments[0])
+ if (arguments_number != 2 || ecma_is_value_error_reference (arguments[0])
|| ecma_is_value_error_reference (arguments[1]))
{
return jerry_throw (ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_wrong_args_msg_p)));
@@ -7269,7 +7171,7 @@ jerry_container_operation (jerry_container_operation_t operation, /**< container
}
}
return jerry_return (result);
-#else /* JERRY_BUILTIN_CONTAINER */
+#else /* !JERRY_BUILTIN_CONTAINER */
JERRY_UNUSED (operation);
JERRY_UNUSED (container);
JERRY_UNUSED (arguments);
diff --git a/jerry-core/config.h b/jerry-core/config.h
index d2b2204d..b68c7ea4 100644
--- a/jerry-core/config.h
+++ b/jerry-core/config.h
@@ -29,102 +29,102 @@
* By default all built-ins are enabled if they are not defined.
*/
#ifndef JERRY_BUILTINS
-# define JERRY_BUILTINS 1
+#define JERRY_BUILTINS 1
#endif /* !defined (JERRY_BUILTINS) */
#ifndef JERRY_BUILTIN_ANNEXB
-# define JERRY_BUILTIN_ANNEXB JERRY_BUILTINS
+#define JERRY_BUILTIN_ANNEXB JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_ANNEXB) */
#ifndef JERRY_BUILTIN_ARRAY
-# define JERRY_BUILTIN_ARRAY JERRY_BUILTINS
+#define JERRY_BUILTIN_ARRAY JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_ARRAY) */
#ifndef JERRY_BUILTIN_BOOLEAN
-# define JERRY_BUILTIN_BOOLEAN JERRY_BUILTINS
+#define JERRY_BUILTIN_BOOLEAN JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_BOOLEAN) */
#ifndef JERRY_BUILTIN_DATE
-# define JERRY_BUILTIN_DATE JERRY_BUILTINS
+#define JERRY_BUILTIN_DATE JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_DATE) */
#ifndef JERRY_BUILTIN_ERRORS
-# define JERRY_BUILTIN_ERRORS JERRY_BUILTINS
+#define JERRY_BUILTIN_ERRORS JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_ERRORS) */
#ifndef JERRY_BUILTIN_JSON
-# define JERRY_BUILTIN_JSON JERRY_BUILTINS
+#define JERRY_BUILTIN_JSON JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_JSON) */
#ifndef JERRY_BUILTIN_MATH
-# define JERRY_BUILTIN_MATH JERRY_BUILTINS
+#define JERRY_BUILTIN_MATH JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_MATH) */
#ifndef JERRY_BUILTIN_NUMBER
-# define JERRY_BUILTIN_NUMBER JERRY_BUILTINS
+#define JERRY_BUILTIN_NUMBER JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_NUMBER) */
#ifndef JERRY_BUILTIN_REGEXP
-# define JERRY_BUILTIN_REGEXP JERRY_BUILTINS
+#define JERRY_BUILTIN_REGEXP JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_REGEXP) */
#ifndef JERRY_BUILTIN_STRING
-# define JERRY_BUILTIN_STRING JERRY_BUILTINS
+#define JERRY_BUILTIN_STRING JERRY_BUILTINS
#endif /* !defined (JERRY_BUILTIN_STRING) */
/**
* ES2015+ related features, by default all of them are enabled.
*/
#ifndef JERRY_ESNEXT
-# define JERRY_ESNEXT 1
+#define JERRY_ESNEXT 1
#endif /* !defined (JERRY_ESNEXT) */
#ifndef JERRY_BUILTIN_BIGINT
-# define JERRY_BUILTIN_BIGINT JERRY_ESNEXT
+#define JERRY_BUILTIN_BIGINT JERRY_ESNEXT
#endif /* !defined (JERRY_BUILTIN_BIGINT) */
#ifndef JERRY_BUILTIN_CONTAINER
-# define JERRY_BUILTIN_CONTAINER JERRY_ESNEXT
+#define JERRY_BUILTIN_CONTAINER JERRY_ESNEXT
#endif /* !defined (JERRY_BUILTIN_CONTAINER) */
#ifndef JERRY_BUILTIN_DATAVIEW
-# define JERRY_BUILTIN_DATAVIEW JERRY_ESNEXT
+#define JERRY_BUILTIN_DATAVIEW JERRY_ESNEXT
#endif /* !defined (JERRY_BUILTIN_DATAVIEW) */
#ifndef JERRY_BUILTIN_GLOBAL_THIS
-# define JERRY_BUILTIN_GLOBAL_THIS JERRY_ESNEXT
+#define JERRY_BUILTIN_GLOBAL_THIS JERRY_ESNEXT
#endif /* !defined (JERRY_BUILTIN_GLOBAL_THIS) */
#ifndef JERRY_BUILTIN_PROXY
-# define JERRY_BUILTIN_PROXY JERRY_ESNEXT
+#define JERRY_BUILTIN_PROXY JERRY_ESNEXT
#endif /* !defined (JERRY_BUILTIN_PROXY) */
#ifndef JERRY_BUILTIN_REALMS
-# define JERRY_BUILTIN_REALMS JERRY_ESNEXT
+#define JERRY_BUILTIN_REALMS JERRY_ESNEXT
#endif /* !defined (JERRY_BUILTIN_REALMS) */
#ifndef JERRY_BUILTIN_REFLECT
-# define JERRY_BUILTIN_REFLECT JERRY_ESNEXT
+#define JERRY_BUILTIN_REFLECT JERRY_ESNEXT
#endif /* !defined (JERRY_BUILTIN_REFLECT) */
#ifndef JERRY_BUILTIN_TYPEDARRAY
-# define JERRY_BUILTIN_TYPEDARRAY JERRY_ESNEXT
+#define JERRY_BUILTIN_TYPEDARRAY JERRY_ESNEXT
#endif /* !defined (JERRY_BUILTIN_TYPEDARRAY) */
#ifndef JERRY_BUILTIN_SHAREDARRAYBUFFER
-# define JERRY_BUILTIN_SHAREDARRAYBUFFER JERRY_ESNEXT
+#define JERRY_BUILTIN_SHAREDARRAYBUFFER JERRY_ESNEXT
#endif /* !defined (JERRY_BUILTIN_SHAREDARRAYBUFFER) */
#ifndef JERRY_BUILTIN_ATOMICS
-# define JERRY_BUILTIN_ATOMICS JERRY_ESNEXT
+#define JERRY_BUILTIN_ATOMICS JERRY_ESNEXT
#endif /* !defined (JERRY_BUILTIN_ATOMICS) */
#ifndef JERRY_BUILTIN_WEAKREF
-# define JERRY_BUILTIN_WEAKREF JERRY_ESNEXT
+#define JERRY_BUILTIN_WEAKREF JERRY_ESNEXT
#endif /* !defined (JERRY_BUILTIN_WEAKREF) */
#ifndef JERRY_MODULE_SYSTEM
-# define JERRY_MODULE_SYSTEM JERRY_ESNEXT
+#define JERRY_MODULE_SYSTEM JERRY_ESNEXT
#endif /* !defined (JERRY_MODULE_SYSTEM) */
/**
@@ -142,7 +142,7 @@
* For more details see: jmem/jmem.h
*/
#ifndef JERRY_CPOINTER_32_BIT
-# define JERRY_CPOINTER_32_BIT 0
+#define JERRY_CPOINTER_32_BIT 0
#endif /* !defined (JERRY_CPOINTER_32_BIT) */
/**
@@ -153,7 +153,7 @@
* 1: Enable the debugger.
*/
#ifndef JERRY_DEBUGGER
-# define JERRY_DEBUGGER 0
+#define JERRY_DEBUGGER 0
#endif /* !defined (JERRY_DEBUGGER) */
/**
@@ -166,7 +166,7 @@
* Default value: 0
*/
#ifndef JERRY_ERROR_MESSAGES
-# define JERRY_ERROR_MESSAGES 0
+#define JERRY_ERROR_MESSAGES 0
#endif /* !defined (JERRY_ERROR_MESSAGES) */
/**
@@ -179,7 +179,7 @@
* Default value: 0
*/
#ifndef JERRY_EXTERNAL_CONTEXT
-# define JERRY_EXTERNAL_CONTEXT 0
+#define JERRY_EXTERNAL_CONTEXT 0
#endif /* !defined (JERRY_EXTERNAL_CONTEXT) */
/**
@@ -188,7 +188,7 @@
* Default value: 512 KiB
*/
#ifndef JERRY_GLOBAL_HEAP_SIZE
-# define JERRY_GLOBAL_HEAP_SIZE (512)
+#define JERRY_GLOBAL_HEAP_SIZE (512)
#endif /* !defined (JERRY_GLOBAL_HEAP_SIZE) */
/**
@@ -197,7 +197,7 @@
* If value is 0, the default is 1/32 of JERRY_HEAP_SIZE
*/
#ifndef JERRY_GC_LIMIT
-# define JERRY_GC_LIMIT 0
+#define JERRY_GC_LIMIT 0
#endif /* !defined (JERRY_GC_LIMIT) */
/**
@@ -210,7 +210,7 @@
* Default value: 0, unlimited
*/
#ifndef JERRY_STACK_LIMIT
-# define JERRY_STACK_LIMIT (0)
+#define JERRY_STACK_LIMIT (0)
#endif /* !defined (JERRY_STACK_LIMIT) */
/**
@@ -219,7 +219,7 @@
* Default value: 8
*/
#ifndef JERRY_GC_MARK_LIMIT
-# define JERRY_GC_MARK_LIMIT (8)
+#define JERRY_GC_MARK_LIMIT (8)
#endif /* !defined (JERRY_GC_MARK_LIMIT) */
/**
@@ -232,7 +232,7 @@
* Default value: 1
*/
#ifndef JERRY_LCACHE
-# define JERRY_LCACHE 1
+#define JERRY_LCACHE 1
#endif /* !defined (JERRY_LCACHE) */
/**
@@ -245,7 +245,7 @@
* Default value: 0
*/
#ifndef JERRY_FUNCTION_TO_STRING
-# define JERRY_FUNCTION_TO_STRING 0
+#define JERRY_FUNCTION_TO_STRING 0
#endif /* !defined (JERRY_FUNCTION_TO_STRING) */
/**
@@ -258,7 +258,7 @@
* Default value: 0
*/
#ifndef JERRY_LINE_INFO
-# define JERRY_LINE_INFO 0
+#define JERRY_LINE_INFO 0
#endif /* !defined (JERRY_LINE_INFO) */
/**
@@ -271,7 +271,7 @@
* Default value: 0
*/
#ifndef JERRY_LOGGING
-# define JERRY_LOGGING 0
+#define JERRY_LOGGING 0
#endif /* !defined (JERRY_LOGGING) */
/**
@@ -286,7 +286,7 @@
* Only enable it for debugging purposes.
*/
#ifndef JERRY_MEM_GC_BEFORE_EACH_ALLOC
-# define JERRY_MEM_GC_BEFORE_EACH_ALLOC 0
+#define JERRY_MEM_GC_BEFORE_EACH_ALLOC 0
#endif /* !defined (JERRY_MEM_GC_BEFORE_EACH_ALLOC) */
/**
@@ -299,7 +299,7 @@
* Default value: 0
*/
#ifndef JERRY_MEM_STATS
-# define JERRY_MEM_STATS 0
+#define JERRY_MEM_STATS 0
#endif /* !defined (JERRY_MEM_STATS) */
/**
@@ -313,7 +313,7 @@
* Default value: 1
*/
#ifndef JERRY_NUMBER_TYPE_FLOAT64
-# define JERRY_NUMBER_TYPE_FLOAT64 1
+#define JERRY_NUMBER_TYPE_FLOAT64 1
#endif /* !defined (JERRY_NUMBER_TYPE_FLOAT64 */
/**
@@ -326,7 +326,7 @@
* Default value: 1
*/
#ifndef JERRY_PARSER
-# define JERRY_PARSER 1
+#define JERRY_PARSER 1
#endif /* !defined (JERRY_PARSER) */
/**
@@ -341,7 +341,7 @@
* Default value: 0
*/
#ifndef JERRY_PARSER_DUMP_BYTE_CODE
-# define JERRY_PARSER_DUMP_BYTE_CODE 0
+#define JERRY_PARSER_DUMP_BYTE_CODE 0
#endif /* defined (JERRY_PARSER_DUMP_BYTE_CODE) */
/**
@@ -354,7 +354,7 @@
* Default value: 1
*/
#ifndef JERRY_PROPERTY_HASHMAP
-# define JERRY_PROPERTY_HASHMAP 1
+#define JERRY_PROPERTY_HASHMAP 1
#endif /* !defined (JERRY_PROPERTY_HASHMAP) */
/**
@@ -363,7 +363,7 @@
* Default value: 0
*/
#ifndef JERRY_PROMISE_CALLBACK
-# define JERRY_PROMISE_CALLBACK 0
+#define JERRY_PROMISE_CALLBACK 0
#endif /* !defined (JERRY_PROMISE_CALLBACK) */
/**
@@ -379,7 +379,7 @@
* Default value: 0
*/
#ifndef JERRY_REGEXP_DUMP_BYTE_CODE
-# define JERRY_REGEXP_DUMP_BYTE_CODE 0
+#define JERRY_REGEXP_DUMP_BYTE_CODE 0
#endif /* !defined (JERRY_REGEXP_DUMP_BYTE_CODE) */
/**
@@ -388,7 +388,7 @@
* Default value: 0
*/
#ifndef JERRY_REGEXP_STRICT_MODE
-# define JERRY_REGEXP_STRICT_MODE 0
+#define JERRY_REGEXP_STRICT_MODE 0
#endif /* !defined (JERRY_REGEXP_STRICT_MODE) */
/**
@@ -401,7 +401,7 @@
* Default value: 0
*/
#ifndef JERRY_SNAPSHOT_EXEC
-# define JERRY_SNAPSHOT_EXEC 0
+#define JERRY_SNAPSHOT_EXEC 0
#endif /* !defined (JERRY_SNAPSHOT_EXEC) */
/**
@@ -412,7 +412,7 @@
* 1: Enable snapshot save functions.
*/
#ifndef JERRY_SNAPSHOT_SAVE
-# define JERRY_SNAPSHOT_SAVE 0
+#define JERRY_SNAPSHOT_SAVE 0
#endif /* !defined (JERRY_SNAPSHOT_SAVE) */
/**
@@ -425,7 +425,7 @@
* Default value: 0
*/
#ifndef JERRY_SYSTEM_ALLOCATOR
-# define JERRY_SYSTEM_ALLOCATOR 0
+#define JERRY_SYSTEM_ALLOCATOR 0
#endif /* !defined (JERRY_SYSTEM_ALLOCATOR) */
/**
@@ -433,7 +433,7 @@
* By default Unicode case conversion is enabled.
*/
#ifndef JERRY_UNICODE_CASE_CONVERSION
-# define JERRY_UNICODE_CASE_CONVERSION 1
+#define JERRY_UNICODE_CASE_CONVERSION 1
#endif /* !defined (JERRY_UNICODE_CASE_CONVERSION) */
/**
@@ -444,7 +444,7 @@
* 1: Enable the Valgrind specific allocation notifications.
*/
#ifndef JERRY_VALGRIND
-# define JERRY_VALGRIND 0
+#define JERRY_VALGRIND 0
#endif /* !defined (JERRY_VALGRIND) */
/**
@@ -455,7 +455,7 @@
* 1: Enable vm exec stop callback support.
*/
#ifndef JERRY_VM_EXEC_STOP
-# define JERRY_VM_EXEC_STOP 0
+#define JERRY_VM_EXEC_STOP 0
#endif /* !defined (JERRY_VM_EXEC_STOP) */
/**
@@ -466,7 +466,7 @@
* 1: Enable vm throw callback support.
*/
#ifndef JERRY_VM_THROW
-# define JERRY_VM_THROW 0
+#define JERRY_VM_THROW 0
#endif /* !defined (JERRY_VM_THROW) */
/**
@@ -487,7 +487,7 @@
* # define JERRY_ATTR_CONST_DATA __attribute__((section(".rodata.const")))
*/
#ifndef JERRY_ATTR_CONST_DATA
-# define JERRY_ATTR_CONST_DATA
+#define JERRY_ATTR_CONST_DATA
#endif /* !defined (JERRY_ATTR_CONST_DATA) */
/**
@@ -497,7 +497,7 @@
* #define JERRY_ATTR_GLOBAL_HEAP __attribute__((section(".text.globalheap")))
*/
#ifndef JERRY_ATTR_GLOBAL_HEAP
-# define JERRY_ATTR_GLOBAL_HEAP
+#define JERRY_ATTR_GLOBAL_HEAP
#endif /* !defined (JERRY_ATTR_GLOBAL_HEAP) */
/**
@@ -508,232 +508,194 @@
/**
* Check base builtins.
*/
-#if !defined (JERRY_BUILTIN_ANNEXB) \
-|| ((JERRY_BUILTIN_ANNEXB != 0) && (JERRY_BUILTIN_ANNEXB != 1))
-# error "Invalid value for JERRY_BUILTIN_ANNEXB macro."
-#endif
-#if !defined (JERRY_BUILTIN_ARRAY) \
-|| ((JERRY_BUILTIN_ARRAY != 0) && (JERRY_BUILTIN_ARRAY != 1))
-# error "Invalid value for JERRY_BUILTIN_ARRAY macro."
-#endif
-#if !defined (JERRY_BUILTIN_BOOLEAN) \
-|| ((JERRY_BUILTIN_BOOLEAN != 0) && (JERRY_BUILTIN_BOOLEAN != 1))
-# error "Invalid value for JERRY_BUILTIN_BOOLEAN macro."
-#endif
-#if !defined (JERRY_BUILTIN_DATE) \
-|| ((JERRY_BUILTIN_DATE != 0) && (JERRY_BUILTIN_DATE != 1))
-# error "Invalid value for JERRY_BUILTIN_DATE macro."
-#endif
-#if !defined (JERRY_BUILTIN_ERRORS) \
-|| ((JERRY_BUILTIN_ERRORS != 0) && (JERRY_BUILTIN_ERRORS != 1))
-# error "Invalid value for JERRY_BUILTIN_ERRORS macro."
-#endif
-#if !defined (JERRY_BUILTIN_JSON) \
-|| ((JERRY_BUILTIN_JSON != 0) && (JERRY_BUILTIN_JSON != 1))
-# error "Invalid value for JERRY_BUILTIN_JSON macro."
-#endif
-#if !defined (JERRY_BUILTIN_MATH) \
-|| ((JERRY_BUILTIN_MATH != 0) && (JERRY_BUILTIN_MATH != 1))
-# error "Invalid value for JERRY_BUILTIN_MATH macro."
-#endif
-#if !defined (JERRY_BUILTIN_NUMBER) \
-|| ((JERRY_BUILTIN_NUMBER != 0) && (JERRY_BUILTIN_NUMBER != 1))
-# error "Invalid value for JERRY_BUILTIN_NUMBER macro."
-#endif
-#if !defined (JERRY_BUILTIN_REGEXP) \
-|| ((JERRY_BUILTIN_REGEXP != 0) && (JERRY_BUILTIN_REGEXP != 1))
-# error "Invalid value for JERRY_BUILTIN_REGEXP macro."
-#endif
-#if !defined (JERRY_BUILTIN_STRING) \
-|| ((JERRY_BUILTIN_STRING != 0) && (JERRY_BUILTIN_STRING != 1))
-# error "Invalid value for JERRY_BUILTIN_STRING macro."
-#endif
-#if !defined (JERRY_BUILTINS) \
-|| ((JERRY_BUILTINS != 0) && (JERRY_BUILTINS != 1))
-# error "Invalid value for JERRY_BUILTINS macro."
-#endif
+#if (JERRY_BUILTIN_ANNEXB != 0) && (JERRY_BUILTIN_ANNEXB != 1)
+#error "Invalid value for JERRY_BUILTIN_ANNEXB macro."
+#endif /* (JERRY_BUILTIN_ANNEXB != 0) && (JERRY_BUILTIN_ANNEXB != 1) */
+#if (JERRY_BUILTIN_ARRAY != 0) && (JERRY_BUILTIN_ARRAY != 1)
+#error "Invalid value for JERRY_BUILTIN_ARRAY macro."
+#endif /* (JERRY_BUILTIN_ARRAY != 0) && (JERRY_BUILTIN_ARRAY != 1) */
+#if (JERRY_BUILTIN_BOOLEAN != 0) && (JERRY_BUILTIN_BOOLEAN != 1)
+#error "Invalid value for JERRY_BUILTIN_BOOLEAN macro."
+#endif /* (JERRY_BUILTIN_BOOLEAN != 0) && (JERRY_BUILTIN_BOOLEAN != 1) */
+#if (JERRY_BUILTIN_DATE != 0) && (JERRY_BUILTIN_DATE != 1)
+#error "Invalid value for JERRY_BUILTIN_DATE macro."
+#endif /* (JERRY_BUILTIN_DATE != 0) && (JERRY_BUILTIN_DATE != 1) */
+#if (JERRY_BUILTIN_ERRORS != 0) && (JERRY_BUILTIN_ERRORS != 1)
+#error "Invalid value for JERRY_BUILTIN_ERRORS macro."
+#endif /* (JERRY_BUILTIN_ERRORS != 0) && (JERRY_BUILTIN_ERRORS != 1) */
+#if (JERRY_BUILTIN_JSON != 0) && (JERRY_BUILTIN_JSON != 1)
+#error "Invalid value for JERRY_BUILTIN_JSON macro."
+#endif /* (JERRY_BUILTIN_JSON != 0) && (JERRY_BUILTIN_JSON != 1) */
+#if (JERRY_BUILTIN_MATH != 0) && (JERRY_BUILTIN_MATH != 1)
+#error "Invalid value for JERRY_BUILTIN_MATH macro."
+#endif /* (JERRY_BUILTIN_MATH != 0) && (JERRY_BUILTIN_MATH != 1) */
+#if (JERRY_BUILTIN_NUMBER != 0) && (JERRY_BUILTIN_NUMBER != 1)
+#error "Invalid value for JERRY_BUILTIN_NUMBER macro."
+#endif /* (JERRY_BUILTIN_NUMBER != 0) && (JERRY_BUILTIN_NUMBER != 1) */
+#if (JERRY_BUILTIN_REGEXP != 0) && (JERRY_BUILTIN_REGEXP != 1)
+#error "Invalid value for JERRY_BUILTIN_REGEXP macro."
+#endif /* (JERRY_BUILTIN_REGEXP != 0) && (JERRY_BUILTIN_REGEXP != 1) */
+#if (JERRY_BUILTIN_STRING != 0) && (JERRY_BUILTIN_STRING != 1)
+#error "Invalid value for JERRY_BUILTIN_STRING macro."
+#endif /* (JERRY_BUILTIN_STRING != 0) && (JERRY_BUILTIN_STRING != 1) */
+#if (JERRY_BUILTINS != 0) && (JERRY_BUILTINS != 1)
+#error "Invalid value for JERRY_BUILTINS macro."
+#endif /* (JERRY_BUILTINS != 0) && (JERRY_BUILTINS != 1) */
/**
* Check ES2015+ features
*/
-#if !defined (JERRY_ESNEXT) \
-|| ((JERRY_ESNEXT != 0) && (JERRY_ESNEXT != 1))
-# error "Invalid value for JERRY_ESNEXT macro."
-#endif
-#if !defined (JERRY_BUILTIN_REALMS) \
-|| ((JERRY_BUILTIN_REALMS != 0) && (JERRY_BUILTIN_REALMS != 1))
-# error "Invalid value for JERRY_BUILTIN_REALMS macro."
-#endif
-#if !defined (JERRY_BUILTIN_DATAVIEW) \
-|| ((JERRY_BUILTIN_DATAVIEW != 0) && (JERRY_BUILTIN_DATAVIEW != 1))
-# error "Invalid value for JERRY_BUILTIN_DATAVIEW macro."
-#endif
-#if !defined (JERRY_BUILTIN_GLOBAL_THIS) \
-|| ((JERRY_BUILTIN_GLOBAL_THIS != 0) && (JERRY_BUILTIN_GLOBAL_THIS != 1))
-# error "Invalid value for JERRY_BUILTIN_GLOBAL_THIS macro."
-#endif /* !defined (JERRY_BUILTIN_GLOBAL_THIS) */
-#if !defined (JERRY_BUILTIN_REFLECT) \
-|| ((JERRY_BUILTIN_REFLECT != 0) && (JERRY_BUILTIN_REFLECT != 1))
-# error "Invalid value for JERRY_BUILTIN_REFLECT macro."
-#endif
-#if !defined (JERRY_BUILTIN_WEAKREF) \
-|| ((JERRY_BUILTIN_WEAKREF != 0) && (JERRY_BUILTIN_WEAKREF != 1))
-# error "Invalid value for JERRY_BUILTIN_WEAKREF macro."
-#endif
-#if !defined (JERRY_BUILTIN_PROXY) \
-|| ((JERRY_BUILTIN_PROXY != 0) && (JERRY_BUILTIN_PROXY != 1))
-# error "Invalid value for JERRY_BUILTIN_PROXY macro."
-#endif
-#if !defined (JERRY_BUILTIN_TYPEDARRAY) \
-|| ((JERRY_BUILTIN_TYPEDARRAY != 0) && (JERRY_BUILTIN_TYPEDARRAY != 1))
-# error "Invalid value for JERRY_BUILTIN_TYPEDARRAY macro."
-#endif
-#if !defined (JERRY_BUILTIN_SHAREDARRAYBUFFER) \
-|| ((JERRY_BUILTIN_SHAREDARRAYBUFFER != 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER != 1))
-# error "Invalid value for JERRY_BUILTIN_SHAREDARRAYBUFFER macro."
-#endif
-#if !defined (JERRY_BUILTIN_ATOMICS) \
-|| ((JERRY_BUILTIN_ATOMICS != 0) && (JERRY_BUILTIN_ATOMICS != 1))
-# error "Invalid value for JERRY_BUILTIN_ATOMICS macro."
-#endif
-#if !defined (JERRY_BUILTIN_BIGINT) \
-|| ((JERRY_BUILTIN_BIGINT != 0) && (JERRY_BUILTIN_BIGINT != 1))
-# error "Invalid value for JERRY_BUILTIN_BIGINT macro."
-#endif
-#if !defined (JERRY_MODULE_SYSTEM) \
-|| ((JERRY_MODULE_SYSTEM != 0) && (JERRY_MODULE_SYSTEM != 1))
-# error "Invalid value for JERRY_MODULE_SYSTEM macro."
-#endif
-#if (JERRY_ESNEXT == 0) \
-&& ((JERRY_BUILTIN_DATAVIEW == 1) \
-|| (JERRY_BUILTIN_CONTAINER == 1) \
-|| (JERRY_BUILTIN_PROXY == 1) \
-|| (JERRY_BUILTIN_REFLECT == 1) \
-|| (JERRY_BUILTIN_TYPEDARRAY == 1) \
-|| (JERRY_BUILTIN_WEAKREF == 1))
-# error "JERRY_ESNEXT should be enabled too to enable JERRY_BUILTIN_xxxxx macro."
-#endif
+#if (JERRY_ESNEXT != 0) && (JERRY_ESNEXT != 1)
+#error "Invalid value for JERRY_ESNEXT macro."
+#endif /* (JERRY_ESNEXT != 0) && (JERRY_ESNEXT != 1) */
+#if (JERRY_BUILTIN_REALMS != 0) && (JERRY_BUILTIN_REALMS != 1)
+#error "Invalid value for JERRY_BUILTIN_REALMS macro."
+#endif /* (JERRY_BUILTIN_REALMS != 0) && (JERRY_BUILTIN_REALMS != 1) */
+#if (JERRY_BUILTIN_DATAVIEW != 0) && (JERRY_BUILTIN_DATAVIEW != 1)
+#error "Invalid value for JERRY_BUILTIN_DATAVIEW macro."
+#endif /* (JERRY_BUILTIN_DATAVIEW != 0) && (JERRY_BUILTIN_DATAVIEW != 1) */
+#if (JERRY_BUILTIN_GLOBAL_THIS != 0) && (JERRY_BUILTIN_GLOBAL_THIS != 1)
+#error "Invalid value for JERRY_BUILTIN_GLOBAL_THIS macro."
+#endif /* (JERRY_BUILTIN_GLOBAL_THIS != 0) && (JERRY_BUILTIN_GLOBAL_THIS != 1) */
+#if (JERRY_BUILTIN_REFLECT != 0) && (JERRY_BUILTIN_REFLECT != 1)
+#error "Invalid value for JERRY_BUILTIN_REFLECT macro."
+#endif /* (JERRY_BUILTIN_REFLECT != 0) && (JERRY_BUILTIN_REFLECT != 1) */
+#if (JERRY_BUILTIN_WEAKREF != 0) && (JERRY_BUILTIN_WEAKREF != 1)
+#error "Invalid value for JERRY_BUILTIN_WEAKREF macro."
+#endif /* (JERRY_BUILTIN_WEAKREF != 0) && (JERRY_BUILTIN_WEAKREF != 1) */
+#if (JERRY_BUILTIN_PROXY != 0) && (JERRY_BUILTIN_PROXY != 1)
+#error "Invalid value for JERRY_BUILTIN_PROXY macro."
+#endif /* (JERRY_BUILTIN_PROXY != 0) && (JERRY_BUILTIN_PROXY != 1) */
+#if (JERRY_BUILTIN_TYPEDARRAY != 0) && (JERRY_BUILTIN_TYPEDARRAY != 1)
+#error "Invalid value for JERRY_BUILTIN_TYPEDARRAY macro."
+#endif /* (JERRY_BUILTIN_TYPEDARRAY != 0) && (JERRY_BUILTIN_TYPEDARRAY != 1) */
+#if (JERRY_BUILTIN_SHAREDARRAYBUFFER != 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER != 1)
+#error "Invalid value for JERRY_BUILTIN_SHAREDARRAYBUFFER macro."
+#endif /* (JERRY_BUILTIN_SHAREDARRAYBUFFER != 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER != 1) */
+#if (JERRY_BUILTIN_ATOMICS != 0) && (JERRY_BUILTIN_ATOMICS != 1)
+#error "Invalid value for JERRY_BUILTIN_ATOMICS macro."
+#endif /* (JERRY_BUILTIN_ATOMICS != 0) && (JERRY_BUILTIN_ATOMICS != 1) */
+#if (JERRY_BUILTIN_BIGINT != 0) && (JERRY_BUILTIN_BIGINT != 1)
+#error "Invalid value for JERRY_BUILTIN_BIGINT macro."
+#endif /* (JERRY_BUILTIN_BIGINT != 0) && (JERRY_BUILTIN_BIGINT != 1) */
+#if (JERRY_MODULE_SYSTEM != 0) && (JERRY_MODULE_SYSTEM != 1)
+#error "Invalid value for JERRY_MODULE_SYSTEM macro."
+#endif /* (JERRY_MODULE_SYSTEM != 0) && (JERRY_MODULE_SYSTEM != 1) */
+#if (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_DATAVIEW == 1)
+#error "JERRY_ESNEXT should be enabled too to enable JERRY_BUILTIN_DATAVIEW macro."
+#endif /* (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_DATAVIEW == 1) */
+#if (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_CONTAINER == 1)
+#error "JERRY_ESNEXT should be enabled too to enable JERRY_BUILTIN_CONTAINER macro."
+#endif /* (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_CONTAINER == 1) */
+#if (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_PROXY == 1)
+#error "JERRY_ESNEXT should be enabled too to enable JERRY_BUILTIN_PROXY macro."
+#endif /* (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_PROXY == 1) */
+#if (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_REFLECT == 1)
+#error "JERRY_ESNEXT should be enabled too to enable JERRY_BUILTIN_REFLECT macro."
+#endif /* (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_REFLECT == 1) */
+#if (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_TYPEDARRAY == 1)
+#error "JERRY_ESNEXT should be enabled too to enable JERRY_BUILTIN_TYPEDARRAY macro."
+#endif /* (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_TYPEDARRAY == 1) */
+#if (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_WEAKREF == 1)
+#error "JERRY_ESNEXT should be enabled too to enable JERRY_BUILTIN_WEAKREF macro."
+#endif /* (JERRY_ESNEXT == 0) && (JERRY_BUILTIN_WEAKREF == 1) */
#if (JERRY_ESNEXT == 0) && (JERRY_MODULE_SYSTEM == 1)
-# error "JERRY_ESNEXT should be enabled too to enable JERRY_MODULE_SYSTEM macro."
-#endif
+#error "JERRY_ESNEXT should be enabled too to enable JERRY_MODULE_SYSTEM macro."
+#endif /* (JERRY_ESNEXT == 0) && (JERRY_MODULE_SYSTEM == 1) */
#if (JERRY_BUILTIN_TYPEDARRAY == 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER == 1)
-# error "JERRY_BUILTIN_TYPEDARRAY should be enabled too to enable JERRY_BUILTIN_SHAREDARRAYBUFFER macro."
-#endif
+#error "JERRY_BUILTIN_TYPEDARRAY should be enabled too to enable JERRY_BUILTIN_SHAREDARRAYBUFFER macro."
+#endif /* (JERRY_BUILTIN_TYPEDARRAY == 0) && (JERRY_BUILTIN_SHAREDARRAYBUFFER == 1) */
#if (JERRY_BUILTIN_SHAREDARRAYBUFFER == 0) && (JERRY_BUILTIN_ATOMICS == 1)
-# error "JERRY_BUILTIN_SHAREDARRAYBUFFER should be enabled too to enable JERRY_BUILTIN_ATOMICS macro."
-#endif
+#error "JERRY_BUILTIN_SHAREDARRAYBUFFER should be enabled too to enable JERRY_BUILTIN_ATOMICS macro."
+#endif /* (JERRY_BUILTIN_SHAREDARRAYBUFFER == 0) && (JERRY_BUILTIN_ATOMICS == 1) */
/**
* Internal options.
*/
-#if !defined (JERRY_CPOINTER_32_BIT) \
-|| ((JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1))
-# error "Invalid value for 'JERRY_CPOINTER_32_BIT' macro."
-#endif
-#if !defined (JERRY_DEBUGGER) \
-|| ((JERRY_DEBUGGER != 0) && (JERRY_DEBUGGER != 1))
-# error "Invalid value for 'JERRY_DEBUGGER' macro."
-#endif
-#if !defined (JERRY_ERROR_MESSAGES) \
-|| ((JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1))
-# error "Invalid value for 'JERRY_ERROR_MESSAGES' macro."
-#endif
-#if !defined (JERRY_EXTERNAL_CONTEXT) \
-|| ((JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1))
-# error "Invalid value for 'JERRY_EXTERNAL_CONTEXT' macro."
-#endif
-#if !defined (JERRY_GLOBAL_HEAP_SIZE) || (JERRY_GLOBAL_HEAP_SIZE <= 0)
-# error "Invalid value for 'JERRY_GLOBAL_HEAP_SIZE' macro."
-#endif
-#if !defined (JERRY_GC_LIMIT) || (JERRY_GC_LIMIT < 0)
-# error "Invalid value for 'JERRY_GC_LIMIT' macro."
-#endif
-#if !defined (JERRY_STACK_LIMIT) || (JERRY_STACK_LIMIT < 0)
-# error "Invalid value for 'JERRY_STACK_LIMIT' macro."
-#endif
-#if !defined (JERRY_GC_MARK_LIMIT) || (JERRY_GC_MARK_LIMIT < 0)
-# error "Invalid value for 'JERRY_GC_MARK_LIMIT' macro."
-#endif
-#if !defined (JERRY_LCACHE) \
-|| ((JERRY_LCACHE != 0) && (JERRY_LCACHE != 1))
-# error "Invalid value for 'JERRY_LCACHE' macro."
-#endif
-#if !defined (JERRY_FUNCTION_TO_STRING) \
-|| ((JERRY_FUNCTION_TO_STRING != 0) && (JERRY_FUNCTION_TO_STRING != 1))
-# error "Invalid value for 'JERRY_FUNCTION_TO_STRING' macro."
-#endif
-#if !defined (JERRY_LINE_INFO) \
-|| ((JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1))
-# error "Invalid value for 'JERRY_LINE_INFO' macro."
-#endif
-#if !defined (JERRY_LOGGING) \
-|| ((JERRY_LOGGING != 0) && (JERRY_LOGGING != 1))
-# error "Invalid value for 'JERRY_LOGGING' macro."
-#endif
-#if !defined (JERRY_MEM_GC_BEFORE_EACH_ALLOC) \
-|| ((JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1))
-# error "Invalid value for 'JERRY_MEM_GC_BEFORE_EACH_ALLOC' macro."
-#endif
-#if !defined (JERRY_MEM_STATS) \
-|| ((JERRY_MEM_STATS != 0) && (JERRY_MEM_STATS != 1))
-# error "Invalid value for 'JERRY_MEM_STATS' macro."
-#endif
-#if !defined (JERRY_NUMBER_TYPE_FLOAT64) \
-|| ((JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1))
-# error "Invalid value for 'JERRY_NUMBER_TYPE_FLOAT64' macro."
-#endif
-#if !defined (JERRY_PARSER) \
-|| ((JERRY_PARSER != 0) && (JERRY_PARSER != 1))
-# error "Invalid value for 'JERRY_PARSER' macro."
-#endif
-#if !defined (JERRY_PARSER_DUMP_BYTE_CODE) \
-|| ((JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1))
-# error "Invalid value for 'JERRY_PARSER_DUMP_BYTE_CODE' macro."
-#endif
-#if !defined (JERRY_PROPERTY_HASHMAP) \
-|| ((JERRY_PROPERTY_HASHMAP != 0) && (JERRY_PROPERTY_HASHMAP != 1))
-# error "Invalid value for 'JERRY_PROPERTY_HASHMAP' macro."
-#endif
-#if !defined (JERRY_PROMISE_CALLBACK) \
-|| ((JERRY_PROMISE_CALLBACK != 0) && (JERRY_PROMISE_CALLBACK != 1))
-# error "Invalid value for 'JERRY_PROMISE_CALLBACK' macro."
-#endif
-#if !defined (JERRY_REGEXP_DUMP_BYTE_CODE) \
-|| ((JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1))
-# error "Invalid value for 'JERRY_REGEXP_DUMP_BYTE_CODE' macro."
-#endif
-#if !defined (JERRY_REGEXP_STRICT_MODE) \
-|| ((JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1))
-# error "Invalid value for 'JERRY_REGEXP_STRICT_MODE' macro."
-#endif
-#if !defined (JERRY_SNAPSHOT_EXEC) \
-|| ((JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1))
-# error "Invalid value for 'JERRY_SNAPSHOT_EXEC' macro."
-#endif
-#if !defined (JERRY_SNAPSHOT_SAVE) \
-|| ((JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1))
-# error "Invalid value for 'JERRY_SNAPSHOT_SAVE' macro."
-#endif
-#if !defined (JERRY_SYSTEM_ALLOCATOR) \
-|| ((JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1))
-# error "Invalid value for 'JERRY_SYSTEM_ALLOCATOR' macro."
-#endif
-#if !defined (JERRY_UNICODE_CASE_CONVERSION) \
-|| ((JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1))
-# error "Invalid value for 'JERRY_UNICODE_CASE_CONVERSION' macro."
-#endif
-#if !defined (JERRY_VALGRIND) \
-|| ((JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1))
-# error "Invalid value for 'JERRY_VALGRIND' macro."
-#endif
-#if !defined (JERRY_VM_EXEC_STOP) \
-|| ((JERRY_VM_EXEC_STOP != 0) && (JERRY_VM_EXEC_STOP != 1))
-# error "Invalid value for 'JERRY_VM_EXEC_STOP' macro."
-#endif
-#if !defined (JERRY_VM_THROW) \
-|| ((JERRY_VM_THROW != 0) && (JERRY_VM_THROW != 1))
-# error "Invalid value for 'JERRY_VM_THROW' macro."
-#endif
+#if (JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1)
+#error "Invalid value for 'JERRY_CPOINTER_32_BIT' macro."
+#endif /* (JERRY_CPOINTER_32_BIT != 0) && (JERRY_CPOINTER_32_BIT != 1) */
+#if (JERRY_DEBUGGER != 0) && (JERRY_DEBUGGER != 1)
+#error "Invalid value for 'JERRY_DEBUGGER' macro."
+#endif /* (JERRY_DEBUGGER != 0) && (JERRY_DEBUGGER != 1) */
+#if (JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1)
+#error "Invalid value for 'JERRY_ERROR_MESSAGES' macro."
+#endif /* (JERRY_ERROR_MESSAGES != 0) && (JERRY_ERROR_MESSAGES != 1) */
+#if (JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1)
+#error "Invalid value for 'JERRY_EXTERNAL_CONTEXT' macro."
+#endif /* (JERRY_EXTERNAL_CONTEXT != 0) && (JERRY_EXTERNAL_CONTEXT != 1) */
+#if JERRY_GLOBAL_HEAP_SIZE <= 0
+#error "Invalid value for 'JERRY_GLOBAL_HEAP_SIZE' macro."
+#endif /* JERRY_GLOBAL_HEAP_SIZE <= 0 */
+#if JERRY_GC_LIMIT < 0
+#error "Invalid value for 'JERRY_GC_LIMIT' macro."
+#endif /* JERRY_GC_LIMIT < 0 */
+#if JERRY_STACK_LIMIT < 0
+#error "Invalid value for 'JERRY_STACK_LIMIT' macro."
+#endif /* JERRY_STACK_LIMIT < 0 */
+#if JERRY_GC_MARK_LIMIT < 0
+#error "Invalid value for 'JERRY_GC_MARK_LIMIT' macro."
+#endif /* JERRY_GC_MARK_LIMIT < 0 */
+#if (JERRY_LCACHE != 0) && (JERRY_LCACHE != 1)
+#error "Invalid value for 'JERRY_LCACHE' macro."
+#endif /* (JERRY_LCACHE != 0) && (JERRY_LCACHE != 1) */
+#if (JERRY_FUNCTION_TO_STRING != 0) && (JERRY_FUNCTION_TO_STRING != 1)
+#error "Invalid value for 'JERRY_FUNCTION_TO_STRING' macro."
+#endif /* (JERRY_FUNCTION_TO_STRING != 0) && (JERRY_FUNCTION_TO_STRING != 1) */
+#if (JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1)
+#error "Invalid value for 'JERRY_LINE_INFO' macro."
+#endif /* (JERRY_LINE_INFO != 0) && (JERRY_LINE_INFO != 1) */
+#if (JERRY_LOGGING != 0) && (JERRY_LOGGING != 1)
+#error "Invalid value for 'JERRY_LOGGING' macro."
+#endif /* (JERRY_LOGGING != 0) && (JERRY_LOGGING != 1) */
+#if (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1)
+#error "Invalid value for 'JERRY_MEM_GC_BEFORE_EACH_ALLOC' macro."
+#endif /* (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 0) && (JERRY_MEM_GC_BEFORE_EACH_ALLOC != 1) */
+#if (JERRY_MEM_STATS != 0) && (JERRY_MEM_STATS != 1)
+#error "Invalid value for 'JERRY_MEM_STATS' macro."
+#endif /* (JERRY_MEM_STATS != 0) && (JERRY_MEM_STATS != 1) */
+#if (JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1)
+#error "Invalid value for 'JERRY_NUMBER_TYPE_FLOAT64' macro."
+#endif /* (JERRY_NUMBER_TYPE_FLOAT64 != 0) && (JERRY_NUMBER_TYPE_FLOAT64 != 1) */
+#if (JERRY_PARSER != 0) && (JERRY_PARSER != 1)
+#error "Invalid value for 'JERRY_PARSER' macro."
+#endif /* (JERRY_PARSER != 0) && (JERRY_PARSER != 1) */
+#if (JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1)
+#error "Invalid value for 'JERRY_PARSER_DUMP_BYTE_CODE' macro."
+#endif /* (JERRY_PARSER_DUMP_BYTE_CODE != 0) && (JERRY_PARSER_DUMP_BYTE_CODE != 1) */
+#if (JERRY_PROPERTY_HASHMAP != 0) && (JERRY_PROPERTY_HASHMAP != 1)
+#error "Invalid value for 'JERRY_PROPERTY_HASHMAP' macro."
+#endif /* (JERRY_PROPERTY_HASHMAP != 0) && (JERRY_PROPERTY_HASHMAP != 1) */
+#if (JERRY_PROMISE_CALLBACK != 0) && (JERRY_PROMISE_CALLBACK != 1)
+#error "Invalid value for 'JERRY_PROMISE_CALLBACK' macro."
+#endif /* (JERRY_PROMISE_CALLBACK != 0) && (JERRY_PROMISE_CALLBACK != 1) */
+#if (JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1)
+#error "Invalid value for 'JERRY_REGEXP_DUMP_BYTE_CODE' macro."
+#endif /* (JERRY_REGEXP_DUMP_BYTE_CODE != 0) && (JERRY_REGEXP_DUMP_BYTE_CODE != 1) */
+#if (JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1)
+#error "Invalid value for 'JERRY_REGEXP_STRICT_MODE' macro."
+#endif /* (JERRY_REGEXP_STRICT_MODE != 0) && (JERRY_REGEXP_STRICT_MODE != 1) */
+#if (JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1)
+#error "Invalid value for 'JERRY_SNAPSHOT_EXEC' macro."
+#endif /* (JERRY_SNAPSHOT_EXEC != 0) && (JERRY_SNAPSHOT_EXEC != 1) */
+#if (JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1)
+#error "Invalid value for 'JERRY_SNAPSHOT_SAVE' macro."
+#endif /* (JERRY_SNAPSHOT_SAVE != 0) && (JERRY_SNAPSHOT_SAVE != 1) */
+#if (JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1)
+#error "Invalid value for 'JERRY_SYSTEM_ALLOCATOR' macro."
+#endif /* (JERRY_SYSTEM_ALLOCATOR != 0) && (JERRY_SYSTEM_ALLOCATOR != 1) */
+#if (JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1)
+#error "Invalid value for 'JERRY_UNICODE_CASE_CONVERSION' macro."
+#endif /* (JERRY_UNICODE_CASE_CONVERSION != 0) && (JERRY_UNICODE_CASE_CONVERSION != 1) */
+#if (JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1)
+#error "Invalid value for 'JERRY_VALGRIND' macro."
+#endif /* (JERRY_VALGRIND != 0) && (JERRY_VALGRIND != 1) */
+#if (JERRY_VM_EXEC_STOP != 0) && (JERRY_VM_EXEC_STOP != 1)
+#error "Invalid value for 'JERRY_VM_EXEC_STOP' macro."
+#endif /* (JERRY_VM_EXEC_STOP != 0) && (JERRY_VM_EXEC_STOP != 1) */
+#if (JERRY_VM_THROW != 0) && (JERRY_VM_THROW != 1)
+#error "Invalid value for 'JERRY_VM_THROW' macro."
+#endif /* (JERRY_VM_THROW != 0) && (JERRY_VM_THROW != 1) */
/**
* Cross component requirements check.
@@ -743,23 +705,23 @@
* The date module can only use the float 64 number types.
*/
#if JERRY_BUILTIN_DATE && !JERRY_NUMBER_TYPE_FLOAT64
-# error "Date does not support float32"
-#endif
+#error "Date does not support float32"
+#endif /* JERRY_BUILTIN_DATE && !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Promise support must be enabled if Promise callback support is enabled.
*/
#if JERRY_PROMISE_CALLBACK && !JERRY_ESNEXT
-# error "Promise callback support depends on ESNext support"
+#error "Promise callback support depends on ESNext support"
#endif /* JERRY_PROMISE_CALLBACK && !JERRY_ESNEXT */
/**
* Resource name related types into a single guard
*/
#if JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM
-# define JERRY_RESOURCE_NAME 1
-#else
-# define JERRY_RESOURCE_NAME 0
-#endif
+#define JERRY_RESOURCE_NAME 1
+#else /* !(JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM) */
+#define JERRY_RESOURCE_NAME 0
+#endif /* JERRY_LINE_INFO || JERRY_ERROR_MESSAGES || JERRY_MODULE_SYSTEM */
#endif /* !JERRYSCRIPT_CONFIG_H */
diff --git a/jerry-core/debugger/debugger.c b/jerry-core/debugger/debugger.c
index 13caf14a..02ee9880 100644
--- a/jerry-core/debugger/debugger.c
+++ b/jerry-core/debugger/debugger.c
@@ -13,16 +13,19 @@
* limitations under the License.
*/
-#include "byte-code.h"
#include "debugger.h"
+
+#include "jerryscript-debugger.h"
+
#include "ecma-array-object.h"
#include "ecma-builtin-helpers.h"
#include "ecma-conversion.h"
#include "ecma-eval.h"
#include "ecma-function-object.h"
#include "ecma-objects.h"
+
+#include "byte-code.h"
#include "jcontext.h"
-#include "jerryscript-debugger.h"
#include "lit-char-helpers.h"
#if JERRY_DEBUGGER
@@ -39,16 +42,14 @@ typedef struct
* The number of message types in the debugger should reflect the
* debugger versioning.
*/
-JERRY_STATIC_ASSERT (JERRY_DEBUGGER_MESSAGES_OUT_MAX_COUNT == 33
- && JERRY_DEBUGGER_MESSAGES_IN_MAX_COUNT == 21
- && JERRY_DEBUGGER_VERSION == 9,
+JERRY_STATIC_ASSERT (JERRY_DEBUGGER_MESSAGES_OUT_MAX_COUNT == 33 && JERRY_DEBUGGER_MESSAGES_IN_MAX_COUNT == 21
+ && JERRY_DEBUGGER_VERSION == 9,
debugger_version_correlates_to_message_type_count);
/**
* Waiting for data from the client.
*/
-#define JERRY_DEBUGGER_RECEIVE_DATA_MODE \
- (JERRY_DEBUGGER_BREAKPOINT_MODE | JERRY_DEBUGGER_CLIENT_SOURCE_MODE)
+#define JERRY_DEBUGGER_RECEIVE_DATA_MODE (JERRY_DEBUGGER_BREAKPOINT_MODE | JERRY_DEBUGGER_CLIENT_SOURCE_MODE)
/**
* Type cast the debugger send buffer into a specific type.
@@ -59,8 +60,7 @@ JERRY_STATIC_ASSERT (JERRY_DEBUGGER_MESSAGES_OUT_MAX_COUNT == 33
/**
* Type cast the debugger receive buffer into a specific type.
*/
-#define JERRY_DEBUGGER_RECEIVE_BUFFER_AS(type, name_p) \
- type *name_p = ((type *) recv_buffer_p)
+#define JERRY_DEBUGGER_RECEIVE_BUFFER_AS(type, name_p) type *name_p = ((type *) recv_buffer_p)
/**
* Free all unreferenced byte code structures which
@@ -71,17 +71,15 @@ jerry_debugger_free_unreferenced_byte_code (void)
{
jerry_debugger_byte_code_free_t *byte_code_free_p;
- byte_code_free_p = JMEM_CP_GET_POINTER (jerry_debugger_byte_code_free_t,
- JERRY_CONTEXT (debugger_byte_code_free_tail));
+ byte_code_free_p =
+ JMEM_CP_GET_POINTER (jerry_debugger_byte_code_free_t, JERRY_CONTEXT (debugger_byte_code_free_tail));
while (byte_code_free_p != NULL)
{
jerry_debugger_byte_code_free_t *prev_byte_code_free_p;
- prev_byte_code_free_p = JMEM_CP_GET_POINTER (jerry_debugger_byte_code_free_t,
- byte_code_free_p->prev_cp);
+ prev_byte_code_free_p = JMEM_CP_GET_POINTER (jerry_debugger_byte_code_free_t, byte_code_free_p->prev_cp);
- jmem_heap_free_block (byte_code_free_p,
- ((size_t) byte_code_free_p->size) << JMEM_ALIGNMENT_LOG);
+ jmem_heap_free_block (byte_code_free_p, ((size_t) byte_code_free_p->size) << JMEM_ALIGNMENT_LOG);
byte_code_free_p = prev_byte_code_free_p;
}
@@ -488,8 +486,7 @@ jerry_debugger_send_scope_variables (const uint8_t *recv_buffer_p) /**< pointer
continue;
}
- ecma_string_t *prop_name = ecma_string_from_property_name (prop_iter_p->types[i],
- prop_pair_p->names_cp[i]);
+ ecma_string_t *prop_name = ecma_string_from_property_name (prop_iter_p->types[i], prop_pair_p->names_cp[i]);
if (!jerry_debugger_copy_variables_to_string_message (JERRY_DEBUGGER_VALUE_NONE,
prop_name,
@@ -509,10 +506,7 @@ jerry_debugger_send_scope_variables (const uint8_t *recv_buffer_p) /**< pointer
ecma_string_t *str_p = ecma_op_to_string (prop_value_p.value);
JERRY_ASSERT (str_p != NULL);
- if (!jerry_debugger_copy_variables_to_string_message (variable_type,
- str_p,
- message_string_p,
- &buffer_pos))
+ if (!jerry_debugger_copy_variables_to_string_message (variable_type, str_p, message_string_p, &buffer_pos))
{
ecma_deref_ecma_string (str_p);
return;
@@ -591,21 +585,17 @@ jerry_debugger_send_eval (const lit_utf8_byte_t *eval_string_p, /**< evaluated s
if (ecma_is_value_object (result))
{
- message = ecma_op_object_find (ecma_get_object_from_value (result),
- ecma_get_magic_string (LIT_MAGIC_STRING_MESSAGE));
+ message =
+ ecma_op_object_find (ecma_get_object_from_value (result), ecma_get_magic_string (LIT_MAGIC_STRING_MESSAGE));
- if (!ecma_is_value_string (message)
- || ecma_string_is_empty (ecma_get_string_from_value (message)))
+ if (!ecma_is_value_string (message) || ecma_string_is_empty (ecma_get_string_from_value (message)))
{
ecma_free_value (message);
lit_magic_string_id_t id = ecma_object_get_class_name (ecma_get_object_from_value (result));
ecma_free_value (result);
const lit_utf8_byte_t *string_p = lit_get_magic_string_utf8 (id);
- jerry_debugger_send_string (JERRY_DEBUGGER_EVAL_RESULT,
- type,
- string_p,
- strlen ((const char *) string_p));
+ jerry_debugger_send_string (JERRY_DEBUGGER_EVAL_RESULT, type, string_p, strlen ((const char *) string_p));
return false;
}
}
@@ -635,12 +625,12 @@ jerry_debugger_send_eval (const lit_utf8_byte_t *eval_string_p, /**< evaluated s
/**
* Check received packet size.
*/
-#define JERRY_DEBUGGER_CHECK_PACKET_SIZE(type) \
- if (message_size != sizeof (type)) \
- { \
+#define JERRY_DEBUGGER_CHECK_PACKET_SIZE(type) \
+ if (message_size != sizeof (type)) \
+ { \
JERRY_ERROR_MSG ("Invalid message size\n"); \
- jerry_debugger_transport_close (); \
- return false; \
+ jerry_debugger_transport_close (); \
+ return false; \
}
/**
@@ -658,8 +648,7 @@ jerry_debugger_process_message (const uint8_t *recv_buffer_p, /**< pointer to th
{
/* Process the received message. */
- if (recv_buffer_p[0] >= JERRY_DEBUGGER_CONTINUE
- && !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
+ if (recv_buffer_p[0] >= JERRY_DEBUGGER_CONTINUE && !(JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_BREAKPOINT_MODE))
{
JERRY_ERROR_MSG ("Message requires breakpoint mode\n");
jerry_debugger_transport_close ();
@@ -704,9 +693,7 @@ jerry_debugger_process_message (const uint8_t *recv_buffer_p, /**< pointer to th
}
lit_utf8_byte_t *string_p = (lit_utf8_byte_t *) (uint8_data_p + 1);
- memcpy (string_p + uint8_data_p->uint8_offset,
- (lit_utf8_byte_t *) (uint8_data_part_p + 1),
- message_size);
+ memcpy (string_p + uint8_data_p->uint8_offset, (lit_utf8_byte_t *) (uint8_data_part_p + 1), message_size);
if (message_size < expected_data)
{
@@ -754,8 +741,7 @@ jerry_debugger_process_message (const uint8_t *recv_buffer_p, /**< pointer to th
}
jerry_debugger_byte_code_free_t *byte_code_free_p;
- byte_code_free_p = JMEM_CP_GET_NON_NULL_POINTER (jerry_debugger_byte_code_free_t,
- byte_code_free_cp);
+ byte_code_free_p = JMEM_CP_GET_NON_NULL_POINTER (jerry_debugger_byte_code_free_t, byte_code_free_cp);
if (byte_code_free_p->prev_cp != ECMA_NULL_POINTER)
{
@@ -771,8 +757,7 @@ jerry_debugger_process_message (const uint8_t *recv_buffer_p, /**< pointer to th
jmem_stats_free_byte_code_bytes (((size_t) byte_code_free_p->size) << JMEM_ALIGNMENT_LOG);
#endif /* JERRY_MEM_STATS */
- jmem_heap_free_block (byte_code_free_p,
- ((size_t) byte_code_free_p->size) << JMEM_ALIGNMENT_LOG);
+ jmem_heap_free_block (byte_code_free_p, ((size_t) byte_code_free_p->size) << JMEM_ALIGNMENT_LOG);
return true;
}
@@ -1023,8 +1008,8 @@ jerry_debugger_process_message (const uint8_t *recv_buffer_p, /**< pointer to th
client_source_data_p = (jerry_debugger_uint8_data_t *) jmem_heap_alloc_block (client_source_data_size);
client_source_data_p->uint8_size = client_source_size;
- client_source_data_p->uint8_offset = (uint32_t) (message_size
- - sizeof (jerry_debugger_receive_client_source_first_t));
+ client_source_data_p->uint8_offset =
+ (uint32_t) (message_size - sizeof (jerry_debugger_receive_client_source_first_t));
lit_utf8_byte_t *client_source_string_p = (lit_utf8_byte_t *) (client_source_data_p + 1);
memcpy (client_source_string_p,
@@ -1193,8 +1178,7 @@ jerry_debugger_breakpoint_hit (uint8_t message_type) /**< message type */
if (uint8_data != NULL)
{
- jmem_heap_free_block (uint8_data,
- uint8_data->uint8_size + sizeof (jerry_debugger_uint8_data_t));
+ jmem_heap_free_block (uint8_data, uint8_data->uint8_size + sizeof (jerry_debugger_uint8_data_t));
}
JERRY_DEBUGGER_CLEAR_FLAGS (JERRY_DEBUGGER_BREAKPOINT_MODE);
@@ -1460,13 +1444,13 @@ jerry_debugger_exception_object_to_string (ecma_value_t exception_obj_value) /**
string_id = LIT_MAGIC_STRING_TYPE_ERROR_UL;
break;
}
- #if JERRY_ESNEXT
+#if JERRY_ESNEXT
case ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE:
{
string_id = LIT_MAGIC_STRING_AGGREGATE_ERROR_UL;
break;
}
- #endif /* JERRY_ESNEXT */
+#endif /* JERRY_ESNEXT */
case ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE:
{
string_id = LIT_MAGIC_STRING_URI_ERROR_UL;
@@ -1544,10 +1528,8 @@ jerry_debugger_send_exception_string (ecma_value_t exception_value)
ECMA_STRING_TO_UTF8_STRING (string_p, string_data_p, string_size);
- bool result = jerry_debugger_send_string (JERRY_DEBUGGER_EXCEPTION_STR,
- JERRY_DEBUGGER_NO_SUBTYPE,
- string_data_p,
- string_size);
+ bool result =
+ jerry_debugger_send_string (JERRY_DEBUGGER_EXCEPTION_STR, JERRY_DEBUGGER_NO_SUBTYPE, string_data_p, string_size);
ECMA_FINALIZE_UTF8_STRING (string_data_p, string_size);
diff --git a/jerry-core/debugger/debugger.h b/jerry-core/debugger/debugger.h
index cd45e3ab..f4469fd3 100644
--- a/jerry-core/debugger/debugger.h
+++ b/jerry-core/debugger/debugger.h
@@ -16,9 +16,10 @@
#ifndef DEBUGGER_H
#define DEBUGGER_H
-#include "ecma-globals.h"
#include "jerryscript-debugger-transport.h"
+#include "ecma-globals.h"
+
#if JERRY_DEBUGGER
/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */
@@ -51,8 +52,7 @@
/**
* Calculate the size of a message when a count number of items transmitted.
*/
-#define JERRY_DEBUGGER_SEND_SIZE(count, type) \
- ((size_t) ((count * sizeof (type)) + sizeof (jerry_debugger_send_type_t)))
+#define JERRY_DEBUGGER_SEND_SIZE(count, type) ((size_t) ((count * sizeof (type)) + sizeof (jerry_debugger_send_type_t)))
/**
* Debugger operation modes:
@@ -113,8 +113,8 @@ typedef enum
* Set and clear debugger flags.
*/
#define JERRY_DEBUGGER_UPDATE_FLAGS(flags_to_set, flags_to_clear) \
- JERRY_CONTEXT (debugger_flags) = ((JERRY_CONTEXT (debugger_flags) | (uint32_t) (flags_to_set)) \
- & (uint32_t) ~(flags_to_clear))
+ JERRY_CONTEXT (debugger_flags) = \
+ ((JERRY_CONTEXT (debugger_flags) | (uint32_t) (flags_to_set)) & (uint32_t) ~(flags_to_clear))
/**
* Types for the package.
@@ -455,7 +455,7 @@ typedef struct
/**
* Incoming message: get scope variables
-*/
+ */
typedef struct
{
uint8_t type; /**< type of the message */
diff --git a/jerry-core/ecma/base/ecma-alloc.c b/jerry-core/ecma/base/ecma-alloc.c
index 6d5d8d9b..970b05ee 100644
--- a/jerry-core/ecma/base/ecma-alloc.c
+++ b/jerry-core/ecma/base/ecma-alloc.c
@@ -14,10 +14,12 @@
*/
#include "ecma-alloc.h"
-#include "ecma-globals.h"
+
#include "ecma-gc.h"
-#include "jrt.h"
+#include "ecma-globals.h"
+
#include "jmem.h"
+#include "jrt.h"
JERRY_STATIC_ASSERT (sizeof (ecma_property_value_t) == sizeof (ecma_value_t),
size_of_ecma_property_value_t_must_be_equal_to_size_of_ecma_value_t);
@@ -51,7 +53,7 @@ JERRY_STATIC_ASSERT (sizeof (ecma_extended_object_t) - sizeof (ecma_object_t) <=
*
* @return pointer to allocated memory
*/
-extern inline ecma_number_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_number_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_number (void)
{
return (ecma_number_t *) jmem_pools_alloc (sizeof (ecma_number_t));
@@ -71,7 +73,7 @@ ecma_dealloc_number (ecma_number_t *number_p) /**< number to be freed */
*
* @return pointer to allocated memory
*/
-extern inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_object (void)
{
#if JERRY_MEM_STATS
@@ -99,7 +101,7 @@ ecma_dealloc_object (ecma_object_t *object_p) /**< object to be freed */
*
* @return pointer to allocated memory
*/
-extern inline ecma_extended_object_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_extended_object_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_extended_object (size_t size) /**< size of object */
{
#if JERRY_MEM_STATS
@@ -128,7 +130,7 @@ ecma_dealloc_extended_object (ecma_object_t *object_p, /**< extended object */
*
* @return pointer to allocated memory
*/
-extern inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string (void)
{
#if JERRY_MEM_STATS
@@ -156,7 +158,7 @@ ecma_dealloc_string (ecma_string_t *string_p) /**< string to be freed */
*
* @return pointer to allocated memory
*/
-extern inline ecma_extended_string_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_extended_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_extended_string (void)
{
#if JERRY_MEM_STATS
@@ -184,7 +186,7 @@ ecma_dealloc_extended_string (ecma_extended_string_t *ext_string_p) /**< extende
*
* @return pointer to allocated memory
*/
-extern inline ecma_external_string_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_external_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_external_string (void)
{
#if JERRY_MEM_STATS
@@ -212,7 +214,7 @@ ecma_dealloc_external_string (ecma_external_string_t *ext_string_p) /**< externa
*
* @return pointer to allocated memory
*/
-extern inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_string_buffer (size_t size) /**< size of string */
{
#if JERRY_MEM_STATS
@@ -241,7 +243,7 @@ ecma_dealloc_string_buffer (ecma_string_t *string_p, /**< string with data */
*
* @return pointer to allocated memory
*/
-extern inline ecma_property_pair_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_property_pair_t *JERRY_ATTR_ALWAYS_INLINE
ecma_alloc_property_pair (void)
{
#if JERRY_MEM_STATS
diff --git a/jerry-core/ecma/base/ecma-errors.c b/jerry-core/ecma/base/ecma-errors.c
index 27189eaf..eea386bd 100644
--- a/jerry-core/ecma/base/ecma-errors.c
+++ b/jerry-core/ecma/base/ecma-errors.c
@@ -11,7 +11,7 @@
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
- */
+ */
#include "ecma-errors.h"
@@ -20,114 +20,114 @@
/**
* Error message, if an argument is has an error flag
*/
-const char * const ecma_error_value_msg_p = "Argument cannot be marked as error";
+const char* const ecma_error_value_msg_p = "Argument cannot be marked as error";
/**
* Error message, if an argument has a wrong type
*/
-const char * const ecma_error_wrong_args_msg_p = "This type of argument is not allowed";
+const char* const ecma_error_wrong_args_msg_p = "This type of argument is not allowed";
#if !JERRY_PARSER
/**
* Error message, if parsing is disabled
*/
-const char * const ecma_error_parser_not_supported_p = "Source code parsing is disabled";
+const char* const ecma_error_parser_not_supported_p = "Source code parsing is disabled";
#endif /* !JERRY_PARSER */
#if !JERRY_BUILTIN_JSON
/**
* Error message, if JSON support is disabled
*/
-const char * const ecma_error_json_not_supported_p = "JSON support is disabled";
+const char* const ecma_error_json_not_supported_p = "JSON support is disabled";
#endif /* !JERRY_BUILTIN_JSON */
#if !JERRY_ESNEXT
/**
* Error message, if Symbol support is disabled
*/
-const char * const ecma_error_symbol_not_supported_p = "Symbol support is disabled";
+const char* const ecma_error_symbol_not_supported_p = "Symbol support is disabled";
/**
* Error message, if Promise support is disabled
*/
-const char * const ecma_error_promise_not_supported_p = "Promise support is disabled";
+const char* const ecma_error_promise_not_supported_p = "Promise support is disabled";
#endif /* !JERRY_ESNEXT */
#if !JERRY_BUILTIN_TYPEDARRAY
/**
* Error message, if TypedArray support is disabled
*/
-const char * const ecma_error_typed_array_not_supported_p = "TypedArray support is disabled";
+const char* const ecma_error_typed_array_not_supported_p = "TypedArray support is disabled";
#endif /* !JERRY_BUILTIN_TYPEDARRAY */
#if !JERRY_BUILTIN_SHAREDARRAYBUFFER
/**
* Error message, if SharedArrayBuffer support is disabled
*/
-const char * const ecma_error_shared_arraybuffer_not_supported_p = "SharedArrayBuffer support is disabled";
+const char* const ecma_error_shared_arraybuffer_not_supported_p = "SharedArrayBuffer support is disabled";
#endif /* !JERRY_BUILTIN_SHAREDARRAYBUFFER */
#if !JERRY_BUILTIN_DATAVIEW
/**
* Error message, if DataView support is disabled
*/
-const char * const ecma_error_data_view_not_supported_p = "DataView support is disabled";
+const char* const ecma_error_data_view_not_supported_p = "DataView support is disabled";
#endif /* !JERRY_BUILTIN_DATAVIEW */
#if !JERRY_BUILTIN_BIGINT
/**
* Error message, if BigInt support is disabled
*/
-const char * const ecma_error_bigint_not_supported_p = "BigInt support is disabled";
+const char* const ecma_error_bigint_not_supported_p = "BigInt support is disabled";
#endif /* !JERRY_BUILTIN_BIGINT */
#if !JERRY_BUILTIN_CONTAINER
/**
* Error message, if Container support is disabled
*/
-const char * const ecma_error_container_not_supported_p = "Container support is disabled";
+const char* const ecma_error_container_not_supported_p = "Container support is disabled";
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_MODULE_SYSTEM
/**
* Error message, if argument is not a module
*/
-const char * const ecma_error_not_module_p = "Argument is not a module";
+const char* const ecma_error_not_module_p = "Argument is not a module";
/**
* Error message, if a native module export is not found
*/
-const char * const ecma_error_unknown_export_p = "Native module export not found";
+const char* const ecma_error_unknown_export_p = "Native module export not found";
#else /* !JERRY_MODULE_SYSTEM */
/**
* Error message, if Module support is disabled
*/
-const char * const ecma_error_module_not_supported_p = "Module support is disabled";
+const char* const ecma_error_module_not_supported_p = "Module support is disabled";
#endif /* JERRY_MODULE_SYSTEM */
/**
- * Error message, if callback function is not callable
- */
-const char * const ecma_error_callback_is_not_callable = "Callback function is not callable";
+ * Error message, if callback function is not callable
+ */
+const char* const ecma_error_callback_is_not_callable = "Callback function is not callable";
/**
* Error message, if arrayBuffer is detached
*/
-const char * const ecma_error_arraybuffer_is_detached = "ArrayBuffer has been detached";
+const char* const ecma_error_arraybuffer_is_detached = "ArrayBuffer has been detached";
/**
* Error message, cannot convert undefined or null to object
*/
-const char * const ecma_error_cannot_convert_to_object = "Cannot convert undefined or null to object";
+const char* const ecma_error_cannot_convert_to_object = "Cannot convert undefined or null to object";
/**
* Error message, prototype property of a class is non-configurable
*/
-const char * const ecma_error_class_is_non_configurable = "Prototype property of a class is non-configurable";
+const char* const ecma_error_class_is_non_configurable = "Prototype property of a class is non-configurable";
/**
* Error message, argument is not an object
*/
-const char * const ecma_error_argument_is_not_an_object = "Argument is not an object";
+const char* const ecma_error_argument_is_not_an_object = "Argument is not an object";
/**
* Error message length of 'ecma_error_argument_is_not_an_object'
@@ -137,45 +137,45 @@ const int ecma_error_argument_is_not_an_object_length = 25;
/**
* Error message, argument is not a Proxy object
*/
-const char * const ecma_error_argument_is_not_a_proxy = "Argument is not a Proxy object";
+const char* const ecma_error_argument_is_not_a_proxy = "Argument is not a Proxy object";
/**
* Error message, target is not a constructor
*/
-const char * const ecma_error_target_is_not_a_constructor = "Target is not a constructor";
+const char* const ecma_error_target_is_not_a_constructor = "Target is not a constructor";
/**
* Error message, argument is not an regexp
*/
-const char * const ecma_error_argument_is_not_an_regexp = "Argument 'this' is not a RegExp object";
+const char* const ecma_error_argument_is_not_an_regexp = "Argument 'this' is not a RegExp object";
/**
* Error message, invalid array length
*/
-const char * const ecma_error_invalid_array_length = "Invalid Array length";
+const char* const ecma_error_invalid_array_length = "Invalid Array length";
/**
* Error message, local variable is redeclared
*/
-const char * const ecma_error_local_variable_is_redeclared = "Local variable is redeclared";
+const char* const ecma_error_local_variable_is_redeclared = "Local variable is redeclared";
/**
* Error message, expected a function
*/
-const char * const ecma_error_expected_a_function = "Expected a function";
+const char* const ecma_error_expected_a_function = "Expected a function";
#if JERRY_ESNEXT
/**
* Error message, class constructor invoked without new keyword
*/
-const char * const ecma_error_class_constructor_new = "Class constructor cannot be invoked without 'new'";
+const char* const ecma_error_class_constructor_new = "Class constructor cannot be invoked without 'new'";
/**
* Error message, variables declared by let/const must be initialized before reading their value
*/
-const char * const ecma_error_let_const_not_initialized = ("Variables declared by let/const must be"
- " initialized before reading their value");
+const char* const ecma_error_let_const_not_initialized = ("Variables declared by let/const must be"
+ " initialized before reading their value");
#endif /* JERRY_ESNEXT */
@@ -186,31 +186,31 @@ const char * const ecma_error_let_const_not_initialized = ("Variables declared b
/**
* Error message, maximum snapshot size reached
*/
-const char * const ecma_error_maximum_snapshot_size = "Maximum snapshot size reached";
+const char* const ecma_error_maximum_snapshot_size = "Maximum snapshot size reached";
/**
* Error message, regular expressions literals are not supported
*/
-const char * const ecma_error_regular_expression_not_supported = "Regular expression literals are not supported";
+const char* const ecma_error_regular_expression_not_supported = "Regular expression literals are not supported";
/**
* Error message, snapshot buffer too small
*/
-const char * const ecma_error_snapshot_buffer_small = "Snapshot buffer too small";
+const char* const ecma_error_snapshot_buffer_small = "Snapshot buffer too small";
/**
* Error message, Unsupported generate snapshot flags specified
*/
-const char * const ecma_error_snapshot_flag_not_supported = "Unsupported generate snapshot flags specified";
+const char* const ecma_error_snapshot_flag_not_supported = "Unsupported generate snapshot flags specified";
/**
* Error message, Cannot allocate memory for literals
*/
-const char * const ecma_error_cannot_allocate_memory_literals = "Cannot allocate memory for literals";
+const char* const ecma_error_cannot_allocate_memory_literals = "Cannot allocate memory for literals";
/**
* Error message, Unsupported feature: tagged template literals
*/
-const char * const ecma_error_tagged_template_literals = "Unsupported feature: tagged template literals";
+const char* const ecma_error_tagged_template_literals = "Unsupported feature: tagged template literals";
#endif /* JERRY_SNAPSHOT_SAVE || JERRY_SNAPSHOT_EXEC */
diff --git a/jerry-core/ecma/base/ecma-errors.h b/jerry-core/ecma/base/ecma-errors.h
index 8cab743e..6adba1d5 100644
--- a/jerry-core/ecma/base/ecma-errors.h
+++ b/jerry-core/ecma/base/ecma-errors.h
@@ -20,75 +20,75 @@
#if JERRY_ERROR_MESSAGES
-extern const char * const ecma_error_value_msg_p;
-extern const char * const ecma_error_wrong_args_msg_p;
+extern const char* const ecma_error_value_msg_p;
+extern const char* const ecma_error_wrong_args_msg_p;
#if !JERRY_PARSER
-extern const char * const ecma_error_parser_not_supported_p;
+extern const char* const ecma_error_parser_not_supported_p;
#endif /* !JERRY_PARSER */
#if !JERRY_BUILTIN_JSON
-extern const char * const ecma_error_json_not_supported_p;
+extern const char* const ecma_error_json_not_supported_p;
#endif /* !JERRY_BUILTIN_JSON */
#if !JERRY_ESNEXT
-extern const char * const ecma_error_symbol_not_supported_p;
+extern const char* const ecma_error_symbol_not_supported_p;
-extern const char * const ecma_error_promise_not_supported_p;
+extern const char* const ecma_error_promise_not_supported_p;
#endif /* !JERRY_ESNEXT */
#if !JERRY_BUILTIN_TYPEDARRAY
-extern const char * const ecma_error_typed_array_not_supported_p;
+extern const char* const ecma_error_typed_array_not_supported_p;
#endif /* !JERRY_BUILTIN_TYPEDARRAY */
#if !JERRY_BUILTIN_SHAREDARRAYBUFFER
-extern const char * const ecma_error_shared_arraybuffer_not_supported_p;
+extern const char* const ecma_error_shared_arraybuffer_not_supported_p;
#endif /* !JERRY_BUILTIN_SHAREDARRAYBUFFER */
#if !JERRY_BUILTIN_DATAVIEW
-extern const char * const ecma_error_data_view_not_supported_p;
+extern const char* const ecma_error_data_view_not_supported_p;
#endif /* !JERRY_BUILTIN_DATAVIEW */
#if !JERRY_BUILTIN_BIGINT
-extern const char * const ecma_error_bigint_not_supported_p;
+extern const char* const ecma_error_bigint_not_supported_p;
#endif /* !JERRY_BUILTIN_BIGINT */
#if !JERRY_BUILTIN_CONTAINER
-extern const char * const ecma_error_container_not_supported_p;
+extern const char* const ecma_error_container_not_supported_p;
#endif /* !JERRY_BUILTIN_CONTAINER */
#if JERRY_MODULE_SYSTEM
-extern const char * const ecma_error_not_module_p;
-extern const char * const ecma_error_unknown_export_p;
+extern const char* const ecma_error_not_module_p;
+extern const char* const ecma_error_unknown_export_p;
#else /* !JERRY_MODULE_SYSTEM */
-extern const char * const ecma_error_module_not_supported_p;
+extern const char* const ecma_error_module_not_supported_p;
#endif /* JERRY_MODULE_SYSTEM */
-extern const char * const ecma_error_callback_is_not_callable;
-extern const char * const ecma_error_arraybuffer_is_detached;
-extern const char * const ecma_error_cannot_convert_to_object;
-extern const char * const ecma_error_class_is_non_configurable;
-extern const char * const ecma_error_argument_is_not_an_object;
+extern const char* const ecma_error_callback_is_not_callable;
+extern const char* const ecma_error_arraybuffer_is_detached;
+extern const char* const ecma_error_cannot_convert_to_object;
+extern const char* const ecma_error_class_is_non_configurable;
+extern const char* const ecma_error_argument_is_not_an_object;
extern const int ecma_error_argument_is_not_an_object_length;
-extern const char * const ecma_error_argument_is_not_a_proxy;
-extern const char * const ecma_error_target_is_not_a_constructor;
-extern const char * const ecma_error_argument_is_not_an_regexp;
-extern const char * const ecma_error_invalid_array_length;
-extern const char * const ecma_error_local_variable_is_redeclared;
-extern const char * const ecma_error_expected_a_function;
+extern const char* const ecma_error_argument_is_not_a_proxy;
+extern const char* const ecma_error_target_is_not_a_constructor;
+extern const char* const ecma_error_argument_is_not_an_regexp;
+extern const char* const ecma_error_invalid_array_length;
+extern const char* const ecma_error_local_variable_is_redeclared;
+extern const char* const ecma_error_expected_a_function;
#if JERRY_ESNEXT
-extern const char * const ecma_error_class_constructor_new;
-extern const char * const ecma_error_let_const_not_initialized;
+extern const char* const ecma_error_class_constructor_new;
+extern const char* const ecma_error_let_const_not_initialized;
#endif /* JERRY_ESNEXT */
#endif /* JERRY_ERROR_MESSAGES */
/* snapshot errors */
-extern const char * const ecma_error_maximum_snapshot_size;
-extern const char * const ecma_error_regular_expression_not_supported;
-extern const char * const ecma_error_snapshot_buffer_small;
-extern const char * const ecma_error_snapshot_flag_not_supported;
-extern const char * const ecma_error_cannot_allocate_memory_literals;
-extern const char * const ecma_error_tagged_template_literals;
-#endif /* !ECMA_ERRORS_H */
+extern const char* const ecma_error_maximum_snapshot_size;
+extern const char* const ecma_error_regular_expression_not_supported;
+extern const char* const ecma_error_snapshot_buffer_small;
+extern const char* const ecma_error_snapshot_flag_not_supported;
+extern const char* const ecma_error_cannot_allocate_memory_literals;
+extern const char* const ecma_error_tagged_template_literals;
+#endif /* !ECMA_ERRORS_H */
diff --git a/jerry-core/ecma/base/ecma-extended-info.c b/jerry-core/ecma/base/ecma-extended-info.c
index b5fabf58..75181612 100644
--- a/jerry-core/ecma/base/ecma-extended-info.c
+++ b/jerry-core/ecma/base/ecma-extended-info.c
@@ -13,10 +13,12 @@
* limitations under the License.
*/
-#include "byte-code.h"
-#include "ecma-helpers.h"
#include "ecma-extended-info.h"
+#include "ecma-helpers.h"
+
+#include "byte-code.h"
+
#if JERRY_ESNEXT || JERRY_FUNCTION_TO_STRING
/** \addtogroup ecma ECMA
@@ -41,8 +43,7 @@ ecma_extended_info_decode_vlq (uint8_t **buffer_p) /**< [in/out] target buffer *
{
source_p--;
value = (value << ECMA_EXTENDED_INFO_VLQ_SHIFT) | (*source_p & ECMA_EXTENDED_INFO_VLQ_MASK);
- }
- while (*source_p & ECMA_EXTENDED_INFO_VLQ_CONTINUE);
+ } while (*source_p & ECMA_EXTENDED_INFO_VLQ_CONTINUE);
*buffer_p = source_p;
return value;
@@ -71,8 +72,7 @@ ecma_extended_info_encode_vlq (uint8_t **buffer_p, /**< target buffer */
{
current_value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT;
length++;
- }
- while (current_value > 0);
+ } while (current_value > 0);
destination_p -= length;
*buffer_p = destination_p;
@@ -81,8 +81,7 @@ ecma_extended_info_encode_vlq (uint8_t **buffer_p, /**< target buffer */
{
*destination_p++ = (uint8_t) (value | ECMA_EXTENDED_INFO_VLQ_CONTINUE);
value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT;
- }
- while (value > 0);
+ } while (value > 0);
**buffer_p &= ECMA_EXTENDED_INFO_VLQ_MASK;
} /* ecma_extended_info_encode_vlq */
@@ -101,8 +100,7 @@ ecma_extended_info_get_encoded_length (uint32_t value) /**< encoded value */
{
value >>= ECMA_EXTENDED_INFO_VLQ_SHIFT;
length++;
- }
- while (value > 0);
+ } while (value > 0);
return length;
} /* ecma_extended_info_get_encoded_length */
diff --git a/jerry-core/ecma/base/ecma-extended-info.h b/jerry-core/ecma/base/ecma-extended-info.h
index c9fc1c90..95fbcab4 100644
--- a/jerry-core/ecma/base/ecma-extended-info.h
+++ b/jerry-core/ecma/base/ecma-extended-info.h
@@ -23,10 +23,10 @@
* @{
*/
-#if JERRY_ESNEXT || JERRY_FUNCTION_TO_STRING
-
#include "ecma-globals.h"
+#if JERRY_ESNEXT || JERRY_FUNCTION_TO_STRING
+
/**
* Vlq encoding: flag which is set for all bytes except the last one.
*/
diff --git a/jerry-core/ecma/base/ecma-gc.c b/jerry-core/ecma/base/ecma-gc.c
index 2bd2e7fc..83dc808b 100644
--- a/jerry-core/ecma/base/ecma-gc.c
+++ b/jerry-core/ecma/base/ecma-gc.c
@@ -17,6 +17,8 @@
* Garbage collector implementation
*/
+#include "ecma-gc.h"
+
#include "ecma-alloc.h"
#include "ecma-array-object.h"
#include "ecma-arraybuffer-object.h"
@@ -24,16 +26,16 @@
#include "ecma-container-object.h"
#include "ecma-function-object.h"
#include "ecma-globals.h"
-#include "ecma-gc.h"
#include "ecma-helpers.h"
#include "ecma-lcache.h"
#include "ecma-objects.h"
#include "ecma-property-hashmap.h"
#include "ecma-proxy-object.h"
+
#include "jcontext.h"
-#include "jrt.h"
-#include "jrt-libc-includes.h"
#include "jrt-bit-fields.h"
+#include "jrt-libc-includes.h"
+#include "jrt.h"
#include "re-compiler.h"
#include "vm-defines.h"
#include "vm-stack.h"
@@ -300,8 +302,7 @@ ecma_gc_mark_properties (ecma_object_t *object_p, /**< object */
if (!ECMA_PROPERTY_IS_INTERNAL (property))
{
- JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_DELETED
- || property == ECMA_PROPERTY_TYPE_HASHMAP);
+ JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_DELETED || property == ECMA_PROPERTY_TYPE_HASHMAP);
continue;
}
@@ -314,8 +315,8 @@ ecma_gc_mark_properties (ecma_object_t *object_p, /**< object */
case LIT_INTERNAL_MAGIC_STRING_ENVIRONMENT_RECORD:
{
ecma_environment_record_t *environment_record_p;
- environment_record_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_environment_record_t,
- property_pair_p->values[index].value);
+ environment_record_p =
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_environment_record_t, property_pair_p->values[index].value);
if (environment_record_p->this_binding != ECMA_VALUE_UNINITIALIZED)
{
@@ -397,8 +398,7 @@ ecma_gc_mark_properties (ecma_object_t *object_p, /**< object */
{
ecma_gc_set_object_visited (ecma_get_object_from_value (*value_p));
}
- }
- while (++value_p < end_p);
+ } while (++value_p < end_p);
if (property & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL)
{
@@ -406,8 +406,7 @@ ecma_gc_mark_properties (ecma_object_t *object_p, /**< object */
}
item_p = &(((ecma_native_pointer_chain_t *) item_p)->next_p->data);
- }
- while (item_p != NULL);
+ } while (item_p != NULL);
break;
}
@@ -460,8 +459,8 @@ ecma_gc_mark_bound_function_object (ecma_object_t *object_p) /**< bound function
ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) object_p;
ecma_object_t *target_func_p;
- target_func_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- bound_func_p->header.u.bound_function.target_function);
+ target_func_p =
+ ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);
ecma_gc_set_object_visited (target_func_p);
@@ -547,12 +546,11 @@ ecma_gc_mark_map_object (ecma_object_t *object_p) /**< object */
JERRY_ASSERT (object_p != NULL);
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);
uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);
- for (uint32_t i = 0; i < entry_count; i+= ECMA_CONTAINER_PAIR_SIZE)
+ for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_PAIR_SIZE)
{
ecma_container_pair_t *entry_p = (ecma_container_pair_t *) (start_p + i);
@@ -582,12 +580,11 @@ ecma_gc_mark_weakmap_object (ecma_object_t *object_p) /**< object */
JERRY_ASSERT (object_p != NULL);
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);
uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);
- for (uint32_t i = 0; i < entry_count; i+= ECMA_CONTAINER_PAIR_SIZE)
+ for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_PAIR_SIZE)
{
ecma_container_pair_t *entry_p = (ecma_container_pair_t *) (start_p + i);
@@ -598,8 +595,7 @@ ecma_gc_mark_weakmap_object (ecma_object_t *object_p) /**< object */
JERRY_ASSERT (ecma_is_value_object (entry_p->key));
- if (ecma_is_value_object (entry_p->value)
- && ecma_gc_is_object_visited (ecma_get_object_from_value (entry_p->key)))
+ if (ecma_is_value_object (entry_p->value) && ecma_gc_is_object_visited (ecma_get_object_from_value (entry_p->key)))
{
ecma_gc_set_object_visited (ecma_get_object_from_value (entry_p->value));
}
@@ -615,12 +611,11 @@ ecma_gc_mark_set_object (ecma_object_t *object_p) /**< object */
JERRY_ASSERT (object_p != NULL);
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
ecma_value_t *start_p = ECMA_CONTAINER_START (container_p);
uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);
- for (uint32_t i = 0; i < entry_count; i+= ECMA_CONTAINER_VALUE_SIZE)
+ for (uint32_t i = 0; i < entry_count; i += ECMA_CONTAINER_VALUE_SIZE)
{
ecma_value_t *entry_p = start_p + i;
@@ -728,8 +723,7 @@ ecma_gc_mark_executable_object (ecma_object_t *object_p) /**< object */
do
{
ecma_gc_set_object_visited (ecma_get_object_from_value (*(--context_top_p)));
- }
- while (context_top_p > last_item_p);
+ } while (context_top_p > last_item_p);
continue;
}
@@ -750,8 +744,7 @@ ecma_gc_mark_executable_object (ecma_object_t *object_p) /**< object */
JERRY_ASSERT (context_top_p >= context_end_p + offsets);
context_top_p -= offsets;
- }
- while (context_top_p > context_end_p);
+ } while (context_top_p > context_end_p);
}
register_end_p = executable_object_p->frame_ctx.stack_top_p;
@@ -891,8 +884,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
case ECMA_OBJECT_CLASS_SCRIPT:
{
const ecma_compiled_code_t *compiled_code_p;
- compiled_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- ext_object_p->u.cls.u3.value);
+ compiled_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);
JERRY_ASSERT (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION));
ecma_gc_mark_compiled_code (((cbc_uint8_arguments_t *) compiled_code_p)->script_value);
@@ -910,8 +902,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
case ECMA_OBJECT_CLASS_MODULE_NAMESPACE:
{
JERRY_ASSERT (proto_cp == JMEM_CP_NULL);
- ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t,
- ext_object_p->u.cls.u3.value));
+ ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, ext_object_p->u.cls.u3.value));
ecma_gc_mark_properties (object_p, true);
return;
}
@@ -1114,8 +1105,8 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
case ECMA_OBJECT_TYPE_FUNCTION:
{
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) object_p;
- ecma_gc_set_object_visited (ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- ext_func_p->u.function.scope_cp));
+ ecma_gc_set_object_visited (
+ ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_func_p->u.function.scope_cp));
const ecma_compiled_code_t *compiled_code_p = ecma_op_function_get_compiled_code (ext_func_p);
@@ -1249,8 +1240,7 @@ ecma_gc_mark (ecma_object_t *object_p) /**< object to mark from */
case ECMA_OBJECT_TYPE_NATIVE_FUNCTION:
{
ecma_native_function_t *native_function_p = (ecma_native_function_t *) object_p;
- ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t,
- native_function_p->realm_value));
+ ecma_gc_set_object_visited (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, native_function_p->realm_value));
break;
}
#endif /* JERRY_BUILTIN_REALMS */
@@ -1322,8 +1312,7 @@ ecma_gc_free_native_pointer (ecma_property_t property, /**< property descriptor
jmem_heap_free_block (item_p, sizeof (ecma_native_pointer_chain_t));
item_p = next_p;
- }
- while (item_p != NULL);
+ } while (item_p != NULL);
} /* ecma_gc_free_native_pointer */
/**
@@ -1347,8 +1336,8 @@ ecma_free_arguments_object (ecma_extended_object_t *ext_object_p) /**< arguments
if (!(mapped_arguments_p->unmapped.header.u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE))
#endif /* JERRY_SNAPSHOT_EXEC */
{
- ecma_compiled_code_t *byte_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- mapped_arguments_p->u.byte_code);
+ ecma_compiled_code_t *byte_code_p =
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, mapped_arguments_p->u.byte_code);
ecma_bytecode_deref (byte_code_p);
}
@@ -1363,8 +1352,7 @@ ecma_free_arguments_object (ecma_extended_object_t *ext_object_p) /**< arguments
ecma_free_value_if_not_object (argv_p[i]);
}
- uint32_t saved_argument_count = JERRY_MAX (arguments_number,
- arguments_p->header.u.cls.u2.formal_params_number);
+ uint32_t saved_argument_count = JERRY_MAX (arguments_number, arguments_p->header.u.cls.u2.formal_params_number);
return object_size + (saved_argument_count * sizeof (ecma_value_t));
} /* ecma_free_arguments_object */
@@ -1485,8 +1473,7 @@ ecma_gc_free_executable_object (ecma_object_t *object_p) /**< object */
do
{
ecma_free_value_if_not_object (*(--context_top_p));
- }
- while (context_top_p > last_item_p);
+ } while (context_top_p > last_item_p);
continue;
}
@@ -1506,8 +1493,7 @@ ecma_gc_free_executable_object (ecma_object_t *object_p) /**< object */
}
context_top_p = vm_stack_context_abort (&executable_object_p->frame_ctx, context_top_p);
- }
- while (context_top_p > context_end_p);
+ } while (context_top_p > context_end_p);
}
register_end_p = executable_object_p->frame_ctx.stack_top_p;
@@ -1526,8 +1512,7 @@ JERRY_STATIC_ASSERT (!ECMA_PROPERTY_IS_RAW (ECMA_PROPERTY_TYPE_DELETED),
ecma_property_type_deleted_must_not_be_raw_property);
JERRY_STATIC_ASSERT ((ECMA_PROPERTY_TYPE_DELETED & ECMA_PROPERTY_FLAG_LCACHED) == 0,
ecma_property_type_deleted_must_not_have_lcached_flag);
-JERRY_STATIC_ASSERT (ECMA_GC_FREE_SECOND_PROPERTY == 1,
- ecma_gc_free_second_must_be_one);
+JERRY_STATIC_ASSERT (ECMA_GC_FREE_SECOND_PROPERTY == 1, ecma_gc_free_second_must_be_one);
/**
* Free property of an object
@@ -1575,8 +1560,8 @@ ecma_gc_free_property (ecma_object_t *object_p, /**< object */
#if JERRY_CPOINTER_32_BIT
ecma_getter_setter_pointers_t *getter_setter_pair_p;
- getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t,
- prop_pair_p->values[index].getter_setter_pair_cp);
+ getter_setter_pair_p =
+ ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_pair_p->values[index].getter_setter_pair_cp);
jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));
#endif /* JERRY_CPOINTER_32_BIT */
return;
@@ -1655,8 +1640,7 @@ ecma_gc_free_properties (ecma_object_t *object_p, /**< object */
#if JERRY_PROPERTY_HASHMAP
if (prop_iter_cp != JMEM_CP_NULL)
{
- ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
- prop_iter_cp);
+ ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);
if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)
{
ecma_property_hashmap_free (object_p);
@@ -1791,8 +1775,7 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
case ECMA_OBJECT_CLASS_SCRIPT:
{
ecma_compiled_code_t *compiled_code_p;
- compiled_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- ext_object_p->u.cls.u3.value);
+ compiled_code_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);
ecma_bytecode_deref (compiled_code_p);
break;
@@ -1813,8 +1796,8 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
#if JERRY_BUILTIN_REGEXP
case ECMA_OBJECT_CLASS_REGEXP:
{
- ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_ANY_POINTER (ecma_compiled_code_t,
- ext_object_p->u.cls.u3.value);
+ ecma_compiled_code_t *bytecode_p =
+ ECMA_GET_INTERNAL_VALUE_ANY_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);
ecma_bytecode_deref (bytecode_p);
@@ -1886,8 +1869,8 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
case ECMA_OBJECT_CLASS_CONTAINER:
{
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p =
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
ecma_op_container_free_entries (object_p);
ecma_collection_destroy (container_p);
break;
@@ -1978,8 +1961,8 @@ ecma_gc_free_object (ecma_object_t *object_p) /**< object to free */
if (ext_func_p->u.function.bytecode_cp != ECMA_NULL_POINTER)
{
#endif /* JERRY_SNAPSHOT_EXEC */
- ecma_compiled_code_t *byte_code_p = (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- ext_func_p->u.function.bytecode_cp));
+ ecma_compiled_code_t *byte_code_p =
+ (ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_func_p->u.function.bytecode_cp));
#if JERRY_ESNEXT
if (CBC_FUNCTION_IS_ARROW (byte_code_p->status_flags))
@@ -2227,8 +2210,7 @@ ecma_gc_run (void)
obj_iter_cp = obj_next_cp;
}
- }
- while (marked_anything_during_current_iteration);
+ } while (marked_anything_during_current_iteration);
black_end_p->gc_next_cp = JMEM_CP_NULL;
JERRY_CONTEXT (ecma_gc_objects_cp) = black_list_head.gc_next_cp;
@@ -2320,8 +2302,7 @@ ecma_free_unused_memory (jmem_pressure_t pressure) /**< current pressure */
if (!ecma_is_lexical_environment (obj_iter_p)
|| ecma_get_lex_env_type (obj_iter_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
{
- if (!ecma_is_lexical_environment (obj_iter_p)
- && ecma_op_object_is_fast_array (obj_iter_p))
+ if (!ecma_is_lexical_environment (obj_iter_p) && ecma_op_object_is_fast_array (obj_iter_p))
{
obj_iter_cp = obj_iter_p->gc_next_cp;
continue;
@@ -2338,7 +2319,6 @@ ecma_free_unused_memory (jmem_pressure_t pressure) /**< current pressure */
ecma_property_hashmap_free (obj_iter_p);
}
}
-
}
obj_iter_cp = obj_iter_p->gc_next_cp;
diff --git a/jerry-core/ecma/base/ecma-gc.h b/jerry-core/ecma/base/ecma-gc.h
index 8ae76b8a..94a6d2a9 100644
--- a/jerry-core/ecma/base/ecma-gc.h
+++ b/jerry-core/ecma/base/ecma-gc.h
@@ -17,6 +17,7 @@
#define ECMA_GC_H
#include "ecma-globals.h"
+
#include "jmem.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/base/ecma-globals.h b/jerry-core/ecma/base/ecma-globals.h
index b4678a32..b7a38de5 100644
--- a/jerry-core/ecma/base/ecma-globals.h
+++ b/jerry-core/ecma/base/ecma-globals.h
@@ -17,10 +17,11 @@
#define ECMA_GLOBALS_H
#include "ecma-errors.h"
+
#include "config.h"
+#include "jmem.h"
#include "jrt.h"
#include "lit-magic-strings.h"
-#include "jmem.h"
/** \addtogroup ecma ECMA
* @{
@@ -37,7 +38,7 @@
*/
#define ECMA_NULL_POINTER JMEM_CP_NULL
-#if defined (JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY)
+#if defined(JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY)
/**
* JMEM_ALIGNMENT_LOG aligned pointers can be stored directly in ecma_value_t
@@ -55,16 +56,16 @@
*/
typedef enum
{
- ECMA_STATUS_API_AVAILABLE = (1u << 0), /**< api available */
- ECMA_STATUS_DIRECT_EVAL = (1u << 1), /**< eval is called directly */
+ ECMA_STATUS_API_AVAILABLE = (1u << 0), /**< api available */
+ ECMA_STATUS_DIRECT_EVAL = (1u << 1), /**< eval is called directly */
#if JERRY_PROPERTY_HASHMAP
- ECMA_STATUS_HIGH_PRESSURE_GC = (1u << 2), /**< last gc was under high pressure */
+ ECMA_STATUS_HIGH_PRESSURE_GC = (1u << 2), /**< last gc was under high pressure */
#endif /* JERRY_PROPERTY_HASHMAP */
- ECMA_STATUS_EXCEPTION = (1u << 3), /**< last exception is a normal exception */
- ECMA_STATUS_ABORT = (1u << 4), /**< last exception is an abort */
- ECMA_STATUS_ERROR_UPDATE = (1u << 5), /**< the error_object_created_callback_p is called */
+ ECMA_STATUS_EXCEPTION = (1u << 3), /**< last exception is a normal exception */
+ ECMA_STATUS_ABORT = (1u << 4), /**< last exception is an abort */
+ ECMA_STATUS_ERROR_UPDATE = (1u << 5), /**< the error_object_created_callback_p is called */
#if JERRY_VM_THROW
- ECMA_STATUS_ERROR_THROWN = (1u << 6), /**< the vm_throw_callback_p is called */
+ ECMA_STATUS_ERROR_THROWN = (1u << 6), /**< the vm_throw_callback_p is called */
#endif /* JERRY_VM_THROW */
} ecma_status_flag_t;
@@ -190,8 +191,7 @@ typedef int32_t ecma_integer_value_t;
/**
* ECMA make simple value
*/
-#define ECMA_MAKE_VALUE(value) \
- ((((ecma_value_t) (value)) << ECMA_DIRECT_SHIFT) | ECMA_DIRECT_TYPE_SIMPLE_VALUE)
+#define ECMA_MAKE_VALUE(value) ((((ecma_value_t) (value)) << ECMA_DIRECT_SHIFT) | ECMA_DIRECT_TYPE_SIMPLE_VALUE)
/**
* Simple ecma values
@@ -237,7 +237,7 @@ enum
/**
* Maximum integer number for an ecma value
*/
-#define ECMA_INTEGER_NUMBER_MAX 0x7fffff
+#define ECMA_INTEGER_NUMBER_MAX 0x7fffff
/**
* Maximum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT)
*/
@@ -257,7 +257,7 @@ enum
/**
* Minimum integer number for an ecma value
*/
-#define ECMA_INTEGER_NUMBER_MIN -0x7fffff
+#define ECMA_INTEGER_NUMBER_MIN -0x7fffff
/**
* Minimum integer number for an ecma value (shifted left with ECMA_DIRECT_SHIFT)
*/
@@ -275,13 +275,12 @@ enum
#if ECMA_DIRECT_SHIFT != 4
#error "Please update ECMA_INTEGER_NUMBER_MIN/MAX_SHIFTED according to the new value of ECMA_DIRECT_SHIFT."
-#endif
+#endif /* ECMA_DIRECT_SHIFT != 4 */
/**
* Checks whether the integer number is in the integer number range.
*/
-#define ECMA_IS_INTEGER_NUMBER(num) \
- (ECMA_INTEGER_NUMBER_MIN <= (num) && (num) <= ECMA_INTEGER_NUMBER_MAX)
+#define ECMA_IS_INTEGER_NUMBER(num) (ECMA_INTEGER_NUMBER_MIN <= (num) && (num) <= ECMA_INTEGER_NUMBER_MAX)
/**
* Maximum integer number, which if squared, still fits in ecma_integer_value_t
@@ -295,8 +294,7 @@ enum
/**
* Checks whether the error flag is set.
*/
-#define ECMA_IS_VALUE_ERROR(value) \
- (JERRY_UNLIKELY ((value) == ECMA_VALUE_ERROR))
+#define ECMA_IS_VALUE_ERROR(value) (JERRY_UNLIKELY ((value) == ECMA_VALUE_ERROR))
/**
* Callback which tells whether the ECMAScript execution should be stopped.
@@ -422,32 +420,27 @@ typedef enum
/**
* Property flags configurable, enumerable.
*/
-#define ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE \
- (ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_ENUMERABLE)
+#define ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE (ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_ENUMERABLE)
/**
* Property flags configurable, enumerable.
*/
-#define ECMA_PROPERTY_CONFIGURABLE_WRITABLE \
- (ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_WRITABLE)
+#define ECMA_PROPERTY_CONFIGURABLE_WRITABLE (ECMA_PROPERTY_FLAG_CONFIGURABLE | ECMA_PROPERTY_FLAG_WRITABLE)
/**
* Property flag built-in.
*/
-#define ECMA_PROPERTY_BUILT_IN_FIXED \
- (ECMA_PROPERTY_FLAG_BUILT_IN)
+#define ECMA_PROPERTY_BUILT_IN_FIXED (ECMA_PROPERTY_FLAG_BUILT_IN)
/**
* Property flags enumerable, writable.
*/
-#define ECMA_PROPERTY_ENUMERABLE_WRITABLE \
- (ECMA_PROPERTY_FLAG_ENUMERABLE | ECMA_PROPERTY_FLAG_WRITABLE)
+#define ECMA_PROPERTY_ENUMERABLE_WRITABLE (ECMA_PROPERTY_FLAG_ENUMERABLE | ECMA_PROPERTY_FLAG_WRITABLE)
/**
* Property flags built-in, configurable.
*/
-#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE \
- (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_FLAG_CONFIGURABLE)
+#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_FLAG_CONFIGURABLE)
/**
* Property flags built-in, configurable, enumerable.
@@ -458,14 +451,12 @@ typedef enum
/**
* Property flags built-in, configurable, writable.
*/
-#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE \
- (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+#define ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/**
* Property flags built-in, writable.
*/
-#define ECMA_PROPERTY_BUILT_IN_WRITABLE \
- (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_FLAG_WRITABLE)
+#define ECMA_PROPERTY_BUILT_IN_WRITABLE (ECMA_PROPERTY_FLAG_BUILT_IN | ECMA_PROPERTY_FLAG_WRITABLE)
/**
* Property flags built-in, configurable, enumerable, writable.
@@ -495,8 +486,7 @@ typedef enum
/**
* Type of hash-map property.
*/
-#define ECMA_PROPERTY_TYPE_HASHMAP \
- (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT)
+#define ECMA_PROPERTY_TYPE_HASHMAP (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT)
/**
* Type of deleted property.
@@ -523,7 +513,7 @@ typedef enum
/**
* Checks whether a property is not found.
*/
-#define ECMA_PROPERTY_IS_FOUND(property) \
+#define ECMA_PROPERTY_IS_FOUND(property) \
(((property) & (ECMA_PROPERTY_FLAG_DATA | (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))) \
!= (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))
@@ -606,20 +596,17 @@ typedef struct
/**
* Get property name type.
*/
-#define ECMA_PROPERTY_GET_NAME_TYPE(property) \
- ((property) >> ECMA_PROPERTY_NAME_TYPE_SHIFT)
+#define ECMA_PROPERTY_GET_NAME_TYPE(property) ((property) >> ECMA_PROPERTY_NAME_TYPE_SHIFT)
/**
* Returns true if the property pointer is a property pair.
*/
-#define ECMA_PROPERTY_IS_PROPERTY_PAIR(property_header_p) \
- ((property_header_p)->types[0] != ECMA_PROPERTY_TYPE_HASHMAP)
+#define ECMA_PROPERTY_IS_PROPERTY_PAIR(property_header_p) ((property_header_p)->types[0] != ECMA_PROPERTY_TYPE_HASHMAP)
/**
* Property value of all internal properties
*/
-#define ECMA_PROPERTY_INTERNAL \
- (ECMA_PROPERTY_FLAG_DATA | (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))
+#define ECMA_PROPERTY_INTERNAL (ECMA_PROPERTY_FLAG_DATA | (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))
/**
* Checks whether a property is internal property
@@ -629,25 +616,23 @@ typedef struct
/**
* Checks whether a property is raw data or accessor property
*/
-#define ECMA_PROPERTY_IS_RAW(property) \
- ((property) < (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))
+#define ECMA_PROPERTY_IS_RAW(property) ((property) < (ECMA_DIRECT_STRING_SPECIAL << ECMA_PROPERTY_NAME_TYPE_SHIFT))
/**
* Checks whether a property is raw data property (should only be used in assertions)
*/
#define ECMA_PROPERTY_IS_RAW_DATA(property) \
- (((property) & ECMA_PROPERTY_FLAG_DATA) && (property) < ECMA_PROPERTY_INTERNAL)
+ (((property) &ECMA_PROPERTY_FLAG_DATA) && (property) < ECMA_PROPERTY_INTERNAL)
/**
* Create internal property.
*/
-#define ECMA_CREATE_INTERNAL_PROPERTY(object_p, name_p, property_p, property_value_p) \
- do \
- { \
+#define ECMA_CREATE_INTERNAL_PROPERTY(object_p, name_p, property_p, property_value_p) \
+ do \
+ { \
(property_value_p) = ecma_create_named_data_property ((object_p), (name_p), 0, &(property_p)); \
- JERRY_ASSERT (*(property_p) == ECMA_PROPERTY_INTERNAL); \
- } \
- while (0)
+ JERRY_ASSERT (*(property_p) == ECMA_PROPERTY_INTERNAL); \
+ } while (0)
/**
* Property type of all virtual properties
@@ -657,7 +642,7 @@ typedef struct
/**
* Checks whether a property is virtual property
*/
-#define ECMA_PROPERTY_IS_VIRTUAL(property) ECMA_PROPERTY_IS_INTERNAL(property)
+#define ECMA_PROPERTY_IS_VIRTUAL(property) ECMA_PROPERTY_IS_INTERNAL (property)
/**
* Returns true if the property is named property.
@@ -681,8 +666,7 @@ typedef struct
* Compute the property data pointer of a property.
* The property must be part of a property pair.
*/
-#define ECMA_PROPERTY_VALUE_PTR(property_p) \
- ((ecma_property_value_t *) ECMA_PROPERTY_VALUE_DATA_PTR (property_p))
+#define ECMA_PROPERTY_VALUE_PTR(property_p) ((ecma_property_value_t *) ECMA_PROPERTY_VALUE_DATA_PTR (property_p))
/**
* Property reference. It contains the value pointer
@@ -768,7 +752,7 @@ typedef enum
ECMA_OBJECT_CLASS_MODULE_NAMESPACE, /**< Module Namespace (ECMAScript v11, 9.4.6) */
#endif /* JERRY_MODULE_SYSTEM */
- /* These objects are marked by Garbage Collector. */
+/* These objects are marked by Garbage Collector. */
#if JERRY_ESNEXT
ECMA_OBJECT_CLASS_GENERATOR, /**< Generator object (ECMAScript v6, 25.2) */
ECMA_OBJECT_CLASS_ASYNC_GENERATOR, /**< Async generator object (ECMAScript v11, 25.3) */
@@ -781,7 +765,7 @@ typedef enum
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
ECMA_OBJECT_CLASS_MODULE, /**< Module (ECMAScript v6, 15.2) */
-#endif
+#endif /* JERRY_MODULE_SYSTEM */
#if JERRY_ESNEXT
ECMA_OBJECT_CLASS_PROMISE, /**< Promise (ECMAScript v6, 25.4) */
ECMA_OBJECT_CLASS_PROMISE_CAPABILITY, /**< Promise capability (ECMAScript v6, 25.4.1.1) */
@@ -852,10 +836,10 @@ typedef enum
*/
typedef enum
{
- ECMA_ITERATOR_KEYS, /**< keys iterator */
- ECMA_ITERATOR_VALUES, /**< values iterator */
- ECMA_ITERATOR_ENTRIES, /**< entries iterator */
- ECMA_ITERATOR__COUNT, /**< number of iterator kinds */
+ ECMA_ITERATOR_KEYS, /**< keys iterator */
+ ECMA_ITERATOR_VALUES, /**< values iterator */
+ ECMA_ITERATOR_ENTRIES, /**< entries iterator */
+ ECMA_ITERATOR__COUNT, /**< number of iterator kinds */
} ecma_iterator_kind_t;
#endif /* JERRY_ESNEXT */
@@ -868,9 +852,9 @@ typedef enum
/**
* Set JERRY_CONTEXT (status_flags) top 8 bits to the specified 'opts'.
*/
-#define ECMA_SET_LOCAL_PARSE_OPTS(opts) \
- do \
- { \
+#define ECMA_SET_LOCAL_PARSE_OPTS(opts) \
+ do \
+ { \
JERRY_CONTEXT (status_flags) |= ((uint32_t) opts << ECMA_LOCAL_PARSE_OPTS_OFFSET) | ECMA_STATUS_DIRECT_EVAL; \
} while (0)
@@ -883,9 +867,9 @@ typedef enum
/**
* Clear JERRY_CONTEXT (status_flags) top 8 bits.
*/
-#define ECMA_CLEAR_LOCAL_PARSE_OPTS() \
- do \
- { \
+#define ECMA_CLEAR_LOCAL_PARSE_OPTS() \
+ do \
+ { \
JERRY_CONTEXT (status_flags) &= ((1 << ECMA_LOCAL_PARSE_OPTS_OFFSET) - 1); \
} while (0)
@@ -971,8 +955,8 @@ typedef struct
{
jmem_cpointer_t property_list_cp; /**< compressed pointer to object's
* or declerative lexical environments's property list */
- jmem_cpointer_t bound_object_cp; /**< compressed pointer to lexical environments's the bound object */
- jmem_cpointer_t home_object_cp; /**< compressed pointer to lexical environments's the home object */
+ jmem_cpointer_t bound_object_cp; /**< compressed pointer to lexical environments's the bound object */
+ jmem_cpointer_t home_object_cp; /**< compressed pointer to lexical environments's the home object */
} u1;
/** object prototype or outer reference */
@@ -1038,11 +1022,11 @@ typedef ecma_value_t (*ecma_builtin_handler_t) (ecma_object_t *function_obj_p,
*/
typedef enum
{
- ECMA_BUILTIN_ROUTINE_NO_OPTS = 0, /**< No options are provided */
- ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED = (1u << 0), /**< 'length' property has been initialized */
- ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED = (1u << 1), /**< 'name' property has been initialized */
- ECMA_BUILTIN_ROUTINE_GETTER = (1u << 2), /**< this routine is getter */
- ECMA_BUILTIN_ROUTINE_SETTER = (1u << 3), /**< this routine is setter */
+ ECMA_BUILTIN_ROUTINE_NO_OPTS = 0, /**< No options are provided */
+ ECMA_BUILTIN_ROUTINE_LENGTH_INITIALIZED = (1u << 0), /**< 'length' property has been initialized */
+ ECMA_BUILTIN_ROUTINE_NAME_INITIALIZED = (1u << 1), /**< 'name' property has been initialized */
+ ECMA_BUILTIN_ROUTINE_GETTER = (1u << 2), /**< this routine is getter */
+ ECMA_BUILTIN_ROUTINE_SETTER = (1u << 3), /**< this routine is setter */
} ecma_builtin_routine_flags_t;
/**
@@ -1239,13 +1223,13 @@ typedef struct
*/
typedef struct
{
- uint16_t size; /**< real size >> JMEM_ALIGNMENT_LOG */
- uint16_t refs; /**< reference counter for the byte code */
- uint16_t status_flags; /**< various status flags:
- * CBC_IS_FUNCTION check tells whether the byte code
- * is function or regular expression.
- * If function, the other flags must be CBC_CODE_FLAGS...
- * If regexp, the other flags must be RE_FLAG... */
+ uint16_t size; /**< real size >> JMEM_ALIGNMENT_LOG */
+ uint16_t refs; /**< reference counter for the byte code */
+ uint16_t status_flags; /**< various status flags:
+ * CBC_IS_FUNCTION check tells whether the byte code
+ * is function or regular expression.
+ * If function, the other flags must be CBC_CODE_FLAGS...
+ * If regexp, the other flags must be RE_FLAG... */
} ecma_compiled_code_t;
/**
@@ -1331,26 +1315,22 @@ typedef struct
/**
* Size of the internal buffer.
*/
-#define ECMA_CONTAINER_GET_SIZE(container_p) \
- (container_p->buffer_p[0])
+#define ECMA_CONTAINER_GET_SIZE(container_p) (container_p->buffer_p[0])
/**
* Remove the size field of the internal buffer.
*/
-#define ECMA_CONTAINER_SET_SIZE(container_p, size) \
- (container_p->buffer_p[0] = (ecma_value_t) (size))
+#define ECMA_CONTAINER_SET_SIZE(container_p, size) (container_p->buffer_p[0] = (ecma_value_t) (size))
/**
* Number of entries of the internal buffer.
*/
-#define ECMA_CONTAINER_ENTRY_COUNT(collection_p) \
- (collection_p->item_count - 1)
+#define ECMA_CONTAINER_ENTRY_COUNT(collection_p) (collection_p->item_count - 1)
/**
* Pointer to the first entry of the internal buffer.
*/
-#define ECMA_CONTAINER_START(collection_p) \
- (collection_p->buffer_p + 1)
+#define ECMA_CONTAINER_START(collection_p) (collection_p->buffer_p + 1)
#endif /* JERRY_BUILTIN_CONTAINER */
@@ -1380,17 +1360,15 @@ typedef struct
* - is_value_defined : true
* - is_configurable_defined, is_writable_defined, is_enumerable_defined : true
*/
-#define ECMA_NAME_DATA_PROPERTY_DESCRIPTOR_BITS ((uint16_t) (JERRY_PROP_IS_VALUE_DEFINED \
- | JERRY_PROP_IS_CONFIGURABLE_DEFINED \
- | JERRY_PROP_IS_ENUMERABLE_DEFINED \
- | JERRY_PROP_IS_WRITABLE_DEFINED))
+#define ECMA_NAME_DATA_PROPERTY_DESCRIPTOR_BITS \
+ ((uint16_t) (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE_DEFINED \
+ | JERRY_PROP_IS_WRITABLE_DEFINED))
/**
* Bitmask to get a the physical property flags from an ecma_property_descriptor
*/
-#define ECMA_PROPERTY_FLAGS_MASK ((uint16_t) (JERRY_PROP_IS_CONFIGURABLE \
- | JERRY_PROP_IS_ENUMERABLE \
- | JERRY_PROP_IS_WRITABLE))
+#define ECMA_PROPERTY_FLAGS_MASK \
+ ((uint16_t) (JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_WRITABLE))
#if !JERRY_NUMBER_TYPE_FLOAT64
/**
@@ -1412,7 +1390,7 @@ typedef union
/**
* Maximum number of significant digits that ecma-number can store
*/
-#define ECMA_NUMBER_MAX_DIGITS (9)
+#define ECMA_NUMBER_MAX_DIGITS (9)
/**
* Width of sign field
@@ -1420,7 +1398,7 @@ typedef union
* See also:
* IEEE-754 2008, 3.6, Table 3.5
*/
-#define ECMA_NUMBER_SIGN_WIDTH (1)
+#define ECMA_NUMBER_SIGN_WIDTH (1)
/**
* Width of biased exponent field
@@ -1436,7 +1414,7 @@ typedef union
* See also:
* IEEE-754 2008, 3.6, Table 3.5
*/
-#define ECMA_NUMBER_FRACTION_WIDTH (23)
+#define ECMA_NUMBER_FRACTION_WIDTH (23)
#elif JERRY_NUMBER_TYPE_FLOAT64
/**
* Description of an ecma-number
@@ -1457,7 +1435,7 @@ typedef union
/**
* Maximum number of significant digits that ecma-number can store
*/
-#define ECMA_NUMBER_MAX_DIGITS (19)
+#define ECMA_NUMBER_MAX_DIGITS (19)
/**
* Width of sign field
@@ -1465,7 +1443,7 @@ typedef union
* See also:
* IEEE-754 2008, 3.6, Table 3.5
*/
-#define ECMA_NUMBER_SIGN_WIDTH (1)
+#define ECMA_NUMBER_SIGN_WIDTH (1)
/**
* Width of biased exponent field
@@ -1473,7 +1451,7 @@ typedef union
* See also:
* IEEE-754 2008, 3.6, Table 3.5
*/
-#define ECMA_NUMBER_BIASED_EXP_WIDTH (11)
+#define ECMA_NUMBER_BIASED_EXP_WIDTH (11)
/**
* Width of fraction field
@@ -1481,7 +1459,7 @@ typedef union
* See also:
* IEEE-754 2008, 3.6, Table 3.5
*/
-#define ECMA_NUMBER_FRACTION_WIDTH (52)
+#define ECMA_NUMBER_FRACTION_WIDTH (52)
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
@@ -1492,12 +1470,12 @@ typedef union
/**
* Value '1' of ecma_number_t
*/
-#define ECMA_NUMBER_ONE ((ecma_number_t) 1)
+#define ECMA_NUMBER_ONE ((ecma_number_t) 1)
/**
* Value '2' of ecma_number_t
*/
-#define ECMA_NUMBER_TWO ((ecma_number_t) 2)
+#define ECMA_NUMBER_TWO ((ecma_number_t) 2)
/**
* Value '0.5' of ecma_number_t
@@ -1515,74 +1493,74 @@ typedef union
*
* See also: ECMA_262 v5, 15.7.3.3
*/
-# define ECMA_NUMBER_MIN_VALUE (FLT_MIN)
+#define ECMA_NUMBER_MIN_VALUE (FLT_MIN)
/**
* Number.MAX_VALUE (i.e., the maximum value of ecma-number)
*
* See also: ECMA_262 v5, 15.7.3.2
*/
-# define ECMA_NUMBER_MAX_VALUE (FLT_MAX)
+#define ECMA_NUMBER_MAX_VALUE (FLT_MAX)
/**
* Number.EPSILON
*
* See also: ECMA_262 v6, 20.1.2.1
*/
-# define ECMA_NUMBER_EPSILON ((ecma_number_t) 1.1920928955078125e-7)
+#define ECMA_NUMBER_EPSILON ((ecma_number_t) 1.1920928955078125e-7)
/**
* Number.MAX_SAFE_INTEGER
*
* See also: ECMA_262 v6, 20.1.2.6
*/
-# define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0xFFFFFF)
+#define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0xFFFFFF)
/**
* Number.MIN_SAFE_INTEGER
*
* See also: ECMA_262 v6, 20.1.2.8
*/
-# define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0xFFFFFF)
+#define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0xFFFFFF)
#elif JERRY_NUMBER_TYPE_FLOAT64
/**
* Number.MAX_VALUE (i.e., the maximum value of ecma-number)
*
* See also: ECMA_262 v5, 15.7.3.2
*/
-# define ECMA_NUMBER_MAX_VALUE ((ecma_number_t) 1.7976931348623157e+308)
+#define ECMA_NUMBER_MAX_VALUE ((ecma_number_t) 1.7976931348623157e+308)
/**
* Number.MIN_VALUE (i.e., the smallest positive value of ecma-number)
*
* See also: ECMA_262 v5, 15.7.3.3
*/
-# define ECMA_NUMBER_MIN_VALUE ((ecma_number_t) 5e-324)
+#define ECMA_NUMBER_MIN_VALUE ((ecma_number_t) 5e-324)
/**
* Number.EPSILON
*
* See also: ECMA_262 v6, 20.1.2.1
*/
-# define ECMA_NUMBER_EPSILON ((ecma_number_t) 2.2204460492503130808472633361816e-16)
+#define ECMA_NUMBER_EPSILON ((ecma_number_t) 2.2204460492503130808472633361816e-16)
/**
* Number.MAX_SAFE_INTEGER
*
* See also: ECMA_262 v6, 20.1.2.6
*/
-# define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0x1FFFFFFFFFFFFF)
+#define ECMA_NUMBER_MAX_SAFE_INTEGER ((ecma_number_t) 0x1FFFFFFFFFFFFF)
/**
* Number.MIN_SAFE_INTEGER
*
* See also: ECMA_262 v6, 20.1.2.8
*/
-# define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0x1FFFFFFFFFFFFF)
+#define ECMA_NUMBER_MIN_SAFE_INTEGER ((ecma_number_t) -0x1FFFFFFFFFFFFF)
#endif /* !JERRY_NUMBER_TYPE_FLOAT64 */
/**
* Euler number
*/
-#define ECMA_NUMBER_E ((ecma_number_t) 2.7182818284590452354)
+#define ECMA_NUMBER_E ((ecma_number_t) 2.7182818284590452354)
/**
* Natural logarithm of 10
@@ -1607,17 +1585,17 @@ typedef union
/**
* Pi number
*/
-#define ECMA_NUMBER_PI ((ecma_number_t) 3.1415926535897932)
+#define ECMA_NUMBER_PI ((ecma_number_t) 3.1415926535897932)
/**
* Square root of 0.5
*/
-#define ECMA_NUMBER_SQRT_1_2 ((ecma_number_t) 0.7071067811865476)
+#define ECMA_NUMBER_SQRT_1_2 ((ecma_number_t) 0.7071067811865476)
/**
* Square root of 2
*/
-#define ECMA_NUMBER_SQRT2 ((ecma_number_t) 1.4142135623730951)
+#define ECMA_NUMBER_SQRT2 ((ecma_number_t) 1.4142135623730951)
/**
* Maximum number of characters in string representation of ecma-number
@@ -1657,8 +1635,7 @@ typedef struct
/**
* Compute the total allocated size of the collection based on it's capacity
*/
-#define ECMA_COLLECTION_ALLOCATED_SIZE(capacity) \
- (uint32_t) (capacity * sizeof (ecma_value_t))
+#define ECMA_COLLECTION_ALLOCATED_SIZE(capacity) (uint32_t) (capacity * sizeof (ecma_value_t))
/**
* Initial allocated size of an ecma-collection
@@ -1724,8 +1701,7 @@ typedef enum
/**
* Checks whether the string is direct.
*/
-#define ECMA_IS_DIRECT_STRING(string_p) \
- ((((uintptr_t) (string_p)) & 0x1) != 0)
+#define ECMA_IS_DIRECT_STRING(string_p) ((((uintptr_t) (string_p)) & 0x1) != 0)
/**
* Checks whether the string is direct.
@@ -1736,8 +1712,7 @@ typedef enum
/**
* Returns the type of a direct string.
*/
-#define ECMA_GET_DIRECT_STRING_TYPE(string_p) \
- ((((uintptr_t) (string_p)) >> ECMA_VALUE_SHIFT) & 0x3)
+#define ECMA_GET_DIRECT_STRING_TYPE(string_p) ((((uintptr_t) (string_p)) >> ECMA_VALUE_SHIFT) & 0x3)
/**
* Shift applied to type conversions.
@@ -1753,8 +1728,7 @@ typedef enum
/**
* Returns the value of a direct string.
*/
-#define ECMA_GET_DIRECT_STRING_VALUE(string_p) \
- (((uintptr_t) (string_p)) >> ECMA_DIRECT_STRING_SHIFT)
+#define ECMA_GET_DIRECT_STRING_VALUE(string_p) (((uintptr_t) (string_p)) >> ECMA_DIRECT_STRING_SHIFT)
/**
* Maximum number of bytes that a long-utf8-string is able to store
@@ -1799,14 +1773,12 @@ typedef enum
/**
* Set an ecma-string as static string
*/
-#define ECMA_SET_STRING_AS_STATIC(string_p) \
- (string_p)->refs_and_container |= ECMA_STATIC_STRING_FLAG
+#define ECMA_SET_STRING_AS_STATIC(string_p) (string_p)->refs_and_container |= ECMA_STATIC_STRING_FLAG
/**
* Checks whether the ecma-string is static string
*/
-#define ECMA_STRING_IS_STATIC(string_p) \
- ((string_p)->refs_and_container & ECMA_STATIC_STRING_FLAG)
+#define ECMA_STRING_IS_STATIC(string_p) ((string_p)->refs_and_container & ECMA_STATIC_STRING_FLAG)
/**
* Returns with the container type of a string.
@@ -1817,8 +1789,7 @@ typedef enum
/**
* Checks whether the reference counter is 1 of a string.
*/
-#define ECMA_STRING_IS_REF_EQUALS_TO_ONE(string_desc_p) \
- (((string_desc_p)->refs_and_container >> 4) == 1)
+#define ECMA_STRING_IS_REF_EQUALS_TO_ONE(string_desc_p) (((string_desc_p)->refs_and_container >> 4) == 1)
/**
* Checks whether the reference counter is 1 of an extended primitive.
@@ -1878,38 +1849,34 @@ typedef struct
/**
* Header size of an ecma ASCII string
*/
-#define ECMA_ASCII_STRING_HEADER_SIZE \
- ((lit_utf8_size_t) (sizeof (ecma_string_t) + sizeof (uint8_t)))
+#define ECMA_ASCII_STRING_HEADER_SIZE ((lit_utf8_size_t) (sizeof (ecma_string_t) + sizeof (uint8_t)))
/**
* Get the size of an ecma ASCII string
*/
#define ECMA_ASCII_STRING_GET_SIZE(string_p) \
- ((lit_utf8_size_t) *((lit_utf8_byte_t *) (string_p) + sizeof (ecma_string_t)) + 1)
+ ((lit_utf8_size_t) * ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_string_t)) + 1)
/**
* Set the size of an ecma ASCII string
*/
#define ECMA_ASCII_STRING_SET_SIZE(string_p, size) \
- (*((lit_utf8_byte_t *) (string_p) + sizeof (ecma_string_t)) = (uint8_t) ((size) - 1))
+ (*((lit_utf8_byte_t *) (string_p) + sizeof (ecma_string_t)) = (uint8_t) ((size) -1))
/**
* Get the start position of the string buffer of an ecma ASCII string
*/
-#define ECMA_ASCII_STRING_GET_BUFFER(string_p) \
- ((lit_utf8_byte_t *) (string_p) + ECMA_ASCII_STRING_HEADER_SIZE)
+#define ECMA_ASCII_STRING_GET_BUFFER(string_p) ((lit_utf8_byte_t *) (string_p) + ECMA_ASCII_STRING_HEADER_SIZE)
/**
* Get the start position of the string buffer of an ecma UTF8 string
*/
-#define ECMA_SHORT_STRING_GET_BUFFER(string_p) \
- ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_short_string_t))
+#define ECMA_SHORT_STRING_GET_BUFFER(string_p) ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_short_string_t))
/**
* Get the start position of the string buffer of an ecma long CESU8 string
*/
-#define ECMA_LONG_STRING_BUFFER_START(string_p) \
- ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_long_string_t))
+#define ECMA_LONG_STRING_BUFFER_START(string_p) ((lit_utf8_byte_t *) (string_p) + sizeof (ecma_long_string_t))
/**
* ECMA extended string-value descriptor
@@ -2074,18 +2041,18 @@ typedef ecma_value_t (*ecma_typedarray_setter_fn_t) (lit_utf8_byte_t *src, ecma_
*/
typedef enum
{
- ECMA_INT8_ARRAY, /**< Int8Array */
- ECMA_UINT8_ARRAY, /**< Uint8Array */
+ ECMA_INT8_ARRAY, /**< Int8Array */
+ ECMA_UINT8_ARRAY, /**< Uint8Array */
ECMA_UINT8_CLAMPED_ARRAY, /**< Uint8ClampedArray */
- ECMA_INT16_ARRAY, /**< Int16Array */
- ECMA_UINT16_ARRAY, /**< Uint16Array */
- ECMA_INT32_ARRAY, /**< Int32Array */
- ECMA_UINT32_ARRAY, /**< Uint32Array */
- ECMA_FLOAT32_ARRAY, /**< Float32Array */
- ECMA_FLOAT64_ARRAY, /**< Float64Array */
+ ECMA_INT16_ARRAY, /**< Int16Array */
+ ECMA_UINT16_ARRAY, /**< Uint16Array */
+ ECMA_INT32_ARRAY, /**< Int32Array */
+ ECMA_UINT32_ARRAY, /**< Uint32Array */
+ ECMA_FLOAT32_ARRAY, /**< Float32Array */
+ ECMA_FLOAT64_ARRAY, /**< Float64Array */
/* ECMA_TYPEDARRAY_IS_BIGINT_TYPE macro should be updated when new types are added */
- ECMA_BIGINT64_ARRAY, /**< BigInt64Array */
- ECMA_BIGUINT64_ARRAY, /**< BigUInt64Array */
+ ECMA_BIGINT64_ARRAY, /**< BigInt64Array */
+ ECMA_BIGUINT64_ARRAY, /**< BigUInt64Array */
} ecma_typedarray_type_t;
/**
@@ -2145,8 +2112,7 @@ typedef struct
/**
* Checks whether a given typedarray is BigInt type or not.
**/
-#define ECMA_TYPEDARRAY_IS_BIGINT_TYPE(id) \
- ((id) >= ECMA_BIGINT64_ARRAY)
+#define ECMA_TYPEDARRAY_IS_BIGINT_TYPE(id) ((id) >= ECMA_BIGINT64_ARRAY)
#endif /* JERRY_BUILTIN_BIGINT */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
@@ -2187,7 +2153,7 @@ typedef enum
/**
* Checks whether the executable object is waiting for resuming.
*/
-#define ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED(executable_object_p) \
+#define ECMA_EXECUTABLE_OBJECT_IS_SUSPENDED(executable_object_p) \
(!((executable_object_p)->extended_object.u.cls.u2.executable_obj_flags \
& (ECMA_EXECUTABLE_OBJECT_COMPLETED | ECMA_EXECUTABLE_OBJECT_RUNNING)))
@@ -2306,21 +2272,21 @@ typedef struct
* Check the current stack usage. If the limit is reached a RangeError is raised.
* The macro argument specifies the return value which is usally ECMA_VALUE_ERROR or NULL.
*/
-#define ECMA_CHECK_STACK_USAGE_RETURN(RETURN_VALUE) \
-do \
-{ \
- if (ecma_get_current_stack_usage () > CONFIG_MEM_STACK_LIMIT) \
- { \
- ecma_raise_range_error (ECMA_ERR_MSG ("Maximum call stack size exceeded")); \
- return RETURN_VALUE; \
- } \
-} while (0)
+#define ECMA_CHECK_STACK_USAGE_RETURN(RETURN_VALUE) \
+ do \
+ { \
+ if (ecma_get_current_stack_usage () > CONFIG_MEM_STACK_LIMIT) \
+ { \
+ ecma_raise_range_error (ECMA_ERR_MSG ("Maximum call stack size exceeded")); \
+ return RETURN_VALUE; \
+ } \
+ } while (0)
/**
* Specialized version of ECMA_CHECK_STACK_USAGE_RETURN which returns ECMA_VALUE_ERROR.
* This version should be used in most cases.
*/
-#define ECMA_CHECK_STACK_USAGE() ECMA_CHECK_STACK_USAGE_RETURN(ECMA_VALUE_ERROR)
+#define ECMA_CHECK_STACK_USAGE() ECMA_CHECK_STACK_USAGE_RETURN (ECMA_VALUE_ERROR)
#else /* JERRY_STACK_LIMIT == 0) */
/**
* If the stack limit is unlimited, this check is an empty macro.
@@ -2446,11 +2412,11 @@ typedef struct
*/
typedef enum
{
- ECMA_ARGUMENTS_OBJECT_NO_FLAGS = 0, /* unmapped arguments object */
- ECMA_ARGUMENTS_OBJECT_MAPPED = (1 << 0), /* mapped arguments object */
- ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE = (1 << 1), /* static mapped arguments object */
- ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED = (1 << 2), /* 'callee' property has been lazy initialized */
- ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED = (1 << 3), /* 'length' property has been lazy initialized */
+ ECMA_ARGUMENTS_OBJECT_NO_FLAGS = 0, /* unmapped arguments object */
+ ECMA_ARGUMENTS_OBJECT_MAPPED = (1 << 0), /* mapped arguments object */
+ ECMA_ARGUMENTS_OBJECT_STATIC_BYTECODE = (1 << 1), /* static mapped arguments object */
+ ECMA_ARGUMENTS_OBJECT_CALLEE_INITIALIZED = (1 << 2), /* 'callee' property has been lazy initialized */
+ ECMA_ARGUMENTS_OBJECT_LENGTH_INITIALIZED = (1 << 3), /* 'length' property has been lazy initialized */
ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED = (1 << 4), /* 'Symbol.iterator' property has been lazy initialized */
} ecma_arguments_object_flags_t;
@@ -2522,4 +2488,4 @@ typedef struct
* @}
*/
-#endif /* !ECMA_GLOBALS_H */
+#endif /* !ECMA_GLOBALS_H */
diff --git a/jerry-core/ecma/base/ecma-helpers-collection.c b/jerry-core/ecma/base/ecma-helpers-collection.c
index e3b17fd6..d140ab93 100644
--- a/jerry-core/ecma/base/ecma-helpers-collection.c
+++ b/jerry-core/ecma/base/ecma-helpers-collection.c
@@ -18,6 +18,7 @@
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
+
#include "jrt.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/base/ecma-helpers-conversion.c b/jerry-core/ecma/base/ecma-helpers-conversion.c
index d42f49af..8a7a9d10 100644
--- a/jerry-core/ecma/base/ecma-helpers-conversion.c
+++ b/jerry-core/ecma/base/ecma-helpers-conversion.c
@@ -17,6 +17,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
+
#include "jrt-libc-includes.h"
#include "lit-char-helpers.h"
#include "lit-magic-strings.h"
@@ -55,8 +56,7 @@ ecma_round_high_to_uint64 (ecma_uint128_t *num_p)
uint64_t masked_lo = num_p->lo & ~(1ULL << 63u);
uint64_t masked_hi = num_p->hi & 0x1;
- if ((num_p->lo >> 63u != 0)
- && (masked_lo > 0 || masked_hi != 0))
+ if ((num_p->lo >> 63u != 0) && (masked_lo > 0 || masked_hi != 0))
{
return (num_p->hi + 1);
}
@@ -66,53 +66,52 @@ ecma_round_high_to_uint64 (ecma_uint128_t *num_p)
/**
* Check if 128-bit integer is zero
*/
-#define ECMA_UINT128_IS_ZERO(name) \
- (name.hi == 0 && name.lo == 0)
+#define ECMA_UINT128_IS_ZERO(name) (name.hi == 0 && name.lo == 0)
/**
* Left shift 128-bit integer by max 63 bits
*/
-#define ECMA_UINT128_LEFT_SHIFT_MAX63(name, shift) \
-{ \
- name.hi = (name.hi << (shift)) | (name.lo >> (64 - (shift))); \
- name.lo <<= (shift); \
-}
+#define ECMA_UINT128_LEFT_SHIFT_MAX63(name, shift) \
+ { \
+ name.hi = (name.hi << (shift)) | (name.lo >> (64 - (shift))); \
+ name.lo <<= (shift); \
+ }
/**
* Right shift 128-bit integer by max 63 bits
*/
-#define ECMA_UINT128_RIGHT_SHIFT_MAX63(name, shift) \
-{ \
- name.lo = (name.lo >> (shift)) | (name.hi << (64 - (shift))); \
- name.hi >>= (shift); \
-}
+#define ECMA_UINT128_RIGHT_SHIFT_MAX63(name, shift) \
+ { \
+ name.lo = (name.lo >> (shift)) | (name.hi << (64 - (shift))); \
+ name.hi >>= (shift); \
+ }
/**
* Add 128-bit integer
*/
#define ECMA_UINT128_ADD(name_add_to, name_to_add) \
-{ \
- name_add_to.hi += name_to_add.hi; \
- name_add_to.lo += name_to_add.lo; \
- if (name_add_to.lo < name_to_add.lo) \
- { \
- name_add_to.hi++; \
- } \
-}
+ { \
+ name_add_to.hi += name_to_add.hi; \
+ name_add_to.lo += name_to_add.lo; \
+ if (name_add_to.lo < name_to_add.lo) \
+ { \
+ name_add_to.hi++; \
+ } \
+ }
/**
* Multiply 128-bit integer by 10
*/
-#define ECMA_UINT128_MUL10(name) \
-{ \
- ECMA_UINT128_LEFT_SHIFT_MAX63 (name, 1u); \
- \
- ecma_uint128_t name ## _tmp = name; \
- \
- ECMA_UINT128_LEFT_SHIFT_MAX63 (name ## _tmp, 2u); \
- \
- ECMA_UINT128_ADD (name, name ## _tmp); \
-}
+#define ECMA_UINT128_MUL10(name) \
+ { \
+ ECMA_UINT128_LEFT_SHIFT_MAX63 (name, 1u); \
+ \
+ ecma_uint128_t name##_tmp = name; \
+ \
+ ECMA_UINT128_LEFT_SHIFT_MAX63 (name##_tmp, 2u); \
+ \
+ ECMA_UINT128_ADD (name, name##_tmp); \
+ }
/**
* Divide 128-bit integer by 10
@@ -129,84 +128,82 @@ ecma_round_high_to_uint64 (ecma_uint128_t *num_p)
*
* Q = Q3 *2^96 + Q2 *2^64 + Q1 *2^32 + Q0 *2^0 // 128-bit quotient
*/
-#define ECMA_UINT128_DIV10(name) \
-{ \
- /* estimation of reciprocal of 10, 128 bits right of the binary point (T1 == T2) */ \
- const uint64_t tenth_l = 0x9999999aul; \
- const uint64_t tenth_m = 0x99999999ul; \
- const uint64_t tenth_h = 0x19999999ul; \
- \
- uint64_t l0 = ((uint32_t) name.lo) * tenth_l; \
- uint64_t l1 = (name.lo >> 32u) * tenth_l; \
- uint64_t l2 = ((uint32_t) name.hi) * tenth_l; \
- uint64_t l3 = (name.hi >> 32u) * tenth_l; \
- uint64_t m0 = ((uint32_t) name.lo) * tenth_m; \
- uint64_t m1 = (name.lo >> 32u) * tenth_m; \
- uint64_t m2 = ((uint32_t) name.hi) * tenth_m; \
- uint64_t m3 = (name.hi >> 32u) * tenth_m; \
- uint64_t h0 = ((uint32_t) name.lo) * tenth_h; \
- uint64_t h1 = (name.lo >> 32u) * tenth_h; \
- uint64_t h2 = ((uint32_t) name.hi) * tenth_h; \
- uint64_t h3 = (name.hi >> 32u) * tenth_h; \
- \
- uint64_t q0 = l0 >> 32u; \
- q0 += (uint32_t) l1; \
- q0 += (uint32_t) m0; \
- \
- q0 >>= 32u; \
- q0 += l1 >> 32u; \
- q0 += m0 >> 32u; \
- q0 += (uint32_t) l2; \
- q0 += (uint32_t) m1; \
- q0 += (uint32_t) m0; \
- \
- q0 >>= 32u; \
- q0 += l2 >> 32u; \
- q0 += m1 >> 32u; \
- q0 += m0 >> 32u; \
- q0 += (uint32_t) l3; \
- q0 += (uint32_t) m2; \
- q0 += (uint32_t) m1; \
- q0 += (uint32_t) h0; \
- \
- q0 >>=32u; \
- q0 += l3 >> 32u; \
- q0 += m2 >> 32u; \
- q0 += m1 >> 32u; \
- q0 += h0 >> 32u; \
- q0 += (uint32_t) m3; \
- q0 += (uint32_t) m2; \
- q0 += (uint32_t) h1; \
- \
- uint64_t q1 = q0 >> 32u; \
- q1 += m3 >> 32u; \
- q1 += m2 >> 32u; \
- q1 += h1 >> 32u; \
- q1 += (uint32_t) m3; \
- q1 += (uint32_t) h2; \
- \
- uint64_t q32 = q1 >> 32u; \
- q32 += m3 >> 32u; \
- q32 += h2 >> 32u; \
- q32 += h3; \
- \
- name.lo = (q1 << 32u) | ((uint32_t) q0); \
- name.hi = q32; \
-}
-
-#if defined (__GNUC__) || defined (__clang__)
+#define ECMA_UINT128_DIV10(name) \
+ { \
+ /* estimation of reciprocal of 10, 128 bits right of the binary point (T1 == T2) */ \
+ const uint64_t tenth_l = 0x9999999aul; \
+ const uint64_t tenth_m = 0x99999999ul; \
+ const uint64_t tenth_h = 0x19999999ul; \
+ \
+ uint64_t l0 = ((uint32_t) name.lo) * tenth_l; \
+ uint64_t l1 = (name.lo >> 32u) * tenth_l; \
+ uint64_t l2 = ((uint32_t) name.hi) * tenth_l; \
+ uint64_t l3 = (name.hi >> 32u) * tenth_l; \
+ uint64_t m0 = ((uint32_t) name.lo) * tenth_m; \
+ uint64_t m1 = (name.lo >> 32u) * tenth_m; \
+ uint64_t m2 = ((uint32_t) name.hi) * tenth_m; \
+ uint64_t m3 = (name.hi >> 32u) * tenth_m; \
+ uint64_t h0 = ((uint32_t) name.lo) * tenth_h; \
+ uint64_t h1 = (name.lo >> 32u) * tenth_h; \
+ uint64_t h2 = ((uint32_t) name.hi) * tenth_h; \
+ uint64_t h3 = (name.hi >> 32u) * tenth_h; \
+ \
+ uint64_t q0 = l0 >> 32u; \
+ q0 += (uint32_t) l1; \
+ q0 += (uint32_t) m0; \
+ \
+ q0 >>= 32u; \
+ q0 += l1 >> 32u; \
+ q0 += m0 >> 32u; \
+ q0 += (uint32_t) l2; \
+ q0 += (uint32_t) m1; \
+ q0 += (uint32_t) m0; \
+ \
+ q0 >>= 32u; \
+ q0 += l2 >> 32u; \
+ q0 += m1 >> 32u; \
+ q0 += m0 >> 32u; \
+ q0 += (uint32_t) l3; \
+ q0 += (uint32_t) m2; \
+ q0 += (uint32_t) m1; \
+ q0 += (uint32_t) h0; \
+ \
+ q0 >>= 32u; \
+ q0 += l3 >> 32u; \
+ q0 += m2 >> 32u; \
+ q0 += m1 >> 32u; \
+ q0 += h0 >> 32u; \
+ q0 += (uint32_t) m3; \
+ q0 += (uint32_t) m2; \
+ q0 += (uint32_t) h1; \
+ \
+ uint64_t q1 = q0 >> 32u; \
+ q1 += m3 >> 32u; \
+ q1 += m2 >> 32u; \
+ q1 += h1 >> 32u; \
+ q1 += (uint32_t) m3; \
+ q1 += (uint32_t) h2; \
+ \
+ uint64_t q32 = q1 >> 32u; \
+ q32 += m3 >> 32u; \
+ q32 += h2 >> 32u; \
+ q32 += h3; \
+ \
+ name.lo = (q1 << 32u) | ((uint32_t) q0); \
+ name.hi = q32; \
+ }
+
+#if defined(__GNUC__) || defined(__clang__)
/**
* Count leading zeros in the topmost 64 bits of a 128-bit integer.
*/
-#define ECMA_UINT128_CLZ_MAX63(name) \
- __builtin_clzll (name.hi)
+#define ECMA_UINT128_CLZ_MAX63(name) __builtin_clzll (name.hi)
/**
* Count leading zeros in the topmost 4 bits of a 128-bit integer.
*/
-#define ECMA_UINT128_CLZ_MAX4(name) \
- __builtin_clzll (name.hi)
+#define ECMA_UINT128_CLZ_MAX4(name) __builtin_clzll (name.hi)
#else /* !__GNUC__ && !__clang__ */
@@ -238,14 +235,12 @@ static const uint8_t ecma_uint4_clz[] = { 4, 3, 2, 2, 1, 1, 1, 1, 0, 0, 0, 0, 0,
/**
* Count leading zeros in the topmost 64 bits of a 128-bit integer.
*/
-#define ECMA_UINT128_CLZ_MAX63(name) \
- ecma_uint64_clz (name.hi)
+#define ECMA_UINT128_CLZ_MAX63(name) ecma_uint64_clz (name.hi)
/**
* Count leading zeros in the topmost 4 bits of a 128-bit integer.
*/
-#define ECMA_UINT128_CLZ_MAX4(name) \
- ecma_uint4_clz[name.hi >> 60]
+#define ECMA_UINT128_CLZ_MAX4(name) ecma_uint4_clz[name.hi >> 60]
#endif /* __GNUC__ || __clang__ */
@@ -308,7 +303,7 @@ ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 st
{
lit_code_point_t upper_limit = LIT_CHAR_0 + radix;
- for (const lit_utf8_byte_t * iter_p = str_p; iter_p <= end_p; iter_p++)
+ for (const lit_utf8_byte_t *iter_p = str_p; iter_p <= end_p; iter_p++)
{
int32_t digit_value;
@@ -328,22 +323,19 @@ ecma_utf8_string_to_number_by_radix (const lit_utf8_byte_t *str_p, /**< utf-8 st
}
#endif /* JERRY_ESNEXT */
- for (const lit_utf8_byte_t * iter_p = str_p; iter_p <= end_p; iter_p++)
+ for (const lit_utf8_byte_t *iter_p = str_p; iter_p <= end_p; iter_p++)
{
int32_t digit_value;
- if (*iter_p >= LIT_CHAR_0
- && *iter_p <= LIT_CHAR_9)
+ if (*iter_p >= LIT_CHAR_0 && *iter_p <= LIT_CHAR_9)
{
digit_value = (*iter_p - LIT_CHAR_0);
}
- else if (*iter_p >= LIT_CHAR_LOWERCASE_A
- && *iter_p <= LIT_CHAR_LOWERCASE_F)
+ else if (*iter_p >= LIT_CHAR_LOWERCASE_A && *iter_p <= LIT_CHAR_LOWERCASE_F)
{
digit_value = 10 + (*iter_p - LIT_CHAR_LOWERCASE_A);
}
- else if (*iter_p >= LIT_CHAR_UPPERCASE_A
- && *iter_p <= LIT_CHAR_UPPERCASE_F)
+ else if (*iter_p >= LIT_CHAR_UPPERCASE_A && *iter_p <= LIT_CHAR_UPPERCASE_F)
{
digit_value = 10 + (*iter_p - LIT_CHAR_UPPERCASE_A);
}
@@ -393,20 +385,19 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
return ECMA_NUMBER_ZERO;
}
- if (end_p >= str_p + 2
- && str_p[0] == LIT_CHAR_0)
+ if (end_p >= str_p + 2 && str_p[0] == LIT_CHAR_0)
{
switch (LEXER_TO_ASCII_LOWERCASE (str_p[1]))
{
- case LIT_CHAR_LOWERCASE_X :
+ case LIT_CHAR_LOWERCASE_X:
{
return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 16 | options);
}
- case LIT_CHAR_LOWERCASE_O :
+ case LIT_CHAR_LOWERCASE_O:
{
return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 8 | options);
}
- case LIT_CHAR_LOWERCASE_B :
+ case LIT_CHAR_LOWERCASE_B:
{
return ecma_utf8_string_to_number_by_radix (str_p + 2, end_p, 2 | options);
}
@@ -455,8 +446,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
{
int32_t digit_value;
- if (*str_p >= LIT_CHAR_0
- && *str_p <= LIT_CHAR_9)
+ if (*str_p >= LIT_CHAR_0 && *str_p <= LIT_CHAR_9)
{
digit_seen = true;
digit_value = (*str_p - LIT_CHAR_0);
@@ -489,8 +479,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
str_p++;
}
- if (str_p <= end_p
- && *str_p == LIT_CHAR_DOT)
+ if (str_p <= end_p && *str_p == LIT_CHAR_DOT)
{
str_p++;
@@ -504,8 +493,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
{
int32_t digit_value;
- if (*str_p >= LIT_CHAR_0
- && *str_p <= LIT_CHAR_9)
+ if (*str_p >= LIT_CHAR_0 && *str_p <= LIT_CHAR_9)
{
digit_seen = true;
digit_value = (*str_p - LIT_CHAR_0);
@@ -539,9 +527,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
int32_t e_in_lit = 0;
bool e_in_lit_sign = false;
- if (str_p <= end_p
- && (*str_p == LIT_CHAR_LOWERCASE_E
- || *str_p == LIT_CHAR_UPPERCASE_E))
+ if (str_p <= end_p && (*str_p == LIT_CHAR_LOWERCASE_E || *str_p == LIT_CHAR_UPPERCASE_E))
{
str_p++;
@@ -569,8 +555,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
{
int32_t digit_value;
- if (*str_p >= LIT_CHAR_0
- && *str_p <= LIT_CHAR_9)
+ if (*str_p >= LIT_CHAR_0 && *str_p <= LIT_CHAR_9)
{
digit_value = (*str_p - LIT_CHAR_0);
}
@@ -587,7 +572,7 @@ ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, /**< utf-8 string */
}
e_in_lit = e_in_lit * 10 + digit_value;
- int32_t e_check = e + (int32_t) digits - 1 + (e_in_lit_sign ? -e_in_lit : e_in_lit);
+ int32_t e_check = e + (int32_t) digits - 1 + (e_in_lit_sign ? -e_in_lit : e_in_lit);
if (e_check > NUMBER_MAX_DECIMAL_EXPONENT)
{
@@ -764,8 +749,7 @@ ecma_uint32_to_utf8_string (uint32_t value, /**< value to convert */
buf_p--;
*buf_p = (lit_utf8_byte_t) ((value % 10) + LIT_CHAR_0);
value /= 10;
- }
- while (value != 0);
+ } while (value != 0);
JERRY_ASSERT (buf_p >= out_buffer_p);
@@ -807,8 +791,7 @@ ecma_number_to_uint32 (ecma_number_t num) /**< ecma-number */
if (abs_num >= num_2_pow_32)
{
- num_in_uint32_range = ecma_number_calc_remainder (abs_num,
- num_2_pow_32);
+ num_in_uint32_range = ecma_number_calc_remainder (abs_num, num_2_pow_32);
}
else
{
@@ -822,8 +805,7 @@ ecma_number_to_uint32 (ecma_number_t num) /**< ecma-number */
const uint32_t ret = sign ? -uint32_num : uint32_num;
#ifndef JERRY_NDEBUG
- if (sign
- && uint32_num != 0)
+ if (sign && uint32_num != 0)
{
JERRY_ASSERT (ret == uint64_2_pow_32 - uint32_num);
}
@@ -885,16 +867,16 @@ ecma_number_to_int32 (ecma_number_t num) /**< ecma-number */
} /* ecma_number_to_int32 */
/**
- * Perform conversion of ecma-number to decimal representation with decimal exponent.
- *
- * Note:
- * The calculated values correspond to s, n, k parameters in ECMA-262 v5, 9.8.1, item 5:
- * - parameter out_digits_p corresponds to s, the digits of the number;
- * - parameter out_decimal_exp_p corresponds to n, the decimal exponent;
- * - return value corresponds to k, the number of digits.
- *
- * @return the number of digits
- */
+ * Perform conversion of ecma-number to decimal representation with decimal exponent.
+ *
+ * Note:
+ * The calculated values correspond to s, n, k parameters in ECMA-262 v5, 9.8.1, item 5:
+ * - parameter out_digits_p corresponds to s, the digits of the number;
+ * - parameter out_decimal_exp_p corresponds to n, the decimal exponent;
+ * - return value corresponds to k, the number of digits.
+ *
+ * @return the number of digits
+ */
lit_utf8_size_t
ecma_number_to_decimal (ecma_number_t num, /**< ecma-number */
lit_utf8_byte_t *out_digits_p, /**< [out] buffer to fill with digits */
@@ -951,7 +933,8 @@ ecma_number_to_utf8_string (ecma_number_t num, /**< ecma-number */
if (ecma_number_is_infinity (num))
{
/* 4. */
- dst_p = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_INFINITY_UL, dst_p,
+ dst_p = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_INFINITY_UL,
+ dst_p,
(lit_utf8_size_t) (buffer_p + buffer_size - dst_p));
JERRY_ASSERT (dst_p <= buffer_p + buffer_size);
return (lit_utf8_size_t) (dst_p - buffer_p);
diff --git a/jerry-core/ecma/base/ecma-helpers-external-pointers.c b/jerry-core/ecma/base/ecma-helpers-external-pointers.c
index 23372219..66d542a0 100644
--- a/jerry-core/ecma/base/ecma-helpers-external-pointers.c
+++ b/jerry-core/ecma/base/ecma-helpers-external-pointers.c
@@ -16,9 +16,9 @@
#include "ecma-alloc.h"
#include "ecma-array-object.h"
#include "ecma-globals.h"
-#include "ecma-objects.h"
-#include "ecma-objects-general.h"
#include "ecma-helpers.h"
+#include "ecma-objects-general.h"
+#include "ecma-objects.h"
/** \addtogroup ecma ECMA
* @{
@@ -185,8 +185,7 @@ ecma_get_native_pointer_value (ecma_object_t *obj_p, /**< object to get property
if (JERRY_LIKELY (*property_p & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL))
{
- ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t,
- value_p->value);
+ ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value_p->value);
if (native_pointer_p->native_info_p == native_info_p)
{
@@ -215,8 +214,7 @@ ecma_get_native_pointer_value (ecma_object_t *obj_p, /**< object to get property
}
item_p = item_p->next_p;
- }
- while (item_p != NULL);
+ } while (item_p != NULL);
return NULL;
} /* ecma_get_native_pointer_value */
@@ -259,8 +257,7 @@ ecma_delete_native_pointer_property (ecma_object_t *obj_p, /**< object to delete
if (JERRY_LIKELY (*property_p & ECMA_PROPERTY_FLAG_SINGLE_EXTERNAL))
{
- ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t,
- value_p->value);
+ ecma_native_pointer_t *native_pointer_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_native_pointer_t, value_p->value);
if (native_pointer_p->native_info_p != native_info_p)
{
@@ -326,8 +323,7 @@ ecma_delete_native_pointer_property (ecma_object_t *obj_p, /**< object to delete
prev_p = item_p;
item_p = item_p->next_p;
- }
- while (item_p != NULL);
+ } while (item_p != NULL);
return false;
} /* ecma_delete_native_pointer_property */
diff --git a/jerry-core/ecma/base/ecma-helpers-number.c b/jerry-core/ecma/base/ecma-helpers-number.c
index 0e998f2b..a7921436 100644
--- a/jerry-core/ecma/base/ecma-helpers-number.c
+++ b/jerry-core/ecma/base/ecma-helpers-number.c
@@ -16,6 +16,7 @@
#include <math.h>
#include "ecma-conversion.h"
+
#include "lit-char-helpers.h"
/** \addtogroup ecma ECMA
@@ -28,20 +29,17 @@
JERRY_STATIC_ASSERT (sizeof (ecma_value_t) == sizeof (ecma_integer_value_t),
size_of_ecma_value_t_must_be_equal_to_the_size_of_ecma_integer_value_t);
-JERRY_STATIC_ASSERT (ECMA_DIRECT_SHIFT == ECMA_VALUE_SHIFT + 1,
- currently_directly_encoded_values_has_one_extra_flag);
+JERRY_STATIC_ASSERT (ECMA_DIRECT_SHIFT == ECMA_VALUE_SHIFT + 1, currently_directly_encoded_values_has_one_extra_flag);
JERRY_STATIC_ASSERT (((1 << (ECMA_DIRECT_SHIFT - 1)) | ECMA_TYPE_DIRECT) == ECMA_DIRECT_TYPE_SIMPLE_VALUE,
currently_directly_encoded_values_start_after_direct_type_simple_value);
/**
* Position of the sign bit in ecma-numbers
*/
-#define ECMA_NUMBER_SIGN_POS (ECMA_NUMBER_FRACTION_WIDTH + \
- ECMA_NUMBER_BIASED_EXP_WIDTH)
+#define ECMA_NUMBER_SIGN_POS (ECMA_NUMBER_FRACTION_WIDTH + ECMA_NUMBER_BIASED_EXP_WIDTH)
#if !JERRY_NUMBER_TYPE_FLOAT64
-JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint32_t),
- size_of_ecma_number_t_must_be_equal_to_4_bytes);
+JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint32_t), size_of_ecma_number_t_must_be_equal_to_4_bytes);
/**
* Packing sign, fraction and biased exponent to ecma-number
@@ -56,9 +54,8 @@ ecma_number_pack (bool sign, /**< sign */
JERRY_ASSERT ((biased_exp & ~((1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1)) == 0);
JERRY_ASSERT ((fraction & ~((1ull << ECMA_NUMBER_FRACTION_WIDTH) - 1)) == 0);
- uint32_t packed_value = (((sign ? 1u : 0u) << ECMA_NUMBER_SIGN_POS) |
- (biased_exp << ECMA_NUMBER_FRACTION_WIDTH) |
- ((uint32_t) fraction));
+ uint32_t packed_value =
+ (((sign ? 1u : 0u) << ECMA_NUMBER_SIGN_POS) | (biased_exp << ECMA_NUMBER_FRACTION_WIDTH) | ((uint32_t) fraction));
ecma_number_accessor_t u;
u.as_uint32_t = packed_value;
@@ -103,8 +100,7 @@ ecma_number_unpack (ecma_number_t num, /**< ecma-number */
const int32_t ecma_number_exponent_bias = 127;
#elif JERRY_NUMBER_TYPE_FLOAT64
-JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint64_t),
- size_of_ecma_number_t_must_be_equal_to_8_bytes);
+JERRY_STATIC_ASSERT (sizeof (ecma_number_t) == sizeof (uint64_t), size_of_ecma_number_t_must_be_equal_to_8_bytes);
/**
* Packing sign, fraction and biased exponent to ecma-number
@@ -116,9 +112,8 @@ ecma_number_pack (bool sign, /**< sign */
uint32_t biased_exp, /**< biased exponent */
uint64_t fraction) /**< fraction */
{
- uint64_t packed_value = (((sign ? 1ull : 0ull) << ECMA_NUMBER_SIGN_POS) |
- (((uint64_t) biased_exp) << ECMA_NUMBER_FRACTION_WIDTH) |
- fraction);
+ uint64_t packed_value = (((sign ? 1ull : 0ull) << ECMA_NUMBER_SIGN_POS)
+ | (((uint64_t) biased_exp) << ECMA_NUMBER_FRACTION_WIDTH) | fraction);
JERRY_ASSERT ((biased_exp & ~((1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1)) == 0);
JERRY_ASSERT ((fraction & ~((1ull << ECMA_NUMBER_FRACTION_WIDTH) - 1)) == 0);
@@ -228,9 +223,8 @@ ecma_number_is_nan (ecma_number_t num) /**< ecma-number */
uint32_t biased_exp = ecma_number_get_biased_exponent_field (num);
uint64_t fraction = ecma_number_get_fraction_field (num);
- /* IEEE-754 2008, 3.4, a */
- bool is_nan_ieee754 = ((biased_exp == (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1)
- && (fraction != 0));
+ /* IEEE-754 2008, 3.4, a */
+ bool is_nan_ieee754 = ((biased_exp == (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1) && (fraction != 0));
JERRY_ASSERT (is_nan == is_nan_ieee754);
#endif /* !JERRY_NDEBUG */
@@ -251,7 +245,7 @@ ecma_number_make_nan (void)
#if JERRY_NUMBER_TYPE_FLOAT64
f.as_uint64_t = 0x7ff8000000000000ull; /* double QNaN, same as the C99 nan("") returns. */
#else /* !JERRY_NUMBER_TYPE_FLOAT64 */
- f.as_uint32_t = 0x7fc00000u; /* float QNaN, same as the C99 nanf("") returns. */
+ f.as_uint32_t = 0x7fc00000u; /* float QNaN, same as the C99 nanf("") returns. */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
return f.as_ecma_number_t;
} /* ecma_number_make_nan */
@@ -304,8 +298,8 @@ ecma_number_is_zero (ecma_number_t num) /**< ecma-number */
#ifndef JERRY_NDEBUG
/* IEEE-754 2008, 3.4, e */
- bool is_zero_ieee754 = (ecma_number_get_fraction_field (num) == 0
- && ecma_number_get_biased_exponent_field (num) == 0);
+ bool is_zero_ieee754 =
+ (ecma_number_get_fraction_field (num) == 0 && ecma_number_get_biased_exponent_field (num) == 0);
JERRY_ASSERT (is_zero == is_zero_ieee754);
#endif /* !JERRY_NDEBUG */
@@ -327,8 +321,7 @@ ecma_number_is_infinity (ecma_number_t num) /**< ecma-number */
uint64_t fraction = ecma_number_get_fraction_field (num);
/* IEEE-754 2008, 3.4, b */
- return ((biased_exp == (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1)
- && (fraction == 0));
+ return ((biased_exp == (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1) && (fraction == 0));
} /* ecma_number_is_infinity */
/**
@@ -340,11 +333,11 @@ ecma_number_is_infinity (ecma_number_t num) /**< ecma-number */
extern inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_number_is_finite (ecma_number_t num) /**< ecma-number */
{
-#if defined (__GNUC__) || defined (__clang__)
+#if defined(__GNUC__) || defined(__clang__)
return __builtin_isfinite (num);
-#elif defined (_WIN32)
+#elif defined(_WIN32)
return isfinite (num);
-#else
+#else /* !(defined(__GNUC__) || defined(__clang__) || defined(_WIN32)) */
return !ecma_number_is_nan (num) && !ecma_number_is_infinity (num);
#endif /* defined (__GNUC__) || defined (__clang__) */
} /* ecma_number_is_finite */
@@ -422,9 +415,7 @@ ecma_number_make_normal_positive_from_fraction_and_exponent (uint64_t fraction,
JERRY_ASSERT ((fraction & ~((1ull << (ECMA_NUMBER_FRACTION_WIDTH + 1)) - 1)) == 0);
JERRY_ASSERT ((fraction & (1ull << ECMA_NUMBER_FRACTION_WIDTH)) != 0);
- return ecma_number_pack (false,
- biased_exp,
- fraction & ~(1ull << ECMA_NUMBER_FRACTION_WIDTH));
+ return ecma_number_pack (false, biased_exp, fraction & ~(1ull << ECMA_NUMBER_FRACTION_WIDTH));
} /* ecma_number_make_normal_positive_from_fraction_and_exponent */
/**
@@ -463,8 +454,7 @@ ecma_number_make_from_sign_mantissa_and_exponent (bool sign, /**< true - for neg
}
/* Normalizing mantissa */
- while (mantissa != 0
- && ((mantissa & (1ull << ECMA_NUMBER_FRACTION_WIDTH)) == 0))
+ while (mantissa != 0 && ((mantissa & (1ull << ECMA_NUMBER_FRACTION_WIDTH)) == 0))
{
exponent--;
mantissa <<= 1;
@@ -507,9 +497,7 @@ ecma_number_make_from_sign_mantissa_and_exponent (bool sign, /**< true - for neg
JERRY_ASSERT (biased_exp < (1u << ECMA_NUMBER_BIASED_EXP_WIDTH) - 1);
JERRY_ASSERT ((mantissa & ~((1ull << ECMA_NUMBER_FRACTION_WIDTH) - 1)) == 0);
- return ecma_number_pack (sign,
- biased_exp,
- mantissa);
+ return ecma_number_pack (sign, biased_exp, mantissa);
} /* ecma_number_make_from_sign_mantissa_and_exponent */
/**
@@ -542,9 +530,7 @@ ecma_number_get_prev (ecma_number_t num) /**< ecma-number */
fraction--;
}
- return ecma_number_pack (false,
- biased_exp,
- fraction);
+ return ecma_number_pack (false, biased_exp, fraction);
} /* ecma_number_get_prev */
/**
@@ -581,9 +567,7 @@ ecma_number_get_next (ecma_number_t num) /**< ecma-number */
fraction &= ~(1ull << ECMA_NUMBER_FRACTION_WIDTH);
- return ecma_number_pack (false,
- biased_exp,
- fraction);
+ return ecma_number_pack (false, biased_exp, fraction);
} /* ecma_number_get_next */
/**
@@ -609,8 +593,7 @@ ecma_number_trunc (ecma_number_t num) /**< ecma-number */
{
fraction &= ~((1ull << (dot_shift - exponent)) - 1);
- ecma_number_t tmp = ecma_number_make_normal_positive_from_fraction_and_exponent (fraction,
- exponent);
+ ecma_number_t tmp = ecma_number_make_normal_positive_from_fraction_and_exponent (fraction, exponent);
if (sign)
{
return -tmp;
@@ -639,18 +622,15 @@ ecma_number_t
ecma_number_calc_remainder (ecma_number_t left_num, /**< left operand */
ecma_number_t right_num) /**< right operand */
{
- JERRY_ASSERT (!ecma_number_is_nan (left_num)
- && !ecma_number_is_zero (left_num)
+ JERRY_ASSERT (!ecma_number_is_nan (left_num) && !ecma_number_is_zero (left_num)
&& !ecma_number_is_infinity (left_num));
- JERRY_ASSERT (!ecma_number_is_nan (right_num)
- && !ecma_number_is_zero (right_num)
+ JERRY_ASSERT (!ecma_number_is_nan (right_num) && !ecma_number_is_zero (right_num)
&& !ecma_number_is_infinity (right_num));
const ecma_number_t q = ecma_number_trunc (left_num / right_num);
ecma_number_t r = left_num - right_num * q;
- if (ecma_number_is_zero (r)
- && ecma_number_is_negative (left_num))
+ if (ecma_number_is_zero (r) && ecma_number_is_negative (left_num))
{
r = -r;
}
@@ -667,8 +647,7 @@ ecma_number_t
ecma_number_pow (ecma_number_t x, /**< left operand */
ecma_number_t y) /**< right operand */
{
- if (ecma_number_is_nan (y) ||
- (ecma_number_is_infinity (y) && (x == 1.0 || x == -1.0)))
+ if (ecma_number_is_nan (y) || (ecma_number_is_infinity (y) && (x == 1.0 || x == -1.0)))
{
/* Handle differences between ES5.1 and ISO C standards for pow. */
return ecma_number_make_nan ();
@@ -692,7 +671,7 @@ extern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE
ecma_integer_multiply (ecma_integer_value_t left_integer, /**< left operand */
ecma_integer_value_t right_integer) /**< right operand */
{
-#if defined (__GNUC__) || defined (__clang__)
+#if defined(__GNUC__) || defined(__clang__)
/* Check if left_integer is power of 2 */
if (JERRY_UNLIKELY ((left_integer & (left_integer - 1)) == 0))
{
@@ -720,16 +699,16 @@ ecma_integer_multiply (ecma_integer_value_t left_integer, /**< left operand */
ecma_value_t
ecma_number_parse_int (const lit_utf8_byte_t *string_buff, /**< routine's first argument's
* string buffer */
- lit_utf8_size_t string_buff_size, /**< routine's first argument's
- * string buffer's size */
- ecma_value_t radix) /**< routine's second argument */
+ lit_utf8_size_t string_buff_size, /**< routine's first argument's
+ * string buffer's size */
+ ecma_value_t radix) /**< routine's second argument */
{
if (string_buff_size == 0)
{
return ecma_make_nan_value ();
}
- /* 2. Remove leading whitespace. */
+ /* 2. Remove leading whitespace. */
const lit_utf8_byte_t *string_end_p = string_buff + string_buff_size;
const lit_utf8_byte_t *start_p = ecma_string_trim_front (string_buff, string_end_p);
@@ -796,9 +775,7 @@ ecma_number_parse_int (const lit_utf8_byte_t *string_buff, /**< routine's first
}
/* 10. */
- if (strip_prefix
- && ((end_p - start_p) >= 2)
- && (current == LIT_CHAR_0))
+ if (strip_prefix && ((end_p - start_p) >= 2) && (current == LIT_CHAR_0))
{
ecma_char_t next = *string_curr_p;
if (next == LIT_CHAR_LOWERCASE_X || next == LIT_CHAR_UPPERCASE_X)
@@ -896,8 +873,8 @@ ecma_number_parse_int (const lit_utf8_byte_t *string_buff, /**< routine's first
ecma_value_t
ecma_number_parse_float (const lit_utf8_byte_t *string_buff, /**< routine's first argument's
* string buffer */
- lit_utf8_size_t string_buff_size) /**< routine's first argument's
- * string buffer's size */
+ lit_utf8_size_t string_buff_size) /**< routine's first argument's
+ * string buffer's size */
{
if (string_buff_size == 0)
{
@@ -937,8 +914,7 @@ ecma_number_parse_float (const lit_utf8_byte_t *string_buff, /**< routine's firs
/* The input string should be at least the length of "Infinity" to be correctly processed as
* the infinity value.
*/
- if ((str_end_p - str_curr_p) >= (int) infinity_length
- && memcmp (infinity_str_p, str_curr_p, infinity_length) == 0)
+ if ((str_end_p - str_curr_p) >= (int) infinity_length && memcmp (infinity_str_p, str_curr_p, infinity_length) == 0)
{
/* String matched Infinity. */
return ecma_make_number_value (ecma_number_make_infinity (sign));
@@ -1021,15 +997,13 @@ ecma_number_parse_float (const lit_utf8_byte_t *string_buff, /**< routine's firs
}
/* Check exponent. */
- if ((current == LIT_CHAR_LOWERCASE_E || current == LIT_CHAR_UPPERCASE_E)
- && (has_whole_part || has_fraction_part)
+ if ((current == LIT_CHAR_LOWERCASE_E || current == LIT_CHAR_UPPERCASE_E) && (has_whole_part || has_fraction_part)
&& str_curr_p < str_end_p)
{
current = *str_curr_p++;
/* Check sign of exponent. */
- if ((current == LIT_CHAR_PLUS || current == LIT_CHAR_MINUS)
- && str_curr_p < str_end_p)
+ if ((current == LIT_CHAR_PLUS || current == LIT_CHAR_MINUS) && str_curr_p < str_end_p)
{
current = *str_curr_p++;
}
diff --git a/jerry-core/ecma/base/ecma-helpers-string.c b/jerry-core/ecma/base/ecma-helpers-string.c
index aa9dfa4f..a4d6749b 100644
--- a/jerry-core/ecma/base/ecma-helpers-string.c
+++ b/jerry-core/ecma/base/ecma-helpers-string.c
@@ -19,9 +19,10 @@
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
+
#include "jcontext.h"
-#include "jrt.h"
#include "jrt-libc-includes.h"
+#include "jrt.h"
#include "lit-char-helpers.h"
#include "lit-magic-strings.h"
@@ -41,8 +42,7 @@ JERRY_STATIC_ASSERT ((ECMA_STRING_MAX_REF | ECMA_STRING_CONTAINER_MASK | ECMA_ST
JERRY_STATIC_ASSERT (ECMA_STRING_NOT_ARRAY_INDEX == UINT32_MAX,
ecma_string_not_array_index_must_be_equal_to_uint32_max);
-JERRY_STATIC_ASSERT ((ECMA_TYPE_DIRECT_STRING & 0x1) != 0,
- ecma_type_direct_string_must_be_odd_number);
+JERRY_STATIC_ASSERT ((ECMA_TYPE_DIRECT_STRING & 0x1) != 0, ecma_type_direct_string_must_be_odd_number);
JERRY_STATIC_ASSERT (LIT_MAGIC_STRING__COUNT <= ECMA_DIRECT_STRING_MAX_IMM,
all_magic_strings_must_be_encoded_as_direct_string);
@@ -96,8 +96,7 @@ ecma_string_to_array_index (const lit_utf8_byte_t *string_p, /**< utf-8 string *
}
index = (index * 10) + (uint32_t) (*string_p++ - LIT_CHAR_0);
- }
- while (string_p < string_end_p);
+ } while (string_p < string_end_p);
if (string_size < ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32)
{
@@ -107,9 +106,7 @@ ecma_string_to_array_index (const lit_utf8_byte_t *string_p, /**< utf-8 string *
/* Overflow must be checked as well when size is
* equal to ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32. */
- if (*string_p > LIT_CHAR_9
- || *string_p < LIT_CHAR_0
- || index > (UINT32_MAX / 10)
+ if (*string_p > LIT_CHAR_9 || *string_p < LIT_CHAR_0 || index > (UINT32_MAX / 10)
|| (index == (UINT32_MAX / 10) && *string_p > LIT_CHAR_5))
{
return false;
@@ -241,8 +238,7 @@ ecma_prop_name_is_symbol (ecma_string_t *string_p) /**< ecma-string */
{
JERRY_ASSERT (string_p != NULL);
- return (!ECMA_IS_DIRECT_STRING (string_p)
- && ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_SYMBOL);
+ return (!ECMA_IS_DIRECT_STRING (string_p) && ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_SYMBOL);
} /* ecma_prop_name_is_symbol */
#endif /* JERRY_ESNEXT */
@@ -251,7 +247,7 @@ ecma_prop_name_is_symbol (ecma_string_t *string_p) /**< ecma-string */
*
* @return pointer to ecma-string descriptor
*/
-static inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
+static inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_new_ecma_string_from_utf8_buffer (lit_utf8_size_t length, /**< length of the buffer */
lit_utf8_size_t size, /**< size of the buffer */
lit_utf8_byte_t **data_p) /**< [out] pointer to the start of the string buffer */
@@ -382,9 +378,8 @@ ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, /**< utf-8 stri
}
lit_utf8_byte_t *data_p;
- string_desc_p = ecma_new_ecma_string_from_utf8_buffer (lit_utf8_string_length (string_p, string_size),
- string_size,
- &data_p);
+ string_desc_p =
+ ecma_new_ecma_string_from_utf8_buffer (lit_utf8_string_length (string_p, string_size), string_size, &data_p);
string_desc_p->u.hash = lit_utf8_string_calc_hash (string_p, string_size);
memcpy (data_p, string_p, string_size);
@@ -446,9 +441,8 @@ ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string
JERRY_ASSERT (lit_is_valid_utf8_string (string_p, string_size, false));
lit_utf8_byte_t *data_p;
- ecma_string_t *string_desc_p = ecma_new_ecma_string_from_utf8_buffer (converted_string_length,
- converted_string_size,
- &data_p);
+ ecma_string_t *string_desc_p =
+ ecma_new_ecma_string_from_utf8_buffer (converted_string_length, converted_string_size, &data_p);
const lit_utf8_byte_t *const begin_data_p = data_p;
pos = 0;
@@ -661,8 +655,8 @@ ecma_new_ecma_string_from_number (ecma_number_t num) /**< ecma-number */
if (ecma_number_is_infinity (num))
{
- lit_magic_string_id_t id = (ecma_number_is_negative (num) ? LIT_MAGIC_STRING_NEGATIVE_INFINITY_UL
- : LIT_MAGIC_STRING_INFINITY_UL);
+ lit_magic_string_id_t id =
+ (ecma_number_is_negative (num) ? LIT_MAGIC_STRING_NEGATIVE_INFINITY_UL : LIT_MAGIC_STRING_INFINITY_UL);
return ecma_get_magic_string (id);
}
@@ -676,9 +670,8 @@ ecma_new_ecma_string_from_number (ecma_number_t num) /**< ecma-number */
#endif /* !JERRY_NDEBUG */
lit_utf8_byte_t *data_p;
- ecma_string_t *string_desc_p = ecma_new_ecma_string_from_utf8_buffer (lit_utf8_string_length (str_buf, str_size),
- str_size,
- &data_p);
+ ecma_string_t *string_desc_p =
+ ecma_new_ecma_string_from_utf8_buffer (lit_utf8_string_length (str_buf, str_size), str_size, &data_p);
string_desc_p->u.hash = lit_utf8_string_calc_hash (str_buf, str_size);
memcpy (data_p, str_buf, str_size);
@@ -694,7 +687,7 @@ ecma_new_ecma_string_from_number (ecma_number_t num) /**< ecma-number */
*
* @return pointer to ecma-string descriptor
*/
-extern inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_get_magic_string (lit_magic_string_id_t id) /**< identifier of magic string */
{
JERRY_ASSERT (id < LIT_MAGIC_STRING__COUNT);
@@ -709,7 +702,7 @@ ecma_get_magic_string (lit_magic_string_id_t id) /**< identifier of magic string
*
* @return pointer to ecma-string descriptor
*/
-extern inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_get_internal_string (lit_magic_string_id_t id) /**< identifier of magic string */
{
JERRY_ASSERT (id >= LIT_NON_INTERNAL_MAGIC_STRING__COUNT && id < LIT_MAGIC_STRING__COUNT);
@@ -743,11 +736,8 @@ ecma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */
uint8_t flags = ECMA_STRING_FLAG_IS_ASCII;
lit_utf8_byte_t uint32_to_string_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];
- const lit_utf8_byte_t *cesu8_string1_p = ecma_string_get_chars (string1_p,
- &cesu8_string1_size,
- &cesu8_string1_length,
- uint32_to_string_buffer,
- &flags);
+ const lit_utf8_byte_t *cesu8_string1_p =
+ ecma_string_get_chars (string1_p, &cesu8_string1_size, &cesu8_string1_length, uint32_to_string_buffer, &flags);
JERRY_ASSERT (!(flags & ECMA_STRING_FLAG_MUST_BE_FREED));
JERRY_ASSERT (cesu8_string1_length > 0);
@@ -762,10 +752,8 @@ ecma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */
}
lit_magic_string_id_t magic_string_id;
- magic_string_id = lit_is_utf8_string_pair_magic (cesu8_string1_p,
- cesu8_string1_size,
- cesu8_string2_p,
- cesu8_string2_size);
+ magic_string_id =
+ lit_is_utf8_string_pair_magic (cesu8_string1_p, cesu8_string1_size, cesu8_string2_p, cesu8_string2_size);
if (magic_string_id != LIT_MAGIC_STRING__COUNT)
{
@@ -789,10 +777,8 @@ ecma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */
if (lit_get_magic_string_ex_count () > 0)
{
lit_magic_string_ex_id_t magic_string_ex_id;
- magic_string_ex_id = lit_is_ex_utf8_string_pair_magic (cesu8_string1_p,
- cesu8_string1_size,
- cesu8_string2_p,
- cesu8_string2_size);
+ magic_string_ex_id =
+ lit_is_ex_utf8_string_pair_magic (cesu8_string1_p, cesu8_string1_size, cesu8_string2_p, cesu8_string2_size);
if (magic_string_ex_id < lit_get_magic_string_ex_count ())
{
@@ -802,9 +788,8 @@ ecma_append_chars_to_string (ecma_string_t *string1_p, /**< base ecma-string */
}
lit_utf8_byte_t *data_p;
- ecma_string_t *string_desc_p = ecma_new_ecma_string_from_utf8_buffer (cesu8_string1_length + cesu8_string2_length,
- new_size,
- &data_p);
+ ecma_string_t *string_desc_p =
+ ecma_new_ecma_string_from_utf8_buffer (cesu8_string1_length + cesu8_string2_length, new_size, &data_p);
lit_string_hash_t hash_start;
@@ -857,18 +842,13 @@ ecma_concat_ecma_strings (ecma_string_t *string1_p, /**< first ecma-string */
lit_utf8_byte_t uint32_to_string_buffer[ECMA_MAX_CHARS_IN_STRINGIFIED_UINT32];
uint8_t flags = ECMA_STRING_FLAG_IS_ASCII;
- const lit_utf8_byte_t *cesu8_string2_p = ecma_string_get_chars (string2_p,
- &cesu8_string2_size,
- &cesu8_string2_length,
- uint32_to_string_buffer,
- &flags);
+ const lit_utf8_byte_t *cesu8_string2_p =
+ ecma_string_get_chars (string2_p, &cesu8_string2_size, &cesu8_string2_length, uint32_to_string_buffer, &flags);
JERRY_ASSERT (cesu8_string2_p != NULL);
- ecma_string_t *result_p = ecma_append_chars_to_string (string1_p,
- cesu8_string2_p,
- cesu8_string2_size,
- cesu8_string2_length);
+ ecma_string_t *result_p =
+ ecma_append_chars_to_string (string1_p, cesu8_string2_p, cesu8_string2_size, cesu8_string2_length);
JERRY_ASSERT (!(flags & ECMA_STRING_FLAG_MUST_BE_FREED));
@@ -1200,10 +1180,7 @@ ecma_string_copy_to_utf8_buffer (const ecma_string_t *string_p, /**< ecma-string
return size;
}
- size = lit_convert_cesu8_string_to_utf8_string (chars_p,
- size,
- buffer_p,
- buffer_size);
+ size = lit_convert_cesu8_string_to_utf8_string (chars_p, size, buffer_p, buffer_size);
if (flags & ECMA_STRING_FLAG_MUST_BE_FREED)
{
@@ -1606,7 +1583,6 @@ ecma_string_get_chars (const ecma_string_t *string_p, /**< ecma-string */
JERRY_ASSERT (length == size);
*flags_p |= ECMA_STRING_FLAG_IS_UINT32 | ECMA_STRING_FLAG_REHASH_NEEDED;
break;
-
}
default:
{
@@ -1634,8 +1610,7 @@ ecma_string_get_chars (const ecma_string_t *string_p, /**< ecma-string */
*length_p = length;
}
- if ((*flags_p & ECMA_STRING_FLAG_IS_ASCII)
- && length != size)
+ if ((*flags_p & ECMA_STRING_FLAG_IS_ASCII) && length != size)
{
*flags_p = (uint8_t) (*flags_p & (uint8_t) ~ECMA_STRING_FLAG_IS_ASCII);
}
@@ -1685,7 +1660,7 @@ ecma_string_is_length (const ecma_string_t *string_p) /**< property name */
*
* @return pointer to the converted ecma string
*/
-static inline ecma_string_t * JERRY_ATTR_ALWAYS_INLINE
+static inline ecma_string_t *JERRY_ATTR_ALWAYS_INLINE
ecma_property_to_string (ecma_property_t property, /**< property name type */
jmem_cpointer_t prop_name_cp) /**< property name compressed pointer */
{
@@ -1964,8 +1939,7 @@ bool
ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-string */
const ecma_string_t *string2_p) /**< ecma-string */
{
- if (ecma_compare_ecma_strings (string1_p,
- string2_p))
+ if (ecma_compare_ecma_strings (string1_p, string2_p))
{
return false;
}
@@ -2038,10 +2012,7 @@ ecma_compare_ecma_strings_relational (const ecma_string_t *string1_p, /**< ecma-
}
}
- return lit_compare_utf8_strings_relational (utf8_string1_p,
- utf8_string1_size,
- utf8_string2_p,
- utf8_string2_size);
+ return lit_compare_utf8_strings_relational (utf8_string1_p, utf8_string1_size, utf8_string2_p, utf8_string2_size);
} /* ecma_compare_ecma_strings_relational */
/**
@@ -2071,8 +2042,7 @@ ecma_string_get_ascii_size (const ecma_string_t *string_p) /**< ecma-string */
return ECMA_STRING_NO_ASCII_SIZE;
}
- JERRY_ASSERT (ECMA_STRING_IS_ASCII (lit_get_magic_string_utf8 (id),
- lit_get_magic_string_size (id)));
+ JERRY_ASSERT (ECMA_STRING_IS_ASCII (lit_get_magic_string_utf8 (id), lit_get_magic_string_size (id)));
return lit_get_magic_string_size (id);
}
@@ -2120,8 +2090,7 @@ ecma_string_get_length (const ecma_string_t *string_p) /**< ecma-string */
JERRY_ASSERT ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) >= LIT_MAGIC_STRING__COUNT);
uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) - LIT_MAGIC_STRING__COUNT;
- return lit_utf8_string_length (lit_get_magic_string_ex_utf8 (id),
- lit_get_magic_string_ex_size (id));
+ return lit_utf8_string_length (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));
}
if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_HEAP_UTF8_STRING)
@@ -2137,8 +2106,7 @@ ecma_string_get_length (const ecma_string_t *string_p) /**< ecma-string */
JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX);
lit_magic_string_ex_id_t id = LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id;
- return lit_utf8_string_length (lit_get_magic_string_ex_utf8 (id),
- lit_get_magic_string_ex_size (id));
+ return lit_utf8_string_length (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));
} /* ecma_string_get_length */
/**
@@ -2162,8 +2130,7 @@ ecma_string_get_utf8_length (const ecma_string_t *string_p) /**< ecma-string */
JERRY_ASSERT ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) >= LIT_MAGIC_STRING__COUNT);
uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) - LIT_MAGIC_STRING__COUNT;
- return lit_get_utf8_length_of_cesu8_string (lit_get_magic_string_ex_utf8 (id),
- lit_get_magic_string_ex_size (id));
+ return lit_get_utf8_length_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));
}
if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_HEAP_UTF8_STRING)
@@ -2196,8 +2163,7 @@ ecma_string_get_utf8_length (const ecma_string_t *string_p) /**< ecma-string */
lit_magic_string_ex_id_t id = LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id;
- return lit_get_utf8_length_of_cesu8_string (lit_get_magic_string_ex_utf8 (id),
- lit_get_magic_string_ex_size (id));
+ return lit_get_utf8_length_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));
} /* ecma_string_get_utf8_length */
/**
@@ -2259,8 +2225,7 @@ ecma_string_get_utf8_size (const ecma_string_t *string_p) /**< ecma-string */
JERRY_ASSERT ((uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) >= LIT_MAGIC_STRING__COUNT);
uint32_t id = (uint32_t) ECMA_GET_DIRECT_STRING_VALUE (string_p) - LIT_MAGIC_STRING__COUNT;
- return lit_get_utf8_size_of_cesu8_string (lit_get_magic_string_ex_utf8 (id),
- lit_get_magic_string_ex_size (id));
+ return lit_get_utf8_size_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));
}
if (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_HEAP_UTF8_STRING)
@@ -2291,8 +2256,7 @@ ecma_string_get_utf8_size (const ecma_string_t *string_p) /**< ecma-string */
JERRY_ASSERT (ECMA_STRING_GET_CONTAINER (string_p) == ECMA_STRING_CONTAINER_MAGIC_STRING_EX);
lit_magic_string_ex_id_t id = LIT_MAGIC_STRING__COUNT - string_p->u.magic_string_ex_id;
- return lit_get_utf8_size_of_cesu8_string (lit_get_magic_string_ex_utf8 (id),
- lit_get_magic_string_ex_size (id));
+ return lit_get_utf8_size_of_cesu8_string (lit_get_magic_string_ex_utf8 (id), lit_get_magic_string_ex_size (id));
} /* ecma_string_get_utf8_size */
/**
@@ -2511,7 +2475,7 @@ ecma_string_substr (const ecma_string_t *string_p, /**< pointer to an ecma strin
*/
const lit_utf8_byte_t *
ecma_string_trim_front (const lit_utf8_byte_t *start_p, /**< current string's start position */
- const lit_utf8_byte_t *end_p) /**< current string's end position */
+ const lit_utf8_byte_t *end_p) /**< current string's end position */
{
ecma_char_t ch;
@@ -2540,7 +2504,7 @@ ecma_string_trim_front (const lit_utf8_byte_t *start_p, /**< current string's st
*/
const lit_utf8_byte_t *
ecma_string_trim_back (const lit_utf8_byte_t *start_p, /**< current string's start position */
- const lit_utf8_byte_t *end_p) /**< current string's end position */
+ const lit_utf8_byte_t *end_p) /**< current string's end position */
{
ecma_char_t ch;
@@ -2568,7 +2532,7 @@ ecma_string_trim_back (const lit_utf8_byte_t *start_p, /**< current string's sta
*/
extern inline void JERRY_ATTR_ALWAYS_INLINE
ecma_string_trim_helper (const lit_utf8_byte_t **utf8_str_p, /**< [in, out] current string position */
- lit_utf8_size_t *utf8_str_size) /**< [in, out] size of the given string */
+ lit_utf8_size_t *utf8_str_size) /**< [in, out] size of the given string */
{
const lit_utf8_byte_t *end_p = *utf8_str_p + *utf8_str_size;
const lit_utf8_byte_t *start_p = *utf8_str_p;
@@ -2622,11 +2586,10 @@ ecma_string_trim (const ecma_string_t *string_p) /**< pointer to an ecma string
ecma_value_t
ecma_string_pad (ecma_value_t original_string_p, /**< Input ecma string */
ecma_value_t max_length, /**< Length to pad to, including original length */
- ecma_value_t fill_string, /**< The string to pad with */
+ ecma_value_t fill_string, /**< The string to pad with */
bool pad_on_start) /**< true - if we are padding to the start, calling with padStart
false - if we are padding to the end, calling with padEnd */
{
-
/* 3 */
ecma_length_t int_max_length;
if (ECMA_IS_VALUE_ERROR (ecma_op_to_length (max_length, &int_max_length)))
@@ -2723,7 +2686,7 @@ ecma_stringbuilder_create (void)
jmem_stats_allocate_string_bytes (initial_size);
#endif /* JERRY_MEM_STATS */
- ecma_stringbuilder_t ret = {.header_p = header_p};
+ ecma_stringbuilder_t ret = { .header_p = header_p };
return ret;
} /* ecma_stringbuilder_create */
@@ -2744,12 +2707,11 @@ ecma_stringbuilder_create_from (ecma_string_t *string_p) /**< ecma string */
jmem_stats_allocate_string_bytes (initial_size);
#endif /* JERRY_MEM_STATS */
- size_t copied_size = ecma_string_copy_to_cesu8_buffer (string_p,
- ECMA_STRINGBUILDER_STRING_PTR (header_p),
- string_size);
+ size_t copied_size =
+ ecma_string_copy_to_cesu8_buffer (string_p, ECMA_STRINGBUILDER_STRING_PTR (header_p), string_size);
JERRY_ASSERT (copied_size == string_size);
- ecma_stringbuilder_t ret = {.header_p = header_p};
+ ecma_stringbuilder_t ret = { .header_p = header_p };
return ret;
} /* ecma_stringbuilder_create_from */
@@ -2772,7 +2734,7 @@ ecma_stringbuilder_create_raw (const lit_utf8_byte_t *data_p, /**< pointer to da
memcpy (ECMA_STRINGBUILDER_STRING_PTR (header_p), data_p, data_size);
- ecma_stringbuilder_t ret = {.header_p = header_p};
+ ecma_stringbuilder_t ret = { .header_p = header_p };
return ret;
} /* ecma_stringbuilder_create_raw */
@@ -2797,7 +2759,7 @@ ecma_stringbuilder_grow (ecma_stringbuilder_t *builder_p, /**< string builder */
jmem_stats_allocate_string_bytes (required_size);
#endif /* JERRY_MEM_STATS */
- return ((lit_utf8_byte_t *) header_p) + header_p->current_size - required_size;
+ return ((lit_utf8_byte_t *) header_p) + header_p->current_size - required_size;
} /* ecma_stringbuilder_grow */
/**
@@ -2860,9 +2822,7 @@ ecma_stringbuilder_append (ecma_stringbuilder_t *builder_p, /**< string builder
const lit_utf8_size_t string_size = ecma_string_get_size (string_p);
lit_utf8_byte_t *dest_p = ecma_stringbuilder_grow (builder_p, string_size);
- size_t copied_size = ecma_string_copy_to_cesu8_buffer (string_p,
- dest_p,
- string_size);
+ size_t copied_size = ecma_string_copy_to_cesu8_buffer (string_p, dest_p, string_size);
JERRY_ASSERT (copied_size == string_size);
} /* ecma_stringbuilder_append */
@@ -2953,7 +2913,7 @@ ecma_stringbuilder_finalize (ecma_stringbuilder_t *builder_p) /**< string builde
#ifndef JERRY_NDEBUG
builder_p->header_p = NULL;
-#endif
+#endif /* !defined (JERRY_NDEBUG) */
size_t container_size = sizeof (ecma_short_string_t);
const lit_string_hash_t hash = lit_utf8_string_calc_hash (string_begin_p, string_size);
@@ -2978,9 +2938,7 @@ ecma_stringbuilder_finalize (ecma_stringbuilder_t *builder_p) /**< string builde
const size_t utf8_string_size = string_size + container_size;
header_p = jmem_heap_realloc_block (header_p, header_p->current_size, utf8_string_size);
- memmove (((lit_utf8_byte_t *) header_p + container_size),
- ECMA_STRINGBUILDER_STRING_PTR (header_p),
- string_size);
+ memmove (((lit_utf8_byte_t *) header_p + container_size), ECMA_STRINGBUILDER_STRING_PTR (header_p), string_size);
#if JERRY_MEM_STATS
jmem_stats_allocate_string_bytes (container_size - ECMA_ASCII_STRING_HEADER_SIZE);
@@ -3021,7 +2979,7 @@ ecma_stringbuilder_destroy (ecma_stringbuilder_t *builder_p) /**< string builder
#ifndef JERRY_NDEBUG
builder_p->header_p = NULL;
-#endif
+#endif /* !defined (JERRY_NDEBUG) */
#if JERRY_MEM_STATS
jmem_stats_free_string_bytes (size);
diff --git a/jerry-core/ecma/base/ecma-helpers-value.c b/jerry-core/ecma/base/ecma-helpers-value.c
index a10c9188..8b3598a9 100644
--- a/jerry-core/ecma/base/ecma-helpers-value.c
+++ b/jerry-core/ecma/base/ecma-helpers-value.c
@@ -15,20 +15,18 @@
#include "ecma-alloc.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "jrt.h"
+
#include "jrt-bit-fields.h"
+#include "jrt.h"
#include "vm-defines.h"
-#include "ecma-function-object.h"
-
-JERRY_STATIC_ASSERT (ECMA_TYPE___MAX <= ECMA_VALUE_TYPE_MASK,
- ecma_types_must_be_less_than_mask);
+JERRY_STATIC_ASSERT (ECMA_TYPE___MAX <= ECMA_VALUE_TYPE_MASK, ecma_types_must_be_less_than_mask);
-JERRY_STATIC_ASSERT ((ECMA_VALUE_TYPE_MASK + 1) == (1 << ECMA_VALUE_SHIFT),
- ecma_value_part_must_start_after_flags);
+JERRY_STATIC_ASSERT ((ECMA_VALUE_TYPE_MASK + 1) == (1 << ECMA_VALUE_SHIFT), ecma_value_part_must_start_after_flags);
JERRY_STATIC_ASSERT (ECMA_VALUE_SHIFT <= JMEM_ALIGNMENT_LOG,
ecma_value_shift_must_be_less_than_or_equal_than_mem_alignment_log);
@@ -42,18 +40,16 @@ JERRY_STATIC_ASSERT (sizeof (jmem_cpointer_t) <= sizeof (jmem_cpointer_tag_t),
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
/* cppcheck-suppress zerodiv */
-JERRY_STATIC_ASSERT (sizeof (uintptr_t) <= sizeof (ecma_value_t),
- uintptr_t_must_fit_in_ecma_value_t);
+JERRY_STATIC_ASSERT (sizeof (uintptr_t) <= sizeof (ecma_value_t), uintptr_t_must_fit_in_ecma_value_t);
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
-JERRY_STATIC_ASSERT (sizeof (uintptr_t) > sizeof (ecma_value_t),
- uintptr_t_must_not_fit_in_ecma_value_t);
+JERRY_STATIC_ASSERT (sizeof (uintptr_t) > sizeof (ecma_value_t), uintptr_t_must_not_fit_in_ecma_value_t);
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
JERRY_STATIC_ASSERT ((ECMA_VALUE_FALSE | (1 << ECMA_DIRECT_SHIFT)) == ECMA_VALUE_TRUE
- && ECMA_VALUE_FALSE != ECMA_VALUE_TRUE,
+ && ECMA_VALUE_FALSE != ECMA_VALUE_TRUE,
only_the_lowest_bit_must_be_different_for_simple_value_true_and_false);
#if JERRY_BUILTIN_BIGINT
@@ -110,7 +106,7 @@ ecma_pointer_to_ecma_value (const void *ptr) /**< pointer */
*
* @return pointer
*/
-static inline void * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
+static inline void *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_pointer_from_ecma_value (ecma_value_t value) /**< value */
{
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
@@ -277,8 +273,7 @@ extern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_are_values_integer_numbers (ecma_value_t first_value, /**< first ecma value */
ecma_value_t second_value) /**< second ecma value */
{
- JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_INTEGER_VALUE == 0,
- ecma_direct_type_integer_value_must_be_zero);
+ JERRY_STATIC_ASSERT (ECMA_DIRECT_TYPE_INTEGER_VALUE == 0, ecma_direct_type_integer_value_must_be_zero);
return ((first_value | second_value) & ECMA_DIRECT_TYPE_MASK) == ECMA_DIRECT_TYPE_INTEGER_VALUE;
} /* ecma_are_values_integer_numbers */
@@ -304,8 +299,7 @@ ecma_is_value_float_number (ecma_value_t value) /**< ecma value */
extern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_number (ecma_value_t value) /**< ecma value */
{
- return (ecma_is_value_integer_number (value)
- || ecma_is_value_float_number (value));
+ return (ecma_is_value_integer_number (value) || ecma_is_value_float_number (value));
} /* ecma_is_value_number */
JERRY_STATIC_ASSERT ((ECMA_TYPE_STRING | 0x4) == ECMA_TYPE_DIRECT_STRING,
@@ -362,12 +356,12 @@ ecma_is_value_magic_string (ecma_value_t value, /**< ecma value */
extern inline bool JERRY_ATTR_CONST JERRY_ATTR_ALWAYS_INLINE
ecma_is_value_bigint (ecma_value_t value) /**< ecma value */
{
- #if JERRY_BUILTIN_BIGINT
+#if JERRY_BUILTIN_BIGINT
return (ecma_get_value_type_field (value) == ECMA_TYPE_BIGINT);
- #else /* !JERRY_BUILTIN_BIGINT */
+#else /* !JERRY_BUILTIN_BIGINT */
JERRY_UNUSED (value);
return false;
- #endif /* JERRY_BUILTIN_BIGINT */
+#endif /* JERRY_BUILTIN_BIGINT */
} /* ecma_is_value_bigint */
/**
@@ -441,14 +435,9 @@ ecma_is_value_error_reference (ecma_value_t value) /**< ecma value */
void
ecma_check_value_type_is_spec_defined (ecma_value_t value) /**< ecma value */
{
- JERRY_ASSERT (ecma_is_value_undefined (value)
- || ecma_is_value_null (value)
- || ecma_is_value_boolean (value)
- || ecma_is_value_number (value)
- || ecma_is_value_string (value)
- || ecma_is_value_bigint (value)
- || ecma_is_value_symbol (value)
- || ecma_is_value_object (value));
+ JERRY_ASSERT (ecma_is_value_undefined (value) || ecma_is_value_null (value) || ecma_is_value_boolean (value)
+ || ecma_is_value_number (value) || ecma_is_value_string (value) || ecma_is_value_bigint (value)
+ || ecma_is_value_symbol (value) || ecma_is_value_object (value));
} /* ecma_check_value_type_is_spec_defined */
/**
@@ -768,7 +757,7 @@ ecma_get_float_from_value (ecma_value_t value) /**< ecma value */
*
* @return floating point value
*/
-extern inline ecma_number_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_number_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_pointer_from_float_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_get_value_type_field (value) == ECMA_TYPE_FLOAT);
@@ -797,7 +786,7 @@ ecma_get_number_from_value (ecma_value_t value) /**< ecma value */
*
* @return the string pointer
*/
-extern inline ecma_string_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_string_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_string_from_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_is_value_string (value));
@@ -816,7 +805,7 @@ ecma_get_string_from_value (ecma_value_t value) /**< ecma value */
*
* @return the string pointer
*/
-extern inline ecma_string_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_string_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_symbol_from_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_is_value_symbol (value));
@@ -830,7 +819,7 @@ ecma_get_symbol_from_value (ecma_value_t value) /**< ecma value */
*
* @return the string pointer
*/
-extern inline ecma_string_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_string_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_prop_name_from_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_is_value_prop_name (value));
@@ -848,7 +837,7 @@ ecma_get_prop_name_from_value (ecma_value_t value) /**< ecma value */
*
* @return the pointer
*/
-extern inline ecma_object_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_object_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_object_from_value (ecma_value_t value) /**< ecma value */
{
JERRY_ASSERT (ecma_is_value_object (value));
@@ -861,7 +850,7 @@ ecma_get_object_from_value (ecma_value_t value) /**< ecma value */
*
* @return the pointer
*/
-extern inline ecma_extended_primitive_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_extended_primitive_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_get_extended_primitive_from_value (ecma_value_t value) /**< ecma value */
{
#if JERRY_BUILTIN_BIGINT
@@ -892,7 +881,7 @@ ecma_invert_boolean_value (ecma_value_t value) /**< ecma value */
* @return copy of the given value
*/
ecma_value_t
-ecma_copy_value (ecma_value_t value) /**< value description */
+ecma_copy_value (ecma_value_t value) /**< value description */
{
switch (ecma_get_value_type_field (value))
{
@@ -951,7 +940,7 @@ ecma_copy_value (ecma_value_t value) /**< value description */
* @return copy of the given value
*/
extern inline ecma_value_t JERRY_ATTR_ALWAYS_INLINE
-ecma_fast_copy_value (ecma_value_t value) /**< value description */
+ecma_fast_copy_value (ecma_value_t value) /**< value description */
{
return (ecma_get_value_type_field (value) == ECMA_TYPE_DIRECT) ? value : ecma_copy_value (value);
} /* ecma_fast_copy_value */
@@ -1006,8 +995,7 @@ void
ecma_value_assign_value (ecma_value_t *value_p, /**< [in, out] ecma value */
ecma_value_t ecma_value) /**< value to assign */
{
- JERRY_STATIC_ASSERT (ECMA_TYPE_DIRECT == 0,
- ecma_type_direct_must_be_zero_for_the_next_check);
+ JERRY_STATIC_ASSERT (ECMA_TYPE_DIRECT == 0, ecma_type_direct_must_be_zero_for_the_next_check);
if (*value_p == ecma_value)
{
@@ -1018,8 +1006,7 @@ ecma_value_assign_value (ecma_value_t *value_p, /**< [in, out] ecma value */
{
*value_p = ecma_value;
}
- else if (ecma_is_value_float_number (ecma_value)
- && ecma_is_value_float_number (*value_p))
+ else if (ecma_is_value_float_number (ecma_value) && ecma_is_value_float_number (*value_p))
{
const ecma_number_t *num_src_p = (ecma_number_t *) ecma_get_pointer_from_ecma_value (ecma_value);
ecma_number_t *num_dst_p = (ecma_number_t *) ecma_get_pointer_from_ecma_value (*value_p);
diff --git a/jerry-core/ecma/base/ecma-helpers.c b/jerry-core/ecma/base/ecma-helpers.c
index efa1a112..b47e1535 100644
--- a/jerry-core/ecma/base/ecma-helpers.c
+++ b/jerry-core/ecma/base/ecma-helpers.c
@@ -13,20 +13,22 @@
* limitations under the License.
*/
+#include "ecma-helpers.h"
+
#include "ecma-alloc.h"
#include "ecma-array-object.h"
+#include "ecma-builtins.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
-#include "ecma-helpers.h"
#include "ecma-lcache.h"
#include "ecma-line-info.h"
#include "ecma-property-hashmap.h"
+
+#include "byte-code.h"
#include "jcontext.h"
#include "jrt-bit-fields.h"
-#include "byte-code.h"
#include "re-compiler.h"
-#include "ecma-builtins.h"
#if JERRY_DEBUGGER
#include "debugger.h"
@@ -62,13 +64,13 @@ JERRY_STATIC_ASSERT (ECMA_PROPERTY_FLAGS_MASK == ECMA_PROPERTY_CONFIGURABLE_ENUM
/* These checks are needed by ecma_get_object_base_type. */
JERRY_STATIC_ASSERT ((int) ECMA_OBJECT_TYPE_BUILT_IN_GENERAL == ((int) ECMA_OBJECT_TYPE_GENERAL | 0x1)
- && ((int) ECMA_OBJECT_TYPE_GENERAL & 0x1) == 0,
+ && ((int) ECMA_OBJECT_TYPE_GENERAL & 0x1) == 0,
ecma_object_type_built_in_general_has_unexpected_value);
JERRY_STATIC_ASSERT ((int) ECMA_OBJECT_TYPE_BUILT_IN_CLASS == ((int) ECMA_OBJECT_TYPE_CLASS | 0x1)
- && ((int) ECMA_OBJECT_TYPE_CLASS & 0x1) == 0,
+ && ((int) ECMA_OBJECT_TYPE_CLASS & 0x1) == 0,
ecma_object_type_built_in_class_has_unexpected_value);
JERRY_STATIC_ASSERT ((int) ECMA_OBJECT_TYPE_BUILT_IN_ARRAY == ((int) ECMA_OBJECT_TYPE_ARRAY | 0x1)
- && ((int) ECMA_OBJECT_TYPE_ARRAY & 0x1) == 0,
+ && ((int) ECMA_OBJECT_TYPE_ARRAY & 0x1) == 0,
ecma_object_type_built_in_array_has_unexpected_value);
/**
@@ -147,8 +149,7 @@ ecma_object_t *
ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< outer lexical environment */
ecma_object_t *binding_obj_p) /**< binding object */
{
- JERRY_ASSERT (binding_obj_p != NULL
- && !ecma_is_lexical_environment (binding_obj_p));
+ JERRY_ASSERT (binding_obj_p != NULL && !ecma_is_lexical_environment (binding_obj_p));
ecma_object_t *new_lexical_environment_p = ecma_alloc_object ();
@@ -156,8 +157,7 @@ ecma_create_object_lex_env (ecma_object_t *outer_lexical_environment_p, /**< out
ecma_init_gc_info (new_lexical_environment_p);
- ECMA_SET_NON_NULL_POINTER (new_lexical_environment_p->u1.bound_object_cp,
- binding_obj_p);
+ ECMA_SET_NON_NULL_POINTER (new_lexical_environment_p->u1.bound_object_cp, binding_obj_p);
ECMA_SET_POINTER (new_lexical_environment_p->u2.outer_reference_cp, outer_lexical_environment_p);
@@ -298,7 +298,7 @@ ecma_get_lex_env_type (const ecma_object_t *object_p) /**< lexical environment *
*
* @return pointer to ecma object
*/
-extern inline ecma_object_t * JERRY_ATTR_PURE
+extern inline ecma_object_t *JERRY_ATTR_PURE
ecma_get_lex_env_binding_object (const ecma_object_t *object_p) /**< object-bound lexical environment */
{
JERRY_ASSERT (object_p != NULL);
@@ -381,8 +381,7 @@ ecma_clone_decl_lexical_environment (ecma_object_t *lex_env_p, /**< declarative
}
prop_iter_cp = prop_iter_p->next_property_cp;
- }
- while (prop_iter_cp != JMEM_CP_NULL);
+ } while (prop_iter_cp != JMEM_CP_NULL);
ecma_deref_object (lex_env_p);
return new_lex_env_p;
@@ -411,8 +410,8 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
if (*property_list_head_p != ECMA_NULL_POINTER)
{
/* If the first entry is free (deleted), it is reused. */
- ecma_property_header_t *first_property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
- *property_list_head_p);
+ ecma_property_header_t *first_property_p =
+ ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, *property_list_head_p);
#if JERRY_PROPERTY_HASHMAP
bool has_hashmap = false;
@@ -420,8 +419,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
if (first_property_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)
{
property_list_head_p = &first_property_p->next_property_cp;
- first_property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
- *property_list_head_p);
+ first_property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, *property_list_head_p);
has_hashmap = true;
}
#endif /* JERRY_PROPERTY_HASHMAP */
@@ -433,8 +431,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
ecma_property_pair_t *first_property_pair_p = (ecma_property_pair_t *) first_property_p;
ecma_property_t name_type;
- first_property_pair_p->names_cp[0] = ecma_string_to_property_name (name_p,
- &name_type);
+ first_property_pair_p->names_cp[0] = ecma_string_to_property_name (name_p, &name_type);
first_property_p->types[0] = (ecma_property_t) (type_and_flags | name_type);
ecma_property_t *property_p = first_property_p->types + 0;
@@ -456,10 +453,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
if (has_hashmap)
{
- ecma_property_hashmap_insert (object_p,
- name_p,
- first_property_pair_p,
- 0);
+ ecma_property_hashmap_insert (object_p, name_p, first_property_pair_p, 0);
}
#endif /* JERRY_PROPERTY_HASHMAP */
@@ -478,8 +472,8 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
if (*property_list_head_p != ECMA_NULL_POINTER)
{
- ecma_property_header_t *first_property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
- *property_list_head_p);
+ ecma_property_header_t *first_property_p =
+ ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, *property_list_head_p);
if (first_property_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)
{
@@ -495,8 +489,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
first_property_pair_p->names_cp[0] = LIT_INTERNAL_MAGIC_STRING_DELETED;
ecma_property_t name_type;
- first_property_pair_p->names_cp[1] = ecma_string_to_property_name (name_p,
- &name_type);
+ first_property_pair_p->names_cp[1] = ecma_string_to_property_name (name_p, &name_type);
first_property_pair_p->header.types[1] = (ecma_property_t) (type_and_flags | name_type);
@@ -518,10 +511,7 @@ ecma_create_property (ecma_object_t *object_p, /**< the object */
if (has_hashmap)
{
- ecma_property_hashmap_insert (object_p,
- name_p,
- first_property_pair_p,
- 1);
+ ecma_property_hashmap_insert (object_p, name_p, first_property_pair_p, 1);
}
#endif /* JERRY_PROPERTY_HASHMAP */
@@ -542,8 +532,7 @@ ecma_create_named_data_property (ecma_object_t *object_p, /**< object */
* if this field is non-NULL */
{
JERRY_ASSERT (object_p != NULL && name_p != NULL);
- JERRY_ASSERT (ecma_is_lexical_environment (object_p)
- || !ecma_op_object_is_fast_array (object_p));
+ JERRY_ASSERT (ecma_is_lexical_environment (object_p) || !ecma_op_object_is_fast_array (object_p));
JERRY_ASSERT (ecma_find_named_property (object_p, name_p) == NULL);
JERRY_ASSERT ((prop_attributes & ~ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_ENUMERABLE_WRITABLE) == 0);
@@ -570,8 +559,7 @@ ecma_create_named_accessor_property (ecma_object_t *object_p, /**< object */
* if this field is non-NULL */
{
JERRY_ASSERT (object_p != NULL && name_p != NULL);
- JERRY_ASSERT (ecma_is_lexical_environment (object_p)
- || !ecma_op_object_is_fast_array (object_p));
+ JERRY_ASSERT (ecma_is_lexical_environment (object_p) || !ecma_op_object_is_fast_array (object_p));
JERRY_ASSERT (ecma_find_named_property (object_p, name_p) == NULL);
JERRY_ASSERT ((prop_attributes & ~ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_ENUMERABLE) == 0);
@@ -630,8 +618,7 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
{
JERRY_ASSERT (obj_p != NULL);
JERRY_ASSERT (name_p != NULL);
- JERRY_ASSERT (ecma_is_lexical_environment (obj_p)
- || !ecma_op_object_is_fast_array (obj_p));
+ JERRY_ASSERT (ecma_is_lexical_environment (obj_p) || !ecma_op_object_is_fast_array (obj_p));
#if JERRY_LCACHE
ecma_property_t *property_p = ecma_lcache_lookup (obj_p, name_p);
@@ -648,17 +635,13 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
#if JERRY_PROPERTY_HASHMAP
if (prop_iter_cp != JMEM_CP_NULL)
{
- ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
- prop_iter_cp);
+ ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);
if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)
{
jmem_cpointer_t property_real_name_cp;
- property_p = ecma_property_hashmap_find ((ecma_property_hashmap_t *) prop_iter_p,
- name_p,
- &property_real_name_cp);
+ property_p = ecma_property_hashmap_find ((ecma_property_hashmap_t *) prop_iter_p, name_p, &property_real_name_cp);
#if JERRY_LCACHE
- if (property_p != NULL
- && !ecma_is_property_lcached (property_p))
+ if (property_p != NULL && !ecma_is_property_lcached (property_p))
{
ecma_lcache_insert (obj_p, property_real_name_cp, property_p);
}
@@ -682,8 +665,7 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
while (prop_iter_cp != JMEM_CP_NULL)
{
- ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
- prop_iter_cp);
+ ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);
JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));
@@ -717,8 +699,7 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
{
while (prop_iter_cp != JMEM_CP_NULL)
{
- ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
- prop_iter_cp);
+ ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);
JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (prop_iter_p));
@@ -763,8 +744,7 @@ ecma_find_named_property (ecma_object_t *obj_p, /**< object to find property in
#endif /* JERRY_PROPERTY_HASHMAP */
#if JERRY_LCACHE
- if (property_p != NULL
- && !ecma_is_property_lcached (property_p))
+ if (property_p != NULL && !ecma_is_property_lcached (property_p))
{
ecma_lcache_insert (obj_p, property_name_cp, property_p);
}
@@ -788,8 +768,7 @@ ecma_get_named_data_property (ecma_object_t *obj_p, /**< object to find property
{
JERRY_ASSERT (obj_p != NULL);
JERRY_ASSERT (name_p != NULL);
- JERRY_ASSERT (ecma_is_lexical_environment (obj_p)
- || !ecma_op_object_is_fast_array (obj_p));
+ JERRY_ASSERT (ecma_is_lexical_environment (obj_p) || !ecma_op_object_is_fast_array (obj_p));
ecma_property_t *property_p = ecma_find_named_property (obj_p, name_p);
@@ -816,8 +795,7 @@ ecma_delete_property (ecma_object_t *object_p, /**< object */
if (cur_prop_cp != JMEM_CP_NULL)
{
- ecma_property_header_t *cur_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
- cur_prop_cp);
+ ecma_property_header_t *cur_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, cur_prop_cp);
if (cur_prop_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)
{
@@ -830,8 +808,7 @@ ecma_delete_property (ecma_object_t *object_p, /**< object */
while (cur_prop_cp != JMEM_CP_NULL)
{
- ecma_property_header_t *cur_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
- cur_prop_cp);
+ ecma_property_header_t *cur_prop_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, cur_prop_cp);
JERRY_ASSERT (ECMA_PROPERTY_IS_PROPERTY_PAIR (cur_prop_p));
@@ -846,9 +823,7 @@ ecma_delete_property (ecma_object_t *object_p, /**< object */
#if JERRY_PROPERTY_HASHMAP
if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP)
{
- hashmap_status = ecma_property_hashmap_delete (object_p,
- prop_pair_p->names_cp[i],
- cur_prop_p->types + i);
+ hashmap_status = ecma_property_hashmap_delete (object_p, prop_pair_p->names_cp[i], cur_prop_p->types + i);
}
#endif /* JERRY_PROPERTY_HASHMAP */
@@ -988,8 +963,7 @@ ecma_set_named_accessor_property_getter (ecma_object_t *object_p, /**< the prope
#if JERRY_CPOINTER_32_BIT
ecma_getter_setter_pointers_t *getter_setter_pair_p;
- getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t,
- prop_value_p->getter_setter_pair_cp);
+ getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_value_p->getter_setter_pair_cp);
ECMA_SET_POINTER (getter_setter_pair_p->getter_cp, getter_p);
#else /* !JERRY_CPOINTER_32_BIT */
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.getter_cp, getter_p);
@@ -1008,8 +982,7 @@ ecma_set_named_accessor_property_setter (ecma_object_t *object_p, /**< the prope
#if JERRY_CPOINTER_32_BIT
ecma_getter_setter_pointers_t *getter_setter_pair_p;
- getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t,
- prop_value_p->getter_setter_pair_cp);
+ getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, prop_value_p->getter_setter_pair_cp);
ECMA_SET_POINTER (getter_setter_pair_p->setter_cp, setter_p);
#else /* !JERRY_CPOINTER_32_BIT */
ECMA_SET_POINTER (prop_value_p->getter_setter_pair.setter_cp, setter_p);
@@ -1059,7 +1032,7 @@ ecma_property_to_reference (ecma_property_t *property_p) /**< data or reference
*
* @return pointer to the value
*/
-extern inline ecma_property_value_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_property_value_t *JERRY_ATTR_ALWAYS_INLINE
ecma_get_property_value_from_named_reference (ecma_property_value_t *reference_p) /**< data property reference */
{
ecma_value_t value = reference_p->value;
@@ -1248,14 +1221,12 @@ ecma_free_property_descriptor (ecma_property_descriptor_t *prop_desc_p) /**< pro
ecma_free_value (prop_desc_p->value);
}
- if ((prop_desc_p->flags & JERRY_PROP_IS_GET_DEFINED)
- && prop_desc_p->get_p != NULL)
+ if ((prop_desc_p->flags & JERRY_PROP_IS_GET_DEFINED) && prop_desc_p->get_p != NULL)
{
ecma_deref_object (prop_desc_p->get_p);
}
- if ((prop_desc_p->flags & JERRY_PROP_IS_SET_DEFINED)
- && prop_desc_p->set_p != NULL)
+ if ((prop_desc_p->flags & JERRY_PROP_IS_SET_DEFINED) && prop_desc_p->set_p != NULL)
{
ecma_deref_object (prop_desc_p->set_p);
}
@@ -1551,8 +1522,8 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
for (uint32_t i = const_literal_end; i < literal_end; i++)
{
- ecma_compiled_code_t *bytecode_literal_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- literal_start_p[i]);
+ ecma_compiled_code_t *bytecode_literal_p =
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_start_p[i]);
/* Self references are ignored. */
if (bytecode_literal_p != bytecode_p)
@@ -1606,8 +1577,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
{
jerry_debugger_byte_code_free_t *first_byte_code_free_p;
- first_byte_code_free_p = JMEM_CP_GET_NON_NULL_POINTER (jerry_debugger_byte_code_free_t,
- byte_code_free_head);
+ first_byte_code_free_p = JMEM_CP_GET_NON_NULL_POINTER (jerry_debugger_byte_code_free_t, byte_code_free_head);
first_byte_code_free_p->prev_cp = byte_code_free_cp;
}
@@ -1629,8 +1599,7 @@ ecma_bytecode_deref (ecma_compiled_code_t *bytecode_p) /**< byte code pointer */
#endif /* JERRY_BUILTIN_REGEXP */
}
- jmem_heap_free_block (bytecode_p,
- ((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);
+ jmem_heap_free_block (bytecode_p, ((size_t) bytecode_p->size) << JMEM_ALIGNMENT_LOG);
} /* ecma_bytecode_deref */
/**
@@ -1659,8 +1628,7 @@ ecma_script_get_from_value (ecma_value_t value) /**< compiled code */
if (ext_object_p->u.cls.type == ECMA_OBJECT_CLASS_SCRIPT)
{
- bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- ext_object_p->u.cls.u3.value);
+ bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, ext_object_p->u.cls.u3.value);
break;
}
@@ -1687,8 +1655,8 @@ ecma_script_get_from_value (ecma_value_t value) /**< compiled code */
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
- object_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- ext_object_p->u.bound_function.target_function);
+ object_p =
+ ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_object_p->u.bound_function.target_function);
continue;
}
#if JERRY_ESNEXT
@@ -1741,7 +1709,7 @@ ecma_compiled_code_resolve_arguments_start (const ecma_compiled_code_t *bytecode
*
* @return position of the function name of the compiled code
*/
-extern inline ecma_value_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_value_t *JERRY_ATTR_ALWAYS_INLINE
ecma_compiled_code_resolve_function_name (const ecma_compiled_code_t *bytecode_header_p) /**< compiled code */
{
JERRY_ASSERT (bytecode_header_p != NULL);
diff --git a/jerry-core/ecma/base/ecma-helpers.h b/jerry-core/ecma/base/ecma-helpers.h
index f96d1e00..609cf62e 100644
--- a/jerry-core/ecma/base/ecma-helpers.h
+++ b/jerry-core/ecma/base/ecma-helpers.h
@@ -17,6 +17,7 @@
#define ECMA_HELPERS_H
#include "ecma-globals.h"
+
#include "jmem.h"
#include "lit-strings.h"
@@ -47,8 +48,8 @@
* Set value of non-null compressed pointer so that it will correspond
* to specified non_compressed_pointer.
*/
-#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) JMEM_CP_SET_NON_NULL_POINTER (field, \
- non_compressed_pointer)
+#define ECMA_SET_NON_NULL_POINTER(field, non_compressed_pointer) \
+ JMEM_CP_SET_NON_NULL_POINTER (field, non_compressed_pointer)
/**
* Set value of pointer-tag value so that it will correspond
@@ -88,42 +89,38 @@
*/
typedef enum
{
- ECMA_STRING_FLAG_EMPTY = 0, /**< No options are provided. */
- ECMA_STRING_FLAG_IS_ASCII = (1 << 0), /**< The string contains only ASCII characters. */
+ ECMA_STRING_FLAG_EMPTY = 0, /**< No options are provided. */
+ ECMA_STRING_FLAG_IS_ASCII = (1 << 0), /**< The string contains only ASCII characters. */
ECMA_STRING_FLAG_REHASH_NEEDED = (1 << 1), /**< The hash of the string must be recalculated.
* For more details see ecma_append_chars_to_string */
- ECMA_STRING_FLAG_IS_UINT32 = (1 << 2), /**< The string repesents an UINT32 number */
+ ECMA_STRING_FLAG_IS_UINT32 = (1 << 2), /**< The string repesents an UINT32 number */
ECMA_STRING_FLAG_MUST_BE_FREED = (1 << 3), /**< The returned buffer must be freed */
} ecma_string_flag_t;
/**
* Underscore is ignored when this option is passed.
*/
- #define ECMA_CONVERSION_ALLOW_UNDERSCORE 0x1
+#define ECMA_CONVERSION_ALLOW_UNDERSCORE 0x1
/**
* Convert ecma-string's contents to a cesu-8 string and put it into a buffer.
*/
-#define ECMA_STRING_TO_UTF8_STRING(ecma_str_ptr, /**< ecma string pointer */ \
- utf8_ptr, /**< [out] output buffer pointer */ \
+#define ECMA_STRING_TO_UTF8_STRING(ecma_str_ptr, /**< ecma string pointer */ \
+ utf8_ptr, /**< [out] output buffer pointer */ \
utf8_str_size) /**< [out] output buffer size */ \
- lit_utf8_size_t utf8_str_size; \
- uint8_t utf8_ptr ## flags = ECMA_STRING_FLAG_EMPTY; \
- const lit_utf8_byte_t *utf8_ptr = ecma_string_get_chars (ecma_str_ptr, \
- &utf8_str_size, \
- NULL, \
- NULL, \
- &utf8_ptr ## flags);
+ lit_utf8_size_t utf8_str_size; \
+ uint8_t utf8_ptr##flags = ECMA_STRING_FLAG_EMPTY; \
+ const lit_utf8_byte_t *utf8_ptr = ecma_string_get_chars (ecma_str_ptr, &utf8_str_size, NULL, NULL, &utf8_ptr##flags);
/**
* Free the cesu-8 string buffer allocated by 'ECMA_STRING_TO_UTF8_STRING'
*/
#define ECMA_FINALIZE_UTF8_STRING(utf8_ptr, /**< pointer to character buffer */ \
- utf8_str_size) /**< buffer size */ \
- if (utf8_ptr ## flags & ECMA_STRING_FLAG_MUST_BE_FREED) \
- { \
- JERRY_ASSERT (utf8_ptr != NULL); \
- jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \
+ utf8_str_size) /**< buffer size */ \
+ if (utf8_ptr##flags & ECMA_STRING_FLAG_MUST_BE_FREED) \
+ { \
+ JERRY_ASSERT (utf8_ptr != NULL); \
+ jmem_heap_free_block ((void *) utf8_ptr, utf8_str_size); \
}
#ifdef ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY
@@ -131,64 +128,54 @@ typedef enum
/**
* Set an internal property value from pointer.
*/
-#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) \
- ((field) = ((ecma_value_t) pointer))
+#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) ((field) = ((ecma_value_t) pointer))
/**
* Set an internal property value from pointer. Pointer can be NULL.
*/
-#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) \
- ((field) = ((ecma_value_t) pointer))
+#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) ((field) = ((ecma_value_t) pointer))
/**
* Convert an internal property value to pointer.
*/
-#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \
- ((type *) field)
+#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) ((type *) field)
/**
* Convert an internal property value to pointer. Result can be NULL.
*/
-#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) \
- ((type *) field)
+#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) ((type *) field)
/**
* Checks whether an internal property is NULL.
*/
-#define ECMA_IS_INTERNAL_VALUE_NULL(field) \
- ((field) == ((ecma_value_t) NULL))
+#define ECMA_IS_INTERNAL_VALUE_NULL(field) ((field) == ((ecma_value_t) NULL))
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
/**
* Set an internal property value from pointer.
*/
-#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) \
- ECMA_SET_NON_NULL_POINTER (field, pointer)
+#define ECMA_SET_INTERNAL_VALUE_POINTER(field, pointer) ECMA_SET_NON_NULL_POINTER (field, pointer)
/**
* Set an internal property value from pointer. Pointer can be NULL.
*/
-#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) \
- ECMA_SET_POINTER (field, pointer)
+#define ECMA_SET_INTERNAL_VALUE_ANY_POINTER(field, pointer) ECMA_SET_POINTER (field, pointer)
/**
* Convert an internal property value to pointer.
*/
-#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) \
- ECMA_GET_NON_NULL_POINTER (type, field)
+#define ECMA_GET_INTERNAL_VALUE_POINTER(type, field) ECMA_GET_NON_NULL_POINTER (type, field)
/**
* Convert an internal property value to pointer. Result can be NULL.
*/
-#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) \
- ECMA_GET_POINTER (type, field)
+#define ECMA_GET_INTERNAL_VALUE_ANY_POINTER(type, field) ECMA_GET_POINTER (type, field)
/**
* Checks whether an internal property is NULL.
*/
-#define ECMA_IS_INTERNAL_VALUE_NULL(field) \
- ((field) == ((ecma_value_t) JMEM_CP_NULL))
+#define ECMA_IS_INTERNAL_VALUE_NULL(field) ((field) == ((ecma_value_t) JMEM_CP_NULL))
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
@@ -264,7 +251,7 @@ ecma_value_t JERRY_ATTR_PURE ecma_make_extended_primitive_value (const ecma_exte
uint32_t type);
ecma_integer_value_t JERRY_ATTR_CONST ecma_get_integer_from_value (ecma_value_t value);
ecma_number_t JERRY_ATTR_PURE ecma_get_float_from_value (ecma_value_t value);
-ecma_number_t * ecma_get_pointer_from_float_value (ecma_value_t value);
+ecma_number_t *ecma_get_pointer_from_float_value (ecma_value_t value);
ecma_number_t JERRY_ATTR_PURE ecma_get_number_from_value (ecma_value_t value);
ecma_string_t JERRY_ATTR_PURE *ecma_get_string_from_value (ecma_value_t value);
#if JERRY_ESNEXT
@@ -299,14 +286,12 @@ ecma_length_t ecma_op_advance_string_index (ecma_string_t *str_p, ecma_length_t
ecma_string_t *ecma_new_map_key_string (ecma_value_t value);
bool ecma_prop_name_is_map_key (ecma_string_t *string_p);
#endif /* JERRY_BUILTIN_CONTAINER */
-ecma_string_t *ecma_new_ecma_string_from_ascii (const lit_utf8_byte_t *string_p,
- lit_utf8_size_t string_size);
-ecma_string_t *ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p,
- lit_utf8_size_t string_size);
+ecma_string_t *ecma_new_ecma_string_from_ascii (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);
+ecma_string_t *ecma_new_ecma_string_from_utf8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);
ecma_string_t *ecma_new_ecma_string_from_utf8_converted_to_cesu8 (const lit_utf8_byte_t *string_p,
lit_utf8_size_t string_size);
-ecma_string_t *ecma_new_ecma_external_string_from_cesu8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size,
- void *user_p);
+ecma_string_t *
+ecma_new_ecma_external_string_from_cesu8 (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size, void *user_p);
ecma_string_t *ecma_new_ecma_string_from_code_unit (ecma_char_t code_unit);
#if JERRY_ESNEXT
ecma_string_t *ecma_new_ecma_string_from_code_units (ecma_char_t first_code_unit, ecma_char_t second_code_unit);
@@ -331,28 +316,24 @@ void ecma_destroy_ecma_string (ecma_string_t *string_p);
ecma_number_t ecma_string_to_number (const ecma_string_t *str_p);
uint32_t ecma_string_get_array_index (const ecma_string_t *str_p);
-lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT
-ecma_string_copy_to_cesu8_buffer (const ecma_string_t *string_desc_p,
- lit_utf8_byte_t *buffer_p,
- lit_utf8_size_t buffer_size);
-lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT
-ecma_string_copy_to_utf8_buffer (const ecma_string_t *string_desc_p,
- lit_utf8_byte_t *buffer_p,
- lit_utf8_size_t buffer_size);
-lit_utf8_size_t
-ecma_substring_copy_to_cesu8_buffer (const ecma_string_t *string_desc_p,
- lit_utf8_size_t start_pos,
- lit_utf8_size_t end_pos,
- lit_utf8_byte_t *buffer_p,
- lit_utf8_size_t buffer_size);
-lit_utf8_size_t
-ecma_substring_copy_to_utf8_buffer (const ecma_string_t *string_desc_p,
- lit_utf8_size_t start_pos,
- lit_utf8_size_t end_pos,
- lit_utf8_byte_t *buffer_p,
- lit_utf8_size_t buffer_size);
-void ecma_string_to_utf8_bytes (const ecma_string_t *string_desc_p, lit_utf8_byte_t *buffer_p,
- lit_utf8_size_t buffer_size);
+lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT ecma_string_copy_to_cesu8_buffer (const ecma_string_t *string_desc_p,
+ lit_utf8_byte_t *buffer_p,
+ lit_utf8_size_t buffer_size);
+lit_utf8_size_t JERRY_ATTR_WARN_UNUSED_RESULT ecma_string_copy_to_utf8_buffer (const ecma_string_t *string_desc_p,
+ lit_utf8_byte_t *buffer_p,
+ lit_utf8_size_t buffer_size);
+lit_utf8_size_t ecma_substring_copy_to_cesu8_buffer (const ecma_string_t *string_desc_p,
+ lit_utf8_size_t start_pos,
+ lit_utf8_size_t end_pos,
+ lit_utf8_byte_t *buffer_p,
+ lit_utf8_size_t buffer_size);
+lit_utf8_size_t ecma_substring_copy_to_utf8_buffer (const ecma_string_t *string_desc_p,
+ lit_utf8_size_t start_pos,
+ lit_utf8_size_t end_pos,
+ lit_utf8_byte_t *buffer_p,
+ lit_utf8_size_t buffer_size);
+void
+ecma_string_to_utf8_bytes (const ecma_string_t *string_desc_p, lit_utf8_byte_t *buffer_p, lit_utf8_size_t buffer_size);
const lit_utf8_byte_t *ecma_string_get_chars (const ecma_string_t *string_p,
lit_utf8_size_t *size_p,
lit_utf8_size_t *length_p,
@@ -369,7 +350,8 @@ jmem_cpointer_t ecma_string_to_property_name (ecma_string_t *prop_name_p, ecma_p
ecma_string_t *ecma_string_from_property_name (ecma_property_t property, jmem_cpointer_t prop_name_cp);
lit_string_hash_t ecma_string_get_property_name_hash (ecma_property_t property, jmem_cpointer_t prop_name_cp);
uint32_t ecma_string_get_property_index (ecma_property_t property, jmem_cpointer_t prop_name_cp);
-bool ecma_string_compare_to_property_name (ecma_property_t property, jmem_cpointer_t prop_name_cp,
+bool ecma_string_compare_to_property_name (ecma_property_t property,
+ jmem_cpointer_t prop_name_cp,
const ecma_string_t *string_p);
bool ecma_compare_ecma_strings (const ecma_string_t *string1_p, const ecma_string_t *string2_p);
@@ -387,20 +369,16 @@ lit_string_hash_t ecma_string_hash (const ecma_string_t *string_p);
ecma_string_t *ecma_string_substr (const ecma_string_t *string_p, lit_utf8_size_t start_pos, lit_utf8_size_t end_pos);
const lit_utf8_byte_t *ecma_string_trim_front (const lit_utf8_byte_t *start_p, const lit_utf8_byte_t *end_p);
const lit_utf8_byte_t *ecma_string_trim_back (const lit_utf8_byte_t *start_p, const lit_utf8_byte_t *end_p);
-void ecma_string_trim_helper (const lit_utf8_byte_t **utf8_str_p,
- lit_utf8_size_t *utf8_str_size);
+void ecma_string_trim_helper (const lit_utf8_byte_t **utf8_str_p, lit_utf8_size_t *utf8_str_size);
ecma_string_t *ecma_string_trim (const ecma_string_t *string_p);
#if JERRY_ESNEXT
-ecma_value_t ecma_string_pad (ecma_value_t original_string_p,
- ecma_value_t max_length,
- ecma_value_t fill_string,
- bool pad_on_start);
+ecma_value_t
+ecma_string_pad (ecma_value_t original_string_p, ecma_value_t max_length, ecma_value_t fill_string, bool pad_on_start);
#endif /* JERRY_ESNEXT */
ecma_stringbuilder_t ecma_stringbuilder_create (void);
ecma_stringbuilder_t ecma_stringbuilder_create_from (ecma_string_t *string_p);
-ecma_stringbuilder_t ecma_stringbuilder_create_raw (const lit_utf8_byte_t *data_p,
- const lit_utf8_size_t data_size);
+ecma_stringbuilder_t ecma_stringbuilder_create_raw (const lit_utf8_byte_t *data_p, const lit_utf8_size_t data_size);
lit_utf8_size_t ecma_stringbuilder_get_size (ecma_stringbuilder_t *builder_p);
lit_utf8_byte_t *ecma_stringbuilder_get_data (ecma_stringbuilder_t *builder_p);
void ecma_stringbuilder_revert (ecma_stringbuilder_t *builder_p, const lit_utf8_size_t size);
@@ -425,18 +403,15 @@ bool ecma_number_is_negative (ecma_number_t num);
bool ecma_number_is_zero (ecma_number_t num);
bool ecma_number_is_infinity (ecma_number_t num);
bool ecma_number_is_finite (ecma_number_t num);
-ecma_number_t
-ecma_number_make_from_sign_mantissa_and_exponent (bool sign, uint64_t mantissa, int32_t exponent);
+ecma_number_t ecma_number_make_from_sign_mantissa_and_exponent (bool sign, uint64_t mantissa, int32_t exponent);
ecma_number_t ecma_number_get_prev (ecma_number_t num);
ecma_number_t ecma_number_get_next (ecma_number_t num);
ecma_number_t ecma_number_trunc (ecma_number_t num);
ecma_number_t ecma_number_calc_remainder (ecma_number_t left_num, ecma_number_t right_num);
ecma_number_t ecma_number_pow (ecma_number_t x, ecma_number_t y);
-ecma_value_t ecma_number_parse_int (const lit_utf8_byte_t *string_buff,
- lit_utf8_size_t string_buff_size,
- ecma_value_t radix);
-ecma_value_t ecma_number_parse_float (const lit_utf8_byte_t *string_buff,
- lit_utf8_size_t string_buff_size);
+ecma_value_t
+ecma_number_parse_int (const lit_utf8_byte_t *string_buff, lit_utf8_size_t string_buff_size, ecma_value_t radix);
+ecma_value_t ecma_number_parse_float (const lit_utf8_byte_t *string_buff, lit_utf8_size_t string_buff_size);
ecma_value_t ecma_integer_multiply (ecma_integer_value_t left_integer, ecma_integer_value_t right_integer);
lit_utf8_size_t ecma_number_to_decimal (ecma_number_t num, lit_utf8_byte_t *out_digits_p, int32_t *out_decimal_exp_p);
@@ -476,30 +451,33 @@ ecma_lexical_environment_type_t JERRY_ATTR_PURE ecma_get_lex_env_type (const ecm
ecma_object_t JERRY_ATTR_PURE *ecma_get_lex_env_binding_object (const ecma_object_t *object_p);
ecma_object_t *ecma_clone_decl_lexical_environment (ecma_object_t *lex_env_p, bool copy_values);
-ecma_property_value_t *
-ecma_create_named_data_property (ecma_object_t *object_p, ecma_string_t *name_p, uint8_t prop_attributes,
- ecma_property_t **out_prop_p);
-ecma_property_value_t *
-ecma_create_named_accessor_property (ecma_object_t *object_p, ecma_string_t *name_p, ecma_object_t *get_p,
- ecma_object_t *set_p, uint8_t prop_attributes, ecma_property_t **out_prop_p);
+ecma_property_value_t *ecma_create_named_data_property (ecma_object_t *object_p,
+ ecma_string_t *name_p,
+ uint8_t prop_attributes,
+ ecma_property_t **out_prop_p);
+ecma_property_value_t *ecma_create_named_accessor_property (ecma_object_t *object_p,
+ ecma_string_t *name_p,
+ ecma_object_t *get_p,
+ ecma_object_t *set_p,
+ uint8_t prop_attributes,
+ ecma_property_t **out_prop_p);
#if JERRY_MODULE_SYSTEM
void ecma_create_named_reference_property (ecma_object_t *object_p, ecma_string_t *name_p, ecma_value_t reference);
#endif /* JERRY_MODULE_SYSTEM */
-ecma_property_t *
-ecma_find_named_property (ecma_object_t *obj_p, ecma_string_t *name_p);
-ecma_property_value_t *
-ecma_get_named_data_property (ecma_object_t *obj_p, ecma_string_t *name_p);
+ecma_property_t *ecma_find_named_property (ecma_object_t *obj_p, ecma_string_t *name_p);
+ecma_property_value_t *ecma_get_named_data_property (ecma_object_t *obj_p, ecma_string_t *name_p);
void ecma_delete_property (ecma_object_t *object_p, ecma_property_value_t *prop_value_p);
-void ecma_named_data_property_assign_value (ecma_object_t *obj_p, ecma_property_value_t *prop_value_p,
- ecma_value_t value);
+void
+ecma_named_data_property_assign_value (ecma_object_t *obj_p, ecma_property_value_t *prop_value_p, ecma_value_t value);
-ecma_getter_setter_pointers_t *
-ecma_get_named_accessor_property (const ecma_property_value_t *prop_value_p);
-void ecma_set_named_accessor_property_getter (ecma_object_t *object_p, ecma_property_value_t *prop_value_p,
+ecma_getter_setter_pointers_t *ecma_get_named_accessor_property (const ecma_property_value_t *prop_value_p);
+void ecma_set_named_accessor_property_getter (ecma_object_t *object_p,
+ ecma_property_value_t *prop_value_p,
ecma_object_t *getter_p);
-void ecma_set_named_accessor_property_setter (ecma_object_t *object_p, ecma_property_value_t *prop_value_p,
+void ecma_set_named_accessor_property_setter (ecma_object_t *object_p,
+ ecma_property_value_t *prop_value_p,
ecma_object_t *setter_p);
#if JERRY_MODULE_SYSTEM
ecma_value_t ecma_property_to_reference (ecma_property_t *property_p);
@@ -549,15 +527,15 @@ uintptr_t ecma_get_current_stack_usage (void);
#endif /* (JERRY_STACK_LIMIT != 0) */
/* ecma-helpers-external-pointers.c */
-bool ecma_create_native_pointer_property (ecma_object_t *obj_p, void *native_p,
+bool ecma_create_native_pointer_property (ecma_object_t *obj_p,
+ void *native_p,
const jerry_object_native_info_t *native_info_p);
ecma_native_pointer_t *ecma_get_native_pointer_value (ecma_object_t *obj_p,
const jerry_object_native_info_t *native_info_p);
bool ecma_delete_native_pointer_property (ecma_object_t *obj_p, const jerry_object_native_info_t *native_info_p);
/* ecma-helpers-conversion.c */
-ecma_number_t ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, lit_utf8_size_t str_size,
- uint32_t option);
+ecma_number_t ecma_utf8_string_to_number (const lit_utf8_byte_t *str_p, lit_utf8_size_t str_size, uint32_t option);
lit_utf8_size_t ecma_uint32_to_utf8_string (uint32_t value, lit_utf8_byte_t *out_buffer_p, lit_utf8_size_t buffer_size);
uint32_t ecma_number_to_uint32 (ecma_number_t num);
int32_t ecma_number_to_int32 (ecma_number_t num);
diff --git a/jerry-core/ecma/base/ecma-init-finalize.c b/jerry-core/ecma/base/ecma-init-finalize.c
index 5ae409bf..acfb0422 100644
--- a/jerry-core/ecma/base/ecma-init-finalize.c
+++ b/jerry-core/ecma/base/ecma-init-finalize.c
@@ -13,14 +13,16 @@
* limitations under the License.
*/
+#include "ecma-init-finalize.h"
+
#include "ecma-builtins.h"
#include "ecma-gc.h"
#include "ecma-helpers.h"
-#include "ecma-init-finalize.h"
#include "ecma-lex-env.h"
#include "ecma-literal-storage.h"
-#include "jmem.h"
+
#include "jcontext.h"
+#include "jmem.h"
/** \addtogroup ecma ECMA
* @{
@@ -89,8 +91,7 @@ ecma_finalize (void)
{
jerry_fatal (ERR_UNTERMINATED_GC_LOOPS);
}
- }
- while (JERRY_CONTEXT (ecma_gc_new_objects) != 0);
+ } while (JERRY_CONTEXT (ecma_gc_new_objects) != 0);
#if JERRY_ESNEXT
jmem_cpointer_t *global_symbols_cp = JERRY_CONTEXT (global_symbols_cp);
diff --git a/jerry-core/ecma/base/ecma-lcache.c b/jerry-core/ecma/base/ecma-lcache.c
index e4e69ede..d1a52372 100644
--- a/jerry-core/ecma/base/ecma-lcache.c
+++ b/jerry-core/ecma/base/ecma-lcache.c
@@ -13,10 +13,12 @@
* limitations under the License.
*/
+#include "ecma-lcache.h"
+
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-lcache.h"
+
#include "jcontext.h"
/** \addtogroup ecma ECMA
@@ -98,7 +100,7 @@ ecma_lcache_insert (const ecma_object_t *object_p, /**< object */
ECMA_SET_NON_NULL_POINTER (object_cp, object_p);
size_t row_index = ecma_lcache_row_index (object_cp, name_cp);
- ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache) [row_index];
+ ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index];
ecma_lcache_hash_entry_t *entry_end_p = entry_p + ECMA_LCACHE_HASH_ROW_LENGTH;
do
@@ -109,8 +111,7 @@ ecma_lcache_insert (const ecma_object_t *object_p, /**< object */
}
entry_p++;
- }
- while (entry_p < entry_end_p);
+ } while (entry_p < entry_end_p);
/* Invalidate the last entry. */
ecma_lcache_invalidate_entry (--entry_p);
@@ -136,7 +137,7 @@ insert:
* @return a pointer to an ecma_property_t if the lookup is successful
* NULL otherwise
*/
-extern inline ecma_property_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_property_t *JERRY_ATTR_ALWAYS_INLINE
ecma_lcache_lookup (const ecma_object_t *object_p, /**< object */
const ecma_string_t *prop_name_p) /**< property's name */
{
@@ -161,7 +162,7 @@ ecma_lcache_lookup (const ecma_object_t *object_p, /**< object */
size_t row_index = ecma_lcache_row_index (object_cp, prop_name_cp);
- ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache) [row_index];
+ ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index];
ecma_lcache_hash_entry_t *entry_end_p = entry_p + ECMA_LCACHE_HASH_ROW_LENGTH;
ecma_lcache_hash_entry_id_t id = ECMA_LCACHE_CREATE_ID (object_cp, prop_name_cp);
@@ -173,8 +174,7 @@ ecma_lcache_lookup (const ecma_object_t *object_p, /**< object */
return entry_p->prop_p;
}
entry_p++;
- }
- while (entry_p < entry_end_p);
+ } while (entry_p < entry_end_p);
return NULL;
} /* ecma_lcache_lookup */
@@ -195,12 +195,12 @@ ecma_lcache_invalidate (const ecma_object_t *object_p, /**< object */
ECMA_SET_NON_NULL_POINTER (object_cp, object_p);
size_t row_index = ecma_lcache_row_index (object_cp, name_cp);
- ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache) [row_index];
+ ecma_lcache_hash_entry_t *entry_p = JERRY_CONTEXT (lcache)[row_index];
while (true)
{
/* The property must be present. */
- JERRY_ASSERT (entry_p - JERRY_CONTEXT (lcache) [row_index] < ECMA_LCACHE_HASH_ROW_LENGTH);
+ JERRY_ASSERT (entry_p - JERRY_CONTEXT (lcache)[row_index] < ECMA_LCACHE_HASH_ROW_LENGTH);
if (entry_p->id != 0 && entry_p->prop_p == prop_p)
{
diff --git a/jerry-core/ecma/base/ecma-lcache.h b/jerry-core/ecma/base/ecma-lcache.h
index dbea603d..818e410b 100644
--- a/jerry-core/ecma/base/ecma-lcache.h
+++ b/jerry-core/ecma/base/ecma-lcache.h
@@ -23,6 +23,8 @@
* @{
*/
+#include "ecma-globals.h"
+
#if JERRY_LCACHE
void ecma_lcache_insert (const ecma_object_t *object_p, const jmem_cpointer_t name_cp, ecma_property_t *prop_p);
ecma_property_t *ecma_lcache_lookup (const ecma_object_t *object_p, const ecma_string_t *prop_name_p);
diff --git a/jerry-core/ecma/base/ecma-line-info.c b/jerry-core/ecma/base/ecma-line-info.c
index 6678d9cb..db561c46 100644
--- a/jerry-core/ecma/base/ecma-line-info.c
+++ b/jerry-core/ecma/base/ecma-line-info.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "ecma-helpers.h"
#include "ecma-line-info.h"
+#include "ecma-helpers.h"
+
#if JERRY_LINE_INFO
/** \addtogroup ecma ECMA
@@ -45,8 +46,7 @@ ecma_line_info_decode_vlq (uint8_t **buffer_p) /**< [in/out] target buffer */
do
{
value = (value << ECMA_LINE_INFO_VLQ_SHIFT) | (*source_p & ECMA_LINE_INFO_VLQ_MASK);
- }
- while (*source_p++ & ECMA_LINE_INFO_VLQ_CONTINUE);
+ } while (*source_p++ & ECMA_LINE_INFO_VLQ_CONTINUE);
*buffer_p = source_p;
return value;
@@ -169,8 +169,7 @@ ecma_line_info_get (uint8_t *line_info_p, /**< line info buffer */
column = ecma_line_info_difference_update (column, value);
end_offset += end_offset_increase;
- }
- while (end_offset_increase != 0 && end_offset <= offset);
+ } while (end_offset_increase != 0 && end_offset <= offset);
location_p->line = line;
location_p->column = column;
diff --git a/jerry-core/ecma/base/ecma-line-info.h b/jerry-core/ecma/base/ecma-line-info.h
index 0402f979..f2094018 100644
--- a/jerry-core/ecma/base/ecma-line-info.h
+++ b/jerry-core/ecma/base/ecma-line-info.h
@@ -90,8 +90,7 @@
/**
* Minimum size of a stream (except the last one).
*/
-#define ECMA_LINE_INFO_STREAM_SIZE_MIN \
- ((2 * ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX) - 1)
+#define ECMA_LINE_INFO_STREAM_SIZE_MIN ((2 * ECMA_LINE_INFO_STREAM_VALUE_COUNT_MAX) - 1)
/* Helper functions for parser/js/js-parser-line-info-create.c. */
uint32_t ecma_line_info_decode_vlq (uint8_t **buffer_p);
@@ -99,8 +98,7 @@ uint32_t ecma_line_info_difference_update (uint32_t current_value, uint32_t diff
/* General functions. */
void ecma_line_info_free (uint8_t *line_info_p);
-void ecma_line_info_get (uint8_t *line_info_p, uint32_t offset,
- jerry_backtrace_location_t *location_p);
+void ecma_line_info_get (uint8_t *line_info_p, uint32_t offset, jerry_backtrace_location_t *location_p);
#if JERRY_PARSER_DUMP_BYTE_CODE
void ecma_line_info_dump (uint8_t *line_info_p);
diff --git a/jerry-core/ecma/base/ecma-literal-storage.c b/jerry-core/ecma/base/ecma-literal-storage.c
index 37fd9bb4..5e69b00d 100644
--- a/jerry-core/ecma/base/ecma-literal-storage.c
+++ b/jerry-core/ecma/base/ecma-literal-storage.c
@@ -13,11 +13,13 @@
* limitations under the License.
*/
+#include "ecma-literal-storage.h"
+
#include "ecma-alloc.h"
-#include "ecma-bigint.h"
#include "ecma-big-uint.h"
-#include "ecma-literal-storage.h"
+#include "ecma-bigint.h"
#include "ecma-helpers.h"
+
#include "jcontext.h"
/** \addtogroup ecma ECMA
@@ -42,8 +44,7 @@ ecma_free_symbol_list (jmem_cpointer_t symbol_list_cp) /**< symbol list */
{
if (symbol_list_p->values[i] != JMEM_CP_NULL)
{
- ecma_string_t *string_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t,
- symbol_list_p->values[i]);
+ ecma_string_t *string_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, symbol_list_p->values[i]);
JERRY_ASSERT (ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p));
ecma_deref_ecma_string (string_p);
@@ -71,8 +72,7 @@ ecma_free_string_list (jmem_cpointer_t string_list_cp) /**< string list */
{
if (string_list_p->values[i] != JMEM_CP_NULL)
{
- ecma_string_t *string_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t,
- string_list_p->values[i]);
+ ecma_string_t *string_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, string_list_p->values[i]);
JERRY_ASSERT (ECMA_STRING_IS_REF_EQUALS_TO_ONE (string_p));
ecma_destroy_ecma_string (string_p);
@@ -93,8 +93,7 @@ ecma_free_number_list (jmem_cpointer_t number_list_cp) /**< number list */
{
while (number_list_cp != JMEM_CP_NULL)
{
- ecma_lit_storage_item_t *number_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t,
- number_list_cp);
+ ecma_lit_storage_item_t *number_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, number_list_cp);
for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)
{
@@ -120,15 +119,14 @@ ecma_free_bigint_list (jmem_cpointer_t bigint_list_cp) /**< bigint list */
{
while (bigint_list_cp != JMEM_CP_NULL)
{
- ecma_lit_storage_item_t *bigint_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t,
- bigint_list_cp);
+ ecma_lit_storage_item_t *bigint_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, bigint_list_cp);
for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)
{
if (bigint_list_p->values[i] != JMEM_CP_NULL)
{
- ecma_extended_primitive_t *bigint_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_extended_primitive_t,
- bigint_list_p->values[i]);
+ ecma_extended_primitive_t *bigint_p =
+ JMEM_CP_GET_NON_NULL_POINTER (ecma_extended_primitive_t, bigint_list_p->values[i]);
JERRY_ASSERT (ECMA_EXTENDED_PRIMITIVE_IS_REF_EQUALS_TO_ONE (bigint_p));
ecma_deref_bigint (bigint_p);
}
@@ -168,8 +166,8 @@ ecma_find_or_create_literal_string (const lit_utf8_byte_t *chars_p, /**< string
lit_utf8_size_t size, /**< size of the string */
bool is_ascii) /**< encode of the string */
{
- ecma_string_t *string_p = (is_ascii ? ecma_new_ecma_string_from_ascii (chars_p, size)
- : ecma_new_ecma_string_from_utf8 (chars_p, size));
+ ecma_string_t *string_p =
+ (is_ascii ? ecma_new_ecma_string_from_ascii (chars_p, size) : ecma_new_ecma_string_from_utf8 (chars_p, size));
if (ECMA_IS_DIRECT_STRING (string_p))
{
@@ -194,8 +192,7 @@ ecma_find_or_create_literal_string (const lit_utf8_byte_t *chars_p, /**< string
}
else
{
- ecma_string_t *value_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t,
- string_list_p->values[i]);
+ ecma_string_t *value_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, string_list_p->values[i]);
if (ecma_compare_ecma_strings (string_p, value_p))
{
@@ -256,8 +253,7 @@ ecma_find_or_create_literal_number (ecma_number_t number_arg) /**< number to be
while (number_list_cp != JMEM_CP_NULL)
{
- ecma_lit_storage_item_t *number_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t,
- number_list_cp);
+ ecma_lit_storage_item_t *number_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, number_list_cp);
for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)
{
@@ -270,8 +266,7 @@ ecma_find_or_create_literal_number (ecma_number_t number_arg) /**< number to be
}
else
{
- ecma_number_t *number_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_number_t,
- number_list_p->values[i]);
+ ecma_number_t *number_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_number_t, number_list_p->values[i]);
if (*number_p == number_arg)
{
@@ -330,8 +325,7 @@ ecma_find_or_create_literal_bigint (ecma_value_t bigint) /**< bigint to be searc
while (bigint_list_cp != JMEM_CP_NULL)
{
- ecma_lit_storage_item_t *bigint_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t,
- bigint_list_cp);
+ ecma_lit_storage_item_t *bigint_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, bigint_list_cp);
for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)
{
@@ -344,8 +338,8 @@ ecma_find_or_create_literal_bigint (ecma_value_t bigint) /**< bigint to be searc
}
else
{
- ecma_extended_primitive_t *other_bigint_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_extended_primitive_t,
- bigint_list_p->values[i]);
+ ecma_extended_primitive_t *other_bigint_p =
+ JMEM_CP_GET_NON_NULL_POINTER (ecma_extended_primitive_t, bigint_list_p->values[i]);
ecma_value_t other_bigint = ecma_make_extended_primitive_value (other_bigint_p, ECMA_TYPE_BIGINT);
if (ecma_bigint_is_equal_to_bigint (bigint, other_bigint))
@@ -417,8 +411,9 @@ ecma_find_or_create_literal_bigint (ecma_value_t bigint) /**< bigint to be searc
/**
* Append the value at the end of the appropriate list if it is not present there.
*/
-void ecma_save_literals_append_value (ecma_value_t value, /**< value to be appended */
- ecma_collection_t *lit_pool_p) /**< list of known values */
+void
+ecma_save_literals_append_value (ecma_value_t value, /**< value to be appended */
+ ecma_collection_t *lit_pool_p) /**< list of known values */
{
/* Unlike direct numbers, direct strings are converted to character literals. */
if (!ecma_is_value_string (value)
@@ -498,11 +493,9 @@ ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_
for (uint32_t i = const_literal_end; i < literal_end; i++)
{
- ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- literal_p[i]);
+ ecma_compiled_code_t *bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_p[i]);
- if (CBC_IS_FUNCTION (bytecode_p->status_flags)
- && bytecode_p != compiled_code_p)
+ if (CBC_IS_FUNCTION (bytecode_p->status_flags) && bytecode_p != compiled_code_p)
{
ecma_save_literals_add_compiled_code (bytecode_p, lit_pool_p);
}
diff --git a/jerry-core/ecma/base/ecma-literal-storage.h b/jerry-core/ecma/base/ecma-literal-storage.h
index d9cf6b28..6850a868 100644
--- a/jerry-core/ecma/base/ecma-literal-storage.h
+++ b/jerry-core/ecma/base/ecma-literal-storage.h
@@ -17,6 +17,7 @@
#define ECMA_LIT_STORAGE_H
#include "ecma-globals.h"
+
#include "jmem.h"
#include "lit-globals.h"
@@ -48,18 +49,19 @@ ecma_value_t ecma_find_or_create_literal_bigint (ecma_value_t bigint);
#if JERRY_SNAPSHOT_SAVE
void ecma_save_literals_append_value (ecma_value_t value, ecma_collection_t *lit_pool_p);
-void ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_p,
- ecma_collection_t *lit_pool_p);
-bool ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p, uint32_t *buffer_p, size_t buffer_size,
- size_t *in_out_buffer_offset_p, lit_mem_to_snapshot_id_map_entry_t **out_map_p,
+void ecma_save_literals_add_compiled_code (const ecma_compiled_code_t *compiled_code_p, ecma_collection_t *lit_pool_p);
+bool ecma_save_literals_for_snapshot (ecma_collection_t *lit_pool_p,
+ uint32_t *buffer_p,
+ size_t buffer_size,
+ size_t *in_out_buffer_offset_p,
+ lit_mem_to_snapshot_id_map_entry_t **out_map_p,
uint32_t *out_map_len_p);
#endif /* JERRY_SNAPSHOT_SAVE */
#if JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE
-ecma_value_t
-ecma_snapshot_get_literal (const uint8_t *literal_base_p, ecma_value_t literal_value);
-ecma_value_t *
-ecma_snapshot_resolve_serializable_values (const ecma_compiled_code_t *compiled_code_p, uint8_t *byte_code_end_p);
+ecma_value_t ecma_snapshot_get_literal (const uint8_t *literal_base_p, ecma_value_t literal_value);
+ecma_value_t *ecma_snapshot_resolve_serializable_values (const ecma_compiled_code_t *compiled_code_p,
+ uint8_t *byte_code_end_p);
#endif /* JERRY_SNAPSHOT_EXEC || JERRY_SNAPSHOT_SAVE */
/**
diff --git a/jerry-core/ecma/base/ecma-module.c b/jerry-core/ecma/base/ecma-module.c
index 878e9a73..fdff9031 100644
--- a/jerry-core/ecma/base/ecma-module.c
+++ b/jerry-core/ecma/base/ecma-module.c
@@ -13,7 +13,7 @@
* limitations under the License.
*/
-#include "jcontext.h"
+#include "ecma-module.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
@@ -21,8 +21,9 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-lex-env.h"
-#include "ecma-module.h"
#include "ecma-objects.h"
+
+#include "jcontext.h"
#include "lit-char-helpers.h"
#include "vm.h"
@@ -104,15 +105,15 @@ ecma_module_set_error_state (ecma_module_t *module_p) /**< module */
{
module_p->header.u.cls.u1.module_state = JERRY_MODULE_STATE_ERROR;
- if (JERRY_CONTEXT (module_state_changed_callback_p) != NULL
- && !jcontext_has_pending_abort ())
+ if (JERRY_CONTEXT (module_state_changed_callback_p) != NULL && !jcontext_has_pending_abort ())
{
jerry_value_t exception = jcontext_take_exception ();
- JERRY_CONTEXT (module_state_changed_callback_p) (JERRY_MODULE_STATE_ERROR,
- ecma_make_object_value (&module_p->header.object),
- exception,
- JERRY_CONTEXT (module_state_changed_callback_user_p));
+ JERRY_CONTEXT (module_state_changed_callback_p)
+ (JERRY_MODULE_STATE_ERROR,
+ ecma_make_object_value (&module_p->header.object),
+ exception,
+ JERRY_CONTEXT (module_state_changed_callback_user_p));
jcontext_raise_exception (exception);
}
} /* ecma_module_set_error_state */
@@ -122,7 +123,7 @@ ecma_module_set_error_state (ecma_module_t *module_p) /**< module */
*
* @return module pointer
*/
-static inline ecma_module_t * JERRY_ATTR_ALWAYS_INLINE
+static inline ecma_module_t *JERRY_ATTR_ALWAYS_INLINE
ecma_module_get_from_object (ecma_value_t module_val) /**< module */
{
JERRY_ASSERT (ecma_is_value_object (module_val));
@@ -210,8 +211,7 @@ ecma_module_resolve_set_append (ecma_module_resolve_set_t *set_p, /**< resolve s
while (true)
{
- if (current_p->module_p == module_p
- && ecma_compare_ecma_strings (current_p->name_p, export_name_p))
+ if (current_p->module_p == module_p && ecma_compare_ecma_strings (current_p->name_p, export_name_p))
{
return false;
}
@@ -339,16 +339,14 @@ ecma_module_resolve_import (ecma_module_resolve_result_t *resolve_result_p, /**<
{
JERRY_ASSERT (import_node_p != NULL);
- for (ecma_module_names_t *import_names_p = import_node_p->module_names_p;
- import_names_p != NULL;
+ for (ecma_module_names_t *import_names_p = import_node_p->module_names_p; import_names_p != NULL;
import_names_p = import_names_p->next_p)
{
if (ecma_compare_ecma_strings (local_name_p, import_names_p->local_name_p))
{
ecma_module_t *imported_module_p = ecma_module_get_from_object (import_node_p->u.path_or_module);
- if (ecma_compare_ecma_string_to_magic_id (import_names_p->imex_name_p,
- LIT_MAGIC_STRING_ASTERIX_CHAR))
+ if (ecma_compare_ecma_string_to_magic_id (import_names_p->imex_name_p, LIT_MAGIC_STRING_ASTERIX_CHAR))
{
/* Namespace import. */
ecma_value_t namespace = ecma_make_object_value (imported_module_p->namespace_object_p);
@@ -401,19 +399,18 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */
if (current_module_p->header.u.cls.u2.module_flags & ECMA_MODULE_HAS_NAMESPACE)
{
- ecma_property_t *property_p = ecma_find_named_property (current_module_p->namespace_object_p,
- current_export_name_p);
+ ecma_property_t *property_p =
+ ecma_find_named_property (current_module_p->namespace_object_p, current_export_name_p);
if (property_p != NULL)
{
ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
- JERRY_ASSERT ((!(*property_p & ECMA_PROPERTY_FLAG_DATA)
- && !(property_value_p->value & ECMA_MODULE_NAMESPACE_RESULT_FLAG))
- || ((*property_p & ECMA_PROPERTY_FLAG_DATA)
- && ecma_is_value_object (property_value_p->value)
- && ecma_object_class_is (ecma_get_object_from_value (property_value_p->value),
- ECMA_OBJECT_CLASS_MODULE_NAMESPACE)));
+ JERRY_ASSERT (
+ (!(*property_p & ECMA_PROPERTY_FLAG_DATA) && !(property_value_p->value & ECMA_MODULE_NAMESPACE_RESULT_FLAG))
+ || ((*property_p & ECMA_PROPERTY_FLAG_DATA) && ecma_is_value_object (property_value_p->value)
+ && ecma_object_class_is (ecma_get_object_from_value (property_value_p->value),
+ ECMA_OBJECT_CLASS_MODULE_NAMESPACE)));
if (!ecma_module_resolve_update (resolve_result_p, property_value_p->value))
{
@@ -432,8 +429,8 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */
{
if (ecma_compare_ecma_strings (current_export_name_p, export_names_p->imex_name_p))
{
- ecma_property_t *property_p = ecma_find_named_property (current_module_p->scope_p,
- export_names_p->local_name_p);
+ ecma_property_t *property_p =
+ ecma_find_named_property (current_module_p->scope_p, export_names_p->local_name_p);
if (property_p != NULL)
{
@@ -473,8 +470,7 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */
{
ecma_module_t *target_module_p = ecma_module_get_from_object (*indirect_export_p->u.module_object_p);
- if (ecma_compare_ecma_string_to_magic_id (export_names_p->local_name_p,
- LIT_MAGIC_STRING_ASTERIX_CHAR))
+ if (ecma_compare_ecma_string_to_magic_id (export_names_p->local_name_p, LIT_MAGIC_STRING_ASTERIX_CHAR))
{
/* Namespace export. */
ecma_value_t namespace = ecma_make_object_value (target_module_p->namespace_object_p);
@@ -525,10 +521,9 @@ ecma_module_resolve_export (ecma_module_t *const module_p, /**< base module */
star_export_p = star_export_p->next_p;
}
-next_iteration:
+ next_iteration:
current_set_p = current_set_p->next_p;
- }
- while (current_set_p != NULL);
+ } while (current_set_p != NULL);
exit:
ecma_module_resolve_set_cleanup (resolve_set_p);
@@ -586,10 +581,11 @@ ecma_module_evaluate (ecma_module_t *module_p) /**< module */
if (JERRY_CONTEXT (module_state_changed_callback_p) != NULL)
{
- JERRY_CONTEXT (module_state_changed_callback_p) (JERRY_MODULE_STATE_EVALUATED,
- ecma_make_object_value (&module_p->header.object),
- ret_value,
- JERRY_CONTEXT (module_state_changed_callback_user_p));
+ JERRY_CONTEXT (module_state_changed_callback_p)
+ (JERRY_MODULE_STATE_EVALUATED,
+ ecma_make_object_value (&module_p->header.object),
+ ret_value,
+ JERRY_CONTEXT (module_state_changed_callback_user_p));
}
}
else
@@ -746,8 +742,7 @@ ecma_module_create_namespace_object (ecma_module_t *module_p) /**< module */
#if JERRY_PROPERTY_HASHMAP
if (prop_iter_cp != JMEM_CP_NULL)
{
- ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
- prop_iter_cp);
+ ecma_property_header_t *prop_iter_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, prop_iter_cp);
if (prop_iter_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP)
{
prop_iter_cp = prop_iter_p->next_property_cp;
@@ -802,8 +797,7 @@ ecma_module_create_namespace_object (ecma_module_t *module_p) /**< module */
}
export_names_p = export_names_p->next_p;
- }
- while (export_names_p != NULL);
+ } while (export_names_p != NULL);
}
ecma_module_node_t *indirect_export_p = current_module_p->indirect_exports_p;
@@ -848,8 +842,7 @@ ecma_module_create_namespace_object (ecma_module_t *module_p) /**< module */
}
current_set_p = current_set_p->next_p;
- }
- while (current_set_p != NULL);
+ } while (current_set_p != NULL);
ecma_value_t *buffer_p = properties_p->buffer_p;
uint32_t item_count = properties_p->item_count;
@@ -863,8 +856,7 @@ ecma_module_create_namespace_object (ecma_module_t *module_p) /**< module */
{
end -= 2;
ecma_module_heap_sort_shift_down (buffer_p, item_count, end);
- }
- while (end > 0);
+ } while (end > 0);
end = item_count - 2;
@@ -880,8 +872,7 @@ ecma_module_create_namespace_object (ecma_module_t *module_p) /**< module */
ecma_module_heap_sort_shift_down (buffer_p, end, 0);
end -= 2;
- }
- while (end > 0);
+ } while (end > 0);
}
ecma_value_t *buffer_end_p = properties_p->buffer_p + item_count;
@@ -989,15 +980,12 @@ ecma_module_connect_imports (ecma_module_t *module_p)
while (import_names_p != NULL)
{
- if (ecma_compare_ecma_string_to_magic_id (import_names_p->imex_name_p,
- LIT_MAGIC_STRING_ASTERIX_CHAR))
+ if (ecma_compare_ecma_string_to_magic_id (import_names_p->imex_name_p, LIT_MAGIC_STRING_ASTERIX_CHAR))
{
/* Namespace import. */
ecma_property_value_t *value_p;
- value_p = ecma_create_named_data_property (module_p->scope_p,
- import_names_p->local_name_p,
- ECMA_PROPERTY_FIXED,
- NULL);
+ value_p =
+ ecma_create_named_data_property (module_p->scope_p, import_names_p->local_name_p, ECMA_PROPERTY_FIXED, NULL);
value_p->value = ecma_make_object_value (imported_module_p->namespace_object_p);
}
else
@@ -1021,9 +1009,7 @@ ecma_module_connect_imports (ecma_module_t *module_p)
}
else
{
- ecma_create_named_reference_property (module_p->scope_p,
- import_names_p->local_name_p,
- resolve_result.result);
+ ecma_create_named_reference_property (module_p->scope_p, import_names_p->local_name_p, resolve_result.result);
}
}
@@ -1253,9 +1239,8 @@ restart:
if (current_module_p->namespace_object_p == NULL)
{
- ecma_object_t *namespace_object_p = ecma_create_object (NULL,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *namespace_object_p =
+ ecma_create_object (NULL, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
namespace_object_p->type_flags_refs &= (ecma_object_descriptor_t) ~ECMA_OBJECT_FLAG_EXTENSIBLE;
@@ -1297,8 +1282,7 @@ restart:
}
iterator_p = iterator_p->prev_p;
- }
- while (iterator_p != end_p);
+ } while (iterator_p != end_p);
iterator_p = last_p;
@@ -1313,8 +1297,7 @@ restart:
}
iterator_p = iterator_p->prev_p;
- }
- while (iterator_p != end_p);
+ } while (iterator_p != end_p);
do
{
@@ -1325,16 +1308,16 @@ restart:
if (JERRY_CONTEXT (module_state_changed_callback_p) != NULL)
{
- JERRY_CONTEXT (module_state_changed_callback_p) (JERRY_MODULE_STATE_LINKED,
- ecma_make_object_value (&last_p->module_p->header.object),
- ECMA_VALUE_UNDEFINED,
- JERRY_CONTEXT (module_state_changed_callback_user_p));
+ JERRY_CONTEXT (module_state_changed_callback_p)
+ (JERRY_MODULE_STATE_LINKED,
+ ecma_make_object_value (&last_p->module_p->header.object),
+ ECMA_VALUE_UNDEFINED,
+ JERRY_CONTEXT (module_state_changed_callback_user_p));
}
jmem_heap_free_block (last_p, sizeof (ecma_module_stack_item_t));
last_p = prev_p;
- }
- while (last_p != end_p);
+ } while (last_p != end_p);
if (current_p == NULL)
{
@@ -1357,8 +1340,7 @@ error:
jmem_heap_free_block (last_p, sizeof (ecma_module_stack_item_t));
last_p = prev_p;
- }
- while (last_p != NULL);
+ } while (last_p != NULL);
return ECMA_VALUE_ERROR;
} /* ecma_module_link */
@@ -1397,8 +1379,7 @@ ecma_module_import (ecma_value_t specifier, /**< module specifier */
goto error;
}
- if (ecma_is_value_object (result)
- && ecma_is_promise (ecma_get_object_from_value (result)))
+ if (ecma_is_value_object (result) && ecma_is_promise (ecma_get_object_from_value (result)))
{
return result;
}
diff --git a/jerry-core/ecma/base/ecma-module.h b/jerry-core/ecma/base/ecma-module.h
index 1a590e29..dd76f57c 100644
--- a/jerry-core/ecma/base/ecma-module.h
+++ b/jerry-core/ecma/base/ecma-module.h
@@ -16,9 +16,10 @@
#ifndef ECMA_MODULE_H
#define ECMA_MODULE_H
-#include "common.h"
#include "ecma-globals.h"
+#include "common.h"
+
#if JERRY_MODULE_SYSTEM
#define ECMA_MODULE_MAX_PATH 255u
@@ -40,8 +41,8 @@ typedef enum
typedef struct ecma_module_names
{
struct ecma_module_names *next_p; /**< next linked list node */
- ecma_string_t *imex_name_p; /**< Import/export name of the item */
- ecma_string_t *local_name_p; /**< Local name of the item */
+ ecma_string_t *imex_name_p; /**< Import/export name of the item */
+ ecma_string_t *local_name_p; /**< Local name of the item */
} ecma_module_names_t;
/**
@@ -54,19 +55,19 @@ typedef struct ecma_module_names
typedef struct ecma_module
{
/* Note: state is stored in header.u.class_prop.extra_info */
- ecma_extended_object_t header; /**< header part */
+ ecma_extended_object_t header; /**< header part */
/* TODO(dbatyai): These could be compressed pointers */
- ecma_object_t *scope_p; /**< lexical lenvironment of the module */
- ecma_object_t *namespace_object_p; /**< namespace object of the module */
- struct ecma_module_node *imports_p; /**< import requests of the module */
- ecma_module_names_t *local_exports_p; /**< local exports of the module */
- struct ecma_module_node *indirect_exports_p; /**< indirect exports of the module */
- struct ecma_module_node *star_exports_p; /**< star exports of the module */
+ ecma_object_t *scope_p; /**< lexical lenvironment of the module */
+ ecma_object_t *namespace_object_p; /**< namespace object of the module */
+ struct ecma_module_node *imports_p; /**< import requests of the module */
+ ecma_module_names_t *local_exports_p; /**< local exports of the module */
+ struct ecma_module_node *indirect_exports_p; /**< indirect exports of the module */
+ struct ecma_module_node *star_exports_p; /**< star exports of the module */
/* Code used for evaluating a module */
union
{
- ecma_compiled_code_t *compiled_code_p; /**< compiled code for the module */
+ ecma_compiled_code_t *compiled_code_p; /**< compiled code for the module */
jerry_native_module_evaluate_callback_t callback; /**< callback for evaluating native modules */
} u;
} ecma_module_t;
@@ -98,8 +99,8 @@ typedef struct ecma_module_node
typedef struct ecma_module_resolve_set
{
struct ecma_module_resolve_set *next_p; /**< next in linked list */
- ecma_module_t *module_p; /**< module */
- ecma_string_t *name_p; /**< identifier name */
+ ecma_module_t *module_p; /**< module */
+ ecma_string_t *name_p; /**< identifier name */
} ecma_module_resolve_set_t;
/**
@@ -108,17 +109,15 @@ typedef struct ecma_module_resolve_set
typedef struct ecma_module_resolve_stack
{
struct ecma_module_resolve_stack *next_p; /**< next in linked list */
- ecma_module_t *module_p; /**< module request */
- ecma_string_t *export_name_p; /**< export identifier name */
- bool resolving; /**< flag storing wether the current frame started resolving */
+ ecma_module_t *module_p; /**< module request */
+ ecma_string_t *export_name_p; /**< export identifier name */
+ bool resolving; /**< flag storing wether the current frame started resolving */
} ecma_module_resolve_stack_t;
ecma_value_t ecma_module_initialize (ecma_module_t *module_p);
ecma_module_t *ecma_module_get_resolved_module (ecma_value_t module_val);
-ecma_value_t ecma_module_link (ecma_module_t *module_p,
- jerry_module_resolve_callback_t callback_p,
- void *user_p);
+ecma_value_t ecma_module_link (ecma_module_t *module_p, jerry_module_resolve_callback_t callback_p, void *user_p);
ecma_value_t ecma_module_evaluate (ecma_module_t *module_p);
ecma_value_t ecma_module_import (ecma_value_t specifier, ecma_value_t user_value);
diff --git a/jerry-core/ecma/base/ecma-property-hashmap.c b/jerry-core/ecma/base/ecma-property-hashmap.c
index 1c80de4f..370b1fc7 100644
--- a/jerry-core/ecma/base/ecma-property-hashmap.c
+++ b/jerry-core/ecma/base/ecma-property-hashmap.c
@@ -13,11 +13,13 @@
* limitations under the License.
*/
+#include "ecma-property-hashmap.h"
+
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-property-hashmap.h"
-#include "jrt-libc-includes.h"
+
#include "jcontext.h"
+#include "jrt-libc-includes.h"
/** \addtogroup ecma ECMA
* @{
@@ -42,28 +44,26 @@
/**
* Stepping values for searching items in the hashmap.
*/
-static const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS] JERRY_ATTR_CONST_DATA =
-{
+static const uint8_t ecma_property_hashmap_steps[ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS] JERRY_ATTR_CONST_DATA = {
3, 5, 7, 11, 13, 17, 19, 23
};
/**
* Get the value of a bit in a bitmap.
*/
-#define ECMA_PROPERTY_HASHMAP_GET_BIT(byte_p, index) \
- ((byte_p)[(index) >> 3] & (1 << ((index) & 0x7)))
+#define ECMA_PROPERTY_HASHMAP_GET_BIT(byte_p, index) ((byte_p)[(index) >> 3] & (1 << ((index) &0x7)))
/**
* Clear the value of a bit in a bitmap.
*/
#define ECMA_PROPERTY_HASHMAP_CLEAR_BIT(byte_p, index) \
- ((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] & ~(1 << ((index) & 0x7))))
+ ((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] & ~(1 << ((index) &0x7))))
/**
* Set the value of a bit in a bitmap.
*/
#define ECMA_PROPERTY_HASHMAP_SET_BIT(byte_p, index) \
- ((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] | (1 << ((index) & 0x7))))
+ ((byte_p)[(index) >> 3] = (uint8_t) ((byte_p)[(index) >> 3] | (1 << ((index) &0x7))))
/**
* Create a new property hashmap for the object.
@@ -156,8 +156,7 @@ ecma_property_hashmap_create (ecma_object_t *object_p) /**< object */
ecma_property_pair_t *property_pair_p = (ecma_property_pair_t *) prop_iter_p;
- uint32_t entry_index = ecma_string_get_property_name_hash (prop_iter_p->types[i],
- property_pair_p->names_cp[i]);
+ uint32_t entry_index = ecma_string_get_property_name_hash (prop_iter_p->types[i], property_pair_p->names_cp[i]);
uint32_t step = ecma_property_hashmap_steps[entry_index & (ECMA_PROPERTY_HASHMAP_NUMBER_OF_STEPS - 1)];
entry_index &= mask;
@@ -202,8 +201,8 @@ ecma_property_hashmap_free (ecma_object_t *object_p) /**< object */
/* Property hash must be exists and must be the first property. */
JERRY_ASSERT (object_p->u1.property_list_cp != JMEM_CP_NULL);
- ecma_property_header_t *property_p = ECMA_GET_NON_NULL_POINTER (ecma_property_header_t,
- object_p->u1.property_list_cp);
+ ecma_property_header_t *property_p =
+ ECMA_GET_NON_NULL_POINTER (ecma_property_header_t, object_p->u1.property_list_cp);
JERRY_ASSERT (property_p->types[0] == ECMA_PROPERTY_TYPE_HASHMAP);
@@ -211,8 +210,7 @@ ecma_property_hashmap_free (ecma_object_t *object_p) /**< object */
object_p->u1.property_list_cp = property_p->next_property_cp;
- jmem_heap_free_block (hashmap_p,
- ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count));
+ jmem_heap_free_block (hashmap_p, ECMA_PROPERTY_HASHMAP_GET_TOTAL_SIZE (hashmap_p->max_property_count));
} /* ecma_property_hashmap_free */
/**
@@ -226,8 +224,8 @@ ecma_property_hashmap_insert (ecma_object_t *object_p, /**< object */
{
JERRY_ASSERT (property_pair_p != NULL);
- ecma_property_hashmap_t *hashmap_p = ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t,
- object_p->u1.property_list_cp);
+ ecma_property_hashmap_t *hashmap_p =
+ ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t, object_p->u1.property_list_cp);
JERRY_ASSERT (hashmap_p->header.types[0] == ECMA_PROPERTY_TYPE_HASHMAP);
@@ -300,8 +298,8 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
jmem_cpointer_t name_cp, /**< property name */
ecma_property_t *property_p) /**< property */
{
- ecma_property_hashmap_t *hashmap_p = ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t,
- object_p->u1.property_list_cp);
+ ecma_property_hashmap_t *hashmap_p =
+ ECMA_GET_NON_NULL_POINTER (ecma_property_hashmap_t, object_p->u1.property_list_cp);
JERRY_ASSERT (hashmap_p->header.types[0] == ECMA_PROPERTY_TYPE_HASHMAP);
@@ -337,8 +335,8 @@ ecma_property_hashmap_delete (ecma_object_t *object_p, /**< object */
offset = 1;
}
- ecma_property_pair_t *property_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t,
- pair_list_p[entry_index]);
+ ecma_property_pair_t *property_pair_p =
+ ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]);
if ((property_pair_p->header.types + offset) == property_p)
{
@@ -393,9 +391,7 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
{
if (ECMA_PROPERTY_IS_NAMED_PROPERTY (prop_iter_p->types[i]))
{
- if (ecma_string_compare_to_property_name (prop_iter_p->types[i],
- prop_pair_p->names_cp[i],
- name_p))
+ if (ecma_string_compare_to_property_name (prop_iter_p->types[i], prop_pair_p->names_cp[i], name_p))
{
/* Property is found */
property_found = true;
@@ -437,8 +433,8 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
offset = 1;
}
- ecma_property_pair_t *property_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t,
- pair_list_p[entry_index]);
+ ecma_property_pair_t *property_pair_p =
+ ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]);
ecma_property_t *property_p = property_pair_p->header.types + offset;
@@ -486,8 +482,8 @@ ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, /**< hashmap */
offset = 1;
}
- ecma_property_pair_t *property_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t,
- pair_list_p[entry_index]);
+ ecma_property_pair_t *property_pair_p =
+ ECMA_GET_NON_NULL_POINTER (ecma_property_pair_t, pair_list_p[entry_index]);
ecma_property_t *property_p = property_pair_p->header.types + offset;
diff --git a/jerry-core/ecma/base/ecma-property-hashmap.h b/jerry-core/ecma/base/ecma-property-hashmap.h
index 8aafd24c..265075e9 100644
--- a/jerry-core/ecma/base/ecma-property-hashmap.h
+++ b/jerry-core/ecma/base/ecma-property-hashmap.h
@@ -16,6 +16,8 @@
#ifndef ECMA_PROPERTY_HASHMAP_H
#define ECMA_PROPERTY_HASHMAP_H
+#include "ecma-globals.h"
+
/** \addtogroup ecma ECMA
* @{
*
@@ -67,12 +69,15 @@ typedef enum
void ecma_property_hashmap_create (ecma_object_t *object_p);
void ecma_property_hashmap_free (ecma_object_t *object_p);
-void ecma_property_hashmap_insert (ecma_object_t *object_p, ecma_string_t *name_p,
- ecma_property_pair_t *property_pair_p, int property_index);
-ecma_property_hashmap_delete_status ecma_property_hashmap_delete (ecma_object_t *object_p, jmem_cpointer_t name_cp,
- ecma_property_t *property_p);
+void ecma_property_hashmap_insert (ecma_object_t *object_p,
+ ecma_string_t *name_p,
+ ecma_property_pair_t *property_pair_p,
+ int property_index);
+ecma_property_hashmap_delete_status
+ecma_property_hashmap_delete (ecma_object_t *object_p, jmem_cpointer_t name_cp, ecma_property_t *property_p);
-ecma_property_t *ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p, ecma_string_t *name_p,
+ecma_property_t *ecma_property_hashmap_find (ecma_property_hashmap_t *hashmap_p,
+ ecma_string_t *name_p,
jmem_cpointer_t *property_real_name_cp);
#endif /* JERRY_PROPERTY_HASHMAP */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c
index 3fe7ff1b..84956daf 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.c
@@ -22,6 +22,7 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
+
#include "jrt.h"
#if JERRY_ESNEXT
@@ -30,7 +31,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-aggregateerror-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID aggregate_error_prototype
+#define BUILTIN_UNDERSCORED_ID aggregate_error_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h
index e5fa5d49..f03cb638 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror-prototype.inc.h
@@ -25,19 +25,13 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.7.8 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_AGGREGATE_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_AGGREGATE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.9 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_AGGREGATE_ERROR_UL,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.10 */
-STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
- LIT_MAGIC_STRING__EMPTY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.c
index c2df08bf..e1c25618 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.c
@@ -14,19 +14,20 @@
*/
#include "ecma-alloc.h"
+#include "ecma-array-object.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-builtin-helpers.h"
-#include "ecma-objects.h"
-#include "ecma-function-object.h"
#include "ecma-iterator-object.h"
-#include "ecma-array-object.h"
-#include "jrt.h"
+#include "ecma-objects.h"
+
#include "jcontext.h"
+#include "jrt.h"
#if JERRY_ESNEXT
@@ -34,7 +35,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-aggregateerror.inc.h"
-#define BUILTIN_UNDERSCORED_ID aggregate_error
+#define BUILTIN_UNDERSCORED_ID aggregate_error
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h
index 475efac0..c343b41d 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-aggregateerror.inc.h
@@ -24,21 +24,15 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 2,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 2, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_AGGREGATE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_AGGREGATE_ERROR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c
index 203a826c..3c0c49bd 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.c
@@ -13,11 +13,11 @@
* limitations under the License.
*/
+#include "ecma-arraybuffer-object.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-iterator-object.h"
#include "ecma-typedarray-object.h"
-#include "ecma-arraybuffer-object.h"
#if JERRY_ESNEXT
@@ -39,7 +39,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-iterator-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID array_iterator_prototype
+#define BUILTIN_UNDERSCORED_ID array_iterator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -130,10 +130,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t
index = (ecma_length_t) (ecma_get_number_from_value (index_value) + 1);
}
- ecma_value_t put_result = ecma_op_object_put (obj_p,
- prop_name_p,
- ecma_make_length_value (index),
- true);
+ ecma_value_t put_result = ecma_op_object_put (obj_p, prop_name_p, ecma_make_length_value (index), true);
JERRY_ASSERT (ecma_is_value_true (put_result));
@@ -183,8 +180,7 @@ ecma_builtin_array_iterator_prototype_object_next (ecma_value_t this_val) /**< t
/* 17.b */
ecma_value_t entry_array_value;
- entry_array_value = ecma_create_array_from_iter_element (get_value,
- ecma_make_length_value (index));
+ entry_array_value = ecma_create_array_from_iter_element (get_value, ecma_make_length_value (index));
result = ecma_create_iter_result_object (entry_array_value, ECMA_VALUE_FALSE);
ecma_free_value (entry_array_value);
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h
index aa4f4179..1338fb44 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-iterator-prototype.inc.h
@@ -21,9 +21,7 @@
#if JERRY_ESNEXT
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_ARRAY_ITERATOR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c
index ff99558f..2caad899 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.c
@@ -22,7 +22,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-prototype-unscopables.inc.h"
-#define BUILTIN_UNDERSCORED_ID array_prototype_unscopables
+#define BUILTIN_UNDERSCORED_ID array_prototype_unscopables
#include "ecma-builtin-internal-routines-template.inc.h"
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h
index 932c3d4c..d4d79db8 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype-unscopables.inc.h
@@ -21,49 +21,27 @@
#if JERRY_ESNEXT
-SIMPLE_VALUE (LIT_MAGIC_STRING_AT,
- ECMA_VALUE_TRUE,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_AT, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
-SIMPLE_VALUE (LIT_MAGIC_STRING_COPY_WITHIN,
- ECMA_VALUE_TRUE,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_COPY_WITHIN, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
-SIMPLE_VALUE (LIT_MAGIC_STRING_ENTRIES,
- ECMA_VALUE_TRUE,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_ENTRIES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
-SIMPLE_VALUE (LIT_MAGIC_STRING_FILL,
- ECMA_VALUE_TRUE,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_FILL, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
-SIMPLE_VALUE (LIT_MAGIC_STRING_FIND,
- ECMA_VALUE_TRUE,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_FIND, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
-SIMPLE_VALUE (LIT_MAGIC_STRING_FIND_INDEX,
- ECMA_VALUE_TRUE,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_FIND_INDEX, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
-SIMPLE_VALUE (LIT_MAGIC_STRING_FLAT,
- ECMA_VALUE_TRUE,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_FLAT, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
-SIMPLE_VALUE (LIT_MAGIC_STRING_FLATMAP,
- ECMA_VALUE_TRUE,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_FLATMAP, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
-SIMPLE_VALUE (LIT_MAGIC_STRING_INCLUDES,
- ECMA_VALUE_TRUE,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_INCLUDES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
-SIMPLE_VALUE (LIT_MAGIC_STRING_KEYS,
- ECMA_VALUE_TRUE,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_KEYS, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
-SIMPLE_VALUE (LIT_MAGIC_STRING_VALUES,
- ECMA_VALUE_TRUE,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_VALUES, ECMA_VALUE_TRUE, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE)
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c
index cc064f76..70cad898 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.c
@@ -26,8 +26,9 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
-#include "lit-char-helpers.h"
+
#include "jrt.h"
+#include "lit-char-helpers.h"
#if JERRY_BUILTIN_ARRAY
@@ -45,7 +46,7 @@
enum
{
ECMA_ARRAY_PROTOTYPE_ROUTINE_START = 0,
- /* Note: these 2 routine ids must be in this order */
+/* Note: these 2 routine ids must be in this order */
#if !JERRY_ESNEXT
ECMA_ARRAY_PROTOTYPE_TO_STRING,
#endif /* !JERRY_ESNEXT */
@@ -85,7 +86,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID array_prototype
+#define BUILTIN_UNDERSCORED_ID array_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -109,15 +110,12 @@ ecma_builtin_array_prototype_helper_set_length (ecma_object_t *object, /**< obje
ecma_number_t length) /**< new length */
{
ecma_value_t length_value = ecma_make_number_value (length);
- ecma_value_t ret_value = ecma_op_object_put (object,
- ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH),
- length_value,
- true);
+ ecma_value_t ret_value =
+ ecma_op_object_put (object, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), length_value, true);
ecma_free_value (length_value);
- JERRY_ASSERT (ecma_is_value_boolean (ret_value)
- || ecma_is_value_empty (ret_value)
+ JERRY_ASSERT (ecma_is_value_boolean (ret_value) || ecma_is_value_empty (ret_value)
|| ECMA_IS_VALUE_ERROR (ret_value));
return ret_value;
} /* ecma_builtin_array_prototype_helper_set_length */
@@ -202,9 +200,8 @@ ecma_builtin_array_prototype_object_concat (const ecma_value_t args[], /**< argu
ecma_length_t new_length = 0;
/* 5.b - 5.c for this_arg */
- ecma_value_t concat_this_value = ecma_builtin_helper_array_concat_value (new_array_p,
- &new_length,
- ecma_make_object_value (obj_p));
+ ecma_value_t concat_this_value =
+ ecma_builtin_helper_array_concat_value (new_array_p, &new_length, ecma_make_object_value (obj_p));
if (ECMA_IS_VALUE_ERROR (concat_this_value))
{
ecma_deref_object (new_array_p);
@@ -227,8 +224,8 @@ ecma_builtin_array_prototype_object_concat (const ecma_value_t args[], /**< argu
JERRY_ASSERT (ecma_is_value_empty (concat_value));
}
- ecma_value_t set_length_value = ecma_builtin_array_prototype_helper_set_length (new_array_p,
- ((ecma_number_t) new_length));
+ ecma_value_t set_length_value =
+ ecma_builtin_array_prototype_helper_set_length (new_array_p, ((ecma_number_t) new_length));
if (ECMA_IS_VALUE_ERROR (set_length_value))
{
ecma_deref_object (new_array_p);
@@ -279,8 +276,7 @@ ecma_op_array_get_to_string_at_index (ecma_object_t *obj_p, /**< this object */
return NULL;
}
- if (ecma_is_value_undefined (index_value)
- || ecma_is_value_null (index_value))
+ if (ecma_is_value_undefined (index_value) || ecma_is_value_null (index_value))
{
return ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
}
@@ -370,7 +366,7 @@ static ecma_value_t
ecma_builtin_array_prototype_object_pop (ecma_object_t *obj_p, /**< object */
ecma_length_t len) /**< object's length */
{
- /* 4. */
+ /* 4. */
if (len == 0)
{
/* 4.a */
@@ -523,14 +519,12 @@ ecma_builtin_array_prototype_object_reverse (ecma_value_t this_arg, /**< this ar
ecma_object_t *obj_p, /**< object */
ecma_length_t len) /**< object's length */
{
-
if (ecma_op_object_is_fast_array (obj_p))
{
uint32_t middle = (uint32_t) len / 2;
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
- if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE
- && len != 0)
+ if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0)
{
ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);
@@ -674,7 +668,7 @@ ecma_builtin_array_prototype_object_reverse (ecma_value_t this_arg, /**< this ar
ret_value = ECMA_VALUE_EMPTY;
-clean_up:
+ clean_up:
ecma_free_value (upper_value);
ecma_free_value (lower_value);
ecma_deref_ecma_string (lower_str_p);
@@ -714,8 +708,7 @@ ecma_builtin_array_prototype_object_shift (ecma_object_t *obj_p, /**< object */
{
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
- if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE
- && len != 0)
+ if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0)
{
ecma_value_t *buffer_p = ECMA_GET_NON_NULL_POINTER (ecma_value_t, obj_p->u1.property_list_cp);
ecma_value_t ret_value = buffer_p[0];
@@ -817,9 +810,7 @@ ecma_builtin_array_prototype_object_slice (ecma_value_t arg1, /**< start */
ecma_length_t start = 0, end = len;
/* 5. 6.*/
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg1,
- len,
- &start)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg1, len, &start)))
{
return ECMA_VALUE_ERROR;
}
@@ -832,9 +823,7 @@ ecma_builtin_array_prototype_object_slice (ecma_value_t arg1, /**< start */
else
{
/* 7. part 2, 8.*/
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg2,
- len,
- &end)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (arg2, len, &end)))
{
return ECMA_VALUE_ERROR;
}
@@ -946,10 +935,7 @@ ecma_builtin_array_prototype_object_slice (ecma_value_t arg1, /**< start */
#else /* !JERRY_ESNEXT */
const uint32_t prop_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE;
#endif /* JERRY_ESNEXT */
- put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p,
- n,
- get_value,
- prop_flags);
+ put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, n, get_value, prop_flags);
ecma_free_value (get_value);
#if JERRY_ESNEXT
@@ -1057,10 +1043,7 @@ ecma_builtin_array_prototype_object_sort_compare_helper (ecma_value_t lhs, /**<
ecma_value_t compare_args[] = { lhs, rhs };
- ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p,
- ECMA_VALUE_UNDEFINED,
- compare_args,
- 2);
+ ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p, ECMA_VALUE_UNDEFINED, compare_args, 2);
if (ECMA_IS_VALUE_ERROR (call_value))
{
return call_value;
@@ -1178,11 +1161,8 @@ ecma_builtin_array_prototype_object_sort (ecma_value_t this_arg, /**< this argum
if (copied_num > 1)
{
const ecma_builtin_helper_sort_compare_fn_t sort_cb = &ecma_builtin_array_prototype_object_sort_compare_helper;
- ecma_value_t sort_value = ecma_builtin_helper_array_merge_sort_helper (values_buffer,
- (uint32_t) (copied_num),
- arg1,
- sort_cb,
- NULL);
+ ecma_value_t sort_value =
+ ecma_builtin_helper_array_merge_sort_helper (values_buffer, (uint32_t) (copied_num), arg1, sort_cb, NULL);
if (ECMA_IS_VALUE_ERROR (sort_value))
{
goto clean_up;
@@ -1271,9 +1251,7 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
if (args_number > 0)
{
/* ES5.1: 6, ES11: 4. */
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (args[0],
- len,
- &actual_start)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (args[0], len, &actual_start)))
{
return ECMA_VALUE_ERROR;
}
@@ -1295,8 +1273,8 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
}
/* ES5.1: 7 */
- actual_delete_count = (ecma_length_t) (JERRY_MIN (JERRY_MAX (delete_num, 0),
- (ecma_number_t) (len - actual_start)));
+ actual_delete_count =
+ (ecma_length_t) (JERRY_MIN (JERRY_MAX (delete_num, 0), (ecma_number_t) (len - actual_start)));
}
}
@@ -1344,10 +1322,7 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
const uint32_t prop_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE;
#endif /* JERRY_ESNEXT */
- ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p,
- k,
- from_present,
- prop_flags);
+ ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, k, from_present, prop_flags);
ecma_free_value (from_present);
#if JERRY_ESNEXT
@@ -1364,8 +1339,8 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
#if JERRY_ESNEXT
/* ES11: 12. */
- ecma_value_t set_length = ecma_builtin_array_prototype_helper_set_length (new_array_p,
- ((ecma_number_t) actual_delete_count));
+ ecma_value_t set_length =
+ ecma_builtin_array_prototype_helper_set_length (new_array_p, ((ecma_number_t) actual_delete_count));
if (ECMA_IS_VALUE_ERROR (set_length))
{
@@ -1465,10 +1440,7 @@ ecma_builtin_array_prototype_object_splice (const ecma_value_t args[], /**< argu
uint32_t idx = 0;
for (uint32_t arg_index = 2; arg_index < args_number; arg_index++, idx++)
{
- ecma_value_t put_value = ecma_op_object_put_by_index (obj_p,
- actual_start + idx,
- args[arg_index],
- true);
+ ecma_value_t put_value = ecma_op_object_put_by_index (obj_p, actual_start + idx, args[arg_index], true);
if (ECMA_IS_VALUE_ERROR (put_value))
{
@@ -1506,13 +1478,11 @@ ecma_builtin_array_prototype_object_unshift (const ecma_value_t args[], /**< arg
ecma_object_t *obj_p, /**< object */
ecma_length_t len) /**< object's length */
{
-
if (ecma_op_object_is_fast_array (obj_p))
{
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) obj_p;
- if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE
- && len != 0)
+ if (ext_obj_p->u.array.length_prop_and_hole_count < ECMA_FAST_ARRAY_HOLE_ONE && len != 0)
{
if (args_number > UINT32_MAX - len)
{
@@ -1730,8 +1700,7 @@ ecma_builtin_array_prototype_object_index_of (const ecma_value_t args[], /**< ar
}
/* 9.b.i, 9.b.ii */
- if (ecma_is_value_found (get_value)
- && ecma_op_strict_equality_compare (args[0], get_value))
+ if (ecma_is_value_found (get_value) && ecma_op_strict_equality_compare (args[0], get_value))
{
ecma_free_value (get_value);
return ecma_make_length_value (from_idx);
@@ -1822,7 +1791,7 @@ ecma_builtin_array_prototype_object_last_index_of (const ecma_value_t args[], /*
}
}
- /* 8. */
+ /* 8. */
while (from_idx < len)
{
/* 8.a */
@@ -1834,8 +1803,7 @@ ecma_builtin_array_prototype_object_last_index_of (const ecma_value_t args[], /*
}
/* 8.b.i, 8.b.ii */
- if (ecma_is_value_found (get_value)
- && ecma_op_strict_equality_compare (search_element, get_value))
+ if (ecma_is_value_found (get_value) && ecma_op_strict_equality_compare (search_element, get_value))
{
ecma_free_value (get_value);
return ecma_make_length_value (from_idx);
@@ -2023,10 +1991,7 @@ ecma_builtin_array_prototype_object_map (ecma_value_t arg1, /**< callbackfn */
#else /* !JERRY_ESNEXT */
const uint32_t prop_flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE;
#endif /* JERRY_ESNEXT */
- put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p,
- index,
- mapped_value,
- prop_flags);
+ put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, index, mapped_value, prop_flags);
ecma_free_value (mapped_value);
ecma_free_value (current_value);
@@ -2124,10 +2089,7 @@ ecma_builtin_array_prototype_object_filter (ecma_value_t arg1, /**< callbackfn *
if (ecma_op_to_boolean (call_value))
{
ecma_value_t put_comp;
- put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p,
- new_array_index,
- get_value,
- prop_flags);
+ put_comp = ecma_builtin_helper_def_prop_by_index (new_array_p, new_array_index, get_value, prop_flags);
#if JERRY_ESNEXT
if (ECMA_IS_VALUE_ERROR (put_comp))
{
@@ -2206,8 +2168,7 @@ ecma_builtin_array_reduce_from (const ecma_value_t args_p[], /**< routine's argu
k_present = true;
/* 8.b.ii-iii */
- ecma_value_t current_value = ecma_op_object_find_by_index (obj_p, start_from_left ? index
- : last_index - index);
+ ecma_value_t current_value = ecma_op_object_find_by_index (obj_p, start_from_left ? index : last_index - index);
if (ECMA_IS_VALUE_ERROR (current_value))
{
@@ -2253,12 +2214,9 @@ ecma_builtin_array_reduce_from (const ecma_value_t args_p[], /**< routine's argu
{
/* 9.c.i, 9.c.ii */
current_index = ecma_make_length_value (corrected_index);
- ecma_value_t call_args[] = {accumulator, current_value, current_index, ecma_make_object_value (obj_p)};
+ ecma_value_t call_args[] = { accumulator, current_value, current_index, ecma_make_object_value (obj_p) };
- ecma_value_t call_value = ecma_op_function_call (func_object_p,
- ECMA_VALUE_UNDEFINED,
- call_args,
- 4);
+ ecma_value_t call_value = ecma_op_function_call (func_object_p, ECMA_VALUE_UNDEFINED, call_args, 4);
ecma_free_value (current_index);
ecma_free_value (accumulator);
ecma_free_value (current_value);
@@ -2298,9 +2256,7 @@ ecma_builtin_array_prototype_fill (ecma_value_t value, /**< value */
ecma_length_t k, final;
/* 5. 6. 7. */
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (start_val,
- len,
- &k)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (start_val, len, &k)))
{
return ECMA_VALUE_ERROR;
}
@@ -2313,9 +2269,7 @@ ecma_builtin_array_prototype_fill (ecma_value_t value, /**< value */
else
{
/* 8 part 2, 9, 10 */
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (end_val,
- len,
- &final)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_array_index_normalize (end_val, len, &final)))
{
return ECMA_VALUE_ERROR;
}
@@ -2728,7 +2682,7 @@ ecma_builtin_array_flatten_into_array (ecma_value_t target, /**< target will con
{
/* i-ii. */
ecma_value_t source_val = ecma_make_length_value (source_index);
- ecma_value_t args[] = {element, source_val, ecma_make_object_value (source)};
+ ecma_value_t args[] = { element, source_val, ecma_make_object_value (source) };
ecma_value_t temp_element = ecma_op_function_call (ecma_get_object_from_value (mapped_value), thisArg, args, 3);
ecma_free_value (element);
@@ -2787,10 +2741,8 @@ ecma_builtin_array_flatten_into_array (ecma_value_t target, /**< target will con
/* vi. */
const uint32_t flags = ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;
- ecma_value_t element_temp = ecma_builtin_helper_def_prop_by_index (ecma_get_object_from_value (target),
- target_index,
- element,
- flags);
+ ecma_value_t element_temp =
+ ecma_builtin_helper_def_prop_by_index (ecma_get_object_from_value (target), target_index, element, flags);
ecma_free_value (element);
@@ -2885,13 +2837,8 @@ ecma_builtin_array_prototype_object_flat_map (ecma_value_t callback, /**< callba
}
/* 5. */
- ecma_value_t flatten_val = ecma_builtin_array_flatten_into_array (ecma_make_object_value (new_array_p),
- obj_p,
- len,
- 0,
- 1,
- callback,
- this_arg);
+ ecma_value_t flatten_val =
+ ecma_builtin_array_flatten_into_array (ecma_make_object_value (new_array_p), obj_p, len, 0, 1, callback, this_arg);
if (ECMA_IS_VALUE_ERROR (flatten_val))
{
ecma_deref_object (new_array_p);
@@ -2937,16 +2884,11 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
#endif /* !JERRY_ESNEXT */
if (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_SORT)
{
- ret_value = ecma_builtin_array_prototype_object_sort (this_arg,
- arguments_list_p[0],
- obj_p);
-
+ ret_value = ecma_builtin_array_prototype_object_sort (this_arg, arguments_list_p[0], obj_p);
}
else if (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_CONCAT)
{
- ret_value = ecma_builtin_array_prototype_object_concat (arguments_list_p,
- arguments_number,
- obj_p);
+ ret_value = ecma_builtin_array_prototype_object_concat (arguments_list_p, arguments_number, obj_p);
}
ecma_deref_object (obj_p);
@@ -3004,10 +2946,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
}
case ECMA_ARRAY_PROTOTYPE_PUSH:
{
- ret_value = ecma_builtin_array_prototype_object_push (arguments_list_p,
- arguments_number,
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_object_push (arguments_list_p, arguments_number, obj_p, length);
break;
}
case ECMA_ARRAY_PROTOTYPE_REVERSE:
@@ -3022,49 +2961,32 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
}
case ECMA_ARRAY_PROTOTYPE_SLICE:
{
- ret_value = ecma_builtin_array_prototype_object_slice (arguments_list_p[0],
- arguments_list_p[1],
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_object_slice (arguments_list_p[0], arguments_list_p[1], obj_p, length);
break;
}
case ECMA_ARRAY_PROTOTYPE_SPLICE:
{
- ret_value = ecma_builtin_array_prototype_object_splice (arguments_list_p,
- arguments_number,
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_object_splice (arguments_list_p, arguments_number, obj_p, length);
break;
}
case ECMA_ARRAY_PROTOTYPE_UNSHIFT:
{
- ret_value = ecma_builtin_array_prototype_object_unshift (arguments_list_p,
- arguments_number,
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_object_unshift (arguments_list_p, arguments_number, obj_p, length);
break;
}
case ECMA_ARRAY_PROTOTYPE_AT:
{
- ret_value = ecma_builtin_array_prototype_object_at (arguments_list_p[0],
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_object_at (arguments_list_p[0], obj_p, length);
break;
}
case ECMA_ARRAY_PROTOTYPE_INDEX_OF:
{
- ret_value = ecma_builtin_array_prototype_object_index_of (arguments_list_p,
- arguments_number,
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_object_index_of (arguments_list_p, arguments_number, obj_p, length);
break;
}
case ECMA_ARRAY_PROTOTYPE_LAST_INDEX_OF:
{
- ret_value = ecma_builtin_array_prototype_object_last_index_of (arguments_list_p,
- arguments_number,
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_object_last_index_of (arguments_list_p, arguments_number, obj_p, length);
break;
}
case ECMA_ARRAY_PROTOTYPE_EVERY:
@@ -3080,10 +3002,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
}
case ECMA_ARRAY_PROTOTYPE_MAP:
{
- ret_value = ecma_builtin_array_prototype_object_map (arguments_list_p[0],
- arguments_list_p[1],
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_object_map (arguments_list_p[0], arguments_list_p[1], obj_p, length);
break;
}
case ECMA_ARRAY_PROTOTYPE_REDUCE:
@@ -3099,10 +3018,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
#if JERRY_ESNEXT
case ECMA_ARRAY_PROTOTYPE_COPY_WITHIN:
{
- ret_value = ecma_builtin_array_prototype_object_copy_within (arguments_list_p,
- arguments_number,
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_object_copy_within (arguments_list_p, arguments_number, obj_p, length);
break;
}
case ECMA_ARRAY_PROTOTYPE_FIND:
@@ -3126,26 +3042,18 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
}
case ECMA_ARRAY_PROTOTYPE_INCLUDES:
{
- ret_value = ecma_builtin_array_prototype_includes (arguments_list_p,
- arguments_number,
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_includes (arguments_list_p, arguments_number, obj_p, length);
break;
}
case ECMA_ARRAY_PROTOTYPE_FLAT:
{
- ret_value = ecma_builtin_array_prototype_object_flat (arguments_list_p,
- arguments_number,
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_object_flat (arguments_list_p, arguments_number, obj_p, length);
break;
}
case ECMA_ARRAY_PROTOTYPE_FLATMAP:
{
- ret_value = ecma_builtin_array_prototype_object_flat_map (arguments_list_p[0],
- arguments_list_p[1],
- obj_p,
- length);
+ ret_value =
+ ecma_builtin_array_prototype_object_flat_map (arguments_list_p[0], arguments_list_p[1], obj_p, length);
break;
}
#endif /* JERRY_ESNEXT */
@@ -3153,10 +3061,7 @@ ecma_builtin_array_prototype_dispatch_routine (uint8_t builtin_routine_id, /**<
{
JERRY_ASSERT (builtin_routine_id == ECMA_ARRAY_PROTOTYPE_FILTER);
- ret_value = ecma_builtin_array_prototype_object_filter (arguments_list_p[0],
- arguments_list_p[1],
- obj_p,
- length);
+ ret_value = ecma_builtin_array_prototype_object_filter (arguments_list_p[0], arguments_list_p[1], obj_p, length);
break;
}
}
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.inc.h
index 387c3a48..4ca296af 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array-prototype.inc.h
@@ -25,9 +25,7 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.4.4.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#if JERRY_ESNEXT
/* ECMA-262 v6, 22.1.3.31 */
@@ -40,9 +38,7 @@ OBJECT_VALUE (LIT_GLOBAL_SYMBOL_UNSCOPABLES,
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.4.4 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 0,
- ECMA_PROPERTY_FLAG_WRITABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_WRITABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
@@ -82,11 +78,12 @@ ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_ARRAY_PROTOTYPE_KEYS, 0, 0)
ROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_ARRAY_PROTOTYPE_INCLUDES, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_FLAT, ECMA_ARRAY_PROTOTYPE_FLAT, 1, 0)
ROUTINE (LIT_MAGIC_STRING_FLATMAP, ECMA_ARRAY_PROTOTYPE_FLATMAP, 2, 1)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL,
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES,
+ LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES, LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,
+INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR,
+ LIT_INTERNAL_MAGIC_STRING_ARRAY_PROTOTYPE_VALUES,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array.c b/jerry-core/ecma/builtin-objects/ecma-builtin-array.c
index 399c88d0..469ad114 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-array.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array.c
@@ -14,8 +14,9 @@
*/
#include "ecma-alloc.h"
-#include "ecma-builtins.h"
+#include "ecma-array-object.h"
#include "ecma-builtin-helpers.h"
+#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
@@ -24,7 +25,7 @@
#include "ecma-helpers.h"
#include "ecma-iterator-object.h"
#include "ecma-objects.h"
-#include "ecma-array-object.h"
+
#include "jcontext.h"
#include "jrt.h"
@@ -53,7 +54,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-array.inc.h"
-#define BUILTIN_UNDERSCORED_ID array
+#define BUILTIN_UNDERSCORED_ID array
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -185,10 +186,8 @@ ecma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */
{
/* 6.g.iv.1 */
ecma_value_t len_value = ecma_make_uint32_value (k);
- ecma_value_t set_status = ecma_op_object_put (array_obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH),
- len_value,
- true);
+ ecma_value_t set_status =
+ ecma_op_object_put (array_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len_value, true);
ecma_free_value (len_value);
/* 6.g.iv.2 */
@@ -255,7 +254,7 @@ ecma_builtin_array_object_from (ecma_value_t this_arg, /**< 'this' argument */
k++;
}
-iterator_cleanup:
+ iterator_cleanup:
ecma_free_value (iterator);
ecma_free_value (next_method);
ecma_deref_object (array_obj_p);
@@ -376,10 +375,8 @@ iterator_cleanup:
/* 17. */
len_value = ecma_make_length_value (k);
- ecma_value_t set_status = ecma_op_object_put (array_obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH),
- len_value,
- true);
+ ecma_value_t set_status =
+ ecma_op_object_put (array_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len_value, true);
ecma_free_value (len_value);
/* 18. */
@@ -420,10 +417,8 @@ ecma_builtin_array_object_of (ecma_value_t this_arg, /**< 'this' argument */
ecma_value_t len = ecma_make_uint32_value (arguments_list_len);
- ecma_value_t ret_val = ecma_op_function_construct (ecma_get_object_from_value (this_arg),
- ecma_get_object_from_value (this_arg),
- &len,
- 1);
+ ecma_value_t ret_val =
+ ecma_op_function_construct (ecma_get_object_from_value (this_arg), ecma_get_object_from_value (this_arg), &len, 1);
if (ECMA_IS_VALUE_ERROR (ret_val))
{
@@ -437,10 +432,8 @@ ecma_builtin_array_object_of (ecma_value_t this_arg, /**< 'this' argument */
while (k < arguments_list_len)
{
- ecma_value_t define_status = ecma_builtin_helper_def_prop_by_index (obj_p,
- k,
- arguments_list_p[k],
- prop_status_flags);
+ ecma_value_t define_status =
+ ecma_builtin_helper_def_prop_by_index (obj_p, k, arguments_list_p[k], prop_status_flags);
if (ECMA_IS_VALUE_ERROR (define_status))
{
@@ -452,10 +445,7 @@ ecma_builtin_array_object_of (ecma_value_t this_arg, /**< 'this' argument */
k++;
}
- ret_val = ecma_op_object_put (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH),
- len,
- true);
+ ret_val = ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), len, true);
ecma_free_value (len);
@@ -482,8 +472,7 @@ ecma_builtin_array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arg
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
- if (arguments_list_len != 1
- || !ecma_is_value_number (arguments_list_p[0]))
+ if (arguments_list_len != 1 || !ecma_is_value_number (arguments_list_p[0]))
{
return ecma_op_new_array_object_from_buffer (arguments_list_p, arguments_list_len);
}
@@ -514,8 +503,8 @@ ecma_builtin_array_dispatch_construct (const ecma_value_t *arguments_list_p, /**
#if !JERRY_ESNEXT
return ecma_builtin_array_dispatch_call (arguments_list_p, arguments_list_len);
#else /* JERRY_ESNEXT */
- ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
- ECMA_BUILTIN_ID_ARRAY_PROTOTYPE);
+ ecma_object_t *proto_p =
+ ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_ARRAY_PROTOTYPE);
if (proto_p == NULL)
{
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-array.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-array.inc.h
index 5a031fab..19f8b731 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-array.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-array.inc.h
@@ -25,21 +25,15 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.4.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_ARRAY_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ARRAY_PROTOTYPE, ECMA_PROPERTY_FIXED)
/* Number properties:
* (property name, object pointer getter) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_ARRAY_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ARRAY_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
/* Routine properties:
@@ -50,9 +44,7 @@ ROUTINE (LIT_MAGIC_STRING_FROM, ECMA_ARRAY_ROUTINE_FROM, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_OF, ECMA_ARRAY_ROUTINE_OF, NON_FIXED, 0)
/* ECMA-262 v6, 22.1.2.5 */
-ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
- ECMA_ARRAY_ROUTINE_SPECIES_GET,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ECMA_ARRAY_ROUTINE_SPECIES_GET, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#endif /* !(JERRY_BUILTIN_ARRAY) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c
index 1ce2a1a6..d1aee322 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.c
@@ -13,6 +13,7 @@
* limitations under the License.
*/
+#include "ecma-arraybuffer-object.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
@@ -22,9 +23,9 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
-#include "ecma-arraybuffer-object.h"
-#include "jrt.h"
+
#include "jrt-libc-includes.h"
+#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -32,7 +33,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-arraybuffer-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID arraybuffer_prototype
+#define BUILTIN_UNDERSCORED_ID arraybuffer_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h
index 6d77ed25..80463446 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer-prototype.inc.h
@@ -24,9 +24,7 @@
/* Object properties:
* (property name, object pointer getter) */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_ARRAYBUFFER,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ARRAYBUFFER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* Readonly accessor properties */
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,
@@ -34,9 +32,7 @@ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 24.1.4.4 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_ARRAY_BUFFER_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c
index 0cc315f5..1ad9d9bf 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.c
@@ -13,14 +13,15 @@
* limitations under the License.
*/
+#include "ecma-arraybuffer-object.h"
#include "ecma-builtins.h"
+#include "ecma-dataview-object.h"
#include "ecma-exceptions.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-arraybuffer-object.h"
-#include "ecma-dataview-object.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -29,7 +30,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-arraybuffer.inc.h"
-#define BUILTIN_UNDERSCORED_ID arraybuffer
+#define BUILTIN_UNDERSCORED_ID arraybuffer
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h
index 0c05b869..6fe1a936 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-arraybuffer.inc.h
@@ -24,20 +24,14 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Object properties:
* (property name, object pointer getter) */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE, ECMA_PROPERTY_FIXED)
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_ARRAY_BUFFER_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
@@ -46,9 +40,7 @@ STRING_VALUE (LIT_MAGIC_STRING_NAME,
ROUTINE (LIT_MAGIC_STRING_IS_VIEW_UL, ecma_builtin_arraybuffer_object_is_view, 1, 1)
/* ES2015 24.1.3.3 */
-ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
- ecma_builtin_arraybuffer_species_get,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_arraybuffer_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c
index 1c25e172..0f2c5552 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-from-sync-iterator-prototype.c
@@ -13,6 +13,8 @@
* limitations under the License.
*/
+#include "jerryscript-types.h"
+
#include "ecma-builtin-handlers.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
@@ -23,8 +25,8 @@
#include "ecma-iterator-object.h"
#include "ecma-objects.h"
#include "ecma-promise-object.h"
+
#include "jcontext.h"
-#include "jerryscript-types.h"
#include "jrt.h"
#include "lit-magic-strings.h"
#include "lit-strings.h"
@@ -37,8 +39,8 @@
#include "ecma-builtins-internal.h"
/**
- * This object has a custom dispatch function.
- */
+ * This object has a custom dispatch function.
+ */
#define BUILTIN_CUSTOM_DISPATCH
/**
@@ -53,7 +55,7 @@ enum
} ecma_async_from_sync_iterator_operation_type_t;
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-from-sync-iterator-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID async_from_sync_iterator_prototype
+#define BUILTIN_UNDERSCORED_ID async_from_sync_iterator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -146,9 +148,8 @@ ecma_builtin_async_from_sync_iterator_prototype_next (ecma_async_from_sync_itera
ecma_value_t value) /**< routine's 'value' argument */
{
/* 5. */
- ecma_value_t next_result = ecma_op_iterator_next (iter_p->header.u.cls.u3.sync_iterator,
- iter_p->sync_next_method,
- value);
+ ecma_value_t next_result =
+ ecma_op_iterator_next (iter_p->header.u.cls.u3.sync_iterator, iter_p->sync_next_method, value);
/* 6. */
if (ECMA_IS_VALUE_ERROR (ecma_op_if_abrupt_reject_promise (&next_result, capability_p)))
@@ -224,10 +225,8 @@ ecma_builtin_async_from_sync_iterator_prototype_do (ecma_async_from_sync_iterato
}
/* 7.b. */
- ecma_value_t resolve = ecma_op_function_call (ecma_get_object_from_value (func_obj),
- ECMA_VALUE_UNDEFINED,
- &call_arg,
- arg_size);
+ ecma_value_t resolve =
+ ecma_op_function_call (ecma_get_object_from_value (func_obj), ECMA_VALUE_UNDEFINED, &call_arg, arg_size);
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (resolve));
ecma_free_value (resolve);
@@ -273,10 +272,8 @@ ecma_builtin_async_from_sync_iterator_prototype_do (ecma_async_from_sync_iterato
ecma_value_t type_error = ecma_make_object_value (type_error_obj_p);
/* 10.a. */
- ecma_value_t reject = ecma_op_function_call (ecma_get_object_from_value (capability_p->reject),
- ECMA_VALUE_UNDEFINED,
- &type_error,
- 1);
+ ecma_value_t reject =
+ ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), ECMA_VALUE_UNDEFINED, &type_error, 1);
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (reject));
ecma_deref_object (type_error_obj_p);
ecma_free_value (reject);
@@ -292,11 +289,11 @@ ecma_builtin_async_from_sync_iterator_prototype_do (ecma_async_from_sync_iterato
} /* ecma_builtin_async_from_sync_iterator_prototype_do */
/**
- * Dispatcher of the %AsyncFromSyncIteratorPrototype% built-in's routines
- *
- * @return ecma value
- * Returned value must be freed with ecma_free_value.
- */
+ * Dispatcher of the %AsyncFromSyncIteratorPrototype% built-in's routines
+ *
+ * @return ecma value
+ * Returned value must be freed with ecma_free_value.
+ */
ecma_value_t
ecma_builtin_async_from_sync_iterator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide
* routine
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.c
index 68f2a012..150bb953 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.c
@@ -21,7 +21,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-function-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID async_function_prototype
+#define BUILTIN_UNDERSCORED_ID async_function_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h
index 5ff638c7..32e3cfae 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function-prototype.inc.h
@@ -22,14 +22,10 @@
#if JERRY_ESNEXT
/* ECMA-262 v11, 25.7.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_ASYNC_FUNCTION,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v11, 25.7.3.2 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_ASYNC_FUNCTION_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.c
index bb26e4e3..115af43c 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.c
@@ -22,7 +22,7 @@
#include "ecma-function-object.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-function.inc.h"
-#define BUILTIN_UNDERSCORED_ID async_function
+#define BUILTIN_UNDERSCORED_ID async_function
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -47,9 +47,7 @@ ecma_builtin_async_function_dispatch_call (const ecma_value_t *arguments_list_p,
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
- return ecma_op_create_dynamic_function (arguments_list_p,
- arguments_list_len,
- ECMA_PARSE_ASYNC_FUNCTION);
+ return ecma_op_create_dynamic_function (arguments_list_p, arguments_list_len, ECMA_PARSE_ASYNC_FUNCTION);
} /* ecma_builtin_async_function_dispatch_call */
/**
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.inc.h
index e304ff17..fb96a002 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-function.inc.h
@@ -22,24 +22,16 @@
#if JERRY_ESNEXT
/* ECMA-262 v11, 25.7.2 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_ASYNC_FUNCTION_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v11, 25.7.2.1 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v10, 25.7.2.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_FUNCTION_PROTOTYPE, ECMA_PROPERTY_FIXED)
/* ECMA-262 v11, 25.7.3.2 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_ASYNC_FUNCTION_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.c
index 26091097..ad2fcd67 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.c
@@ -22,7 +22,7 @@
#include "ecma-function-object.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-generator-function.inc.h"
-#define BUILTIN_UNDERSCORED_ID async_generator_function
+#define BUILTIN_UNDERSCORED_ID async_generator_function
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h
index acafd42b..40914c49 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-function.inc.h
@@ -22,19 +22,13 @@
#if JERRY_ESNEXT
/* ECMA-262 v10, 25.3.2 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v10, 25.3.2.1 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 25.3.2.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_ASYNC_GENERATOR,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_GENERATOR, ECMA_PROPERTY_FIXED)
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c
index 72a49491..0d710f26 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.c
@@ -21,6 +21,7 @@
#include "ecma-helpers.h"
#include "ecma-iterator-object.h"
#include "ecma-promise-object.h"
+
#include "jcontext.h"
#include "opcodes.h"
#include "vm-defines.h"
@@ -31,8 +32,8 @@
#include "ecma-builtins-internal.h"
/**
- * This object has a custom dispatch function.
- */
+ * This object has a custom dispatch function.
+ */
#define BUILTIN_CUSTOM_DISPATCH
/**
@@ -47,7 +48,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-generator-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID async_generator_prototype
+#define BUILTIN_UNDERSCORED_ID async_generator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -64,26 +65,26 @@ enum
* Convert routine type to operation type..
*/
#define ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION(type) \
- ((ecma_async_generator_operation_type_t) ((type) - ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT))
+ ((ecma_async_generator_operation_type_t) ((type) -ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT))
JERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_NEXT)
- == ECMA_ASYNC_GENERATOR_DO_NEXT,
+ == ECMA_ASYNC_GENERATOR_DO_NEXT,
convert_ecma_async_generator_routine_next_to_ecma_async_generator_do_next_failed);
JERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_THROW)
- == ECMA_ASYNC_GENERATOR_DO_THROW,
+ == ECMA_ASYNC_GENERATOR_DO_THROW,
convert_ecma_async_generator_routine_throw_to_ecma_async_generator_do_throw_failed);
JERRY_STATIC_ASSERT (ECMA_ASYNC_GENERATOR_ROUTINE_TO_OPERATION (ECMA_ASYNC_GENERATOR_PROTOTYPE_ROUTINE_RETURN)
- == ECMA_ASYNC_GENERATOR_DO_RETURN,
+ == ECMA_ASYNC_GENERATOR_DO_RETURN,
convert_ecma_async_generator_routine_return_to_ecma_async_generator_do_return_failed);
/**
- * Dispatcher of the Generator built-in's routines
- *
- * @return ecma value
- * Returned value must be freed with ecma_free_value.
- */
+ * Dispatcher of the Generator built-in's routines
+ *
+ * @return ecma value
+ * Returned value must be freed with ecma_free_value.
+ */
ecma_value_t
ecma_builtin_async_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
* identifier */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h
index f96a2e26..481c097d 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator-prototype.inc.h
@@ -25,14 +25,10 @@
* (property name, object pointer getter) */
/* ECMA-262 v6, 25.3.1.5 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_ASYNC_GENERATOR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ASYNC_GENERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 25.2.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_ASYNC_GENERATOR,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_GENERATOR, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.c
index 51e095d5..2f5651b1 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.c
@@ -21,7 +21,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-generator.inc.h"
-#define BUILTIN_UNDERSCORED_ID async_generator
+#define BUILTIN_UNDERSCORED_ID async_generator
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.inc.h
index 0b6162d5..076e42cc 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-generator.inc.h
@@ -22,14 +22,10 @@
#if JERRY_ESNEXT
/* ECMA-262 v6, 25.3.2.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ASYNC_GENERATOR_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 25.3.2.3.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ASYNC_GENERATOR_PROTOTYPE, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 25.3.2.3.3 */
STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c
index aaefa492..ec65c765 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-async-iterator-prototype.c
@@ -37,7 +37,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-async-iterator-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID async_iterator_prototype
+#define BUILTIN_UNDERSCORED_ID async_iterator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.c b/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.c
index a73850b1..c7d1847c 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.c
@@ -17,6 +17,7 @@
#include "ecma-builtins.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_ATOMICS
@@ -51,7 +52,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-atomics.inc.h"
-#define BUILTIN_UNDERSCORED_ID atomics
+#define BUILTIN_UNDERSCORED_ID atomics
#include "ecma-builtin-internal-routines-template.inc.h"
@@ -76,7 +77,7 @@ enum
static ecma_value_t
ecma_builtin_atomics_compare_exchange (ecma_value_t typedarray, /**< typedArray argument */
ecma_value_t index, /**< index argument */
- ecma_value_t expected_value, /**< expectedValue argument */
+ ecma_value_t expected_value, /**< expectedValue argument */
ecma_value_t replacement_value) /**< replacementValue argument*/
{
JERRY_UNUSED (typedarray);
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.inc.h
index 7eab2372..a11b4518 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-atomics.inc.h
@@ -22,9 +22,7 @@
#if JERRY_BUILTIN_ATOMICS
/* ECMA-262 v11, 24.4.14 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_ATOMICS_U,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_ATOMICS_U, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c
index 7eee8cc6..3c32e724 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.c
@@ -38,7 +38,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-bigint-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID bigint_prototype
+#define BUILTIN_UNDERSCORED_ID bigint_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h
index 91f637fb..1dc916b0 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint-prototype.inc.h
@@ -25,14 +25,10 @@
* (property name, object pointer getter) */
/* ECMA-262 v11, 20.2.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_BIGINT,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_BIGINT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v11, 20.2.3.5 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_BIGINT_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_BIGINT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c
index 08f0dacb..1c7e9f0c 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.c
@@ -23,7 +23,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-bigint.inc.h"
-#define BUILTIN_UNDERSCORED_ID bigint
+#define BUILTIN_UNDERSCORED_ID bigint
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.inc.h
index a19f9acd..d8b216ab 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-bigint.inc.h
@@ -25,22 +25,16 @@
* (property name, number value, writable, enumerable, configurable) */
/* ECMA-262 v11, 20.2.1 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v11, 20.2.1 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_BIGINT_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_BIGINT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v11, 20.2.2.3 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_BIGINT_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_BIGINT_PROTOTYPE, ECMA_PROPERTY_FIXED)
#endif /* JERRY_BUILTIN_BIGINT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c
index cefa45cd..cd175dd4 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.c
@@ -22,6 +22,7 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_BOOLEAN
@@ -45,7 +46,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-boolean-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID boolean_prototype
+#define BUILTIN_UNDERSCORED_ID boolean_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h
index d9dba92b..82ef75f9 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean-prototype.inc.h
@@ -25,14 +25,12 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.6.4.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_BOOLEAN,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_BOOLEAN, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_BOOLEAN_PROTOTYPE_ROUTINE_TO_STRING, 0, 0)
-ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_BOOLEAN_PROTOTYPE_ROUTINE_VALUE_OF, 0, 0)
+ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_BOOLEAN_PROTOTYPE_ROUTINE_VALUE_OF, 0, 0)
#endif /* JERRY_BUILTIN_BOOLEAN */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c
index 3883317a..603d6104 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.c
@@ -22,6 +22,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_BOOLEAN
@@ -30,7 +31,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-boolean.inc.h"
-#define BUILTIN_UNDERSCORED_ID boolean
+#define BUILTIN_UNDERSCORED_ID boolean
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.inc.h
index b52478aa..51e0c298 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-boolean.inc.h
@@ -25,21 +25,15 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.6.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_BOOLEAN_PROTOTYPE, ECMA_PROPERTY_FIXED)
/* Number properties:
* (property name, object pointer getter) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_BOOLEAN_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_BOOLEAN_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_BOOLEAN */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c
index b0edf012..edebf7b7 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.c
@@ -14,8 +14,8 @@
*/
#include "ecma-arraybuffer-object.h"
-#include "ecma-exceptions.h"
#include "ecma-dataview-object.h"
+#include "ecma-exceptions.h"
#include "ecma-gc.h"
#if JERRY_BUILTIN_DATAVIEW
@@ -74,7 +74,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-dataview-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID dataview_prototype
+#define BUILTIN_UNDERSCORED_ID dataview_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -179,7 +179,8 @@ ecma_builtin_dataview_prototype_dispatch_routine (uint8_t builtin_routine_id, /*
return ecma_op_dataview_get_set_view_value (this_arg,
arguments_list_p[0],
arguments_list_p[1],
- ECMA_VALUE_EMPTY, id);
+ ECMA_VALUE_EMPTY,
+ id);
}
case ECMA_DATAVIEW_PROTOTYPE_SET_FLOAT32:
#if JERRY_NUMBER_TYPE_FLOAT64
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h
index 2f2e245f..82ef26b1 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview-prototype.inc.h
@@ -25,14 +25,10 @@
* (property name, object pointer getter) */
/* ECMA-262 v6, 24.2.3 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_DATAVIEW,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_DATAVIEW, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 23.2.4.21 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_DATAVIEW_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
@@ -64,9 +60,7 @@ ROUTINE (LIT_MAGIC_STRING_SET_BIGUINT64, ECMA_DATAVIEW_PROTOTYPE_SET_BIGUINT64,
#endif /* JERRY_BUILTIN_BIGINT */
/* ECMA-262 v6, 24.2.4.1 */
-ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BUFFER,
- ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BUFFER, ECMA_DATAVIEW_PROTOTYPE_BUFFER_GETTER, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 24.2.4.2 */
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c
index 94d73784..6e86c6dc 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.c
@@ -14,8 +14,8 @@
*/
#include "ecma-builtins.h"
-#include "ecma-exceptions.h"
#include "ecma-dataview-object.h"
+#include "ecma-exceptions.h"
#if JERRY_BUILTIN_DATAVIEW
@@ -23,7 +23,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-dataview.inc.h"
-#define BUILTIN_UNDERSCORED_ID dataview
+#define BUILTIN_UNDERSCORED_ID dataview
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.inc.h
index 009cca18..9b1027cc 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-dataview.inc.h
@@ -25,22 +25,16 @@
* (property name, number value, writable, enumerable, configurable) */
/* ECMA-262 v6, 23.1.2 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 23.1 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_DATAVIEW_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v6, 23.1.2.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE, ECMA_PROPERTY_FIXED)
#endif /* JERRY_BUILTIN_DATAVIEW */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c
index b02de1bf..2a3120bc 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.c
@@ -22,8 +22,8 @@
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
+#include "ecma-objects.h"
#if JERRY_BUILTIN_DATE
@@ -39,7 +39,7 @@
* Checks whether the function uses UTC time zone.
*/
#define BUILTIN_DATE_FUNCTION_IS_UTC(builtin_routine_id) \
- (((builtin_routine_id) - ECMA_DATE_PROTOTYPE_GET_FULL_YEAR) & 0x1)
+ (((builtin_routine_id) -ECMA_DATE_PROTOTYPE_GET_FULL_YEAR) & 0x1)
/**
* List of built-in routine identifiers.
@@ -108,7 +108,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-date-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID date_prototype
+#define BUILTIN_UNDERSCORED_ID date_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -311,7 +311,7 @@ ecma_builtin_date_prototype_dispatch_get (uint16_t builtin_routine_id, /**< buil
* Returns true, if the built-in id sets a year.
*/
#define ECMA_DATE_PROTOTYPE_IS_SET_YEAR_ROUTINE(builtin_routine_id) \
- ((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \
+ ((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \
|| (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR \
|| (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_YEAR)
@@ -321,7 +321,7 @@ ecma_builtin_date_prototype_dispatch_get (uint16_t builtin_routine_id, /**< buil
* Returns true, if the built-in id sets a year.
*/
#define ECMA_DATE_PROTOTYPE_IS_SET_YEAR_ROUTINE(builtin_routine_id) \
- ((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \
+ ((builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_FULL_YEAR \
|| (builtin_routine_id) == ECMA_DATE_PROTOTYPE_SET_UTC_FULL_YEAR)
#endif /* JERRY_BUILTIN_ANNEXB */
@@ -677,7 +677,6 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b
if (builtin_routine_id <= ECMA_DATE_PROTOTYPE_SET_UTC_MILLISECONDS)
{
-
if (builtin_routine_id <= ECMA_DATE_PROTOTYPE_GET_UTC_TIMEZONE_OFFSET)
{
if (!BUILTIN_DATE_FUNCTION_IS_UTC (builtin_routine_id))
@@ -706,10 +705,7 @@ ecma_builtin_date_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< b
return ecma_builtin_date_prototype_dispatch_get (builtin_routine_id, date_value);
}
- return ecma_builtin_date_prototype_dispatch_set (builtin_routine_id,
- this_obj_p,
- arguments_list,
- arguments_number);
+ return ecma_builtin_date_prototype_dispatch_set (builtin_routine_id, this_obj_p, arguments_list, arguments_number);
}
if (builtin_routine_id == ECMA_DATE_PROTOTYPE_TO_ISO_STRING)
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.inc.h
index 1c80040a..ff4f9a20 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date-prototype.inc.h
@@ -21,9 +21,7 @@
#if JERRY_BUILTIN_DATE
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_DATE,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_DATE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_DATE_PROTOTYPE_TO_STRING, 0, 0)
ROUTINE (LIT_MAGIC_STRING_TO_DATE_STRING_UL, ECMA_DATE_PROTOTYPE_TO_DATE_STRING, 0, 0)
@@ -69,10 +67,12 @@ ROUTINE (LIT_MAGIC_STRING_TO_ISO_STRING_UL, ECMA_DATE_PROTOTYPE_TO_ISO_STRING, 0
ROUTINE (LIT_MAGIC_STRING_TO_JSON_UL, ECMA_DATE_PROTOTYPE_TO_JSON, 1, 1)
#if JERRY_ESNEXT
ROUTINE_CONFIGURABLE_ONLY (LIT_GLOBAL_SYMBOL_TO_PRIMITIVE, ECMA_DATE_PROTOTYPE_TO_PRIMITIVE, 1, 1)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_UTC_STRING_UL, LIT_MAGIC_STRING_TO_UTC_STRING_UL,
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_UTC_STRING_UL,
+ LIT_MAGIC_STRING_TO_UTC_STRING_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#if JERRY_BUILTIN_ANNEXB
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_GMT_STRING_UL, LIT_MAGIC_STRING_TO_UTC_STRING_UL,
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_GMT_STRING_UL,
+ LIT_MAGIC_STRING_TO_UTC_STRING_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_ANNEXB */
#else /* !JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date.c b/jerry-core/ecma/builtin-objects/ecma-builtin-date.c
index a16b6c1b..cad9534c 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-date.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date.c
@@ -15,15 +15,16 @@
#include <math.h>
-#include "jcontext.h"
-#include "ecma-function-object.h"
#include "ecma-alloc.h"
#include "ecma-builtin-helpers.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
+
+#include "jcontext.h"
#include "lit-char-helpers.h"
#if JERRY_BUILTIN_DATE
@@ -48,7 +49,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-date.inc.h"
-#define BUILTIN_UNDERSCORED_ID date
+#define BUILTIN_UNDERSCORED_ID date
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -148,8 +149,7 @@ ecma_date_check_two_chars (const lit_utf8_byte_t *str_p, /**< pointer to the ces
ecma_char_t expected_char1, /**< first expected character */
ecma_char_t expected_char2) /**< second expected character */
{
- return (str_p < str_end_p
- && (*str_p == expected_char1 || *str_p == expected_char2));
+ return (str_p < str_end_p && (*str_p == expected_char1 || *str_p == expected_char2));
} /* ecma_date_check_two_chars */
/**
@@ -236,21 +236,20 @@ ecma_date_parse_month_name (const lit_utf8_byte_t **str_p, /**< pointer to the c
} /* ecma_date_parse_month_name */
/**
- * Calculate MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)) for Date constructor and UTC
- *
- * See also:
- * ECMA-262 v11, 20.4.3.4
- *
- * @return false - if the operation fails
- * true - otherwise
- */
+ * Calculate MakeDate(MakeDay(yr, m, dt), MakeTime(h, min, s, milli)) for Date constructor and UTC
+ *
+ * See also:
+ * ECMA-262 v11, 20.4.3.4
+ *
+ * @return false - if the operation fails
+ * true - otherwise
+ */
static bool
ecma_date_construct_helper (const ecma_value_t *args, /**< arguments passed to the Date constructor */
uint32_t args_len, /**< number of arguments */
ecma_number_t *tv_p) /**< [out] time value */
{
- ecma_number_t date_nums[7] =
- {
+ ecma_number_t date_nums[7] = {
ECMA_NUMBER_ZERO, /* year */
ECMA_NUMBER_ZERO, /* month */
ECMA_NUMBER_ONE, /* date */
@@ -287,13 +286,8 @@ ecma_date_construct_helper (const ecma_value_t *args, /**< arguments passed to t
}
/* 10. */
- *tv_p = ecma_date_make_date (ecma_date_make_day (date_nums[0],
- date_nums[1],
- date_nums[2]),
- ecma_date_make_time (date_nums[3],
- date_nums[4],
- date_nums[5],
- date_nums[6]));
+ *tv_p = ecma_date_make_date (ecma_date_make_day (date_nums[0], date_nums[1], date_nums[2]),
+ ecma_date_make_time (date_nums[3], date_nums[4], date_nums[5], date_nums[6]));
return true;
} /* ecma_date_construct_helper */
@@ -324,10 +318,8 @@ ecma_builtin_date_parse_basic (const lit_utf8_byte_t *date_str_curr_p, /**< date
year_limit = 999999;
}
- ecma_number_t year = ecma_date_parse_date_chars (&date_str_curr_p,
- date_str_end_p,
- year_digits,
- ECMA_DATE_LIMIT (0, year_limit));
+ ecma_number_t year =
+ ecma_date_parse_date_chars (&date_str_curr_p, date_str_end_p, year_digits, ECMA_DATE_LIMIT (0, year_limit));
if (is_year_sign_negative)
{
year = -year;
@@ -466,8 +458,7 @@ ecma_builtin_date_parse_basic (const lit_utf8_byte_t *date_str_curr_p, /**< date
* @return the parsed date as ecma_number_t or NaN otherwise
*/
static ecma_number_t
-ecma_builtin_date_parse_toString_formats (const lit_utf8_byte_t *date_str_curr_p,
- const lit_utf8_byte_t *date_str_end_p)
+ecma_builtin_date_parse_toString_formats (const lit_utf8_byte_t *date_str_curr_p, const lit_utf8_byte_t *date_str_end_p)
{
const ecma_number_t nan = ecma_number_make_nan ();
@@ -582,8 +573,7 @@ ecma_builtin_date_parse_toString_formats (const lit_utf8_byte_t *date_str_curr_p
}
const char gmt_p[] = " GMT";
- if (date_str_end_p - date_str_curr_p < 4
- || memcmp (date_str_curr_p, gmt_p, 4) != 0)
+ if (date_str_end_p - date_str_curr_p < 4 || memcmp (date_str_curr_p, gmt_p, 4) != 0)
{
return nan;
}
@@ -725,8 +715,8 @@ ecma_builtin_date_create (ecma_number_t tv)
#if JERRY_ESNEXT
JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) != NULL);
- ecma_object_t *prototype_obj_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
- ECMA_BUILTIN_ID_DATE_PROTOTYPE);
+ ecma_object_t *prototype_obj_p =
+ ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_DATE_PROTOTYPE);
if (JERRY_UNLIKELY (prototype_obj_p == NULL))
{
@@ -787,7 +777,6 @@ ecma_value_t
ecma_builtin_date_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
-
/* 20.4.2.3 */
if (arguments_list_len == 0)
{
@@ -804,7 +793,6 @@ ecma_builtin_date_dispatch_construct (const ecma_value_t *arguments_list_p, /**<
if (ecma_is_value_object (argument)
&& ecma_object_class_is (ecma_get_object_from_value (argument), ECMA_OBJECT_CLASS_DATE))
{
-
#if JERRY_ESNEXT
tv = ((ecma_date_object_t *) ecma_get_object_from_value (argument))->date_value;
#else /* !JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-date.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-date.inc.h
index 7e675c97..f390e0dd 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-date.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-date.inc.h
@@ -22,22 +22,16 @@
#if JERRY_BUILTIN_DATE
/* ECMA-262 v5, 15.9.4.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_DATE_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_DATE_PROTOTYPE, ECMA_PROPERTY_FIXED)
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 7,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 7, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
ROUTINE (LIT_MAGIC_STRING_PARSE, ECMA_DATE_ROUTINE_PARSE, 1, 1)
ROUTINE (LIT_MAGIC_STRING_UTC_U, ECMA_DATE_ROUTINE_UTC, NON_FIXED, 7)
ROUTINE (LIT_MAGIC_STRING_NOW, ECMA_DATE_ROUTINE_NOW, 0, 0)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_DATE_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_DATE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_DATE */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c
index 5f4f5650..861d8226 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.c
@@ -20,18 +20,19 @@
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "lit-char-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
+
#include "jrt.h"
+#include "lit-char-helpers.h"
#include "lit-magic-strings.h"
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
/**
- * This object has a custom dispatch function.
- */
+ * This object has a custom dispatch function.
+ */
#define BUILTIN_CUSTOM_DISPATCH
/**
@@ -44,7 +45,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-error-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID error_prototype
+#define BUILTIN_UNDERSCORED_ID error_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -105,18 +106,16 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
ecma_object_t *obj_p = ecma_get_object_from_value (this_arg);
- ecma_string_t *name_string_p = ecma_builtin_error_prototype_object_to_string_helper (obj_p,
- LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_ERROR_UL);
+ ecma_string_t *name_string_p =
+ ecma_builtin_error_prototype_object_to_string_helper (obj_p, LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL);
if (JERRY_UNLIKELY (name_string_p == NULL))
{
return ECMA_VALUE_ERROR;
}
- ecma_string_t *msg_string_p = ecma_builtin_error_prototype_object_to_string_helper (obj_p,
- LIT_MAGIC_STRING_MESSAGE,
- LIT_MAGIC_STRING__EMPTY);
+ ecma_string_t *msg_string_p =
+ ecma_builtin_error_prototype_object_to_string_helper (obj_p, LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY);
if (JERRY_UNLIKELY (msg_string_p == NULL))
{
@@ -136,7 +135,7 @@ ecma_builtin_error_prototype_object_to_string (ecma_value_t this_arg) /**< this
ecma_stringbuilder_t builder = ecma_stringbuilder_create_from (name_string_p);
- ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *)": ", 2);
+ ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) ": ", 2);
ecma_stringbuilder_append (&builder, msg_string_p);
ecma_deref_ecma_string (name_string_p);
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.inc.h
index 5e02b20c..751094ca 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-error-prototype.inc.h
@@ -23,19 +23,13 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.4.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.4.2 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_ERROR_UL,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.4.3 */
-STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
- LIT_MAGIC_STRING__EMPTY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-error.c b/jerry-core/ecma/builtin-objects/ecma-builtin-error.c
index 17693f2e..1f8dedda 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-error.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-error.c
@@ -14,23 +14,24 @@
*/
#include "ecma-alloc.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-builtin-helpers.h"
#include "ecma-objects.h"
-#include "ecma-function-object.h"
-#include "jrt.h"
+
#include "jcontext.h"
+#include "jrt.h"
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-error.inc.h"
-#define BUILTIN_UNDERSCORED_ID error
+#define BUILTIN_UNDERSCORED_ID error
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -67,8 +68,8 @@ ecma_builtin_error_dispatch_construct (const ecma_value_t *arguments_list_p, /**
#if !JERRY_ESNEXT
return ecma_builtin_error_dispatch_call (arguments_list_p, arguments_list_len);
#else /* JERRY_ESNEXT */
- ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
- ECMA_BUILTIN_ID_ERROR_PROTOTYPE);
+ ecma_object_t *proto_p =
+ ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_ERROR_PROTOTYPE);
if (proto_p == NULL)
{
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-error.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-error.inc.h
index c3df1a7c..7098dd95 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-error.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-error.inc.h
@@ -22,22 +22,16 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.7.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_ERROR_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_ERROR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c
index a755b166..37588033 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.c
@@ -22,6 +22,7 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -30,7 +31,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-evalerror-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID eval_error_prototype
+#define BUILTIN_UNDERSCORED_ID eval_error_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h
index f131641f..1f13dd2f 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror-prototype.inc.h
@@ -25,19 +25,13 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.7.8 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_EVAL_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_EVAL_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.9 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_EVAL_ERROR_UL,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.10 */
-STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
- LIT_MAGIC_STRING__EMPTY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.c
index 29e71ecb..3804420d 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.c
@@ -14,17 +14,18 @@
*/
#include "ecma-alloc.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-builtin-helpers.h"
#include "ecma-objects.h"
-#include "ecma-function-object.h"
-#include "jrt.h"
+
#include "jcontext.h"
+#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -32,7 +33,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-evalerror.inc.h"
-#define BUILTIN_UNDERSCORED_ID eval_error
+#define BUILTIN_UNDERSCORED_ID eval_error
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -69,8 +70,8 @@ ecma_builtin_eval_error_dispatch_construct (const ecma_value_t *arguments_list_p
#if !JERRY_ESNEXT
return ecma_builtin_eval_error_dispatch_call (arguments_list_p, arguments_list_len);
#else /* JERRY_ESNEXT */
- ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
- ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE);
+ ecma_object_t *proto_p =
+ ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE);
if (proto_p == NULL)
{
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.inc.h
index 64887c8d..9efa35f6 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-evalerror.inc.h
@@ -24,22 +24,16 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_EVAL_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_EVAL_ERROR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c
index d1d71ea2..44e30347 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.c
@@ -13,20 +13,22 @@
* limitations under the License.
*/
+#include "ecma-builtin-function-prototype.h"
+
#include "ecma-alloc.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-extended-info.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-function-object.h"
#include "ecma-objects.h"
#include "ecma-proxy-object.h"
+
#include "jrt.h"
-#include "ecma-builtin-function-prototype.h"
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -52,7 +54,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-function-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID function_prototype
+#define BUILTIN_UNDERSCORED_ID function_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -209,7 +211,7 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th
/* 2. */
if (ecma_is_value_null (arg2) || ecma_is_value_undefined (arg2))
{
- return ecma_op_function_call (func_obj_p, arg1, NULL, 0);
+ return ecma_op_function_call (func_obj_p, arg1, NULL, 0);
}
/* 3. */
@@ -256,10 +258,7 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th
if (ecma_is_value_empty (ret_value))
{
JERRY_ASSERT (index == length);
- ret_value = ecma_op_function_call (func_obj_p,
- arg1,
- arguments_list_p,
- (uint32_t) length);
+ ret_value = ecma_op_function_call (func_obj_p, arg1, arguments_list_p, (uint32_t) length);
}
for (uint32_t remove_index = 0; remove_index < index; remove_index++)
@@ -282,17 +281,14 @@ ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, /**< th
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
-ecma_builtin_function_prototype_object_call (ecma_object_t *func_obj_p , /**< this argument object */
+ecma_builtin_function_prototype_object_call (ecma_object_t *func_obj_p, /**< this argument object */
const ecma_value_t *arguments_list_p, /**< list of arguments */
uint32_t arguments_number) /**< number of arguments */
{
if (arguments_number == 0)
{
/* Even a 'this' argument is missing. */
- return ecma_op_function_call (func_obj_p,
- ECMA_VALUE_UNDEFINED,
- NULL,
- 0);
+ return ecma_op_function_call (func_obj_p, ECMA_VALUE_UNDEFINED, NULL, 0);
}
return ecma_op_function_call (func_obj_p,
@@ -311,7 +307,7 @@ ecma_builtin_function_prototype_object_call (ecma_object_t *func_obj_p , /**< th
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
-ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**< this argument object */
+ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p, /**< this argument object */
const ecma_value_t *arguments_list_p, /**< list of arguments */
uint32_t arguments_number) /**< number of arguments */
{
@@ -353,18 +349,13 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**
ecma_object_t *function_p;
ecma_bound_function_t *bound_func_p;
- if (arguments_number == 0
- || (arguments_number == 1 && !ecma_is_value_integer_number (arguments_list_p[0])))
+ if (arguments_number == 0 || (arguments_number == 1 && !ecma_is_value_integer_number (arguments_list_p[0])))
{
- function_p = ecma_create_object (prototype_obj_p,
- sizeof (ecma_bound_function_t),
- ECMA_OBJECT_TYPE_BOUND_FUNCTION);
+ function_p = ecma_create_object (prototype_obj_p, sizeof (ecma_bound_function_t), ECMA_OBJECT_TYPE_BOUND_FUNCTION);
/* 8. */
bound_func_p = (ecma_bound_function_t *) function_p;
- ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function,
- this_arg_obj_p,
- 0);
+ ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function, this_arg_obj_p, 0);
bound_func_p->header.u.bound_function.args_len_or_this = ECMA_VALUE_UNDEFINED;
@@ -379,15 +370,11 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**
size_t obj_size = sizeof (ecma_bound_function_t) + (arguments_number * sizeof (ecma_value_t));
- function_p = ecma_create_object (prototype_obj_p,
- obj_size,
- ECMA_OBJECT_TYPE_BOUND_FUNCTION);
+ function_p = ecma_create_object (prototype_obj_p, obj_size, ECMA_OBJECT_TYPE_BOUND_FUNCTION);
/* 8. */
bound_func_p = (ecma_bound_function_t *) function_p;
- ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function,
- this_arg_obj_p,
- 0);
+ ECMA_SET_NON_NULL_POINTER_TAG (bound_func_p->header.u.bound_function.target_function, this_arg_obj_p, 0);
/* NOTE: This solution provides temporary false data about the object's size
but prevents GC from freeing it until it's not fully initialized. */
@@ -413,9 +400,7 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**
ecma_string_t *len_string = ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH);
ecma_property_descriptor_t prop_desc;
- ecma_value_t status = ecma_op_object_get_own_property_descriptor (this_arg_obj_p,
- len_string,
- &prop_desc);
+ ecma_value_t status = ecma_op_object_get_own_property_descriptor (this_arg_obj_p, len_string, &prop_desc);
#if JERRY_BUILTIN_PROXY
if (ECMA_IS_VALUE_ERROR (status))
@@ -428,8 +413,7 @@ ecma_builtin_function_prototype_object_bind (ecma_object_t *this_arg_obj_p , /**
if (ecma_is_value_true (status))
{
ecma_free_property_descriptor (&prop_desc);
- ecma_value_t len_value = ecma_op_object_get (this_arg_obj_p,
- len_string);
+ ecma_value_t len_value = ecma_op_object_get (this_arg_obj_p, len_string);
if (ECMA_IS_VALUE_ERROR (len_value))
{
@@ -552,9 +536,7 @@ ecma_builtin_function_prototype_dispatch_routine (uint8_t builtin_routine_id, /*
}
case ECMA_FUNCTION_PROTOTYPE_APPLY:
{
- return ecma_builtin_function_prototype_object_apply (func_obj_p,
- arguments_list_p[0],
- arguments_list_p[1]);
+ return ecma_builtin_function_prototype_object_apply (func_obj_p, arguments_list_p[0], arguments_list_p[1]);
}
case ECMA_FUNCTION_PROTOTYPE_CALL:
{
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.h b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.h
index 97ba3137..363681f5 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.h
@@ -16,8 +16,9 @@
#ifndef ECMA_BUILTIN_FUNCTION_PROTOTYPE_H
#define ECMA_BUILTIN_FUNCTION_PROTOTYPE_H
-ecma_value_t ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p,
- ecma_value_t arg1,
- ecma_value_t arg2);
+#include "ecma-globals.h"
+
+ecma_value_t
+ecma_builtin_function_prototype_object_apply (ecma_object_t *func_obj_p, ecma_value_t arg1, ecma_value_t arg2);
#endif /* !ECMA_BUILTIN_FUNCTION_PROTOTYPE_H */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h
index 1c61dfab..46261d2d 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function-prototype.inc.h
@@ -23,21 +23,15 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.3.4.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_FUNCTION,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_FUNCTION, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* Number properties:
* (property name, object pointer getter) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 0,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING__EMPTY,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
/* Routine properties:
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function.c b/jerry-core/ecma/builtin-objects/ecma-builtin-function.c
index 562fab2f..7c8e1dfd 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-function.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function.c
@@ -15,11 +15,12 @@
#include "ecma-alloc.h"
#include "ecma-conversion.h"
-#include "ecma-exceptions.h"
#include "ecma-eval.h"
-#include "ecma-gc.h"
+#include "ecma-exceptions.h"
#include "ecma-function-object.h"
+#include "ecma-gc.h"
#include "ecma-lex-env.h"
+
#include "js-parser.h"
#include "lit-magic-strings.h"
@@ -27,7 +28,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-function.inc.h"
-#define BUILTIN_UNDERSCORED_ID function
+#define BUILTIN_UNDERSCORED_ID function
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-function.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-function.inc.h
index 68f9edbd..388755de 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-function.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-function.inc.h
@@ -23,21 +23,15 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.3.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, ECMA_PROPERTY_FIXED)
/* Number properties:
* (property name, object pointer getter) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_FUNCTION_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.c b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.c
index 05ee6cc8..14907dd1 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.c
@@ -22,7 +22,7 @@
#include "ecma-function-object.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-generator-function.inc.h"
-#define BUILTIN_UNDERSCORED_ID generator_function
+#define BUILTIN_UNDERSCORED_ID generator_function
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -53,7 +53,7 @@ ecma_builtin_generator_function_dispatch_call (const ecma_value_t *arguments_lis
/**
* Handle calling [[Construct]] of built-in GeneratorFunction object
*
-* @return constructed generator function object - if success
+ * @return constructed generator function object - if success
* raised error otherwise
*/
ecma_value_t
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.inc.h
index 842f70a9..a6d60bdc 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-function.inc.h
@@ -22,19 +22,13 @@
#if JERRY_ESNEXT
/* ECMA-262 v6, 25.2.2 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 25.2.2.1 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 25.2.2.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_GENERATOR,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_GENERATOR, ECMA_PROPERTY_FIXED)
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c
index 6ce574ea..815e9393 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-iterator-object.h"
+
#include "jcontext.h"
#include "opcodes.h"
#include "vm-defines.h"
@@ -29,8 +30,8 @@
#include "ecma-builtins-internal.h"
/**
- * This object has a custom dispatch function.
- */
+ * This object has a custom dispatch function.
+ */
#define BUILTIN_CUSTOM_DISPATCH
/**
@@ -45,7 +46,7 @@ enum
} ecma_generator_operation_type_t;
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-generator-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID generator_prototype
+#define BUILTIN_UNDERSCORED_ID generator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -62,18 +63,17 @@ enum
* Convert routine type to operation type..
*/
#define ECMA_GENERATOR_ROUTINE_TO_OPERATION(type) \
- ((ecma_iterator_command_type_t) ((type) - ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT))
+ ((ecma_iterator_command_type_t) ((type) -ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT))
-JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT)
- == ECMA_ITERATOR_NEXT,
+JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_NEXT) == ECMA_ITERATOR_NEXT,
convert_ecma_generator_routine_next_to_ecma_iterator_next_failed);
JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_THROW)
- == ECMA_ITERATOR_THROW,
+ == ECMA_ITERATOR_THROW,
convert_ecma_generator_routine_throw_to_ecma_iterator_throw_failed);
JERRY_STATIC_ASSERT (ECMA_GENERATOR_ROUTINE_TO_OPERATION (ECMA_GENERATOR_PROTOTYPE_ROUTINE_RETURN)
- == ECMA_ITERATOR_RETURN,
+ == ECMA_ITERATOR_RETURN,
convert_ecma_generator_routine_return_to_ecma_iterator_return_failed);
/**
@@ -161,9 +161,8 @@ ecma_builtin_generator_prototype_object_do (vm_executable_object_t *generator_ob
if (byte_code_p[-1] == CBC_EXT_YIELD_ITERATOR)
{
- ecma_value_t iterator = ecma_op_get_iterator (value,
- ECMA_VALUE_SYNC_ITERATOR,
- generator_object_p->frame_ctx.stack_top_p);
+ ecma_value_t iterator =
+ ecma_op_get_iterator (value, ECMA_VALUE_SYNC_ITERATOR, generator_object_p->frame_ctx.stack_top_p);
ecma_free_value (value);
if (ECMA_IS_VALUE_ERROR (iterator))
@@ -195,11 +194,11 @@ ecma_builtin_generator_prototype_object_do (vm_executable_object_t *generator_ob
} /* ecma_builtin_generator_prototype_object_do */
/**
- * Dispatcher of the Generator built-in's routines
- *
- * @return ecma value
- * Returned value must be freed with ecma_free_value.
- */
+ * Dispatcher of the Generator built-in's routines
+ *
+ * @return ecma value
+ * Returned value must be freed with ecma_free_value.
+ */
ecma_value_t
ecma_builtin_generator_prototype_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wide routine
* identifier */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h
index e774f0fb..4028b4e8 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator-prototype.inc.h
@@ -25,14 +25,10 @@
* (property name, object pointer getter) */
/* ECMA-262 v6, 25.3.1.5 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_GENERATOR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_GENERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 25.2.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_GENERATOR,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_GENERATOR, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator.c b/jerry-core/ecma/builtin-objects/ecma-builtin-generator.c
index 7cb11537..29045609 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator.c
@@ -21,7 +21,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-generator.inc.h"
-#define BUILTIN_UNDERSCORED_ID generator
+#define BUILTIN_UNDERSCORED_ID generator
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-generator.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-generator.inc.h
index 235593ba..bf3fc2f5 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-generator.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-generator.inc.h
@@ -22,19 +22,13 @@
#if JERRY_ESNEXT
/* ECMA-262 v6, 25.3.2.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_GENERATOR_FUNCTION,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_GENERATOR_FUNCTION, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 25.3.2.3.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_GENERATOR_PROTOTYPE, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 25.3.2.3.3 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-global.c b/jerry-core/ecma/builtin-objects/ecma-builtin-global.c
index 34570ecb..f0230384 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-global.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-global.c
@@ -21,14 +21,15 @@
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
+
+#include "jcontext.h"
+#include "jrt-bit-fields.h"
+#include "jrt-libc-includes.h"
#include "jrt.h"
#include "lit-char-helpers.h"
#include "lit-magic-strings.h"
#include "lit-strings.h"
#include "vm.h"
-#include "jcontext.h"
-#include "jrt-libc-includes.h"
-#include "jrt-bit-fields.h"
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
@@ -59,7 +60,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-global.inc.h"
-#define BUILTIN_UNDERSCORED_ID global
+#define BUILTIN_UNDERSCORED_ID global
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -137,8 +138,7 @@ ecma_builtin_global_object_is_nan (ecma_number_t arg_num) /**< routine's first a
static ecma_value_t
ecma_builtin_global_object_is_finite (ecma_number_t arg_num) /**< routine's first argument */
{
- bool is_finite = !(ecma_number_is_nan (arg_num)
- || ecma_number_is_infinity (arg_num));
+ bool is_finite = !(ecma_number_is_nan (arg_num) || ecma_number_is_infinity (arg_num));
return ecma_make_boolean_value (is_finite);
} /* ecma_builtin_global_object_is_finite */
@@ -161,22 +161,16 @@ ecma_builtin_global_object_character_is_in (uint32_t character, /**< character *
* One bit for each character between 0 - 127.
* Bit is set if the character is in the unescaped URI set.
*/
-static const uint8_t unescaped_uri_set[16] =
-{
- 0x0, 0x0, 0x0, 0x0, 0xda, 0xff, 0xff, 0xaf,
- 0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47
-};
+static const uint8_t unescaped_uri_set[16] = { 0x0, 0x0, 0x0, 0x0, 0xda, 0xff, 0xff, 0xaf,
+ 0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47 };
/**
* Unescaped URI component characters bitset:
* One bit for each character between 0 - 127.
* Bit is set if the character is in the unescaped component URI set.
*/
-static const uint8_t unescaped_uri_component_set[16] =
-{
- 0x0, 0x0, 0x0, 0x0, 0x82, 0x67, 0xff, 0x3,
- 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47
-};
+static const uint8_t unescaped_uri_component_set[16] = { 0x0, 0x0, 0x0, 0x0, 0x82, 0x67, 0xff, 0x3,
+ 0xfe, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x47 };
/**
* Format is a percent sign followed by two hex digits.
@@ -283,8 +277,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /*
}
}
- if (!is_valid
- || !lit_is_valid_utf8_string (octets, bytes_count, true))
+ if (!is_valid || !lit_is_valid_utf8_string (octets, bytes_count, true))
{
ecma_stringbuilder_destroy (&builder);
return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 string"));
@@ -293,8 +286,7 @@ ecma_builtin_global_object_decode_uri_helper (lit_utf8_byte_t *input_start_p, /*
lit_code_point_t cp;
lit_read_code_point_from_utf8 (octets, bytes_count, &cp);
- if (lit_is_code_point_utf16_high_surrogate (cp)
- || lit_is_code_point_utf16_low_surrogate (cp))
+ if (lit_is_code_point_utf16_high_surrogate (cp) || lit_is_code_point_utf16_low_surrogate (cp))
{
ecma_stringbuilder_destroy (&builder);
return ecma_raise_uri_error (ECMA_ERR_MSG ("Invalid UTF8 codepoint"));
@@ -431,11 +423,8 @@ ecma_builtin_global_object_encode_uri_helper (lit_utf8_byte_t *input_start_p, /*
* Bit is set if the character does not need to be converted to %xx form.
* These characters are: a-z A-Z 0-9 @ * _ + - . /
*/
-static const uint8_t ecma_escape_set[16] =
-{
- 0x0, 0x0, 0x0, 0x0, 0x0, 0xec, 0xff, 0x3,
- 0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x7
-};
+static const uint8_t ecma_escape_set[16] = { 0x0, 0x0, 0x0, 0x0, 0x0, 0xec, 0xff, 0x3,
+ 0xff, 0xff, 0xff, 0x87, 0xfe, 0xff, 0xff, 0x7 };
/**
* The Global object's 'escape' routine
@@ -502,7 +491,7 @@ ecma_builtin_global_object_escape (lit_utf8_byte_t *input_start_p, /**< routine'
* @return number of characters processed during the escape resolve
*/
static uint8_t
-ecma_builtin_global_object_unescape_resolve_escape (const lit_utf8_byte_t *buffer_p, /**< character buffer */
+ecma_builtin_global_object_unescape_resolve_escape (const lit_utf8_byte_t *buffer_p, /**< character buffer */
bool unicode_sequence, /**< true if unescaping unicode sequence */
ecma_char_t *out_result_p) /**< [out] resolved character */
{
@@ -643,15 +632,12 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
if (builtin_routine_id == ECMA_GLOBAL_PARSE_INT)
{
- ret_value = ecma_number_parse_int (string_buff,
- string_buff_size,
- arguments_list_p[1]);
+ ret_value = ecma_number_parse_int (string_buff, string_buff_size, arguments_list_p[1]);
}
else
{
JERRY_ASSERT (builtin_routine_id == ECMA_GLOBAL_PARSE_FLOAT);
- ret_value = ecma_number_parse_float (string_buff,
- string_buff_size);
+ ret_value = ecma_number_parse_float (string_buff, string_buff_size);
}
ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size);
@@ -661,9 +647,7 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
lit_utf8_size_t input_size = ecma_string_get_size (str_p);
- JMEM_DEFINE_LOCAL_ARRAY (input_start_p,
- input_size + 1,
- lit_utf8_byte_t);
+ JMEM_DEFINE_LOCAL_ARRAY (input_start_p, input_size + 1, lit_utf8_byte_t);
ecma_string_to_utf8_bytes (str_p, input_start_p, input_size);
@@ -686,8 +670,8 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
case ECMA_GLOBAL_DECODE_URI:
case ECMA_GLOBAL_DECODE_URI_COMPONENT:
{
- const uint8_t *uri_set = (builtin_routine_id == ECMA_GLOBAL_DECODE_URI ? unescaped_uri_set
- : unescaped_uri_component_set);
+ const uint8_t *uri_set =
+ (builtin_routine_id == ECMA_GLOBAL_DECODE_URI ? unescaped_uri_set : unescaped_uri_component_set);
ret_value = ecma_builtin_global_object_decode_uri_helper (input_start_p, input_size, uri_set);
break;
@@ -697,8 +681,8 @@ ecma_builtin_global_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
JERRY_ASSERT (builtin_routine_id == ECMA_GLOBAL_ENCODE_URI
|| builtin_routine_id == ECMA_GLOBAL_ENCODE_URI_COMPONENT);
- const uint8_t *uri_set = (builtin_routine_id == ECMA_GLOBAL_ENCODE_URI ? unescaped_uri_set
- : unescaped_uri_component_set);
+ const uint8_t *uri_set =
+ (builtin_routine_id == ECMA_GLOBAL_ENCODE_URI ? unescaped_uri_set : unescaped_uri_component_set);
ret_value = ecma_builtin_global_object_encode_uri_helper (input_start_p, input_size, uri_set);
break;
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h
index 88007be2..6048dfd4 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-global.inc.h
@@ -23,147 +23,101 @@
* (property name, simple value, writable, enumerable, configurable) */
/* ECMA-262 v5, 15.1.1.3 */
-SIMPLE_VALUE (LIT_MAGIC_STRING_UNDEFINED,
- ECMA_VALUE_UNDEFINED,
- ECMA_PROPERTY_FIXED)
+SIMPLE_VALUE (LIT_MAGIC_STRING_UNDEFINED, ECMA_VALUE_UNDEFINED, ECMA_PROPERTY_FIXED)
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
/* ECMA-262 v5, 15.1.1.1 */
-NUMBER_VALUE (LIT_MAGIC_STRING_NAN,
- ECMA_BUILTIN_NUMBER_NAN,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_NAN, ECMA_BUILTIN_NUMBER_NAN, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.1.1.2 */
-NUMBER_VALUE (LIT_MAGIC_STRING_INFINITY_UL,
- ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_INFINITY_UL, ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, ECMA_PROPERTY_FIXED)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.1.4.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_OBJECT_UL,
- ECMA_BUILTIN_ID_OBJECT,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_OBJECT_UL, ECMA_BUILTIN_ID_OBJECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.1.4.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_FUNCTION_UL,
- ECMA_BUILTIN_ID_FUNCTION,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_FUNCTION_UL, ECMA_BUILTIN_ID_FUNCTION, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.1.4.3 */
#if JERRY_BUILTIN_ARRAY
-OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_UL,
- ECMA_BUILTIN_ID_ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_UL, ECMA_BUILTIN_ID_ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_ARRAY */
#if JERRY_BUILTIN_STRING
/* ECMA-262 v5, 15.1.4.4 */
-OBJECT_VALUE (LIT_MAGIC_STRING_STRING_UL,
- ECMA_BUILTIN_ID_STRING,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_STRING_UL, ECMA_BUILTIN_ID_STRING, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_STRING */
#if JERRY_BUILTIN_BOOLEAN
/* ECMA-262 v5, 15.1.4.5 */
-OBJECT_VALUE (LIT_MAGIC_STRING_BOOLEAN_UL,
- ECMA_BUILTIN_ID_BOOLEAN,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_BOOLEAN_UL, ECMA_BUILTIN_ID_BOOLEAN, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_BOOLEAN */
#if JERRY_BUILTIN_NUMBER
/* ECMA-262 v5, 15.1.4.6 */
-OBJECT_VALUE (LIT_MAGIC_STRING_NUMBER_UL,
- ECMA_BUILTIN_ID_NUMBER,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_NUMBER_UL, ECMA_BUILTIN_ID_NUMBER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_NUMBER */
#if JERRY_BUILTIN_DATE
/* ECMA-262 v5, 15.1.4.7 */
-OBJECT_VALUE (LIT_MAGIC_STRING_DATE_UL,
- ECMA_BUILTIN_ID_DATE,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_DATE_UL, ECMA_BUILTIN_ID_DATE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_REGEXP
/* ECMA-262 v5, 15.1.4.8 */
-OBJECT_VALUE (LIT_MAGIC_STRING_REGEXP_UL,
- ECMA_BUILTIN_ID_REGEXP,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_REGEXP_UL, ECMA_BUILTIN_ID_REGEXP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_REGEXP */
/* ECMA-262 v5, 15.1.4.9 */
-OBJECT_VALUE (LIT_MAGIC_STRING_ERROR_UL,
- ECMA_BUILTIN_ID_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_ERROR_UL, ECMA_BUILTIN_ID_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#if JERRY_BUILTIN_ERRORS
/* ECMA-262 v5, 15.1.4.10 */
-OBJECT_VALUE (LIT_MAGIC_STRING_EVAL_ERROR_UL,
- ECMA_BUILTIN_ID_EVAL_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_EVAL_ERROR_UL, ECMA_BUILTIN_ID_EVAL_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.1.4.11 */
-OBJECT_VALUE (LIT_MAGIC_STRING_RANGE_ERROR_UL,
- ECMA_BUILTIN_ID_RANGE_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_RANGE_ERROR_UL, ECMA_BUILTIN_ID_RANGE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.1.4.12 */
-OBJECT_VALUE (LIT_MAGIC_STRING_REFERENCE_ERROR_UL,
- ECMA_BUILTIN_ID_REFERENCE_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_REFERENCE_ERROR_UL, ECMA_BUILTIN_ID_REFERENCE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.1.4.13 */
-OBJECT_VALUE (LIT_MAGIC_STRING_SYNTAX_ERROR_UL,
- ECMA_BUILTIN_ID_SYNTAX_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_SYNTAX_ERROR_UL, ECMA_BUILTIN_ID_SYNTAX_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.1.4.14 */
-OBJECT_VALUE (LIT_MAGIC_STRING_TYPE_ERROR_UL,
- ECMA_BUILTIN_ID_TYPE_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_TYPE_ERROR_UL, ECMA_BUILTIN_ID_TYPE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.1.4.15 */
-OBJECT_VALUE (LIT_MAGIC_STRING_URI_ERROR_UL,
- ECMA_BUILTIN_ID_URI_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_URI_ERROR_UL, ECMA_BUILTIN_ID_URI_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_ERRORS */
#if JERRY_BUILTIN_MATH
/* ECMA-262 v5, 15.1.5.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_MATH_UL,
- ECMA_BUILTIN_ID_MATH,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_MATH_UL, ECMA_BUILTIN_ID_MATH, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_REFLECT
/* ECMA-262 v6, 26.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_REFLECT_UL,
- ECMA_BUILTIN_ID_REFLECT,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_REFLECT_UL, ECMA_BUILTIN_ID_REFLECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_REFLECT */
#if JERRY_BUILTIN_JSON
/* ECMA-262 v5, 15.1.5.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_JSON_U,
- ECMA_BUILTIN_ID_JSON,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_JSON_U, ECMA_BUILTIN_ID_JSON, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_JSON */
#if JERRY_BUILTIN_ATOMICS
/* ECMA-262 v5, 15.1.5.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_ATOMICS_U,
- ECMA_BUILTIN_ID_ATOMICS,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_ATOMICS_U, ECMA_BUILTIN_ID_ATOMICS, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_ATOMICS */
#if JERRY_BUILTIN_TYPEDARRAY
-OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_BUFFER_UL,
- ECMA_BUILTIN_ID_ARRAYBUFFER,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_ARRAY_BUFFER_UL, ECMA_BUILTIN_ID_ARRAYBUFFER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#if JERRY_BUILTIN_SHAREDARRAYBUFFER
OBJECT_VALUE (LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL,
@@ -171,48 +125,28 @@ OBJECT_VALUE (LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */
-OBJECT_VALUE (LIT_MAGIC_STRING_INT8_ARRAY_UL,
- ECMA_BUILTIN_ID_INT8ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_INT8_ARRAY_UL, ECMA_BUILTIN_ID_INT8ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_ARRAY_UL,
- ECMA_BUILTIN_ID_UINT8ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_ARRAY_UL, ECMA_BUILTIN_ID_UINT8ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-OBJECT_VALUE (LIT_MAGIC_STRING_INT16_ARRAY_UL,
- ECMA_BUILTIN_ID_INT16ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_INT16_ARRAY_UL, ECMA_BUILTIN_ID_INT16ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-OBJECT_VALUE (LIT_MAGIC_STRING_UINT16_ARRAY_UL,
- ECMA_BUILTIN_ID_UINT16ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_UINT16_ARRAY_UL, ECMA_BUILTIN_ID_UINT16ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-OBJECT_VALUE (LIT_MAGIC_STRING_INT32_ARRAY_UL,
- ECMA_BUILTIN_ID_INT32ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_INT32_ARRAY_UL, ECMA_BUILTIN_ID_INT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-OBJECT_VALUE (LIT_MAGIC_STRING_UINT32_ARRAY_UL,
- ECMA_BUILTIN_ID_UINT32ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_UINT32_ARRAY_UL, ECMA_BUILTIN_ID_UINT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT32_ARRAY_UL,
- ECMA_BUILTIN_ID_FLOAT32ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, ECMA_BUILTIN_ID_FLOAT32ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#if JERRY_NUMBER_TYPE_FLOAT64
-OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT64_ARRAY_UL,
- ECMA_BUILTIN_ID_FLOAT64ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, ECMA_BUILTIN_ID_FLOAT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_BIGINT
-OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT64_ARRAY_UL,
- ECMA_BUILTIN_ID_BIGINT64ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, ECMA_BUILTIN_ID_BIGINT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-OBJECT_VALUE (LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL,
- ECMA_BUILTIN_ID_BIGUINT64ARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, ECMA_BUILTIN_ID_BIGUINT64ARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_BIGINT */
OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL,
@@ -223,73 +157,49 @@ OBJECT_VALUE (LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL,
#if JERRY_BUILTIN_CONTAINER
/* ECMA-262 v6, 23.1.1.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_WEAKSET_UL,
- ECMA_BUILTIN_ID_WEAKSET,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_WEAKSET_UL, ECMA_BUILTIN_ID_WEAKSET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 23.1.1.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_MAP_UL,
- ECMA_BUILTIN_ID_MAP,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_MAP_UL, ECMA_BUILTIN_ID_MAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 23.1.1.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_SET_UL,
- ECMA_BUILTIN_ID_SET,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_SET_UL, ECMA_BUILTIN_ID_SET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 23.1.1.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_WEAKMAP_UL,
- ECMA_BUILTIN_ID_WEAKMAP,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_WEAKMAP_UL, ECMA_BUILTIN_ID_WEAKMAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_WEAKREF
-OBJECT_VALUE (LIT_MAGIC_STRING_WEAKREF_UL,
- ECMA_BUILTIN_ID_WEAKREF,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_WEAKREF_UL, ECMA_BUILTIN_ID_WEAKREF, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_WEAKREF */
#if JERRY_ESNEXT
-OBJECT_VALUE (LIT_MAGIC_STRING_AGGREGATE_ERROR_UL,
- ECMA_BUILTIN_ID_AGGREGATE_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, ECMA_BUILTIN_ID_AGGREGATE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-OBJECT_VALUE (LIT_MAGIC_STRING_PROMISE_UL,
- ECMA_BUILTIN_ID_PROMISE,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROMISE_UL, ECMA_BUILTIN_ID_PROMISE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 19.4.1.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_SYMBOL_UL,
- ECMA_BUILTIN_ID_SYMBOL,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_SYMBOL_UL, ECMA_BUILTIN_ID_SYMBOL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_GLOBAL_THIS
/* ECMA-262 v11, 18.1.1 */
-SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL_THIS_UL,
- ECMA_VALUE_GLOBAL_THIS,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL_THIS_UL, ECMA_VALUE_GLOBAL_THIS, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_GLOBAL_THIS */
#if JERRY_BUILTIN_DATAVIEW
/* ECMA-262 v6, 23.1.1.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_DATAVIEW_UL,
- ECMA_BUILTIN_ID_DATAVIEW,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_DATAVIEW_UL, ECMA_BUILTIN_ID_DATAVIEW, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_PROXY
/* ECMA-262 v6, 26.2.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROXY_UL,
- ECMA_BUILTIN_ID_PROXY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROXY_UL, ECMA_BUILTIN_ID_PROXY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_BIGINT
/* ECMA-262 v11, 20.2.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT_UL,
- ECMA_BUILTIN_ID_BIGINT,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_BIGINT_UL, ECMA_BUILTIN_ID_BIGINT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_BIGINT */
/* Routine properties:
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.c b/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.c
index 984e9823..d727f026 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.c
@@ -18,18 +18,16 @@
#if JERRY_ESNEXT
#include "ecma-builtin-handlers.h"
-#include "ecma-promise-object.h"
#include "ecma-iterator-object.h"
+#include "ecma-promise-object.h"
-static const ecma_builtin_handler_t ecma_native_handlers[] =
-{
+static const ecma_builtin_handler_t ecma_native_handlers[] = {
#define ECMA_NATIVE_HANDLER(id, handler, length) handler,
#include "ecma-builtin-handlers.inc.h"
#undef ECMA_NATIVE_HANDLER
};
-static const uint8_t ecma_native_handler_lengths[] =
-{
+static const uint8_t ecma_native_handler_lengths[] = {
#define ECMA_NATIVE_HANDLER(id, handler, length) length,
#include "ecma-builtin-handlers.inc.h"
#undef ECMA_NATIVE_HANDLER
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.h b/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.h
index de582adc..21e96311 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-handlers.h
@@ -20,8 +20,8 @@
#if JERRY_ESNEXT
-#include "ecma-helpers.h"
#include "ecma-builtins.h"
+#include "ecma-helpers.h"
#include "ecma-promise-object.h"
#include "ecma-proxy-object.h"
@@ -46,10 +46,8 @@ typedef enum
*/
#define ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT 2
-ecma_builtin_handler_t
-ecma_builtin_handler_get (ecma_native_handler_id_t id);
-uint8_t
-ecma_builtin_handler_get_length (ecma_native_handler_id_t id);
+ecma_builtin_handler_t ecma_builtin_handler_get (ecma_native_handler_id_t id);
+uint8_t ecma_builtin_handler_get_length (ecma_native_handler_id_t id);
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c
index 36a96923..f9e697ff 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-date.c
@@ -21,6 +21,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
+
#include "lit-char-helpers.h"
#if JERRY_BUILTIN_DATE
@@ -35,16 +36,12 @@
/**
* Day names
*/
-const char day_names_p[7][3] =
-{
- "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
-};
+const char day_names_p[7][3] = { "Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat" };
/**
* Month names
*/
-const char month_names_p[12][3] =
-{
+const char month_names_p[12][3] = {
"Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"
};
@@ -79,15 +76,10 @@ ecma_date_day_from_year (int32_t year) /**< year value */
{
if (JERRY_LIKELY (year >= 1970))
{
- return (int32_t) (365 * (year - 1970)
- + ((year - 1969) / 4)
- - ((year - 1901) / 100)
- + ((year - 1601) / 400));
+ return (int32_t) (365 * (year - 1970) + ((year - 1969) / 4) - ((year - 1901) / 100) + ((year - 1601) / 400));
}
- return (int32_t) (365 * (year - 1970)
- + floor ((year - 1969) / 4.0)
- - floor ((year - 1901) / 100.0)
+ return (int32_t) (365 * (year - 1970) + floor ((year - 1969) / 4.0) - floor ((year - 1901) / 100.0)
+ floor ((year - 1601) / 400.0));
} /* ecma_date_day_from_year */
@@ -102,8 +94,7 @@ ecma_date_day_from_year (int32_t year) /**< year value */
static int
ecma_date_days_in_year (int32_t year) /**< year */
{
- if (year % 4 != 0
- || (year % 100 == 0 && (year % 400 != 0)))
+ if (year % 4 != 0 || (year % 100 == 0 && (year % 400 != 0)))
{
return ECMA_DATE_DAYS_IN_YEAR;
}
@@ -129,16 +120,34 @@ ecma_date_in_leap_year (int32_t year) /**< time value */
/**
* First days of months in normal and leap years
*/
-static const uint16_t first_day_in_month[2][12] =
-{
- {
- 0, 31, 59, 90, 120, 151, 181, 212, 243, 273, 304, 334, /* normal year */
- }
- ,
- {
- 0, 31, 60, 91, 121, 152, 182, 213, 244, 274, 305, 335 /* leap year */
- }
-};
+static const uint16_t first_day_in_month[2][12] = { {
+ 0,
+ 31,
+ 59,
+ 90,
+ 120,
+ 151,
+ 181,
+ 212,
+ 243,
+ 273,
+ 304,
+ 334, /* normal year */
+ },
+ {
+ 0,
+ 31,
+ 60,
+ 91,
+ 121,
+ 152,
+ 182,
+ 213,
+ 244,
+ 274,
+ 305,
+ 335 /* leap year */
+ } };
/**
* Abstract operation: YearFromTime
@@ -383,9 +392,7 @@ ecma_date_make_time (ecma_number_t hour, /**< hour value */
ecma_number_t sec, /**< second value */
ecma_number_t ms) /**< millisecond value */
{
- if (!ecma_number_is_finite (hour)
- || !ecma_number_is_finite (min)
- || !ecma_number_is_finite (sec)
+ if (!ecma_number_is_finite (hour) || !ecma_number_is_finite (min) || !ecma_number_is_finite (sec)
|| !ecma_number_is_finite (ms))
{
return ecma_number_make_nan ();
@@ -396,10 +403,7 @@ ecma_date_make_time (ecma_number_t hour, /**< hour value */
ecma_number_t s = ecma_number_trunc (sec);
ecma_number_t milli = ecma_number_trunc (ms);
- return (ecma_number_t) ((h * ECMA_DATE_MS_PER_HOUR
- + m * ECMA_DATE_MS_PER_MINUTE
- + s * ECMA_DATE_MS_PER_SECOND
- + milli));
+ return h * ECMA_DATE_MS_PER_HOUR + m * ECMA_DATE_MS_PER_MINUTE + s * ECMA_DATE_MS_PER_SECOND + milli;
} /* ecma_date_make_time */
/**
@@ -416,9 +420,7 @@ ecma_date_make_day (ecma_number_t year, /**< year value */
ecma_number_t date) /**< date value */
{
/* 1. */
- if (!ecma_number_is_finite (year)
- || !ecma_number_is_finite (month)
- || !ecma_number_is_finite (date)
+ if (!ecma_number_is_finite (year) || !ecma_number_is_finite (month) || !ecma_number_is_finite (date)
|| fabs (year) > INT32_MAX)
{
return ecma_number_make_nan ();
@@ -441,9 +443,7 @@ ecma_date_make_day (ecma_number_t year, /**< year value */
}
/* 7. */
- ecma_number_t days = (ecma_date_day_from_year (ym)
- + first_day_in_month[ecma_date_in_leap_year (ym)][mn]
- + (dt - 1));
+ ecma_number_t days = (ecma_date_day_from_year (ym) + first_day_in_month[ecma_date_in_leap_year (ym)][mn] + (dt - 1));
return days * ECMA_DATE_MS_PER_DAY;
} /* ecma_date_make_day */
@@ -459,8 +459,7 @@ ecma_number_t
ecma_date_make_date (ecma_number_t day, /**< day value */
ecma_number_t time) /**< time value */
{
- if (!ecma_number_is_finite (day)
- || !ecma_number_is_finite (time))
+ if (!ecma_number_is_finite (day) || !ecma_number_is_finite (time))
{
return ecma_number_make_nan ();
}
@@ -479,8 +478,7 @@ ecma_date_make_date (ecma_number_t day, /**< day value */
ecma_number_t
ecma_date_time_clip (ecma_number_t time) /**< time value */
{
- if (!ecma_number_is_finite (time)
- || fabs (time) > ECMA_DATE_MAX_VALUE)
+ if (!ecma_number_is_finite (time) || fabs (time) > ECMA_DATE_MAX_VALUE)
{
return ecma_number_make_nan ();
}
@@ -674,14 +672,13 @@ ecma_date_to_string_format (ecma_number_t datetime_number, /**< datetime */
buffer_p--;
*buffer_p = (lit_utf8_byte_t) ((number % 10) + (int32_t) LIT_CHAR_0);
number /= 10;
- }
- while (--number_length);
+ } while (--number_length);
}
JERRY_ASSERT (dest_p <= date_buffer + date_buffer_length);
- return ecma_make_string_value (ecma_new_ecma_string_from_ascii (date_buffer,
- (lit_utf8_size_t) (dest_p - date_buffer)));
+ return ecma_make_string_value (
+ ecma_new_ecma_string_from_ascii (date_buffer, (lit_utf8_size_t) (dest_p - date_buffer)));
} /* ecma_date_to_string_format */
/**
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-error.c b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-error.c
index 74715b20..67f91c1f 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-error.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-error.c
@@ -14,14 +14,15 @@
*/
#include "ecma-alloc.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-builtin-helpers.h"
#include "ecma-objects.h"
+
#include "jrt.h"
/** \addtogroup ecma ECMA
@@ -43,8 +44,7 @@ ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type, /**< native e
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
- if (arguments_list_len != 0
- && !ecma_is_value_undefined (arguments_list_p[0]))
+ if (arguments_list_len != 0 && !ecma_is_value_undefined (arguments_list_p[0]))
{
ecma_string_t *message_string_p = ecma_op_to_string (arguments_list_p[0]);
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-json.c b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-json.c
index 2f1fa927..7b926c7a 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-json.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers-json.c
@@ -14,8 +14,9 @@
*/
#include "ecma-alloc.h"
-#include "ecma-helpers.h"
#include "ecma-builtin-helpers.h"
+#include "ecma-helpers.h"
+
#include "lit-char-helpers.h"
#if JERRY_BUILTIN_JSON
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c
index d00f202c..3edab6f2 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.c
@@ -19,14 +19,15 @@
#include "ecma-array-object.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
-#include "ecma-function-object.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-helpers.h"
-#include "jmem.h"
#include "ecma-objects.h"
-#include "lit-magic-strings.h"
+
+#include "jmem.h"
#include "lit-char-helpers.h"
+#include "lit-magic-strings.h"
/** \addtogroup ecma ECMA
* @{
@@ -61,8 +62,7 @@ ecma_builtin_helper_object_to_string_tag_helper (ecma_value_t tag_value) /**< st
lit_utf8_byte_t *buffer_ptr = str_buffer;
- const lit_magic_string_id_t magic_string_ids[] =
- {
+ const lit_magic_string_id_t magic_string_ids[] = {
LIT_MAGIC_STRING_LEFT_SQUARE_CHAR,
LIT_MAGIC_STRING_OBJECT,
LIT_MAGIC_STRING_SPACE_CHAR,
@@ -71,20 +71,23 @@ ecma_builtin_helper_object_to_string_tag_helper (ecma_value_t tag_value) /**< st
/* Copy to buffer the "[object " string */
for (uint32_t i = 0; i < sizeof (magic_string_ids) / sizeof (lit_magic_string_id_t); ++i)
{
- buffer_ptr = lit_copy_magic_string_to_buffer (magic_string_ids[i], buffer_ptr,
+ buffer_ptr = lit_copy_magic_string_to_buffer (magic_string_ids[i],
+ buffer_ptr,
(lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr));
JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size);
}
/* Copy to buffer the #@@toStringTag# string */
- buffer_ptr += ecma_string_copy_to_cesu8_buffer (tag_str_p, buffer_ptr,
+ buffer_ptr += ecma_string_copy_to_cesu8_buffer (tag_str_p,
+ buffer_ptr,
(lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr));
JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size);
/* Copy to buffer the "]" string */
- buffer_ptr = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_RIGHT_SQUARE_CHAR, buffer_ptr,
+ buffer_ptr = lit_copy_magic_string_to_buffer (LIT_MAGIC_STRING_RIGHT_SQUARE_CHAR,
+ buffer_ptr,
(lit_utf8_size_t) ((str_buffer + buffer_size) - buffer_ptr));
JERRY_ASSERT (buffer_ptr <= str_buffer + buffer_size);
@@ -167,14 +170,10 @@ ecma_builtin_helper_object_to_string (const ecma_value_t this_arg) /**< this arg
ecma_deref_object (obj_p);
return ecma_builtin_helper_object_to_string_tag_helper (tag);
}
- else if (builtin_tag != LIT_MAGIC_STRING_ARGUMENTS_UL
- && builtin_tag != LIT_MAGIC_STRING_FUNCTION_UL
- && builtin_tag != LIT_MAGIC_STRING_ERROR_UL
- && builtin_tag != LIT_MAGIC_STRING_BOOLEAN_UL
- && builtin_tag != LIT_MAGIC_STRING_NUMBER_UL
- && builtin_tag != LIT_MAGIC_STRING_STRING_UL
- && builtin_tag != LIT_MAGIC_STRING_DATE_UL
- && builtin_tag != LIT_MAGIC_STRING_REGEXP_UL
+ else if (builtin_tag != LIT_MAGIC_STRING_ARGUMENTS_UL && builtin_tag != LIT_MAGIC_STRING_FUNCTION_UL
+ && builtin_tag != LIT_MAGIC_STRING_ERROR_UL && builtin_tag != LIT_MAGIC_STRING_BOOLEAN_UL
+ && builtin_tag != LIT_MAGIC_STRING_NUMBER_UL && builtin_tag != LIT_MAGIC_STRING_STRING_UL
+ && builtin_tag != LIT_MAGIC_STRING_DATE_UL && builtin_tag != LIT_MAGIC_STRING_REGEXP_UL
&& builtin_tag != LIT_MAGIC_STRING_ARRAY_UL)
{
builtin_tag = LIT_MAGIC_STRING_OBJECT_UL;
@@ -393,10 +392,8 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *array_obj_p, /**< array *
/* 5.b.iii.3.b */
/* This will always be a simple value since 'is_throw' is false, so no need to free. */
- ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p,
- *length_p + array_index,
- get_value,
- prop_flags);
+ ecma_value_t put_comp =
+ ecma_builtin_helper_def_prop_by_index (array_obj_p, *length_p + array_index, get_value, prop_flags);
ecma_free_value (get_value);
#if JERRY_ESNEXT
if (ECMA_IS_VALUE_ERROR (put_comp))
@@ -414,10 +411,7 @@ ecma_builtin_helper_array_concat_value (ecma_object_t *array_obj_p, /**< array *
/* 5.c.i */
/* This will always be a simple value since 'is_throw' is false, so no need to free. */
- ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p,
- (*length_p)++,
- value,
- prop_flags);
+ ecma_value_t put_comp = ecma_builtin_helper_def_prop_by_index (array_obj_p, (*length_p)++, value, prop_flags);
#if JERRY_ESNEXT
if (ECMA_IS_VALUE_ERROR (put_comp))
@@ -686,10 +680,8 @@ ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_st
{
break;
}
- uint32_t index = ecma_builtin_helper_string_find_index (original_str_p,
- search_str_p,
- (uint32_t) start_ends_with);
- ret_value = ecma_make_boolean_value (index == (uint32_t) start_ends_with);
+ uint32_t index = ecma_builtin_helper_string_find_index (original_str_p, search_str_p, (uint32_t) start_ends_with);
+ ret_value = ecma_make_boolean_value (index == (uint32_t) start_ends_with);
break;
}
#endif /* JERRY_ESNEXT */
@@ -772,7 +764,7 @@ ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, /**< index
while (!((size_t) (original_end_p - str_current_p) < search_str_size))
{
- if (memcmp (str_current_p , search_str_utf8_p, search_str_size) == 0)
+ if (memcmp (str_current_p, search_str_utf8_p, search_str_size) == 0)
{
match_found = start_pos;
break;
@@ -804,10 +796,7 @@ ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, /**< object */
{
if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))
{
- return ecma_builtin_helper_def_prop (obj_p,
- ECMA_CREATE_DIRECT_UINT32_STRING (index),
- value,
- opts);
+ return ecma_builtin_helper_def_prop (obj_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), value, opts);
}
ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);
@@ -842,7 +831,7 @@ ecma_builtin_helper_calculate_index (ecma_value_t index, /**< relative index arg
ecma_number_t relative_index;
ecma_value_t conversion_result = ecma_op_to_integer (index, &relative_index);
- /* 4. */
+ /* 4. */
if (ECMA_IS_VALUE_ERROR (conversion_result))
{
return ECMA_VALUE_ERROR;
@@ -893,9 +882,7 @@ ecma_builtin_helper_def_prop (ecma_object_t *obj_p, /**< object */
prop_desc.value = value;
- return ecma_op_object_define_own_property (obj_p,
- name_p,
- &prop_desc);
+ return ecma_op_object_define_own_property (obj_p, name_p, &prop_desc);
} /* ecma_builtin_helper_def_prop */
/**
@@ -909,16 +896,12 @@ ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p) /**< replace con
{
JERRY_ASSERT (ctx_p->string_p != NULL);
JERRY_ASSERT (ctx_p->matched_p == NULL
- || (ctx_p->matched_p >= ctx_p->string_p
- && ctx_p->matched_p <= ctx_p->string_p + ctx_p->string_size));
+ || (ctx_p->matched_p >= ctx_p->string_p && ctx_p->matched_p <= ctx_p->string_p + ctx_p->string_size));
lit_utf8_size_t replace_size;
uint8_t replace_flags = ECMA_STRING_FLAG_IS_ASCII;
- const lit_utf8_byte_t *replace_buf_p = ecma_string_get_chars (ctx_p->replace_str_p,
- &replace_size,
- NULL,
- NULL,
- &replace_flags);
+ const lit_utf8_byte_t *replace_buf_p =
+ ecma_string_get_chars (ctx_p->replace_str_p, &replace_size, NULL, NULL, &replace_flags);
const lit_utf8_byte_t *const replace_end_p = replace_buf_p + replace_size;
const lit_utf8_byte_t *curr_p = replace_buf_p;
@@ -1016,7 +999,7 @@ ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p) /**< replace con
uint8_t idx = (uint8_t) (c - LIT_CHAR_0);
if (curr_p < replace_end_p && lit_char_is_decimal_digit (*(curr_p)))
{
- uint8_t two_digit_index = (uint8_t) (idx * 10 + (uint8_t) (*(curr_p) - LIT_CHAR_0));
+ uint8_t two_digit_index = (uint8_t) (idx * 10 + (uint8_t) (*(curr_p) -LIT_CHAR_0));
if (two_digit_index < capture_count)
{
idx = two_digit_index;
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h
index 08440fb4..1cf50c15 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-helpers.h
@@ -16,8 +16,8 @@
#ifndef ECMA_BUILTIN_HELPERS_H
#define ECMA_BUILTIN_HELPERS_H
-#include "ecma-globals.h"
#include "ecma-exceptions.h"
+#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-regexp-object.h"
@@ -41,45 +41,38 @@ typedef enum
ECMA_STRING_ENDS_WITH /**< String.includes: ECMA-262 v6, 21.1.3.6 */
} ecma_string_index_of_mode_t;
-ecma_value_t
-ecma_builtin_helper_object_to_string (const ecma_value_t this_arg);
-ecma_string_t *
-ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, ecma_length_t index);
-ecma_value_t
-ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, ecma_length_t *length_p, ecma_value_t value);
-ecma_value_t
-ecma_builtin_helper_uint32_index_normalize (ecma_value_t arg, uint32_t length, uint32_t *number_p);
+ecma_value_t ecma_builtin_helper_object_to_string (const ecma_value_t this_arg);
+ecma_string_t *ecma_builtin_helper_get_to_locale_string_at_index (ecma_object_t *obj_p, ecma_length_t index);
+ecma_value_t ecma_builtin_helper_array_concat_value (ecma_object_t *obj_p, ecma_length_t *length_p, ecma_value_t value);
+ecma_value_t ecma_builtin_helper_uint32_index_normalize (ecma_value_t arg, uint32_t length, uint32_t *number_p);
ecma_value_t
ecma_builtin_helper_array_index_normalize (ecma_value_t arg, ecma_length_t length, ecma_length_t *number_p);
-ecma_value_t
-ecma_builtin_helper_string_index_normalize (ecma_number_t index, uint32_t length, bool nan_to_zero);
-ecma_value_t
-ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_str_p, ecma_value_t arg1,
- ecma_value_t arg2, ecma_string_index_of_mode_t mode);
+ecma_value_t ecma_builtin_helper_string_index_normalize (ecma_number_t index, uint32_t length, bool nan_to_zero);
+ecma_value_t ecma_builtin_helper_string_prototype_object_index_of (ecma_string_t *original_str_p,
+ ecma_value_t arg1,
+ ecma_value_t arg2,
+ ecma_string_index_of_mode_t mode);
uint32_t
-ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, ecma_string_t *search_str_p,
- uint32_t start_pos);
+ecma_builtin_helper_string_find_index (ecma_string_t *original_str_p, ecma_string_t *search_str_p, uint32_t start_pos);
ecma_value_t
ecma_builtin_helper_def_prop (ecma_object_t *obj_p, ecma_string_t *name_p, ecma_value_t value, uint32_t opts);
ecma_value_t
-ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, ecma_length_t index, ecma_value_t value,
- uint32_t opts);
-ecma_value_t
-ecma_builtin_helper_calculate_index (ecma_value_t index, ecma_length_t length, ecma_length_t *out_index);
+ecma_builtin_helper_def_prop_by_index (ecma_object_t *obj_p, ecma_length_t index, ecma_value_t value, uint32_t opts);
+ecma_value_t ecma_builtin_helper_calculate_index (ecma_value_t index, ecma_length_t length, ecma_length_t *out_index);
/**
* Context for replace substitutions
*/
typedef struct
{
- ecma_stringbuilder_t builder; /**< result string builder */
- const lit_utf8_byte_t *string_p; /**< source string */
- lit_utf8_size_t string_size; /**< source string size */
- const lit_utf8_byte_t *matched_p; /**< matched string */
- lit_utf8_size_t matched_size; /**< matcehd string size */
- lit_utf8_size_t match_byte_pos; /**< byte position of the match in the source string */
- uint16_t flags; /**< replace flags */
+ ecma_stringbuilder_t builder; /**< result string builder */
+ const lit_utf8_byte_t *string_p; /**< source string */
+ lit_utf8_size_t string_size; /**< source string size */
+ const lit_utf8_byte_t *matched_p; /**< matched string */
+ lit_utf8_size_t matched_size; /**< matcehd string size */
+ lit_utf8_size_t match_byte_pos; /**< byte position of the match in the source string */
+ uint16_t flags; /**< replace flags */
/**
* Capture results
@@ -89,19 +82,17 @@ typedef struct
#if JERRY_BUILTIN_REGEXP
const ecma_regexp_capture_t *captures_p; /**< array of regexp capturing groups */
#endif /* JERRY_BUILTIN_REGEXP */
- const ecma_collection_t *collection_p; /**< collection of captured substrings */
+ const ecma_collection_t *collection_p; /**< collection of captured substrings */
} u;
- uint32_t capture_count; /**< number of captures in the capturing group array */
- ecma_string_t *replace_str_p; /**< replacement string */
+ uint32_t capture_count; /**< number of captures in the capturing group array */
+ ecma_string_t *replace_str_p; /**< replacement string */
} ecma_replace_context_t;
-void
-ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p);
+void ecma_builtin_replace_substitute (ecma_replace_context_t *ctx_p);
#if JERRY_ESNEXT
-bool
-ecma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p);
+bool ecma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p);
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_DATE
@@ -114,35 +105,35 @@ ecma_builtin_is_regexp_exec (ecma_extended_object_t *obj_p);
*/
/** Hours in a day. */
-#define ECMA_DATE_HOURS_PER_DAY (24)
+#define ECMA_DATE_HOURS_PER_DAY (24)
/** Minutes in an hour. */
-#define ECMA_DATE_MINUTES_PER_HOUR (60)
+#define ECMA_DATE_MINUTES_PER_HOUR (60)
/** Seconds in a minute. */
-#define ECMA_DATE_SECONDS_PER_MINUTE (60)
+#define ECMA_DATE_SECONDS_PER_MINUTE (60)
/** Milliseconds in a second. */
-#define ECMA_DATE_MS_PER_SECOND (1000)
+#define ECMA_DATE_MS_PER_SECOND (1000)
/** ECMA_DATE_MS_PER_MINUTE == 60000 */
-#define ECMA_DATE_MS_PER_MINUTE (ECMA_DATE_MS_PER_SECOND * ECMA_DATE_SECONDS_PER_MINUTE)
+#define ECMA_DATE_MS_PER_MINUTE (ECMA_DATE_MS_PER_SECOND * ECMA_DATE_SECONDS_PER_MINUTE)
/** ECMA_DATE_MS_PER_HOUR == 3600000 */
-#define ECMA_DATE_MS_PER_HOUR (ECMA_DATE_MS_PER_MINUTE * ECMA_DATE_MINUTES_PER_HOUR)
+#define ECMA_DATE_MS_PER_HOUR (ECMA_DATE_MS_PER_MINUTE * ECMA_DATE_MINUTES_PER_HOUR)
/** ECMA_DATE_MS_PER_DAY == 86400000 */
-#define ECMA_DATE_MS_PER_DAY ((ECMA_DATE_MS_PER_HOUR * ECMA_DATE_HOURS_PER_DAY))
+#define ECMA_DATE_MS_PER_DAY ((ECMA_DATE_MS_PER_HOUR * ECMA_DATE_HOURS_PER_DAY))
-#define ECMA_DATE_DAYS_IN_YEAR (365)
+#define ECMA_DATE_DAYS_IN_YEAR (365)
-#define ECMA_DATE_DAYS_IN_LEAP_YEAR (366)
+#define ECMA_DATE_DAYS_IN_LEAP_YEAR (366)
/**
* This gives a range of 8,640,000,000,000,000 milliseconds
* to either side of 01 January, 1970 UTC.
*/
-#define ECMA_DATE_MAX_VALUE 8.64e15
+#define ECMA_DATE_MAX_VALUE 8.64e15
/**
* Timezone type.
@@ -219,21 +210,20 @@ typedef struct
ecma_stringbuilder_t result_builder;
} ecma_json_stringify_context_t;
-ecma_value_t ecma_builtin_json_parse_buffer (const lit_utf8_byte_t * str_start_p,
- lit_utf8_size_t string_size);
+ecma_value_t ecma_builtin_json_parse_buffer (const lit_utf8_byte_t *str_start_p, lit_utf8_size_t string_size);
ecma_value_t ecma_builtin_json_stringify_no_opts (const ecma_value_t value);
bool ecma_json_has_object_in_stack (ecma_json_occurrence_stack_item_t *stack_p, ecma_object_t *object_p);
-ecma_value_t
-ecma_builtin_helper_json_create_non_formatted_json (lit_utf8_byte_t left_bracket, lit_utf8_byte_t right_bracket,
- ecma_collection_t *partial_p);
+ecma_value_t ecma_builtin_helper_json_create_non_formatted_json (lit_utf8_byte_t left_bracket,
+ lit_utf8_byte_t right_bracket,
+ ecma_collection_t *partial_p);
#endif /* JERRY_BUILTIN_JSON */
/* ecma-builtin-helper-error.c */
-ecma_value_t
-ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type, const ecma_value_t *arguments_list_p,
- uint32_t arguments_list_len);
+ecma_value_t ecma_builtin_helper_error_dispatch_call (jerry_error_t error_type,
+ const ecma_value_t *arguments_list_p,
+ uint32_t arguments_list_len);
/* ecma-builtin-helpers-sort.c */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h
index 28bea6fc..be175c23 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-internal-routines-template.inc.h
@@ -14,41 +14,38 @@
*/
#ifndef BUILTIN_UNDERSCORED_ID
-# error "Please, define BUILTIN_UNDERSCORED_ID"
+#error "Please, define BUILTIN_UNDERSCORED_ID"
#endif /* !BUILTIN_UNDERSCORED_ID */
#ifndef BUILTIN_INC_HEADER_NAME
-# error "Please, define BUILTIN_INC_HEADER_NAME"
+#error "Please, define BUILTIN_INC_HEADER_NAME"
#endif /* !BUILTIN_INC_HEADER_NAME */
#include "ecma-objects.h"
-#define PASTE__(x, y) x ## y
-#define PASTE_(x, y) PASTE__ (x, y)
-#define PASTE(x, y) PASTE_ (x, y)
+#define PASTE__(x, y) x##y
+#define PASTE_(x, y) PASTE__ (x, y)
+#define PASTE(x, y) PASTE_ (x, y)
-#define PROPERTY_DESCRIPTOR_LIST_NAME \
- PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _property_descriptor_list)
-#define DISPATCH_ROUTINE_ROUTINE_NAME \
- PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _dispatch_routine)
+#define PROPERTY_DESCRIPTOR_LIST_NAME PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _property_descriptor_list)
+#define DISPATCH_ROUTINE_ROUTINE_NAME PASTE (PASTE (ecma_builtin_, BUILTIN_UNDERSCORED_ID), _dispatch_routine)
#ifndef BUILTIN_CUSTOM_DISPATCH
-#define ROUTINE_ARG(n) , ecma_value_t arg ## n
-#define ROUTINE_ARG_LIST_0 ecma_value_t this_arg
-#define ROUTINE_ARG_LIST_1 ROUTINE_ARG_LIST_0 ROUTINE_ARG(1)
-#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1 ROUTINE_ARG(2)
-#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2 ROUTINE_ARG(3)
-#define ROUTINE_ARG_LIST_NON_FIXED ROUTINE_ARG_LIST_0, \
- const ecma_value_t *arguments_list_p, uint32_t arguments_list_len
+#define ROUTINE_ARG(n) , ecma_value_t arg##n
+#define ROUTINE_ARG_LIST_0 ecma_value_t this_arg
+#define ROUTINE_ARG_LIST_1 ROUTINE_ARG_LIST_0 ROUTINE_ARG (1)
+#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1 ROUTINE_ARG (2)
+#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2 ROUTINE_ARG (3)
+#define ROUTINE_ARG_LIST_NON_FIXED ROUTINE_ARG_LIST_0, const ecma_value_t *arguments_list_p, uint32_t arguments_list_len
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
- static ecma_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number);
+ static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number);
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
- static ecma_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number);
+ static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number);
#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \
- static ecma_value_t c_function_name (ROUTINE_ARG_LIST_ ## args_number);
+ static ecma_value_t c_function_name (ROUTINE_ARG_LIST_##args_number);
#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \
- static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0); \
+ static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0); \
static ecma_value_t c_setter_func_name (ROUTINE_ARG_LIST_1);
#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \
static ecma_value_t c_getter_func_name (ROUTINE_ARG_LIST_0);
@@ -66,17 +63,14 @@
enum
{
PASTE (ECMA_ROUTINE_START_, BUILTIN_UNDERSCORED_ID) = 0,
-#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
- ECMA_ROUTINE_ ## name ## c_function_name,
+#define ROUTINE(name, c_function_name, args_number, length_prop_value) ECMA_ROUTINE_##name##c_function_name,
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
- ECMA_ROUTINE_ ## name ## c_function_name,
+ ECMA_ROUTINE_##name##c_function_name,
#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \
- ECMA_ROUTINE_ ## name ## c_function_name,
+ ECMA_ROUTINE_##name##c_function_name,
#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \
- ECMA_ACCESSOR_ ## name ## c_getter_func_name, \
- ECMA_ACCESSOR_ ## name ## c_setter_func_name,
-#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \
- ECMA_ACCESSOR_ ## name ## c_getter_func_name,
+ ECMA_ACCESSOR_##name##c_getter_func_name, ECMA_ACCESSOR_##name##c_setter_func_name,
+#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) ECMA_ACCESSOR_##name##c_getter_func_name,
#include BUILTIN_INC_HEADER_NAME
};
@@ -85,140 +79,80 @@ enum
/**
* Built-in property list of the built-in object.
*/
-const ecma_builtin_property_descriptor_t PROPERTY_DESCRIPTOR_LIST_NAME[] =
-{
+const ecma_builtin_property_descriptor_t PROPERTY_DESCRIPTOR_LIST_NAME[] = {
#ifndef BUILTIN_CUSTOM_DISPATCH
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_ROUTINE, \
- ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \
- ECMA_ROUTINE_VALUE (ECMA_ROUTINE_ ## name ## c_function_name, length_prop_value) \
- },
+ { name, \
+ ECMA_BUILTIN_PROPERTY_ROUTINE, \
+ ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \
+ ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) },
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_ROUTINE, \
- ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \
- ECMA_ROUTINE_VALUE (ECMA_ROUTINE_ ## name ## c_function_name, length_prop_value) \
- },
+ { name, \
+ ECMA_BUILTIN_PROPERTY_ROUTINE, \
+ ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \
+ ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) },
#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_ROUTINE, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- ECMA_ROUTINE_VALUE (ECMA_ROUTINE_ ## name ## c_function_name, length_prop_value) \
- },
+ { name, \
+ ECMA_BUILTIN_PROPERTY_ROUTINE, \
+ (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
+ ECMA_ROUTINE_VALUE (ECMA_ROUTINE_##name##c_function_name, length_prop_value) },
#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- ECMA_ACCESSOR_ ## name ## c_getter_func_name \
- },
+ { name, \
+ ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \
+ (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
+ ECMA_ACCESSOR_##name##c_getter_func_name },
#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- ECMA_ACCESSOR_READ_WRITE (ECMA_ACCESSOR_ ## name ## c_getter_func_name, \
- ECMA_ACCESSOR_ ## name ## c_setter_func_name) \
- },
+ { name, \
+ ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \
+ (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
+ ECMA_ACCESSOR_READ_WRITE (ECMA_ACCESSOR_##name##c_getter_func_name, ECMA_ACCESSOR_##name##c_setter_func_name) },
#else /* BUILTIN_CUSTOM_DISPATCH */
#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_ROUTINE, \
- ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \
- ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) \
- },
+ { name, \
+ ECMA_BUILTIN_PROPERTY_ROUTINE, \
+ ECMA_PROPERTY_BUILT_IN_CONFIGURABLE_WRITABLE, \
+ ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) },
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_ROUTINE, \
- ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \
- ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) \
- },
+ { name, \
+ ECMA_BUILTIN_PROPERTY_ROUTINE, \
+ ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, \
+ ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) },
#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_ROUTINE, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) \
- },
+ { name, \
+ ECMA_BUILTIN_PROPERTY_ROUTINE, \
+ (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
+ ECMA_ROUTINE_VALUE (c_function_name, length_prop_value) },
#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- c_getter_func_name \
- },
+ { name, \
+ ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_ONLY, \
+ (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
+ c_getter_func_name },
#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- ECMA_ACCESSOR_READ_WRITE (c_getter_func_name, c_setter_func_name) \
- },
+ { name, \
+ ECMA_BUILTIN_PROPERTY_ACCESSOR_READ_WRITE, \
+ (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
+ ECMA_ACCESSOR_READ_WRITE (c_getter_func_name, c_setter_func_name) },
#endif /* !BUILTIN_CUSTOM_DISPATCH */
#define OBJECT_VALUE(name, obj_builtin_id, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_OBJECT, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- obj_builtin_id \
- },
+ { name, ECMA_BUILTIN_PROPERTY_OBJECT, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, obj_builtin_id },
#define SIMPLE_VALUE(name, simple_value, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_SIMPLE, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- simple_value \
- },
+ { name, ECMA_BUILTIN_PROPERTY_SIMPLE, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, simple_value },
#define NUMBER_VALUE(name, number_value, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_NUMBER, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- number_value \
- },
+ { name, ECMA_BUILTIN_PROPERTY_NUMBER, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, number_value },
#define STRING_VALUE(name, magic_string_id, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_STRING, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- magic_string_id \
- },
+ { name, ECMA_BUILTIN_PROPERTY_STRING, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, magic_string_id },
#if JERRY_ESNEXT
-#define SYMBOL_VALUE(name, symbol) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_SYMBOL, \
- ECMA_PROPERTY_BUILT_IN_FIXED, \
- symbol \
- },
+#define SYMBOL_VALUE(name, symbol) { name, ECMA_BUILTIN_PROPERTY_SYMBOL, ECMA_PROPERTY_BUILT_IN_FIXED, symbol },
#define INTRINSIC_PROPERTY(name, magic_string_id, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_INTRINSIC_PROPERTY, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- magic_string_id \
- },
+ { name, ECMA_BUILTIN_PROPERTY_INTRINSIC_PROPERTY, (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, magic_string_id },
#define ACCESSOR_BUILTIN_FUNCTION(name, getter_builtin_id, setter_builtin_id, prop_attributes) \
- { \
- name, \
- ECMA_BUILTIN_PROPERTY_ACCESSOR_BUILTIN_FUNCTION, \
- (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
- ECMA_ACCESSOR_READ_WRITE (getter_builtin_id, setter_builtin_id) \
- },
+ { name, \
+ ECMA_BUILTIN_PROPERTY_ACCESSOR_BUILTIN_FUNCTION, \
+ (prop_attributes) | ECMA_PROPERTY_FLAG_BUILT_IN, \
+ ECMA_ACCESSOR_READ_WRITE (getter_builtin_id, setter_builtin_id) },
#endif /* JERRY_ESNEXT */
#include BUILTIN_INC_HEADER_NAME
- {
- LIT_MAGIC_STRING__COUNT,
- ECMA_BUILTIN_PROPERTY_END,
- 0,
- 0
- }
+ { LIT_MAGIC_STRING__COUNT, ECMA_BUILTIN_PROPERTY_END, 0, 0 }
};
#ifndef BUILTIN_CUSTOM_DISPATCH
@@ -248,39 +182,39 @@ DISPATCH_ROUTINE_ROUTINE_NAME (uint8_t builtin_routine_id, /**< built-in wide ro
{
#define ROUTINE_ARG(n) (arguments_list[n - 1])
#define ROUTINE_ARG_LIST_0
-#define ROUTINE_ARG_LIST_1 , ROUTINE_ARG(1)
-#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1, ROUTINE_ARG(2)
-#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2, ROUTINE_ARG(3)
+#define ROUTINE_ARG_LIST_1 , ROUTINE_ARG (1)
+#define ROUTINE_ARG_LIST_2 ROUTINE_ARG_LIST_1, ROUTINE_ARG (2)
+#define ROUTINE_ARG_LIST_3 ROUTINE_ARG_LIST_2, ROUTINE_ARG (3)
#define ROUTINE_ARG_LIST_NON_FIXED , arguments_list, arguments_number
-#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
- case ECMA_ROUTINE_ ## name ## c_function_name: \
- { \
- return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \
- }
+#define ROUTINE(name, c_function_name, args_number, length_prop_value) \
+ case ECMA_ROUTINE_##name##c_function_name: \
+ { \
+ return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number); \
+ }
#define ROUTINE_CONFIGURABLE_ONLY(name, c_function_name, args_number, length_prop_value) \
- case ECMA_ROUTINE_ ## name ## c_function_name: \
- { \
- return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \
- }
+ case ECMA_ROUTINE_##name##c_function_name: \
+ { \
+ return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number); \
+ }
#define ROUTINE_WITH_FLAGS(name, c_function_name, args_number, length_prop_value, flags) \
- case ECMA_ROUTINE_ ## name ## c_function_name: \
- { \
- return c_function_name (this_arg_value ROUTINE_ARG_LIST_ ## args_number); \
- }
+ case ECMA_ROUTINE_##name##c_function_name: \
+ { \
+ return c_function_name (this_arg_value ROUTINE_ARG_LIST_##args_number); \
+ }
#define ACCESSOR_READ_WRITE(name, c_getter_func_name, c_setter_func_name, prop_attributes) \
- case ECMA_ACCESSOR_ ## name ## c_getter_func_name: \
- { \
- return c_getter_func_name(this_arg_value); \
- } \
- case ECMA_ACCESSOR_ ## name ## c_setter_func_name: \
- { \
- return c_setter_func_name(this_arg_value ROUTINE_ARG_LIST_1); \
- }
+ case ECMA_ACCESSOR_##name##c_getter_func_name: \
+ { \
+ return c_getter_func_name (this_arg_value); \
+ } \
+ case ECMA_ACCESSOR_##name##c_setter_func_name: \
+ { \
+ return c_setter_func_name (this_arg_value ROUTINE_ARG_LIST_1); \
+ }
#define ACCESSOR_READ_ONLY(name, c_getter_func_name, prop_attributes) \
- case ECMA_ACCESSOR_ ## name ## c_getter_func_name: \
- { \
- return c_getter_func_name(this_arg_value); \
- }
+ case ECMA_ACCESSOR_##name##c_getter_func_name: \
+ { \
+ return c_getter_func_name (this_arg_value); \
+ }
#include BUILTIN_INC_HEADER_NAME
#undef ROUTINE_ARG
#undef ROUTINE_ARG_LIST_0
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c b/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c
index 1dc65d63..fc11a6be 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-intrinsic.c
@@ -13,15 +13,16 @@
* limitations under the License.
*/
-#include "ecma-builtins.h"
-#include "ecma-builtin-helpers.h"
-#include "ecma-container-object.h"
#include "ecma-array-object.h"
#include "ecma-arraybuffer-object.h"
-#include "ecma-typedarray-object.h"
-#include "ecma-string-object.h"
+#include "ecma-builtin-helpers.h"
+#include "ecma-builtins.h"
+#include "ecma-container-object.h"
#include "ecma-gc.h"
#include "ecma-helpers.h"
+#include "ecma-string-object.h"
+#include "ecma-typedarray-object.h"
+
#include "lit-char-helpers.h"
#if JERRY_ESNEXT
@@ -53,7 +54,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-intrinsic.inc.h"
-#define BUILTIN_UNDERSCORED_ID intrinsic
+#define BUILTIN_UNDERSCORED_ID intrinsic
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -214,8 +215,8 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-
ecma_number_t *date_value_p = &((ecma_date_object_t *) ecma_get_object_from_value (this_arg))->date_value;
#else /* !JERRY_ESNEXT */
ecma_extended_object_t *arg_ext_object_p = (ecma_extended_object_t *) ecma_get_object_from_value (argument);
- ecma_number_t *date_value_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t,
- arg_ext_object_p->u.class_prop.u.date);
+ ecma_number_t *date_value_p =
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_number_t, arg_ext_object_p->u.class_prop.u.date);
#endif /* JERRY_ESNEXT */
if (ecma_number_is_nan (*date_value_p))
@@ -263,12 +264,10 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-
ecma_value_t result = ecma_make_string_value (ret_str_p);
ecma_deref_ecma_string (to_str_p);
return result;
-
}
default:
{
- JERRY_ASSERT (builtin_routine_id == ECMA_INTRINSIC_PARSE_INT
- || builtin_routine_id == ECMA_INTRINSIC_PARSE_FLOAT);
+ JERRY_ASSERT (builtin_routine_id == ECMA_INTRINSIC_PARSE_INT || builtin_routine_id == ECMA_INTRINSIC_PARSE_FLOAT);
ecma_string_t *str_p = ecma_op_to_string (arguments_list_p[0]);
@@ -282,15 +281,12 @@ ecma_builtin_intrinsic_dispatch_routine (uint8_t builtin_routine_id, /**< built-
if (builtin_routine_id == ECMA_INTRINSIC_PARSE_INT)
{
- result = ecma_number_parse_int (string_buff,
- string_buff_size,
- arguments_list_p[1]);
+ result = ecma_number_parse_int (string_buff, string_buff_size, arguments_list_p[1]);
}
else
{
JERRY_ASSERT (builtin_routine_id == ECMA_INTRINSIC_PARSE_FLOAT);
- result = ecma_number_parse_float (string_buff,
- string_buff_size);
+ result = ecma_number_parse_float (string_buff, string_buff_size);
}
ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size);
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.c
index 19ead319..1bcc9166 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-iterator-prototype.c
@@ -37,7 +37,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-iterator-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID iterator_prototype
+#define BUILTIN_UNDERSCORED_ID iterator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-json.c b/jerry-core/ecma/builtin-objects/ecma-builtin-json.c
index ba71461a..ef2a7dbd 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-json.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-json.c
@@ -15,6 +15,7 @@
#include "ecma-alloc.h"
#include "ecma-array-object.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
@@ -22,11 +23,11 @@
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-builtin-helpers.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
-#include "jrt.h"
+#include "ecma-objects.h"
+
#include "jrt-libc-includes.h"
+#include "jrt.h"
#include "lit-char-helpers.h"
#include "lit-globals.h"
@@ -51,7 +52,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-json.inc.h"
-#define BUILTIN_UNDERSCORED_ID json
+#define BUILTIN_UNDERSCORED_ID json
#include "ecma-builtin-internal-routines-template.inc.h"
/**
@@ -134,9 +135,7 @@ ecma_builtin_json_parse_string (ecma_json_token_t *token_p) /**< token argument
if (*current_p == LIT_CHAR_BACKSLASH)
{
- ecma_stringbuilder_append_raw (&result_builder,
- unappended_p,
- (lit_utf8_size_t) (current_p - unappended_p));
+ ecma_stringbuilder_append_raw (&result_builder, unappended_p, (lit_utf8_size_t) (current_p - unappended_p));
current_p++;
@@ -212,9 +211,7 @@ ecma_builtin_json_parse_string (ecma_json_token_t *token_p) /**< token argument
current_p++;
}
- ecma_stringbuilder_append_raw (&result_builder,
- unappended_p,
- (lit_utf8_size_t) (current_p - unappended_p));
+ ecma_stringbuilder_append_raw (&result_builder, unappended_p, (lit_utf8_size_t) (current_p - unappended_p));
token_p->u.string_p = ecma_stringbuilder_finalize (&result_builder);
token_p->current_p = current_p + 1;
token_p->type = TOKEN_STRING;
@@ -260,8 +257,7 @@ ecma_builtin_json_parse_number (ecma_json_token_t *token_p) /**< token argument
do
{
current_p++;
- }
- while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
+ } while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
}
if (current_p < end_p && *current_p == LIT_CHAR_DOT)
@@ -276,8 +272,7 @@ ecma_builtin_json_parse_number (ecma_json_token_t *token_p) /**< token argument
do
{
current_p++;
- }
- while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
+ } while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
}
if (current_p < end_p && (*current_p == LIT_CHAR_LOWERCASE_E || *current_p == LIT_CHAR_UPPERCASE_E))
@@ -297,8 +292,7 @@ ecma_builtin_json_parse_number (ecma_json_token_t *token_p) /**< token argument
do
{
current_p++;
- }
- while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
+ } while (current_p < end_p && lit_char_is_decimal_digit (*current_p));
}
token_p->type = TOKEN_NUMBER;
@@ -322,9 +316,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum
token_p->type = TOKEN_INVALID;
while (current_p < end_p
- && (*current_p == LIT_CHAR_SP
- || *current_p == LIT_CHAR_CR
- || *current_p == LIT_CHAR_LF
+ && (*current_p == LIT_CHAR_SP || *current_p == LIT_CHAR_CR || *current_p == LIT_CHAR_LF
|| *current_p == LIT_CHAR_TAB))
{
current_p++;
@@ -388,9 +380,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum
lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_NULL);
if (current_p + size <= end_p)
{
- if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_NULL),
- current_p,
- size))
+ if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_NULL), current_p, size))
{
token_p->type = TOKEN_NULL;
token_p->current_p = current_p + size;
@@ -404,9 +394,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum
lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_TRUE);
if (current_p + size <= end_p)
{
- if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_TRUE),
- current_p,
- size))
+ if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_TRUE), current_p, size))
{
token_p->type = TOKEN_TRUE;
token_p->current_p = current_p + size;
@@ -420,9 +408,7 @@ ecma_builtin_json_parse_next_token (ecma_json_token_t *token_p, /**< token argum
lit_utf8_size_t size = lit_get_magic_string_size (LIT_MAGIC_STRING_FALSE);
if (current_p + size <= end_p)
{
- if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_FALSE),
- current_p,
- size))
+ if (!memcmp (lit_get_magic_string_utf8 (LIT_MAGIC_STRING_FALSE), current_p, size))
{
token_p->type = TOKEN_FALSE;
token_p->current_p = current_p + size;
@@ -454,10 +440,8 @@ ecma_builtin_json_define_value_property (ecma_object_t *obj_p, /**< this object
ecma_string_t *property_name_p, /**< property name */
ecma_value_t value) /**< value */
{
- ecma_value_t completion_value = ecma_builtin_helper_def_prop (obj_p,
- property_name_p,
- value,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
+ ecma_value_t completion_value =
+ ecma_builtin_helper_def_prop (obj_p, property_name_p, value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
JERRY_ASSERT (ecma_is_value_boolean (completion_value));
} /* ecma_builtin_json_define_value_property */
@@ -612,10 +596,9 @@ ecma_builtin_json_parse_value (ecma_json_token_t *token_p) /**< token argument *
}
} /* ecma_builtin_json_parse_value */
-static ecma_value_t
-ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p,
- ecma_object_t *object_p,
- ecma_string_t *prop_name);
+static ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p,
+ ecma_object_t *object_p,
+ ecma_string_t *prop_name);
/**
* Abstract operation InternalizeJSONProperty
@@ -698,8 +681,8 @@ ecma_builtin_json_internalize_property (ecma_object_t *reviver_p, /**< reviver f
/* 3.d */
else
{
- ecma_collection_t *props_p = ecma_op_object_get_enumerable_property_names (object_p,
- ECMA_ENUMERABLE_PROPERTY_KEYS);
+ ecma_collection_t *props_p =
+ ecma_op_object_get_enumerable_property_names (object_p, ECMA_ENUMERABLE_PROPERTY_KEYS);
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (props_p == NULL))
{
@@ -737,10 +720,7 @@ ecma_builtin_json_internalize_property (ecma_object_t *reviver_p, /**< reviver f
arguments_list[1] = value;
/* 4. */
- ecma_value_t ret_value = ecma_op_function_call (reviver_p,
- ecma_make_object_value (holder_p),
- arguments_list,
- 2);
+ ecma_value_t ret_value = ecma_op_function_call (reviver_p, ecma_make_object_value (holder_p), arguments_list, 2);
ecma_free_value (value);
return ret_value;
} /* ecma_builtin_json_internalize_property */
@@ -755,10 +735,10 @@ ecma_builtin_json_internalize_property (ecma_object_t *reviver_p, /**< reviver f
* @return ECMA_VALUE_TRUE - if no error occurred.
* error if one of the operation failed.
*/
-static
-ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p, /**< reviver function */
- ecma_object_t *object_p, /**< holder object */
- ecma_string_t *prop_name) /**< property name */
+static ecma_value_t
+ecma_builtin_json_internalize_process_property (ecma_object_t *reviver_p, /**< reviver function */
+ ecma_object_t *object_p, /**< holder object */
+ ecma_string_t *prop_name) /**< property name */
{
/* ES11: 2.b.iii.1 / 2.c.ii.1 */
ecma_value_t new_element = ecma_builtin_json_internalize_property (reviver_p, object_p, prop_name);
@@ -786,10 +766,8 @@ ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *revi
else
{
/* ES11: 2.b.iii.3.a / 2.c.ii.3.a */
- ecma_value_t def_value = ecma_builtin_helper_def_prop (object_p,
- prop_name,
- new_element,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
+ ecma_value_t def_value =
+ ecma_builtin_helper_def_prop (object_p, prop_name, new_element, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
ecma_free_value (new_element);
#if JERRY_ESNEXT
@@ -812,7 +790,7 @@ ecma_value_t ecma_builtin_json_internalize_process_property (ecma_object_t *revi
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
-ecma_builtin_json_parse_buffer (const lit_utf8_byte_t * str_start_p, /**< String to parse */
+ecma_builtin_json_parse_buffer (const lit_utf8_byte_t *str_start_p, /**< String to parse */
lit_utf8_size_t string_size) /**< size of the string */
{
ecma_json_token_t token;
@@ -834,7 +812,7 @@ ecma_builtin_json_parse_buffer (const lit_utf8_byte_t * str_start_p, /**< String
}
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid JSON format"));
-} /*ecma_builtin_json_parse_buffer*/
+} /* ecma_builtin_json_parse_buffer */
/**
* The JSON object's 'parse' routine
@@ -939,9 +917,9 @@ ecma_builtin_json_quote (ecma_stringbuilder_t *builder_p, /**< builder for the r
else if (c < LIT_CHAR_SP || should_escape)
{
/**
- * In ES10 we should escape high or low surrogate characters,
- * so we shouldn't append the unescaped character to the stringbuilder
- */
+ * In ES10 we should escape high or low surrogate characters,
+ * so we shouldn't append the unescaped character to the stringbuilder
+ */
uint8_t offset = should_escape ? LIT_UTF8_MAX_BYTES_IN_CODE_UNIT : 1;
ecma_stringbuilder_append_raw (builder_p,
@@ -986,18 +964,15 @@ ecma_builtin_json_quote (ecma_stringbuilder_t *builder_p, /**< builder for the r
}
}
- ecma_stringbuilder_append_raw (builder_p,
- regular_str_start_p,
- (lit_utf8_size_t) (str_end_p - regular_str_start_p));
+ ecma_stringbuilder_append_raw (builder_p, regular_str_start_p, (lit_utf8_size_t) (str_end_p - regular_str_start_p));
ecma_stringbuilder_append_byte (builder_p, LIT_CHAR_DOUBLE_QUOTE);
ECMA_FINALIZE_UTF8_STRING (string_buff, string_buff_size);
} /* ecma_builtin_json_quote */
-static ecma_value_t
-ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,
- ecma_object_t *holder_p,
- ecma_string_t *key_p);
+static ecma_value_t ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,
+ ecma_object_t *holder_p,
+ ecma_string_t *key_p);
/**
* Abstract operation 'SerializeJSONObject' defined in 24.3.2.3
@@ -1272,9 +1247,8 @@ ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,
}
ecma_object_t *value_obj_p = ecma_get_object_from_value (to_object_value);
- ecma_value_t to_json = ecma_op_object_get_with_receiver (value_obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_TO_JSON_UL),
- value);
+ ecma_value_t to_json =
+ ecma_op_object_get_with_receiver (value_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_TO_JSON_UL), value);
ecma_deref_object (value_obj_p);
@@ -1487,16 +1461,15 @@ ecma_builtin_json_serialize_property (ecma_json_stringify_context_t *context_p,
* Returned value must be freed with ecma_free_value.
*
*/
-static ecma_value_t ecma_builtin_json_str_helper (ecma_json_stringify_context_t *context_p, /**< context argument */
- const ecma_value_t arg1) /**< object argument */
+static ecma_value_t
+ecma_builtin_json_str_helper (ecma_json_stringify_context_t *context_p, /**< context argument */
+ const ecma_value_t arg1) /**< object argument */
{
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
ecma_object_t *obj_wrapper_p = ecma_op_create_object_object_noarg ();
ecma_string_t *empty_str_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
- ecma_value_t put_comp_val = ecma_builtin_helper_def_prop (obj_wrapper_p,
- empty_str_p,
- arg1,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
+ ecma_value_t put_comp_val =
+ ecma_builtin_helper_def_prop (obj_wrapper_p, empty_str_p, arg1, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
JERRY_ASSERT (ecma_is_value_true (put_comp_val));
@@ -1556,9 +1529,9 @@ ecma_builtin_json_stringify_no_opts (const ecma_value_t value) /**< value to str
* Returned value must be freed with ecma_free_value.
*/
static ecma_value_t
-ecma_builtin_json_stringify (ecma_value_t arg1, /**< value */
- ecma_value_t arg2, /**< replacer */
- ecma_value_t arg3) /**< space */
+ecma_builtin_json_stringify (ecma_value_t arg1, /**< value */
+ ecma_value_t arg2, /**< replacer */
+ ecma_value_t arg3) /**< space */
{
ecma_json_stringify_context_t context;
context.replacer_function_p = NULL;
@@ -1750,8 +1723,8 @@ ecma_builtin_json_stringify (ecma_value_t arg1, /**< value */
JMEM_DEFINE_LOCAL_ARRAY (space_buff, num_of_spaces, char);
memset (space_buff, LIT_CHAR_SP, (size_t) num_of_spaces);
- context.gap_str_p = ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff,
- (lit_utf8_size_t) num_of_spaces);
+ context.gap_str_p =
+ ecma_new_ecma_string_from_utf8 ((lit_utf8_byte_t *) space_buff, (lit_utf8_size_t) num_of_spaces);
JMEM_FINALIZE_LOCAL_ARRAY (space_buff);
}
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h
index e83345f8..21776999 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-json.inc.h
@@ -23,9 +23,7 @@
#if JERRY_ESNEXT
/* ECMA-262 v6, 24.3.3 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_JSON_U,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_JSON_U, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
/* Routine properties:
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c
index 15f61a77..9471a450 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.c
@@ -37,7 +37,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-map-iterator-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID map_iterator_prototype
+#define BUILTIN_UNDERSCORED_ID map_iterator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h
index 67348f54..fe2b8187 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map-iterator-prototype.inc.h
@@ -21,9 +21,7 @@
#if JERRY_BUILTIN_CONTAINER
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_MAP_ITERATOR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MAP_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.c
index 45d9329d..d7a10cc9 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.c
@@ -25,7 +25,7 @@
*/
#define BUILTIN_CUSTOM_DISPATCH
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-map-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID map_prototype
+#define BUILTIN_UNDERSCORED_ID map_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.inc.h
index 6d99f667..65d91d69 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map-prototype.inc.h
@@ -25,14 +25,10 @@
* (property name, object pointer getter) */
/* ECMA-262 v6, 23.1.3.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_MAP,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_MAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 23.1.3.13 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_MAP_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
@@ -44,15 +40,15 @@ ROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1)
ROUTINE (LIT_MAGIC_STRING_SET, ECMA_CONTAINER_ROUTINE_SET, 2, 2)
ROUTINE (LIT_MAGIC_STRING_VALUES, ECMA_CONTAINER_ROUTINE_VALUES, 0, 0)
ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_CONTAINER_ROUTINE_KEYS, 0, 0)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_ENTRIES, LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES,
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_ENTRIES,
+ LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES,
+INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR,
+ LIT_INTERNAL_MAGIC_STRING_MAP_PROTOTYPE_ENTRIES,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 23.1.3.10 */
-ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE,
- ECMA_CONTAINER_ROUTINE_SIZE_GETTER,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE, ECMA_CONTAINER_ROUTINE_SIZE_GETTER, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_BUILTIN_CONTAINER */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map.c b/jerry-core/ecma/builtin-objects/ecma-builtin-map.c
index 215e2cc4..f79cccd5 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-map.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map.c
@@ -14,8 +14,8 @@
*/
#include "ecma-builtins.h"
-#include "ecma-exceptions.h"
#include "ecma-container-object.h"
+#include "ecma-exceptions.h"
#if JERRY_BUILTIN_CONTAINER
@@ -23,7 +23,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-map.inc.h"
-#define BUILTIN_UNDERSCORED_ID map
+#define BUILTIN_UNDERSCORED_ID map
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-map.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-map.inc.h
index 5cf091d4..e1ff9c00 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-map.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-map.inc.h
@@ -25,27 +25,19 @@
* (property name, number value, writable, enumerable, configurable) */
/* ECMA-262 v6, 23.1.2 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 0,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 23.1 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_MAP_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_MAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v6, 23.1.2.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_MAP_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_MAP_PROTOTYPE, ECMA_PROPERTY_FIXED)
/* ECMA-262 v6, 23.1.2.2 */
-ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
- ecma_builtin_map_species_get,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_map_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_BUILTIN_CONTAINER */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-math.c b/jerry-core/ecma/builtin-objects/ecma-builtin-math.c
index be8656c9..a9e737ec 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-math.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-math.c
@@ -23,14 +23,15 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-number-arithmetic.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
-#include "jrt.h"
+#include "ecma-objects.h"
+
#include "jrt-libc-includes.h"
+#include "jrt.h"
-#if defined (_WIN32)
+#if defined(_WIN32)
#include <intrin.h>
-#endif
+#endif /* defined(_WIN32) */
#if JERRY_BUILTIN_MATH
@@ -79,11 +80,13 @@ enum
ECMA_MATH_OBJECT_TANH, /* ECMA-262 v6, 20.2.2.34 */
ECMA_MATH_OBJECT_TRUNC, /* ECMA-262 v6, 20.2.2.35 */
#endif /* JERRY_ESNEXT */
- ECMA_MATH_OBJECT_ATAN2, /* ECMA-262 v5, 15.8.2.5 */ /* first routine with 2 arguments */
+ ECMA_MATH_OBJECT_ATAN2,
+/* ECMA-262 v5, 15.8.2.5 */ /* first routine with 2 arguments */
#if JERRY_ESNEXT
ECMA_MATH_OBJECT_IMUL, /* ECMA-262 v6, 20.2.2.19 */
#endif /* JERRY_ESNEXT */
- ECMA_MATH_OBJECT_POW, /* ECMA-262 v5, 15.8.2.13 */ /* last routine with 1 or 2 arguments*/
+ ECMA_MATH_OBJECT_POW,
+ /* ECMA-262 v5, 15.8.2.13 */ /* last routine with 1 or 2 arguments*/
ECMA_MATH_OBJECT_MAX, /* ECMA-262 v5, 15.8.2.11 */
ECMA_MATH_OBJECT_MIN, /* ECMA-262 v5, 15.8.2.12 */
#if JERRY_ESNEXT
@@ -93,7 +96,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-math.inc.h"
-#define BUILTIN_UNDERSCORED_ID math
+#define BUILTIN_UNDERSCORED_ID math
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -151,8 +154,7 @@ ecma_builtin_math_object_max_min (bool is_max, /**< 'max' or 'min' operation */
continue;
}
- if (ecma_number_is_zero (arg_num)
- && ecma_number_is_zero (result_num))
+ if (ecma_number_is_zero (arg_num) && ecma_number_is_zero (result_num))
{
bool is_negative = ecma_number_is_negative (arg_num);
@@ -358,8 +360,7 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi
}
}
- if (builtin_routine_id >= ECMA_MATH_OBJECT_ATAN2
- && arguments_number >= 2)
+ if (builtin_routine_id >= ECMA_MATH_OBJECT_ATAN2 && arguments_number >= 2)
{
if (ecma_is_value_number (arguments_list[1]))
{
@@ -437,15 +438,11 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi
#endif /* JERRY_ESNEXT */
case ECMA_MATH_OBJECT_ROUND:
{
- if (ecma_number_is_nan (x)
- || ecma_number_is_zero (x)
- || ecma_number_is_infinity (x)
- || fmod (x, 1.0) == 0)
+ if (ecma_number_is_nan (x) || ecma_number_is_zero (x) || ecma_number_is_infinity (x) || fmod (x, 1.0) == 0)
{
/* Do nothing. */
}
- else if (ecma_number_is_negative (x)
- && x >= -ECMA_NUMBER_HALF)
+ else if (ecma_number_is_negative (x) && x >= -ECMA_NUMBER_HALF)
{
x = -ECMA_NUMBER_ZERO;
}
@@ -551,12 +548,12 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi
case ECMA_MATH_OBJECT_CLZ32:
{
uint32_t n = ecma_number_to_uint32 (x);
-#if defined (__GNUC__) || defined (__clang__)
+#if defined(__GNUC__) || defined(__clang__)
x = n ? __builtin_clz (n) : 32;
-#elif defined (_WIN32)
+#elif defined(_WIN32)
unsigned long ret;
x = _BitScanReverse (&ret, n) ? 31 - ret : 32;
-#else
+#else /* !(defined(__GNUC__) || defined(__clang__) || defined(_WIN32)) */
x = 32;
for (int i = 31; i >= 0; i--)
{
@@ -566,7 +563,7 @@ ecma_builtin_math_dispatch_routine (uint8_t builtin_routine_id, /**< built-in wi
break;
}
}
-#endif
+#endif /* defined (__GNUC__) || defined (__clang__) */
break;
}
case ECMA_MATH_OBJECT_FROUND:
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-math.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-math.inc.h
index 4c663356..16d24d5e 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-math.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-math.inc.h
@@ -25,50 +25,32 @@
* (property name, number value, writable, enumerable, configurable) */
/* ECMA-262 v5, 15.8.1.1 */
-NUMBER_VALUE (LIT_MAGIC_STRING_E_U,
- ECMA_BUILTIN_NUMBER_E,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_E_U, ECMA_BUILTIN_NUMBER_E, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.8.1.2 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LN10_U,
- ECMA_BUILTIN_NUMBER_LN10,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_LN10_U, ECMA_BUILTIN_NUMBER_LN10, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.8.1.3 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LN2_U,
- ECMA_BUILTIN_NUMBER_LN2,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_LN2_U, ECMA_BUILTIN_NUMBER_LN2, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.8.1.4 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LOG2E_U,
- ECMA_BUILTIN_NUMBER_LOG2E,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_LOG2E_U, ECMA_BUILTIN_NUMBER_LOG2E, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.8.1.5 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LOG10E_U,
- ECMA_BUILTIN_NUMBER_LOG10E,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_LOG10E_U, ECMA_BUILTIN_NUMBER_LOG10E, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.8.1.6 */
-NUMBER_VALUE (LIT_MAGIC_STRING_PI_U,
- ECMA_BUILTIN_NUMBER_PI,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_PI_U, ECMA_BUILTIN_NUMBER_PI, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.8.1.7 */
-NUMBER_VALUE (LIT_MAGIC_STRING_SQRT1_2_U,
- ECMA_BUILTIN_NUMBER_SQRT_1_2,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_SQRT1_2_U, ECMA_BUILTIN_NUMBER_SQRT_1_2, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.8.1.8 */
-NUMBER_VALUE (LIT_MAGIC_STRING_SQRT2_U,
- ECMA_BUILTIN_NUMBER_SQRT2,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_SQRT2_U, ECMA_BUILTIN_NUMBER_SQRT2, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
/* ECMA-262 v6, 20.2.1.9 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_MATH_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_MATH_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
/* Routine properties:
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c
index c27aecb3..6b2bdd52 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.c
@@ -24,8 +24,9 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
-#include "jrt.h"
+
#include "jrt-libc-includes.h"
+#include "jrt.h"
#include "lit-char-helpers.h"
#if JERRY_BUILTIN_NUMBER
@@ -53,7 +54,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-number-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID number_prototype
+#define BUILTIN_UNDERSCORED_ID number_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -146,13 +147,9 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, /
const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- static const lit_utf8_byte_t digit_chars[36] =
- {
- '0', '1', '2', '3', '4', '5', '6', '7', '8', '9',
- 'a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j',
- 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't',
- 'u', 'v', 'w', 'x', 'y', 'z'
- };
+ static const lit_utf8_byte_t digit_chars[36] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b',
+ 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n',
+ 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z' };
uint32_t radix = 10;
if (arguments_list_len > 0 && !ecma_is_value_undefined (arguments_list_p[0]))
@@ -172,10 +169,8 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, /
}
}
- if (ecma_number_is_nan (this_arg_number)
- || ecma_number_is_infinity (this_arg_number)
- || ecma_number_is_zero (this_arg_number)
- || radix == 10)
+ if (ecma_number_is_nan (this_arg_number) || ecma_number_is_infinity (this_arg_number)
+ || ecma_number_is_zero (this_arg_number) || radix == 10)
{
ecma_string_t *ret_str_p = ecma_new_ecma_string_from_number (this_arg_number);
return ecma_make_string_value (ret_str_p);
@@ -319,7 +314,7 @@ ecma_builtin_number_prototype_object_to_string (ecma_number_t this_arg_number, /
* Calculate where we have to put the radix point relative to the beginning of
* the new digits. If the exponent is non-negative this will be right after the number.
*/
- int point = exponent >= 0 ? magnitude + 1: buff_index - magnitude;
+ int point = exponent >= 0 ? magnitude + 1 : buff_index - magnitude;
if (point < 0)
{
@@ -464,10 +459,10 @@ ecma_builtin_number_prototype_object_value_of (ecma_value_t this_arg) /**< this
*/
typedef enum
{
- NUMBER_ROUTINE_TO_FIXED, /**< Number.prototype.toFixed: ECMA-262 v11, 20.1.3.3 */
+ NUMBER_ROUTINE_TO_FIXED, /**< Number.prototype.toFixed: ECMA-262 v11, 20.1.3.3 */
NUMBER_ROUTINE_TO_EXPONENTIAL, /**< Number.prototype.toExponential: ECMA-262 v11, 20.1.3.2 */
- NUMBER_ROUTINE_TO_PRECISION, /**< Number.prototype.toPrecision: ECMA-262 v11, 20.1.3.5 */
- NUMBER_ROUTINE__COUNT, /**< count of the modes */
+ NUMBER_ROUTINE_TO_PRECISION, /**< Number.prototype.toPrecision: ECMA-262 v11, 20.1.3.5 */
+ NUMBER_ROUTINE__COUNT, /**< count of the modes */
} number_routine_mode_t;
/**
@@ -478,8 +473,7 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
ecma_value_t arg, /**< routine's argument */
number_routine_mode_t mode) /**< number routine mode */
{
- if (ecma_is_value_undefined (arg)
- && mode == NUMBER_ROUTINE_TO_PRECISION)
+ if (ecma_is_value_undefined (arg) && mode == NUMBER_ROUTINE_TO_PRECISION)
{
return ecma_builtin_number_prototype_object_to_string (this_num, NULL, 0);
}
@@ -493,8 +487,7 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
}
/* Argument boundary check for toFixed method */
- if (mode == NUMBER_ROUTINE_TO_FIXED
- && (arg_num <= -1 || arg_num >= 101))
+ if (mode == NUMBER_ROUTINE_TO_FIXED && (arg_num <= -1 || arg_num >= 101))
{
return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100"));
}
@@ -561,14 +554,12 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
}
/* Argument boundary check for toExponential and toPrecision methods */
- if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL
- && (arg_num <= -1 || arg_num >= 101))
+ if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL && (arg_num <= -1 || arg_num >= 101))
{
ecma_stringbuilder_destroy (&builder);
return ecma_raise_range_error (ECMA_ERR_MSG ("Fraction digits must be between 0 and 100"));
}
- else if (mode == NUMBER_ROUTINE_TO_PRECISION
- && (arg_num < 1 || arg_num > 100))
+ else if (mode == NUMBER_ROUTINE_TO_PRECISION && (arg_num < 1 || arg_num > 100))
{
ecma_stringbuilder_destroy (&builder);
return ecma_raise_range_error (ECMA_ERR_MSG ("Precision digits must be between 1 and 100"));
@@ -582,8 +573,7 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
arg_int = (int32_t) num_of_digits - 1;
}
- if (mode == NUMBER_ROUTINE_TO_FIXED
- && exponent > 21)
+ if (mode == NUMBER_ROUTINE_TO_FIXED && exponent > 21)
{
ecma_stringbuilder_destroy (&builder);
@@ -606,16 +596,11 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
digits_to_keep += 1;
}
- num_of_digits = ecma_builtin_number_prototype_helper_round (digits,
- num_of_digits,
- digits_to_keep,
- &exponent,
- false);
+ num_of_digits = ecma_builtin_number_prototype_helper_round (digits, num_of_digits, digits_to_keep, &exponent, false);
/* toExponent routine and toPrecision cases where the exponent > precision or exponent < -5 */
if (mode == NUMBER_ROUTINE_TO_EXPONENTIAL
- || (mode == NUMBER_ROUTINE_TO_PRECISION
- && (exponent < -5 || exponent > arg_int)))
+ || (mode == NUMBER_ROUTINE_TO_PRECISION && (exponent < -5 || exponent > arg_int)))
{
/* Append first digit */
ecma_stringbuilder_append_byte (&builder, *digits);
@@ -664,13 +649,11 @@ ecma_builtin_number_prototype_object_to_number_convert (ecma_number_t this_num,
if (mode == NUMBER_ROUTINE_TO_FIXED)
{
- result_digits = ((exponent > 0) ? (lit_utf8_size_t) (exponent + arg_int)
- : (lit_utf8_size_t) (arg_int + 1));
+ result_digits = ((exponent > 0) ? (lit_utf8_size_t) (exponent + arg_int) : (lit_utf8_size_t) (arg_int + 1));
}
else
{
- result_digits = ((exponent <= 0) ? (lit_utf8_size_t) (1 - exponent + arg_int)
- : (lit_utf8_size_t) arg_int);
+ result_digits = ((exponent <= 0) ? (lit_utf8_size_t) (1 - exponent + arg_int) : (lit_utf8_size_t) arg_int);
}
/* Number of digits we copied from digits array */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h
index 530616eb..e5ac7dd1 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-number-prototype.inc.h
@@ -25,9 +25,7 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.7.4.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_NUMBER,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_NUMBER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-number.c b/jerry-core/ecma/builtin-objects/ecma-builtin-number.c
index c36fbd94..6626368c 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-number.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-number.c
@@ -25,6 +25,7 @@
#include "ecma-helpers.h"
#include "ecma-number-object.h"
#include "ecma-objects.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_NUMBER
@@ -52,7 +53,7 @@ enum
#endif /* JERRY_ESNEXT */
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-number.inc.h"
-#define BUILTIN_UNDERSCORED_ID number
+#define BUILTIN_UNDERSCORED_ID number
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-number.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-number.inc.h
index 9f84069b..c586aa07 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-number.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-number.inc.h
@@ -24,64 +24,42 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* ECMA-262 v5, 15.7.3.4 */
-NUMBER_VALUE (LIT_MAGIC_STRING_NAN,
- ECMA_BUILTIN_NUMBER_NAN,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_NAN, ECMA_BUILTIN_NUMBER_NAN, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.7.3.2 */
-NUMBER_VALUE (LIT_MAGIC_STRING_MAX_VALUE_U,
- ECMA_BUILTIN_NUMBER_MAX,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_MAX_VALUE_U, ECMA_BUILTIN_NUMBER_MAX, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.7.3.3 */
-NUMBER_VALUE (LIT_MAGIC_STRING_MIN_VALUE_U,
- ECMA_BUILTIN_NUMBER_MIN,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_MIN_VALUE_U, ECMA_BUILTIN_NUMBER_MIN, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.7.3.5 */
-NUMBER_VALUE (LIT_MAGIC_STRING_POSITIVE_INFINITY_U,
- ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_POSITIVE_INFINITY_U, ECMA_BUILTIN_NUMBER_POSITIVE_INFINITY, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.7.3.6 */
-NUMBER_VALUE (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U,
- ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U, ECMA_BUILTIN_NUMBER_NEGATIVE_INFINITY, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
/* ECMA-262 v6, 20.1.2.1 */
-NUMBER_VALUE (LIT_MAGIC_STRING_EPSILON_U,
- ECMA_BUILTIN_NUMBER_EPSILON,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_EPSILON_U, ECMA_BUILTIN_NUMBER_EPSILON, ECMA_PROPERTY_FIXED)
/* ECMA-262 v6, 20.1.2.6 */
-NUMBER_VALUE (LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U,
- ECMA_BUILTIN_NUMBER_MAX_SAFE_INTEGER,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U, ECMA_BUILTIN_NUMBER_MAX_SAFE_INTEGER, ECMA_PROPERTY_FIXED)
/* ECMA-262 v6, 20.1.2.8 */
-NUMBER_VALUE (LIT_MAGIC_STRING_MIN_SAFE_INTEGER_U,
- ECMA_BUILTIN_NUMBER_MIN_SAFE_INTEGER,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_MIN_SAFE_INTEGER_U, ECMA_BUILTIN_NUMBER_MIN_SAFE_INTEGER, ECMA_PROPERTY_FIXED)
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_NUMBER_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_NUMBER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.7.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_NUMBER_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_NUMBER_PROTOTYPE, ECMA_PROPERTY_FIXED)
#endif /* JERRY_BUILTIN_NUMBER */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c
index 95e06156..7bdf27da 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.c
@@ -15,8 +15,8 @@
#include "ecma-alloc.h"
#include "ecma-builtin-helpers.h"
-#include "ecma-builtins.h"
#include "ecma-builtin-object.h"
+#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
@@ -26,6 +26,7 @@
#include "ecma-objects.h"
#include "ecma-proxy-object.h"
#include "ecma-string-object.h"
+
#include "jrt.h"
#define ECMA_BUILTINS_INTERNAL
@@ -60,7 +61,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-object-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID object_prototype
+#define BUILTIN_UNDERSCORED_ID object_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -247,11 +248,8 @@ ecma_builtin_object_prototype_define_getter_setter (ecma_value_t this_arg, /**<
/* 3. */
ecma_property_descriptor_t desc = ecma_make_empty_property_descriptor ();
- desc.flags |= (JERRY_PROP_IS_ENUMERABLE
- | JERRY_PROP_IS_CONFIGURABLE
- | JERRY_PROP_IS_ENUMERABLE_DEFINED
- | JERRY_PROP_IS_CONFIGURABLE_DEFINED
- | JERRY_PROP_SHOULD_THROW);
+ desc.flags |= (JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_ENUMERABLE_DEFINED
+ | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_SHOULD_THROW);
if (define_getter)
{
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.inc.h
index a9c9d33b..47d2b8b4 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object-prototype.inc.h
@@ -23,9 +23,7 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.2.4.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_OBJECT,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_OBJECT, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
ACCESSOR_READ_WRITE (LIT_MAGIC_STRING__PROTO__,
ECMA_OBJECT_PROTOTYPE_GET_PROTO,
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object.c b/jerry-core/ecma/builtin-objects/ecma-builtin-object.c
index 7d8a08a9..6f7da099 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-object.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object.c
@@ -13,6 +13,8 @@
* limitations under the License.
*/
+#include "ecma-builtin-object.h"
+
#include "ecma-alloc.h"
#include "ecma-array-object.h"
#include "ecma-builtin-helpers.h"
@@ -22,14 +24,15 @@
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
+#include "ecma-objects-general.h"
#include "ecma-objects.h"
#include "ecma-proxy-object.h"
-#include "ecma-objects-general.h"
+
#include "jrt.h"
-#include "ecma-builtin-object.h"
#if JERRY_ESNEXT
-#include "ecma-iterator-object.h"
#include "ecma-function-object.h"
+#include "ecma-iterator-object.h"
+
#include "jcontext.h"
#endif /* JERRY_ESNEXT */
@@ -82,7 +85,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-object.inc.h"
-#define BUILTIN_UNDERSCORED_ID object
+#define BUILTIN_UNDERSCORED_ID object
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -104,8 +107,7 @@ ecma_value_t
ecma_builtin_object_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- if (arguments_list_len == 0
- || ecma_is_value_undefined (arguments_list_p[0])
+ if (arguments_list_len == 0 || ecma_is_value_undefined (arguments_list_p[0])
|| ecma_is_value_null (arguments_list_p[0]))
{
return ecma_make_object_value (ecma_op_create_object_object_noarg ());
@@ -126,16 +128,14 @@ ecma_builtin_object_dispatch_construct (const ecma_value_t *arguments_list_p, /*
#if JERRY_ESNEXT
if (JERRY_CONTEXT (current_new_target_p) != ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT))
{
- ecma_object_t *prototype_obj_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
- ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
+ ecma_object_t *prototype_obj_p =
+ ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
if (JERRY_UNLIKELY (prototype_obj_p == NULL))
{
return ECMA_VALUE_ERROR;
}
- ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
- 0,
- ECMA_OBJECT_TYPE_GENERAL);
+ ecma_object_t *object_p = ecma_create_object (prototype_obj_p, 0, ECMA_OBJECT_TYPE_GENERAL);
ecma_deref_object (prototype_obj_p);
return ecma_make_object_value (object_p);
@@ -374,9 +374,7 @@ ecma_builtin_object_set_integrity_level (ecma_object_t *obj_p, /**< object */
prop_desc.flags |= JERRY_PROP_SHOULD_THROW;
/* 8.a.i */
- ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p,
- property_name_p,
- &prop_desc);
+ ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, property_name_p, &prop_desc);
ecma_free_property_descriptor (&prop_desc);
@@ -425,9 +423,7 @@ ecma_builtin_object_set_integrity_level (ecma_object_t *obj_p, /**< object */
prop_desc.flags |= JERRY_PROP_SHOULD_THROW;
/* 9.3 */
- ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p,
- property_name_p,
- &prop_desc);
+ ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, property_name_p, &prop_desc);
ecma_free_property_descriptor (&prop_desc);
@@ -440,7 +436,6 @@ ecma_builtin_object_set_integrity_level (ecma_object_t *obj_p, /**< object */
ecma_free_value (define_own_prop_ret);
}
-
}
ecma_collection_free (props_p);
@@ -636,8 +631,7 @@ ecma_builtin_object_test_integrity_level (ecma_object_t *obj_p, /**< routine's a
/* 2.b for isFrozen */
/* 2.b for isSealed, 2.c for isFrozen */
- if ((mode == ECMA_OBJECT_ROUTINE_IS_FROZEN && is_writable_data)
- || is_configurable)
+ if ((mode == ECMA_OBJECT_ROUTINE_IS_FROZEN && is_writable_data) || is_configurable)
{
ret_value = ECMA_VALUE_FALSE;
break;
@@ -855,9 +849,7 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine
ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (buffer_p[i]);
ecma_property_descriptor_t prop_desc;
- ecma_value_t get_desc = ecma_op_object_get_own_property_descriptor (props_p,
- prop_name_p,
- &prop_desc);
+ ecma_value_t get_desc = ecma_op_object_get_own_property_descriptor (props_p, prop_name_p, &prop_desc);
#if JERRY_ESNEXT
if (ECMA_IS_VALUE_ERROR (get_desc))
@@ -878,8 +870,8 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine
goto cleanup;
}
- ecma_value_t conv_result = ecma_op_to_property_descriptor (desc_obj,
- &property_descriptors[property_descriptor_number]);
+ ecma_value_t conv_result =
+ ecma_op_to_property_descriptor (desc_obj, &property_descriptors[property_descriptor_number]);
property_descriptors[property_descriptor_number].flags |= JERRY_PROP_SHOULD_THROW;
@@ -906,9 +898,8 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine
{
ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (enum_prop_names->buffer_p[i]);
- ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p,
- prop_name_p,
- &property_descriptors[i]);
+ ecma_value_t define_own_prop_ret =
+ ecma_op_object_define_own_property (obj_p, prop_name_p, &property_descriptors[i]);
if (ECMA_IS_VALUE_ERROR (define_own_prop_ret))
{
goto cleanup;
@@ -922,9 +913,7 @@ ecma_builtin_object_object_define_properties (ecma_object_t *obj_p, /**< routine
cleanup:
/* Clean up. */
- for (uint32_t index = 0;
- index < property_descriptor_number;
- index++)
+ for (uint32_t index = 0; index < property_descriptor_number; index++)
{
ecma_free_property_descriptor (&property_descriptors[index]);
}
@@ -1011,9 +1000,7 @@ ecma_builtin_object_object_define_property (ecma_object_t *obj_p, /**< routine's
prop_desc.flags |= JERRY_PROP_SHOULD_THROW;
- ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p,
- name_str_p,
- &prop_desc);
+ ecma_value_t define_own_prop_ret = ecma_op_object_define_own_property (obj_p, name_str_p, &prop_desc);
ecma_free_property_descriptor (&prop_desc);
ecma_free_value (conv_result);
@@ -1272,10 +1259,8 @@ ecma_builtin_object_from_entries (ecma_value_t iterator) /**< object's iterator
if (property_p == NULL)
{
ecma_property_value_t *prop;
- prop = ecma_create_named_data_property (obj_p,
- property_key,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,
- NULL);
+ prop =
+ ecma_create_named_data_property (obj_p, property_key, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL);
prop->value = ecma_copy_value_if_not_object (value);
}
else
@@ -1331,8 +1316,7 @@ ecma_op_object_get_own_property_keys (ecma_value_t this_arg, /**< this argument
if (type == ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_SYMBOLS)
{
- filter = (JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS
- | JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES);
+ filter = (JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS | JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES);
}
ecma_collection_t *props_p = ecma_op_object_own_property_keys (obj_p, filter);
@@ -1488,8 +1472,8 @@ ecma_builtin_object_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
JERRY_ASSERT (builtin_routine_id - ECMA_OBJECT_ROUTINE_KEYS < ECMA_ENUMERABLE_PROPERTY__COUNT);
const int option = builtin_routine_id - ECMA_OBJECT_ROUTINE_KEYS;
- result = ecma_builtin_object_object_keys_values_helper (obj_p,
- (ecma_enumerable_property_names_options_t) option);
+ result =
+ ecma_builtin_object_object_keys_values_helper (obj_p, (ecma_enumerable_property_names_options_t) option);
break;
}
case ECMA_OBJECT_ROUTINE_GET_OWN_PROPERTY_DESCRIPTOR:
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object.h b/jerry-core/ecma/builtin-objects/ecma-builtin-object.h
index 489e9831..f31b2617 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-object.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object.h
@@ -15,22 +15,20 @@
#ifndef ECMA_BUILTIN_OBJECT_H
#define ECMA_BUILTIN_OBJECT_H
+#include "ecma-globals.h"
+
ecma_value_t ecma_builtin_object_object_get_prototype_of (ecma_object_t *obj_p);
-ecma_value_t ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1,
- ecma_value_t arg2);
+ecma_value_t ecma_builtin_object_object_set_prototype_of (ecma_value_t arg1, ecma_value_t arg2);
-ecma_value_t ecma_builtin_object_object_set_proto (ecma_value_t arg1,
- ecma_value_t arg2);
+ecma_value_t ecma_builtin_object_object_set_proto (ecma_value_t arg1, ecma_value_t arg2);
ecma_value_t ecma_builtin_object_object_prevent_extensions (ecma_object_t *obj_p);
ecma_value_t ecma_builtin_object_object_is_extensible (ecma_object_t *obj_p);
-ecma_value_t ecma_builtin_object_object_get_own_property_descriptor (ecma_object_t *obj_p,
- ecma_string_t *name_str_p);
-ecma_value_t ecma_builtin_object_object_define_property (ecma_object_t *obj_p,
- ecma_string_t *name_str_p,
- ecma_value_t arg3);
+ecma_value_t ecma_builtin_object_object_get_own_property_descriptor (ecma_object_t *obj_p, ecma_string_t *name_str_p);
+ecma_value_t
+ecma_builtin_object_object_define_property (ecma_object_t *obj_p, ecma_string_t *name_str_p, ecma_value_t arg3);
#endif /* !ECMA_BUILTIN_OBJECT_H */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-object.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-object.inc.h
index 546e57b9..7f79d4e5 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-object.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-object.inc.h
@@ -22,22 +22,16 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.2.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_OBJECT_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_OBJECT_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
/* Routine properties:
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c
index 7021b9bb..252512d6 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.c
@@ -38,7 +38,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-promise-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID promise_prototype
+#define BUILTIN_UNDERSCORED_ID promise_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -74,7 +74,7 @@ ecma_builtin_promise_prototype_dispatch_routine (uint8_t builtin_routine_id, /**
}
case ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH:
{
- ecma_value_t args[] = {ECMA_VALUE_UNDEFINED, arguments_list_p[0]};
+ ecma_value_t args[] = { ECMA_VALUE_UNDEFINED, arguments_list_p[0] };
return ecma_op_invoke_by_magic_id (this_arg, LIT_MAGIC_STRING_THEN, args, 2);
}
case ECMA_PROMISE_PROTOTYPE_ROUTINE_FINALLY:
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h
index 2ffcc1b1..2f741624 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-promise-prototype.inc.h
@@ -20,14 +20,10 @@
/* Object properties:
* (property name, object pointer getter) */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_PROMISE,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_PROMISE, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 25.4.5.4 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_PROMISE_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_PROMISE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
ROUTINE (LIT_MAGIC_STRING_THEN, ECMA_PROMISE_PROTOTYPE_ROUTINE_THEN, 2, 2)
ROUTINE (LIT_MAGIC_STRING_CATCH, ECMA_PROMISE_PROTOTYPE_ROUTINE_CATCH, 1, 1)
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c b/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c
index 55afaa34..4de450bf 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-promise.c
@@ -15,8 +15,8 @@
#include "ecma-alloc.h"
#include "ecma-array-object.h"
-#include "ecma-builtin-helpers.h"
#include "ecma-builtin-handlers.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
@@ -24,6 +24,7 @@
#include "ecma-iterator-object.h"
#include "ecma-number-object.h"
#include "ecma-promise-object.h"
+
#include "jcontext.h"
#if JERRY_ESNEXT
@@ -52,7 +53,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-promise.inc.h"
-#define BUILTIN_UNDERSCORED_ID promise
+#define BUILTIN_UNDERSCORED_ID promise
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -87,8 +88,7 @@ ecma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;
- ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor),
- LIT_MAGIC_STRING_RESOLVE);
+ ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor), LIT_MAGIC_STRING_RESOLVE);
if (ECMA_IS_VALUE_ERROR (resolve))
{
@@ -143,7 +143,7 @@ ecma_builtin_promise_perform_race (ecma_value_t iterator, /**< the iterator for
}
/* i. */
- ecma_value_t args[2] = {capability_p->resolve, capability_p->reject};
+ ecma_value_t args[2] = { capability_p->resolve, capability_p->reject };
ecma_value_t result = ecma_op_invoke_by_magic_id (next_promise, LIT_MAGIC_STRING_THEN, args, 2);
ecma_free_value (next_promise);
@@ -175,7 +175,7 @@ exit:
static inline ecma_value_t
ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
ecma_value_t next_method, /**< next method */
- ecma_object_t *capability_obj_p, /**< PromiseCapability record */
+ ecma_object_t *capability_obj_p, /**< PromiseCapability record */
ecma_value_t ctor, /**< the caller of Promise.all */
uint8_t builtin_routine_id, /**< built-in wide routine identifier */
bool *done_p) /**< [out] iteratorRecord[[done]] */
@@ -186,8 +186,7 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;
- ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor),
- LIT_MAGIC_STRING_RESOLVE);
+ ecma_value_t resolve = ecma_op_object_get_by_magic_id (ecma_get_object_from_value (ctor), LIT_MAGIC_STRING_RESOLVE);
if (ECMA_IS_VALUE_ERROR (resolve))
{
@@ -293,8 +292,8 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
if (builtin_routine_id != ECMA_PROMISE_ROUTINE_ANY)
{
/* k. */
- executor_func_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER,
- sizeof (ecma_promise_all_executor_t));
+ executor_func_p =
+ ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER, sizeof (ecma_promise_all_executor_t));
ecma_promise_all_executor_t *executor_p = (ecma_promise_all_executor_t *) executor_func_p;
@@ -339,8 +338,8 @@ ecma_builtin_promise_perform (ecma_value_t iterator, /**< iteratorRecord */
executor_type = ECMA_PROMISE_ANY_REJECT << ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT;
}
- ecma_object_t *reject_func_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER,
- sizeof (ecma_promise_all_executor_t));
+ ecma_object_t *reject_func_p =
+ ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_ALL_HELPER, sizeof (ecma_promise_all_executor_t));
ecma_promise_all_executor_t *reject_p = (ecma_promise_all_executor_t *) reject_func_p;
reject_p->index = idx;
@@ -421,12 +420,8 @@ ecma_builtin_promise_helper (ecma_value_t this_arg, /**< 'this' argument */
}
else
{
- ret = ecma_builtin_promise_perform (iterator,
- next_method,
- capability_obj_p,
- this_arg,
- builtin_routine_id,
- &is_done);
+ ret =
+ ecma_builtin_promise_perform (iterator, next_method, capability_obj_p, this_arg, builtin_routine_id, &is_done);
}
if (ECMA_IS_VALUE_ERROR (ret))
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-promise.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-promise.inc.h
index 03c6439c..52a63aa4 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-promise.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-promise.inc.h
@@ -24,20 +24,14 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Object properties:
* (property name, object pointer getter) */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_PROMISE_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_PROMISE_PROTOTYPE, ECMA_PROPERTY_FIXED)
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_PROMISE_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_PROMISE_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
@@ -49,9 +43,7 @@ ROUTINE (LIT_MAGIC_STRING_ALLSETTLED, ECMA_PROMISE_ROUTINE_ALLSETTLED, 1, 1)
ROUTINE (LIT_MAGIC_STRING_ANY, ECMA_PROMISE_ROUTINE_ANY, 1, 1)
/* ES2015 25.4.4.6 */
-ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
- ECMA_PROMISE_ROUTINE_SPECIES_GET,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ECMA_PROMISE_ROUTINE_SPECIES_GET, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.c b/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.c
index 5844a872..1fe6ac23 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-proxy-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_PROXY
@@ -41,7 +42,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-proxy.inc.h"
-#define BUILTIN_UNDERSCORED_ID proxy
+#define BUILTIN_UNDERSCORED_ID proxy
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.inc.h
index 82fedd00..32670616 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-proxy.inc.h
@@ -24,13 +24,9 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 2,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 2, ECMA_PROPERTY_FLAG_CONFIGURABLE)
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_PROXY_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_PROXY_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c
index 21565971..f72ac2c2 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.c
@@ -22,6 +22,7 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -30,7 +31,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-rangeerror-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID range_error_prototype
+#define BUILTIN_UNDERSCORED_ID range_error_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h
index ce8406b1..1307e4a0 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror-prototype.inc.h
@@ -25,19 +25,13 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.7.8 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_RANGE_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_RANGE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.9 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_RANGE_ERROR_UL,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_RANGE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.10 */
-STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
- LIT_MAGIC_STRING__EMPTY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.c
index cadbfc34..83ae4feb 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.c
@@ -14,17 +14,18 @@
*/
#include "ecma-alloc.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-builtin-helpers.h"
#include "ecma-objects.h"
-#include "ecma-function-object.h"
-#include "jrt.h"
+
#include "jcontext.h"
+#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -32,7 +33,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-rangeerror.inc.h"
-#define BUILTIN_UNDERSCORED_ID range_error
+#define BUILTIN_UNDERSCORED_ID range_error
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.inc.h
index 008acd08..042c13a3 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-rangeerror.inc.h
@@ -24,22 +24,16 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_RANGE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_RANGE_ERROR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_RANGE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c
index f1d4c593..5212d6bf 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.c
@@ -22,6 +22,7 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -30,7 +31,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-referenceerror-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID reference_error_prototype
+#define BUILTIN_UNDERSCORED_ID reference_error_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h
index d03e8a65..caa9e0e3 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror-prototype.inc.h
@@ -25,19 +25,13 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.7.8 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_REFERENCE_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_REFERENCE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.9 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_REFERENCE_ERROR_UL,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_REFERENCE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.10 */
-STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
- LIT_MAGIC_STRING__EMPTY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.c
index a3b6fbaa..5c983555 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.c
@@ -14,17 +14,18 @@
*/
#include "ecma-alloc.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-builtin-helpers.h"
#include "ecma-objects.h"
-#include "ecma-function-object.h"
-#include "jrt.h"
+
#include "jcontext.h"
+#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -32,7 +33,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-referenceerror.inc.h"
-#define BUILTIN_UNDERSCORED_ID reference_error
+#define BUILTIN_UNDERSCORED_ID reference_error
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.inc.h
index 4cb17bae..fa268dbc 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-referenceerror.inc.h
@@ -24,22 +24,16 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_REFERENCE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_REFERENCE_ERROR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_REFERENCE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c b/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c
index 3f921f04..32c32dc7 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-reflect.c
@@ -14,15 +14,16 @@
*/
#include "ecma-array-object.h"
-#include "ecma-builtins.h"
#include "ecma-builtin-function-prototype.h"
-#include "ecma-iterator-object.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtin-object.h"
+#include "ecma-builtins.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
+#include "ecma-iterator-object.h"
#include "ecma-proxy-object.h"
+
#include "jcontext.h"
#if JERRY_BUILTIN_REFLECT
@@ -57,7 +58,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-reflect.inc.h"
-#define BUILTIN_UNDERSCORED_ID reflect
+#define BUILTIN_UNDERSCORED_ID reflect
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -213,10 +214,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
return ECMA_VALUE_ERROR;
}
- ecma_value_t ret_value = ecma_op_function_construct (target_p,
- new_target_p,
- coll_p->buffer_p,
- coll_p->item_count);
+ ecma_value_t ret_value = ecma_op_function_construct (target_p, new_target_p, coll_p->buffer_p, coll_p->item_count);
ecma_collection_free (coll_p);
return ret_value;
@@ -285,9 +283,7 @@ ecma_builtin_reflect_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
return conv_result;
}
- ecma_value_t result = ecma_op_object_define_own_property (obj_p,
- name_str_p,
- &prop_desc);
+ ecma_value_t result = ecma_op_object_define_own_property (obj_p, name_str_p, &prop_desc);
ecma_deref_ecma_string (name_str_p);
ecma_free_property_descriptor (&prop_desc);
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c
index 41ad961d..12b3b08e 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.c
@@ -15,20 +15,22 @@
#include "ecma-alloc.h"
#include "ecma-array-object.h"
-#include "ecma-builtins.h"
#include "ecma-builtin-helpers.h"
+#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
-#include "ecma-globals.h"
#include "ecma-gc.h"
+#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-regexp-object.h"
+
#include "lit-char-helpers.h"
#if JERRY_BUILTIN_REGEXP
#include "ecma-regexp-object.h"
+
#include "re-compiler.h"
#define ECMA_BUILTINS_INTERNAL
@@ -37,7 +39,7 @@
/**
* This object has a custom dispatch function.
*/
- #define BUILTIN_CUSTOM_DISPATCH
+#define BUILTIN_CUSTOM_DISPATCH
/**
* List of built-in routine identifiers.
@@ -73,7 +75,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-regexp-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID regexp_prototype
+#define BUILTIN_UNDERSCORED_ID regexp_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -100,14 +102,8 @@ ecma_builtin_regexp_prototype_flags_helper (ecma_extended_object_t *re_obj_p, /*
uint16_t flags = bc_p->header.status_flags;
- static const uint8_t re_flags[] =
- {
- RE_FLAG_GLOBAL,
- RE_FLAG_IGNORE_CASE,
- RE_FLAG_MULTILINE,
- RE_FLAG_STICKY,
- RE_FLAG_UNICODE,
- RE_FLAG_DOTALL,
+ static const uint8_t re_flags[] = {
+ RE_FLAG_GLOBAL, RE_FLAG_IGNORE_CASE, RE_FLAG_MULTILINE, RE_FLAG_STICKY, RE_FLAG_UNICODE, RE_FLAG_DOTALL,
};
uint16_t offset = (uint16_t) (builtin_routine_id - ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL);
@@ -128,25 +124,12 @@ ecma_builtin_regexp_prototype_flags_helper (ecma_extended_object_t *re_obj_p, /*
static ecma_value_t
ecma_builtin_regexp_prototype_get_flags (ecma_object_t *object_p) /**< this object */
{
- static const lit_magic_string_id_t flag_lit_ids[] =
- {
- LIT_MAGIC_STRING_GLOBAL,
- LIT_MAGIC_STRING_IGNORECASE_UL,
- LIT_MAGIC_STRING_MULTILINE,
- LIT_MAGIC_STRING_DOTALL,
- LIT_MAGIC_STRING_UNICODE,
- LIT_MAGIC_STRING_STICKY
- };
+ static const lit_magic_string_id_t flag_lit_ids[] = { LIT_MAGIC_STRING_GLOBAL, LIT_MAGIC_STRING_IGNORECASE_UL,
+ LIT_MAGIC_STRING_MULTILINE, LIT_MAGIC_STRING_DOTALL,
+ LIT_MAGIC_STRING_UNICODE, LIT_MAGIC_STRING_STICKY };
- static const lit_utf8_byte_t flag_chars[] =
- {
- LIT_CHAR_LOWERCASE_G,
- LIT_CHAR_LOWERCASE_I,
- LIT_CHAR_LOWERCASE_M,
- LIT_CHAR_LOWERCASE_S,
- LIT_CHAR_LOWERCASE_U,
- LIT_CHAR_LOWERCASE_Y
- };
+ static const lit_utf8_byte_t flag_chars[] = { LIT_CHAR_LOWERCASE_G, LIT_CHAR_LOWERCASE_I, LIT_CHAR_LOWERCASE_M,
+ LIT_CHAR_LOWERCASE_S, LIT_CHAR_LOWERCASE_U, LIT_CHAR_LOWERCASE_Y };
ecma_stringbuilder_t builder = ecma_stringbuilder_create ();
for (uint32_t i = 0; i < sizeof (flag_lit_ids) / sizeof (lit_magic_string_id_t); i++)
@@ -466,8 +449,7 @@ ecma_builtin_regexp_prototype_to_string (ecma_object_t *object_p) /**< this obje
#else /* !JERRY_ESNEXT */
ecma_extended_object_t *re_obj_p = (ecma_extended_object_t *) object_p;
- re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t,
- re_obj_p->u.cls.u3.value);
+ re_compiled_code_t *bc_p = ECMA_GET_INTERNAL_VALUE_POINTER (re_compiled_code_t, re_obj_p->u.cls.u3.value);
ecma_string_t *source_p = ecma_get_string_from_value (bc_p->source);
uint16_t flags = bc_p->header.status_flags;
@@ -565,7 +547,7 @@ ecma_builtin_regexp_prototype_match_all (ecma_object_t *regexp_obj_p, /**< this
/* 6. */
ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor);
ecma_value_t flags_value = ecma_make_string_value (flags);
- ecma_value_t match_args[] = { ecma_make_object_value (regexp_obj_p), flags_value};
+ ecma_value_t match_args[] = { ecma_make_object_value (regexp_obj_p), flags_value };
ecma_value_t matcher = ecma_op_function_construct (constructor_obj_p, constructor_obj_p, match_args, 2);
ecma_deref_object (constructor_obj_p);
@@ -604,10 +586,8 @@ ecma_builtin_regexp_prototype_match_all (ecma_object_t *regexp_obj_p, /**< this
/* 8. */
ecma_object_t *matcher_obj_p = ecma_get_object_from_value (matcher);
ecma_value_t last_index_value = ecma_make_length_value (last_index);
- ecma_value_t set = ecma_op_object_put (matcher_obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
- last_index_value,
- true);
+ ecma_value_t set =
+ ecma_op_object_put (matcher_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), last_index_value, true);
ecma_free_value (last_index_value);
@@ -633,9 +613,7 @@ ecma_builtin_regexp_prototype_match_all (ecma_object_t *regexp_obj_p, /**< this
/* 13. */
ecma_object_t *result_obj;
ecma_object_t *proto_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_STRING_ITERATOR_PROTOTYPE);
- result_obj = ecma_create_object (proto_p,
- sizeof (ecma_regexp_string_iterator_t),
- ECMA_OBJECT_TYPE_CLASS);
+ result_obj = ecma_create_object (proto_p, sizeof (ecma_regexp_string_iterator_t), ECMA_OBJECT_TYPE_CLASS);
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) result_obj;
ext_obj_p->u.cls.type = ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR;
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h
index 320b4bf0..9b60457e 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-prototype.inc.h
@@ -22,30 +22,20 @@
#if JERRY_BUILTIN_REGEXP
/* ECMA-262 v5, 15.10.6.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_REGEXP,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_REGEXP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#if JERRY_ESNEXT
-ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_FLAGS,
- ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_FLAGS,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_FLAGS, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_FLAGS, ECMA_PROPERTY_FLAG_CONFIGURABLE)
-ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SOURCE,
- ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_SOURCE,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SOURCE, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_SOURCE, ECMA_PROPERTY_FLAG_CONFIGURABLE)
-ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_GLOBAL,
- ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_GLOBAL, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_GLOBAL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_IGNORECASE_UL,
ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_IGNORE_CASE,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
-ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_DOTALL,
- ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_DOT_ALL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_DOTALL, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_DOT_ALL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_MULTILINE,
ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_MULTILINE,
@@ -55,9 +45,7 @@ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_UNICODE,
ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_UNICODE,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
-ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_STICKY,
- ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_STICKY,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_STICKY, ECMA_REGEXP_PROTOTYPE_ROUTINE_GET_STICKY, ECMA_PROPERTY_FLAG_CONFIGURABLE)
ROUTINE (LIT_GLOBAL_SYMBOL_REPLACE, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_REPLACE, 2, 2)
ROUTINE (LIT_GLOBAL_SYMBOL_SEARCH, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_SEARCH, 1, 1)
@@ -66,29 +54,19 @@ ROUTINE (LIT_GLOBAL_SYMBOL_MATCH, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_MATCH, 1,
ROUTINE (LIT_GLOBAL_SYMBOL_MATCH_ALL, ECMA_REGEXP_PROTOTYPE_ROUTINE_SYMBOL_MATCH_ALL, 1, 1)
#else /* !JERRY_ESNEXT */
/* ECMA-262 v5, 15.10.7.1 */
-STRING_VALUE (LIT_MAGIC_STRING_SOURCE,
- LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP,
- ECMA_PROPERTY_FIXED)
+STRING_VALUE (LIT_MAGIC_STRING_SOURCE, LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.10.7.2 */
-SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL,
- ECMA_VALUE_FALSE,
- ECMA_PROPERTY_FIXED)
+SIMPLE_VALUE (LIT_MAGIC_STRING_GLOBAL, ECMA_VALUE_FALSE, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.10.7.3 */
-SIMPLE_VALUE (LIT_MAGIC_STRING_IGNORECASE_UL,
- ECMA_VALUE_FALSE,
- ECMA_PROPERTY_FIXED)
+SIMPLE_VALUE (LIT_MAGIC_STRING_IGNORECASE_UL, ECMA_VALUE_FALSE, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.10.7.4 */
-SIMPLE_VALUE (LIT_MAGIC_STRING_MULTILINE,
- ECMA_VALUE_FALSE,
- ECMA_PROPERTY_FIXED)
+SIMPLE_VALUE (LIT_MAGIC_STRING_MULTILINE, ECMA_VALUE_FALSE, ECMA_PROPERTY_FIXED)
/* ECMA-262 v5, 15.10.7.5 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LASTINDEX_UL,
- 0,
- ECMA_PROPERTY_FLAG_WRITABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LASTINDEX_UL, 0, ECMA_PROPERTY_FLAG_WRITABLE)
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_ANNEXB
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c
index 9d3ab15f..d2d0d56e 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp-string-iterator-prototype.c
@@ -26,7 +26,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-regexp-string-iterator-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID regexp_string_iterator_prototype
+#define BUILTIN_UNDERSCORED_ID regexp_string_iterator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -144,9 +144,8 @@ ecma_builtin_regexp_string_iterator_prototype_object_next (ecma_value_t this_val
}
uint8_t flags = regexp_string_iterator_obj->header.u.cls.u1.regexp_string_iterator_flags;
- ecma_length_t next_index = ecma_op_advance_string_index (matcher_str_p,
- this_index,
- (flags & RE_FLAG_UNICODE) != 0);
+ ecma_length_t next_index =
+ ecma_op_advance_string_index (matcher_str_p, this_index, (flags & RE_FLAG_UNICODE) != 0);
ecma_value_t next_index_value = ecma_make_length_value (next_index);
ecma_value_t set = ecma_op_object_put (regexp_obj_p,
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c
index e2274301..e9990429 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.c
@@ -19,17 +19,18 @@
#include "ecma-exceptions.h"
#include "ecma-gc.h"
#include "ecma-helpers.h"
-#include "jcontext.h"
#include "ecma-objects.h"
#include "ecma-regexp-object.h"
+#include "jcontext.h"
+
#if JERRY_BUILTIN_REGEXP
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-regexp.inc.h"
-#define BUILTIN_UNDERSCORED_ID regexp
+#define BUILTIN_UNDERSCORED_ID regexp
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -199,8 +200,7 @@ ecma_value_t
ecma_builtin_regexp_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- return ecma_builtin_regexp_dispatch_helper (arguments_list_p,
- arguments_list_len);
+ return ecma_builtin_regexp_dispatch_helper (arguments_list_p, arguments_list_len);
} /* ecma_builtin_regexp_dispatch_call */
/**
@@ -213,8 +213,7 @@ ecma_value_t
ecma_builtin_regexp_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- return ecma_builtin_regexp_dispatch_helper (arguments_list_p,
- arguments_list_len);
+ return ecma_builtin_regexp_dispatch_helper (arguments_list_p, arguments_list_len);
} /* ecma_builtin_regexp_dispatch_construct */
#if JERRY_ESNEXT
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.inc.h
index f64cea94..882e42ca 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-regexp.inc.h
@@ -21,24 +21,16 @@
#if JERRY_BUILTIN_REGEXP
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 2,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 2, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* ECMA-262 v5, 15.10.5.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_REGEXP_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_REGEXP_PROTOTYPE, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_REGEXP_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_REGEXP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 21.2.4.2 */
-ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
- ecma_builtin_regexp_species_get,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_regexp_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_REGEXP */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c
index 38bf75b2..e435626b 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.c
@@ -37,7 +37,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-set-iterator-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID set_iterator_prototype
+#define BUILTIN_UNDERSCORED_ID set_iterator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h
index 471f5ccf..4704236a 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set-iterator-prototype.inc.h
@@ -21,9 +21,7 @@
#if JERRY_BUILTIN_CONTAINER
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_SET_ITERATOR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SET_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.c
index 3f596bda..8ff2687c 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.c
@@ -25,7 +25,7 @@
*/
#define BUILTIN_CUSTOM_DISPATCH
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-set-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID set_prototype
+#define BUILTIN_UNDERSCORED_ID set_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.inc.h
index 1c819a13..8c6f874b 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set-prototype.inc.h
@@ -25,14 +25,10 @@
* (property name, object pointer getter) */
/* ECMA-262 v6, 23.2.3.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_SET,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 23.1.3.13 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_SET_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
@@ -42,16 +38,17 @@ ROUTINE (LIT_MAGIC_STRING_DELETE, ECMA_CONTAINER_ROUTINE_DELETE, 1, 1)
ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_CONTAINER_ROUTINE_FOREACH, 2, 1)
ROUTINE (LIT_MAGIC_STRING_HAS, ECMA_CONTAINER_ROUTINE_HAS, 1, 1)
ROUTINE (LIT_MAGIC_STRING_ENTRIES, ECMA_CONTAINER_ROUTINE_ENTRIES, 0, 0)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES, LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES,
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES,
+ LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES,
+INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR,
+ LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_KEYS, LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES,
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_KEYS,
+ LIT_INTERNAL_MAGIC_STRING_SET_PROTOTYPE_VALUES,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE,
- ECMA_CONTAINER_ROUTINE_SIZE_GETTER,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_SIZE, ECMA_CONTAINER_ROUTINE_SIZE_GETTER, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_BUILTIN_CONTAINER */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set.c b/jerry-core/ecma/builtin-objects/ecma-builtin-set.c
index 5bc8fcc0..8210cc94 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-set.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set.c
@@ -14,8 +14,8 @@
*/
#include "ecma-builtins.h"
-#include "ecma-exceptions.h"
#include "ecma-container-object.h"
+#include "ecma-exceptions.h"
#if JERRY_BUILTIN_CONTAINER
@@ -23,7 +23,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-set.inc.h"
-#define BUILTIN_UNDERSCORED_ID set
+#define BUILTIN_UNDERSCORED_ID set
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-set.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-set.inc.h
index 0d2a7d71..559b4ccb 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-set.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-set.inc.h
@@ -25,27 +25,19 @@
* (property name, number value, writable, enumerable, configurable) */
/* ECMA-262 v6, 23.2.2 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 0,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 23.1 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_SET_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v6, 23.2.2.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_SET_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SET_PROTOTYPE, ECMA_PROPERTY_FIXED)
/* ECMA-262 v6, 23.2.2.2 */
-ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
- ecma_builtin_set_species_get,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_set_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_BUILTIN_CONTAINER */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c
index aea79461..dc6fc22f 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.c
@@ -13,6 +13,7 @@
* limitations under the License.
*/
+#include "ecma-arraybuffer-object.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
@@ -23,9 +24,9 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-shared-arraybuffer-object.h"
-#include "ecma-arraybuffer-object.h"
-#include "jrt.h"
+
#include "jrt-libc-includes.h"
+#include "jrt.h"
#if JERRY_BUILTIN_SHAREDARRAYBUFFER
@@ -33,7 +34,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-shared-arraybuffer-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID shared_arraybuffer_prototype
+#define BUILTIN_UNDERSCORED_ID shared_arraybuffer_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h
index 4008dee7..c7b0b9eb 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer-prototype.inc.h
@@ -24,9 +24,7 @@
/* Object properties:
* (property name, object pointer getter) */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* Readonly accessor properties */
ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,
@@ -34,9 +32,7 @@ ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_BYTE_LENGTH_UL,
ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v11, 24.2.4.4 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c
index e5b7ba00..473287ec 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.c
@@ -14,13 +14,14 @@
*/
#include "ecma-builtins.h"
+#include "ecma-dataview-object.h"
#include "ecma-exceptions.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-shared-arraybuffer-object.h"
-#include "ecma-dataview-object.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_SHAREDARRAYBUFFER
@@ -29,7 +30,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-shared-arraybuffer.inc.h"
-#define BUILTIN_UNDERSCORED_ID shared_arraybuffer
+#define BUILTIN_UNDERSCORED_ID shared_arraybuffer
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h
index 35eafcf2..8a7c73a7 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-shared-arraybuffer.inc.h
@@ -24,20 +24,14 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Object properties:
* (property name, object pointer getter) */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE, ECMA_PROPERTY_FIXED)
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c
index 639fecae..a939a888 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.c
@@ -37,7 +37,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-string-iterator-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID string_iterator_prototype
+#define BUILTIN_UNDERSCORED_ID string_iterator_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -157,10 +157,8 @@ ecma_builtin_string_iterator_prototype_object_next (ecma_value_t this_val) /**<
ext_obj_p->u.cls.u2.iterator_index = ECMA_ITERATOR_INDEX_LIMIT;
ecma_string_t *prop_name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_ITERATOR_NEXT_INDEX);
- ecma_value_t put_result = ecma_op_object_put (obj_p,
- prop_name_p,
- ecma_make_length_value (position + result_size),
- true);
+ ecma_value_t put_result =
+ ecma_op_object_put (obj_p, prop_name_p, ecma_make_length_value (position + result_size), true);
JERRY_ASSERT (ecma_is_value_true (put_result));
}
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h
index 1597c5b2..e5d043d1 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-iterator-prototype.inc.h
@@ -21,9 +21,7 @@
#if JERRY_ESNEXT
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_STRING_ITERATOR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_STRING_ITERATOR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c
index c1c09d65..dafde43e 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.c
@@ -16,8 +16,8 @@
#include "ecma-alloc.h"
#include "ecma-array-object.h"
#include "ecma-builtin-helpers.h"
-#include "ecma-builtins.h"
#include "ecma-builtin-regexp.inc.h"
+#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
@@ -27,9 +27,10 @@
#include "ecma-iterator-object.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
+
#include "jcontext.h"
-#include "jrt.h"
#include "jrt-libc-includes.h"
+#include "jrt.h"
#include "lit-char-helpers.h"
#include "lit-strings.h"
@@ -96,7 +97,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-string-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID string_prototype
+#define BUILTIN_UNDERSCORED_ID string_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -179,8 +180,7 @@ ecma_builtin_string_prototype_char_at_helper (ecma_value_t this_arg, /**< this a
if (index_num < 0 || index_num >= len || (ecma_number_is_nan (index_num) && len == 0))
{
ecma_deref_ecma_string (original_string_p);
- return (charcode_mode ? ecma_make_nan_value ()
- : ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY));
+ return (charcode_mode ? ecma_make_nan_value () : ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY));
}
/* 6 */
@@ -338,7 +338,6 @@ ecma_builtin_string_prototype_object_match (ecma_value_t this_argument, /**< thi
/* 7. */
if (ECMA_IS_VALUE_ERROR (new_regexp))
{
-
ecma_deref_object (regexp_obj_p);
ecma_deref_ecma_string (this_str_p);
return new_regexp;
@@ -629,20 +628,13 @@ ecma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /*
}
uint8_t input_flags = ECMA_STRING_FLAG_IS_ASCII;
- replace_ctx.string_p = ecma_string_get_chars (input_str_p,
- &(replace_ctx.string_size),
- NULL,
- NULL,
- &input_flags);
+ replace_ctx.string_p = ecma_string_get_chars (input_str_p, &(replace_ctx.string_size), NULL, NULL, &input_flags);
lit_utf8_size_t search_size;
lit_utf8_size_t search_length;
uint8_t search_flags = ECMA_STRING_FLAG_IS_ASCII;
- const lit_utf8_byte_t *search_buf_p = ecma_string_get_chars (search_str_p,
- &search_size,
- &search_length,
- NULL,
- &search_flags);
+ const lit_utf8_byte_t *search_buf_p =
+ ecma_string_get_chars (search_str_p, &search_size, &search_length, NULL, &search_flags);
ecma_string_t *result_string_p = NULL;
@@ -669,17 +661,11 @@ ecma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /*
{
ecma_object_t *function_p = ecma_get_object_from_value (replace_value);
- ecma_value_t args[] =
- {
- ecma_make_string_value (search_str_p),
- ecma_make_uint32_value (pos),
- ecma_make_string_value (input_str_p)
- };
+ ecma_value_t args[] = { ecma_make_string_value (search_str_p),
+ ecma_make_uint32_value (pos),
+ ecma_make_string_value (input_str_p) };
- result = ecma_op_function_call (function_p,
- ECMA_VALUE_UNDEFINED,
- args,
- 3);
+ result = ecma_op_function_call (function_p, ECMA_VALUE_UNDEFINED, args, 3);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -708,8 +694,7 @@ ecma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /*
ecma_builtin_replace_substitute (&replace_ctx);
}
- if (!replace_all
- || last_match_end_p == input_end_p)
+ if (!replace_all || last_match_end_p == input_end_p)
{
break;
}
@@ -727,10 +712,9 @@ ecma_builtin_string_prototype_object_replace_helper (ecma_value_t this_value, /*
}
ecma_stringbuilder_append_raw (&replace_ctx.builder,
- last_match_end_p,
- (lit_utf8_size_t) (input_end_p - last_match_end_p));
+ last_match_end_p,
+ (lit_utf8_size_t) (input_end_p - last_match_end_p));
result_string_p = ecma_stringbuilder_finalize (&replace_ctx.builder);
-
}
if (result_string_p == NULL)
@@ -827,9 +811,8 @@ ecma_builtin_string_prototype_object_search (ecma_value_t this_value, /**< this
return ECMA_VALUE_ERROR;
}
- ecma_value_t new_regexp = ecma_op_create_regexp_from_pattern (new_regexp_obj_p,
- ecma_make_string_value (pattern_p),
- ECMA_VALUE_UNDEFINED);
+ ecma_value_t new_regexp =
+ ecma_op_create_regexp_from_pattern (new_regexp_obj_p, ecma_make_string_value (pattern_p), ECMA_VALUE_UNDEFINED);
ecma_deref_ecma_string (pattern_p);
@@ -875,9 +858,7 @@ ecma_builtin_string_prototype_object_slice (ecma_string_t *get_string_val, /**<
/* 4. 6. */
lit_utf8_size_t start = 0, end = len;
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (arg1,
- len,
- &start)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (arg1, len, &start)))
{
return ECMA_VALUE_ERROR;
}
@@ -889,9 +870,7 @@ ecma_builtin_string_prototype_object_slice (ecma_string_t *get_string_val, /**<
}
else
{
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (arg2,
- len,
- &end)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (arg2, len, &end)))
{
return ECMA_VALUE_ERROR;
}
@@ -1046,32 +1025,23 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_value, /**< this a
lit_utf8_size_t string_size;
uint8_t string_flags = ECMA_STRING_FLAG_IS_ASCII;
- const lit_utf8_byte_t *string_buffer_p = ecma_string_get_chars (string_p,
- &string_size,
- NULL,
- NULL,
- &string_flags);
+ const lit_utf8_byte_t *string_buffer_p = ecma_string_get_chars (string_p, &string_size, NULL, NULL, &string_flags);
lit_utf8_size_t separator_size;
uint8_t separator_flags = ECMA_STRING_FLAG_IS_ASCII;
- const lit_utf8_byte_t *separator_buffer_p = ecma_string_get_chars (separator_p,
- &separator_size,
- NULL,
- NULL,
- &separator_flags);
+ const lit_utf8_byte_t *separator_buffer_p =
+ ecma_string_get_chars (separator_p, &separator_size, NULL, NULL, &separator_flags);
const lit_utf8_byte_t *const string_end_p = string_buffer_p + string_size;
- const lit_utf8_byte_t *const compare_end_p = JERRY_MIN (string_end_p - separator_size + 1,
- string_end_p);
+ const lit_utf8_byte_t *const compare_end_p = JERRY_MIN (string_end_p - separator_size + 1, string_end_p);
const lit_utf8_byte_t *current_p = string_buffer_p;
const lit_utf8_byte_t *last_str_begin_p = string_buffer_p;
while (current_p < compare_end_p)
{
- if (!memcmp (current_p, separator_buffer_p, separator_size)
- && (last_str_begin_p != current_p + separator_size))
+ if (!memcmp (current_p, separator_buffer_p, separator_size) && (last_str_begin_p != current_p + separator_size))
{
- ecma_string_t *substr_p = ecma_new_ecma_string_from_utf8 (last_str_begin_p,
- (lit_utf8_size_t) (current_p - last_str_begin_p));
+ ecma_string_t *substr_p =
+ ecma_new_ecma_string_from_utf8 (last_str_begin_p, (lit_utf8_size_t) (current_p - last_str_begin_p));
ecma_value_t put_result = ecma_builtin_helper_def_prop_by_index (array_p,
array_length++,
ecma_make_string_value (substr_p),
@@ -1092,8 +1062,8 @@ ecma_builtin_string_prototype_object_split (ecma_value_t this_value, /**< this a
lit_utf8_incr (&current_p);
}
- ecma_string_t *end_substr_p = ecma_new_ecma_string_from_utf8 (last_str_begin_p,
- (lit_utf8_size_t) (string_end_p - last_str_begin_p));
+ ecma_string_t *end_substr_p =
+ ecma_new_ecma_string_from_utf8 (last_str_begin_p, (lit_utf8_size_t) (string_end_p - last_str_begin_p));
ecma_value_t put_result = ecma_builtin_helper_def_prop_by_index (array_p,
array_length,
ecma_make_string_value (end_substr_p),
@@ -1211,8 +1181,7 @@ ecma_builtin_string_prototype_object_conversion_helper (ecma_string_t *input_str
lit_code_point_t cp = lit_cesu8_read_next (&input_curr_p);
#if JERRY_ESNEXT
- if (lit_is_code_point_utf16_high_surrogate (cp)
- && input_curr_p < input_str_end_p)
+ if (lit_is_code_point_utf16_high_surrogate (cp) && input_curr_p < input_str_end_p)
{
const ecma_char_t next_ch = lit_cesu8_peek_next (input_curr_p);
if (lit_is_code_point_utf16_low_surrogate (next_ch))
@@ -1312,8 +1281,7 @@ ecma_builtin_string_prototype_object_repeat (ecma_string_t *original_string_p, /
for (int32_t n = 0; n < repeat_count; n++)
{
- buffer_ptr += ecma_string_copy_to_cesu8_buffer (original_string_p, buffer_ptr,
- (lit_utf8_size_t) (size));
+ buffer_ptr += ecma_string_copy_to_cesu8_buffer (original_string_p, buffer_ptr, (lit_utf8_size_t) (size));
}
ret_string_p = ecma_new_ecma_string_from_utf8 (str_buffer, (lit_utf8_size_t) (buffer_ptr - str_buffer));
@@ -1353,17 +1321,14 @@ ecma_builtin_string_prototype_object_code_point_at (ecma_string_t *this_string_p
ecma_char_t first = ecma_string_get_char_at_pos (this_string_p, index);
- if (first < LIT_UTF16_HIGH_SURROGATE_MIN
- || first > LIT_UTF16_HIGH_SURROGATE_MAX
- || index + 1 == length)
+ if (first < LIT_UTF16_HIGH_SURROGATE_MIN || first > LIT_UTF16_HIGH_SURROGATE_MAX || index + 1 == length)
{
return ecma_make_uint32_value (first);
}
ecma_char_t second = ecma_string_get_char_at_pos (this_string_p, index + 1);
- if (second < LIT_UTF16_LOW_SURROGATE_MARKER
- || second > LIT_UTF16_LOW_SURROGATE_MAX)
+ if (second < LIT_UTF16_LOW_SURROGATE_MARKER || second > LIT_UTF16_LOW_SURROGATE_MAX)
{
return ecma_make_uint32_value (first);
}
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.inc.h
index 5e78ffed..ba3278f1 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string-prototype.inc.h
@@ -25,17 +25,13 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.5.4.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_STRING,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_STRING, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* Number properties:
* (property name, number value) */
/* ECMA-262 v5, 15.5.4 (String.prototype is itself a String object whose value is an empty String), 15.5.5.1 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 0,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FIXED)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
@@ -77,19 +73,15 @@ ROUTINE (LIT_MAGIC_STRING_STARTS_WITH, ECMA_STRING_PROTOTYPE_STARTS_WITH, 2, 1)
ROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_STRING_PROTOTYPE_INCLUDES, 2, 1)
ROUTINE (LIT_MAGIC_STRING_ENDS_WITH, ECMA_STRING_PROTOTYPE_ENDS_WITH, 2, 1)
ROUTINE (LIT_MAGIC_STRING_CODE_POINT_AT, ECMA_STRING_PROTOTYPE_CODE_POINT_AT, 1, 1)
-ROUTINE (LIT_MAGIC_STRING_PAD_START, ECMA_STRING_PROTOTYPE_PAD_START, 2, 1)
-ROUTINE (LIT_MAGIC_STRING_PAD_END, ECMA_STRING_PROTOTYPE_PAD_END, 2, 1)
+ROUTINE (LIT_MAGIC_STRING_PAD_START, ECMA_STRING_PROTOTYPE_PAD_START, 2, 1)
+ROUTINE (LIT_MAGIC_STRING_PAD_END, ECMA_STRING_PROTOTYPE_PAD_END, 2, 1)
ROUTINE (LIT_GLOBAL_SYMBOL_ITERATOR, ECMA_STRING_PROTOTYPE_ITERATOR, 0, 0)
ROUTINE (LIT_MAGIC_STRING_MATCH_ALL, ECMA_STRING_PROTOTYPE_MATCH_ALL, 1, 1)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_START, LIT_MAGIC_STRING_TRIM_START,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_LEFT, LIT_MAGIC_STRING_TRIM_START,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_END, LIT_MAGIC_STRING_TRIM_END,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_RIGHT, LIT_MAGIC_STRING_TRIM_END,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_START, LIT_MAGIC_STRING_TRIM_START, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_LEFT, LIT_MAGIC_STRING_TRIM_START, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_END, LIT_MAGIC_STRING_TRIM_END, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TRIM_RIGHT, LIT_MAGIC_STRING_TRIM_END, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_STRING */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string.c b/jerry-core/ecma/builtin-objects/ecma-builtin-string.c
index db4ca8a6..206889ba 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-string.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string.c
@@ -13,7 +13,6 @@
* limitations under the License.
*/
-#include "lit-strings.h"
#include "ecma-alloc.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
@@ -23,6 +22,8 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
+
+#include "lit-strings.h"
#if JERRY_ESNEXT
#include "ecma-symbol-object.h"
#endif /* JERRY_ESNEXT */
@@ -50,7 +51,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-string.inc.h"
-#define BUILTIN_UNDERSCORED_ID string
+#define BUILTIN_UNDERSCORED_ID string
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -85,15 +86,11 @@ ecma_builtin_string_object_from_char_code (const ecma_value_t args[], /**< argum
ecma_string_t *ret_string_p = NULL;
bool isError = false;
- JMEM_DEFINE_LOCAL_ARRAY (utf8_buf_p,
- utf8_buf_size,
- lit_utf8_byte_t);
+ JMEM_DEFINE_LOCAL_ARRAY (utf8_buf_p, utf8_buf_size, lit_utf8_byte_t);
lit_utf8_size_t utf8_buf_used = 0;
- for (uint32_t arg_index = 0;
- arg_index < args_number;
- arg_index++)
+ for (uint32_t arg_index = 0; arg_index < args_number; arg_index++)
{
ecma_number_t arg_num;
@@ -411,7 +408,7 @@ ecma_builtin_string_dispatch_routine (uint8_t builtin_routine_id, /**< built-in
switch (builtin_routine_id)
{
- case ECMA_BUILTIN_STRING_OBJECT_FROM_CHAR_CODE:
+ case ECMA_BUILTIN_STRING_OBJECT_FROM_CHAR_CODE:
{
return ecma_builtin_string_object_from_char_code (arguments_list_p, arguments_number);
}
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-string.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-string.inc.h
index 0d08ace2..8bc41343 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-string.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-string.inc.h
@@ -24,22 +24,16 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.7.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_STRING_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_STRING_PROTOTYPE, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_STRING_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_STRING_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
/* Routine properties:
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.c
index 9bd30dce..c508148b 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.c
@@ -13,16 +13,17 @@
* limitations under the License.
*/
- #include "ecma-alloc.h"
- #include "ecma-builtins.h"
- #include "ecma-conversion.h"
- #include "ecma-exceptions.h"
- #include "ecma-gc.h"
- #include "ecma-globals.h"
- #include "ecma-helpers.h"
- #include "ecma-objects.h"
- #include "ecma-symbol-object.h"
- #include "jrt.h"
+#include "ecma-alloc.h"
+#include "ecma-builtins.h"
+#include "ecma-conversion.h"
+#include "ecma-exceptions.h"
+#include "ecma-gc.h"
+#include "ecma-globals.h"
+#include "ecma-helpers.h"
+#include "ecma-objects.h"
+#include "ecma-symbol-object.h"
+
+#include "jrt.h"
#if JERRY_ESNEXT
@@ -47,7 +48,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-symbol-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID symbol_prototype
+#define BUILTIN_UNDERSCORED_ID symbol_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h
index 15ff82a0..585b86b6 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol-prototype.inc.h
@@ -24,26 +24,17 @@
/* Object properties:
* (property name, object pointer getter) */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_SYMBOL,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SYMBOL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
ROUTINE (LIT_MAGIC_STRING_TO_STRING_UL, ECMA_SYMBOL_PROTOTYPE_TO_STRING, 0, 0)
ROUTINE (LIT_MAGIC_STRING_VALUE_OF_UL, ECMA_SYMBOL_PROTOTYPE_VALUE_OF, 0, 0)
-ROUTINE_CONFIGURABLE_ONLY (LIT_GLOBAL_SYMBOL_TO_PRIMITIVE,
- ECMA_SYMBOL_PROTOTYPE_TO_PRIMITIVE,
- 0,
- 1)
+ROUTINE_CONFIGURABLE_ONLY (LIT_GLOBAL_SYMBOL_TO_PRIMITIVE, ECMA_SYMBOL_PROTOTYPE_TO_PRIMITIVE, 0, 1)
/* ECMA-262 v6, 19.4.3.4 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_SYMBOL_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_SYMBOL_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262, v11, 19.4.3.2 */
-ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_DESCRIPTION,
- ECMA_SYMBOL_PROTOTYPE_DESCRIPTION,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_MAGIC_STRING_DESCRIPTION, ECMA_SYMBOL_PROTOTYPE_DESCRIPTION, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#include "ecma-builtin-helpers-macro-undefs.inc.h"
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c
index 5cec6a05..646a4daa 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.c
@@ -13,18 +13,19 @@
* limitations under the License.
*/
- #include "ecma-alloc.h"
- #include "ecma-builtins.h"
- #include "ecma-conversion.h"
- #include "ecma-exceptions.h"
- #include "ecma-gc.h"
- #include "ecma-globals.h"
- #include "ecma-helpers.h"
- #include "ecma-objects.h"
- #include "ecma-symbol-object.h"
- #include "ecma-literal-storage.h"
- #include "jcontext.h"
- #include "jrt.h"
+#include "ecma-alloc.h"
+#include "ecma-builtins.h"
+#include "ecma-conversion.h"
+#include "ecma-exceptions.h"
+#include "ecma-gc.h"
+#include "ecma-globals.h"
+#include "ecma-helpers.h"
+#include "ecma-literal-storage.h"
+#include "ecma-objects.h"
+#include "ecma-symbol-object.h"
+
+#include "jcontext.h"
+#include "jrt.h"
#if JERRY_ESNEXT
@@ -32,7 +33,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-symbol.inc.h"
-#define BUILTIN_UNDERSCORED_ID symbol
+#define BUILTIN_UNDERSCORED_ID symbol
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -106,15 +107,13 @@ ecma_builtin_symbol_for_helper (ecma_value_t value_to_find) /**< symbol or ecma-
while (symbol_list_cp != JMEM_CP_NULL)
{
- ecma_lit_storage_item_t *symbol_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t,
- symbol_list_cp);
+ ecma_lit_storage_item_t *symbol_list_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_lit_storage_item_t, symbol_list_cp);
for (int i = 0; i < ECMA_LIT_STORAGE_VALUE_COUNT; i++)
{
if (symbol_list_p->values[i] != JMEM_CP_NULL)
{
- ecma_string_t *value_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t,
- symbol_list_p->values[i]);
+ ecma_string_t *value_p = JMEM_CP_GET_NON_NULL_POINTER (ecma_string_t, symbol_list_p->values[i]);
if (is_for)
{
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.inc.h
index a2037c82..1d34b3a4 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-symbol.inc.h
@@ -25,73 +25,54 @@
* (property name, number value, writable, enumerable, configurable) */
/* ECMA-262 v6, 19.4.2 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 0,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_SYMBOL_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SYMBOL_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v6, 19.4.2.7 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE, ECMA_PROPERTY_FIXED)
/* ECMA-262 v10, 19.4.2.1 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_ASYNC_ITERATOR,
- LIT_GLOBAL_SYMBOL_ASYNC_ITERATOR)
+SYMBOL_VALUE (LIT_MAGIC_STRING_ASYNC_ITERATOR, LIT_GLOBAL_SYMBOL_ASYNC_ITERATOR)
/* ECMA-262 v6, 19.4.2.2 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_HAS_INSTANCE,
- LIT_GLOBAL_SYMBOL_HAS_INSTANCE)
+SYMBOL_VALUE (LIT_MAGIC_STRING_HAS_INSTANCE, LIT_GLOBAL_SYMBOL_HAS_INSTANCE)
/* ECMA-262 v6, 19.4.2.3 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE,
- LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE)
+SYMBOL_VALUE (LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE, LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE)
/* ECMA-262 v6, 19.4.2.4 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_ITERATOR,
- LIT_GLOBAL_SYMBOL_ITERATOR)
+SYMBOL_VALUE (LIT_MAGIC_STRING_ITERATOR, LIT_GLOBAL_SYMBOL_ITERATOR)
/* ECMA-262 v6, 19.4.2.6 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_MATCH,
- LIT_GLOBAL_SYMBOL_MATCH)
+SYMBOL_VALUE (LIT_MAGIC_STRING_MATCH, LIT_GLOBAL_SYMBOL_MATCH)
/* ECMA-262 v6, 19.4.2.8 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_REPLACE,
- LIT_GLOBAL_SYMBOL_REPLACE)
+SYMBOL_VALUE (LIT_MAGIC_STRING_REPLACE, LIT_GLOBAL_SYMBOL_REPLACE)
/* ECMA-262 v6, 19.4.2.9 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_SEARCH,
- LIT_GLOBAL_SYMBOL_SEARCH)
+SYMBOL_VALUE (LIT_MAGIC_STRING_SEARCH, LIT_GLOBAL_SYMBOL_SEARCH)
/* ECMA-262 v6, 19.4.2.10 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_SPECIES,
- LIT_GLOBAL_SYMBOL_SPECIES)
+SYMBOL_VALUE (LIT_MAGIC_STRING_SPECIES, LIT_GLOBAL_SYMBOL_SPECIES)
/* ECMA-262 v6, 19.4.2.11 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_SPLIT,
- LIT_GLOBAL_SYMBOL_SPLIT)
+SYMBOL_VALUE (LIT_MAGIC_STRING_SPLIT, LIT_GLOBAL_SYMBOL_SPLIT)
/* ECMA-262 v6, 19.4.2.12 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_TO_PRIMITIVE,
- LIT_GLOBAL_SYMBOL_TO_PRIMITIVE)
+SYMBOL_VALUE (LIT_MAGIC_STRING_TO_PRIMITIVE, LIT_GLOBAL_SYMBOL_TO_PRIMITIVE)
/* ECMA-262 v6, 19.4.2.13 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_TO_STRING_TAG,
- LIT_GLOBAL_SYMBOL_TO_STRING_TAG)
+SYMBOL_VALUE (LIT_MAGIC_STRING_TO_STRING_TAG, LIT_GLOBAL_SYMBOL_TO_STRING_TAG)
/* ECMA-262 v6, 19.4.2.14 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_UNSCOPABLES,
- LIT_GLOBAL_SYMBOL_UNSCOPABLES)
+SYMBOL_VALUE (LIT_MAGIC_STRING_UNSCOPABLES, LIT_GLOBAL_SYMBOL_UNSCOPABLES)
/* ECMA-262 v11, 19.4.2.8 */
-SYMBOL_VALUE (LIT_MAGIC_STRING_MATCH_ALL,
- LIT_GLOBAL_SYMBOL_MATCH_ALL)
+SYMBOL_VALUE (LIT_MAGIC_STRING_MATCH_ALL, LIT_GLOBAL_SYMBOL_MATCH_ALL)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c
index 915c586f..2e5e7b8c 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.c
@@ -22,6 +22,7 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -30,7 +31,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-syntaxerror-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID syntax_error_prototype
+#define BUILTIN_UNDERSCORED_ID syntax_error_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h
index abaf5a4f..670efc1d 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror-prototype.inc.h
@@ -25,19 +25,13 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.7.8 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_SYNTAX_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_SYNTAX_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.9 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_SYNTAX_ERROR_UL,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SYNTAX_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.10 */
-STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
- LIT_MAGIC_STRING__EMPTY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.c
index 29d2ce6c..6227ef60 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.c
@@ -14,17 +14,18 @@
*/
#include "ecma-alloc.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-builtin-helpers.h"
#include "ecma-objects.h"
-#include "ecma-function-object.h"
-#include "jrt.h"
+
#include "jcontext.h"
+#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -32,7 +33,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-syntaxerror.inc.h"
-#define BUILTIN_UNDERSCORED_ID syntax_error
+#define BUILTIN_UNDERSCORED_ID syntax_error
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h
index 88e12d51..18df8255 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-syntaxerror.inc.h
@@ -24,22 +24,16 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_SYNTAX_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_SYNTAX_ERROR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_SYNTAX_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.c b/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.c
index 98a68f03..3e2f9df3 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.c
@@ -21,13 +21,14 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
+
#include "jrt.h"
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-type-error-thrower.inc.h"
-#define BUILTIN_UNDERSCORED_ID type_error_thrower
+#define BUILTIN_UNDERSCORED_ID type_error_thrower
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h
index 4833a075..e44c8aba 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-type-error-thrower.inc.h
@@ -24,12 +24,8 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 0,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FIXED)
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING__EMPTY,
- ECMA_PROPERTY_FIXED)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_FIXED)
#include "ecma-builtin-helpers-macro-undefs.inc.h"
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.c
index 45ad8210..9e9971a1 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.c
@@ -22,6 +22,7 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -30,7 +31,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-typeerror-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID type_error_prototype
+#define BUILTIN_UNDERSCORED_ID type_error_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h
index b34fb39e..4d0b4f28 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror-prototype.inc.h
@@ -25,19 +25,13 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.7.8 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_TYPE_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_TYPE_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.9 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_TYPE_ERROR_UL,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_TYPE_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.10 */
-STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
- LIT_MAGIC_STRING__EMPTY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.c
index 608f241f..a16fce50 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.c
@@ -14,17 +14,18 @@
*/
#include "ecma-alloc.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-builtin-helpers.h"
#include "ecma-objects.h"
-#include "ecma-function-object.h"
-#include "jrt.h"
+
#include "jcontext.h"
+#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -32,7 +33,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-typeerror.inc.h"
-#define BUILTIN_UNDERSCORED_ID type_error
+#define BUILTIN_UNDERSCORED_ID type_error
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -69,8 +70,8 @@ ecma_builtin_type_error_dispatch_construct (const ecma_value_t *arguments_list_p
#if !JERRY_ESNEXT
return ecma_builtin_type_error_dispatch_call (arguments_list_p, arguments_list_len);
#else /* JERRY_ESNEXT */
- ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
- ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE);
+ ecma_object_t *proto_p =
+ ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE);
if (proto_p == NULL)
{
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.inc.h
index bcd735b1..a4508f91 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-typeerror.inc.h
@@ -24,22 +24,16 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_TYPE_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_TYPE_ERROR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_TYPE_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.c
index 068ec26a..26acbaba 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.c
@@ -22,6 +22,7 @@
#include "ecma-helpers.h"
#include "ecma-objects.h"
#include "ecma-string-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -30,7 +31,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-urierror-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID uri_error_prototype
+#define BUILTIN_UNDERSCORED_ID uri_error_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h
index caa932cd..2b6fd89c 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror-prototype.inc.h
@@ -25,19 +25,13 @@
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.7.8 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_URI_ERROR,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_URI_ERROR, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.9 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_URI_ERROR_UL,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_URI_ERROR_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v5, 15.11.7.10 */
-STRING_VALUE (LIT_MAGIC_STRING_MESSAGE,
- LIT_MAGIC_STRING__EMPTY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+STRING_VALUE (LIT_MAGIC_STRING_MESSAGE, LIT_MAGIC_STRING__EMPTY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.c b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.c
index fed1838e..52d7a2b6 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.c
@@ -14,17 +14,18 @@
*/
#include "ecma-alloc.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-builtin-helpers.h"
#include "ecma-objects.h"
-#include "ecma-function-object.h"
-#include "jrt.h"
+
#include "jcontext.h"
+#include "jrt.h"
#if JERRY_BUILTIN_ERRORS
@@ -32,7 +33,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-urierror.inc.h"
-#define BUILTIN_UNDERSCORED_ID uri_error
+#define BUILTIN_UNDERSCORED_ID uri_error
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -69,8 +70,8 @@ ecma_builtin_uri_error_dispatch_construct (const ecma_value_t *arguments_list_p,
#if !JERRY_ESNEXT
return ecma_builtin_uri_error_dispatch_call (arguments_list_p, arguments_list_len);
#else /* JERRY_ESNEXT */
- ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
- ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE);
+ ecma_object_t *proto_p =
+ ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE);
if (proto_p == NULL)
{
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.inc.h
index 08259451..fd98a1d7 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-urierror.inc.h
@@ -24,22 +24,16 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_DEFAULT_LENGTH)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v5, 15.11.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_URI_ERROR_PROTOTYPE, ECMA_PROPERTY_FIXED)
#if JERRY_ESNEXT
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_URI_ERROR_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_URI_ERROR_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_ESNEXT */
#endif /* JERRY_BUILTIN_ERRORS */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.c
index d522e9da..2a8d6768 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.c
@@ -25,7 +25,7 @@
*/
#define BUILTIN_CUSTOM_DISPATCH
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakmap-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID weakmap_prototype
+#define BUILTIN_UNDERSCORED_ID weakmap_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h
index d2c1acc6..75d61770 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap-prototype.inc.h
@@ -25,14 +25,10 @@
* (property name, object pointer getter) */
/* ECMA-262 v6, 23.3.3.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_WEAKMAP,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_WEAKMAP, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 23.3.3.6 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_WEAKMAP_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_WEAKMAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c
index 7496e335..76dcfedf 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.c
@@ -14,8 +14,8 @@
*/
#include "ecma-builtins.h"
-#include "ecma-exceptions.h"
#include "ecma-container-object.h"
+#include "ecma-exceptions.h"
#if JERRY_BUILTIN_CONTAINER
@@ -23,7 +23,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakmap.inc.h"
-#define BUILTIN_UNDERSCORED_ID weakmap
+#define BUILTIN_UNDERSCORED_ID weakmap
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.inc.h
index 141b1824..8bf9843f 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakmap.inc.h
@@ -25,22 +25,16 @@
* (property name, number value, writable, enumerable, configurable) */
/* ECMA-262 v6, 23.3.2 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 0,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 23.1 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_WEAKMAP_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_WEAKMAP_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v6, 23.3.2.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE, ECMA_PROPERTY_FIXED)
#endif /* JERRY_BUILTIN_CONTAINER */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.c
index b5a93fea..be72d066 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.c
@@ -39,7 +39,7 @@ enum
* This object has a custom dispatch function.
*/
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakref-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID weakref_prototype
+#define BUILTIN_UNDERSCORED_ID weakref_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -52,12 +52,12 @@ enum
* @{
*/
- /**
- * Deref checks weakRef target
- *
- * @return weakRef target
- * error - otherwise
- */
+/**
+ * Deref checks weakRef target
+ *
+ * @return weakRef target
+ * error - otherwise
+ */
static ecma_value_t
ecma_builtin_weakref_prototype_object_deref (ecma_value_t this_arg) /**< this argument */
{
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h
index cf05cf43..533d3956 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref-prototype.inc.h
@@ -24,13 +24,9 @@
/* Object properties:
* (property name, object pointer getter) */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_WEAKREF,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_WEAKREF, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_WEAKREF_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_WEAKREF_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.c
index 381888f4..286c76e8 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.c
@@ -15,17 +15,18 @@
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
-#include "jcontext.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
+#include "jcontext.h"
+
#if JERRY_BUILTIN_WEAKREF
#define ECMA_BUILTINS_INTERNAL
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakref.inc.h"
-#define BUILTIN_UNDERSCORED_ID weakref
+#define BUILTIN_UNDERSCORED_ID weakref
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -68,17 +69,15 @@ ecma_builtin_weakref_dispatch_construct (const ecma_value_t *arguments_list_p, /
JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) != NULL);
- ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
- ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE);
+ ecma_object_t *proto_p =
+ ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE);
if (JERRY_UNLIKELY (proto_p == NULL))
{
return ECMA_VALUE_ERROR;
}
- ecma_object_t *object_p = ecma_create_object (proto_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_deref_object (proto_p);
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
ext_obj_p->u.cls.type = ECMA_OBJECT_CLASS_WEAKREF;
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.inc.h
index 6a2109ba..d4e6e5b5 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakref.inc.h
@@ -24,20 +24,14 @@
/* Number properties:
* (property name, number value, writable, enumerable, configurable) */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 1,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 1, ECMA_PROPERTY_FLAG_CONFIGURABLE)
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_WEAKREF_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_WEAKREF_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Object properties:
* (property name, object pointer getter) */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_WEAKREF_PROTOTYPE, ECMA_PROPERTY_FIXED)
#endif /* JERRY_BUILTIN_WEAKREF */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.c
index c1232d42..370c5047 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.c
@@ -25,7 +25,7 @@
*/
#define BUILTIN_CUSTOM_DISPATCH
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakset-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID weakset_prototype
+#define BUILTIN_UNDERSCORED_ID weakset_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h
index 6c203333..6221f895 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset-prototype.inc.h
@@ -25,14 +25,10 @@
* (property name, object pointer getter) */
/* ECMA-262 v6, 23.4.3.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_WEAKSET,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_WEAKSET, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ECMA-262 v6, 23.4.3.5 */
-STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG,
- LIT_MAGIC_STRING_WEAKSET_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_GLOBAL_SYMBOL_TO_STRING_TAG, LIT_MAGIC_STRING_WEAKSET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c
index d96790dd..1bd04ec4 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.c
@@ -14,8 +14,8 @@
*/
#include "ecma-builtins.h"
-#include "ecma-exceptions.h"
#include "ecma-container-object.h"
+#include "ecma-exceptions.h"
#if JERRY_BUILTIN_CONTAINER
@@ -23,7 +23,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-weakset.inc.h"
-#define BUILTIN_UNDERSCORED_ID weakset
+#define BUILTIN_UNDERSCORED_ID weakset
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.inc.h
index d9331786..8aa16c84 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtin-weakset.inc.h
@@ -25,22 +25,16 @@
* (property name, number value, writable, enumerable, configurable) */
/* ECMA-262 v6, 23.4.2 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 0,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ECMA-262 v6, 23.4 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_WEAKSET_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_WEAKSET_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* Object properties:
* (property name, object pointer getter) */
/* ECMA-262 v6, 23.4.2.1 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_WEAKSET_PROTOTYPE, ECMA_PROPERTY_FIXED)
#endif /* JERRY_BUILTIN_CONTAINER */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h b/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h
index a158c0f0..c8030b6b 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtins-internal.h
@@ -17,7 +17,7 @@
#define ECMA_BUILTINS_INTERNAL_H
#ifndef ECMA_BUILTINS_INTERNAL
-# error "!ECMA_BUILTINS_INTERNAL"
+#error "!ECMA_BUILTINS_INTERNAL"
#endif /* !ECMA_BUILTINS_INTERNAL */
#include "ecma-builtins.h"
@@ -80,36 +80,20 @@ typedef struct
uint16_t value; /**< value of the property */
} ecma_builtin_property_descriptor_t;
-#define BUILTIN_ROUTINE(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
-extern const ecma_builtin_property_descriptor_t \
-ecma_builtin_ ## lowercase_name ## _property_descriptor_list[]; \
-ecma_value_t \
-ecma_builtin_ ## lowercase_name ## _dispatch_call (const ecma_value_t *, \
- uint32_t); \
-ecma_value_t \
-ecma_builtin_ ## lowercase_name ## _dispatch_construct (const ecma_value_t *, \
- uint32_t); \
-ecma_value_t \
-ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint8_t builtin_routine_id, \
- ecma_value_t this_arg_value, \
- const ecma_value_t [], \
- uint32_t);
-#define BUILTIN(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
-extern const ecma_builtin_property_descriptor_t \
-ecma_builtin_ ## lowercase_name ## _property_descriptor_list[]; \
-ecma_value_t \
-ecma_builtin_ ## lowercase_name ## _dispatch_routine (uint8_t builtin_routine_id, \
- ecma_value_t this_arg_value, \
- const ecma_value_t [], \
- uint32_t);
+#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
+ extern const ecma_builtin_property_descriptor_t ecma_builtin_##lowercase_name##_property_descriptor_list[]; \
+ ecma_value_t ecma_builtin_##lowercase_name##_dispatch_call (const ecma_value_t *, uint32_t); \
+ ecma_value_t ecma_builtin_##lowercase_name##_dispatch_construct (const ecma_value_t *, uint32_t); \
+ ecma_value_t ecma_builtin_##lowercase_name##_dispatch_routine (uint8_t builtin_routine_id, \
+ ecma_value_t this_arg_value, \
+ const ecma_value_t[], \
+ uint32_t);
+#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
+ extern const ecma_builtin_property_descriptor_t ecma_builtin_##lowercase_name##_property_descriptor_list[]; \
+ ecma_value_t ecma_builtin_##lowercase_name##_dispatch_routine (uint8_t builtin_routine_id, \
+ ecma_value_t this_arg_value, \
+ const ecma_value_t[], \
+ uint32_t);
#include "ecma-builtins.inc.h"
#undef BUILTIN_ROUTINE
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins.c b/jerry-core/ecma/builtin-objects/ecma-builtins.c
index d95c111f..b2473bef 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtins.c
+++ b/jerry-core/ecma/builtin-objects/ecma-builtins.c
@@ -13,14 +13,16 @@
* limitations under the License.
*/
-#include "ecma-alloc.h"
#include "ecma-builtins.h"
+
+#include "ecma-alloc.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-function-object.h"
#include "ecma-objects.h"
+
#include "jcontext.h"
#include "jrt-bit-fields.h"
@@ -58,8 +60,7 @@ typedef ecma_value_t (*ecma_builtin_dispatch_routine_t) (uint8_t builtin_routine
/**
* Definition of built-in dispatch call function pointer.
*/
-typedef ecma_value_t (*ecma_builtin_dispatch_call_t) (const ecma_value_t arguments_list[],
- uint32_t arguments_number);
+typedef ecma_value_t (*ecma_builtin_dispatch_call_t) (const ecma_value_t arguments_list[], uint32_t arguments_number);
/**
* Definition of a builtin descriptor which contains the builtin object's:
* - prototype objects's id (13-bits)
@@ -85,36 +86,26 @@ typedef uint16_t ecma_builtin_descriptor_t;
/**
* Create a builtin descriptor value
*/
-#define ECMA_MAKE_BUILTIN_DESCRIPTOR(type, proto_id) \
- (((proto_id) << ECMA_BUILTIN_PROTOTYPE_ID_SHIFT) | (type))
+#define ECMA_MAKE_BUILTIN_DESCRIPTOR(type, proto_id) (((proto_id) << ECMA_BUILTIN_PROTOTYPE_ID_SHIFT) | (type))
/**
* List of the built-in descriptors.
*/
-static const ecma_builtin_descriptor_t ecma_builtin_descriptors[] =
-{
+static const ecma_builtin_descriptor_t ecma_builtin_descriptors[] = {
/** @cond doxygen_suppress */
#define BUILTIN(a, b, c, d, e)
-#define BUILTIN_ROUTINE(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
+#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
ECMA_MAKE_BUILTIN_DESCRIPTOR (object_type, object_prototype_builtin_id),
#include "ecma-builtins.inc.h"
#undef BUILTIN
#undef BUILTIN_ROUTINE
#define BUILTIN_ROUTINE(a, b, c, d, e)
-#define BUILTIN(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
+#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
ECMA_MAKE_BUILTIN_DESCRIPTOR (object_type, object_prototype_builtin_id),
#include "ecma-builtins.inc.h"
#undef BUILTIN
#undef BUILTIN_ROUTINE
-/** @endcond */
+ /** @endcond */
};
#ifndef JERRY_NDEBUG
@@ -123,26 +114,18 @@ enum
{
ECMA_BUILTIN_EXTENSIBLE_CHECK =
#define BUILTIN(a, b, c, d, e)
-#define BUILTIN_ROUTINE(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
+#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
(is_extensible != 0 || builtin_id == ECMA_BUILTIN_ID_TYPE_ERROR_THROWER) &&
#include "ecma-builtins.inc.h"
#undef BUILTIN
#undef BUILTIN_ROUTINE
#define BUILTIN_ROUTINE(a, b, c, d, e)
-#define BUILTIN(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
+#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
(is_extensible != 0 || builtin_id == ECMA_BUILTIN_ID_TYPE_ERROR_THROWER) &&
#include "ecma-builtins.inc.h"
#undef BUILTIN
#undef BUILTIN_ROUTINE
- true
+ true
};
/** @endcond */
@@ -156,97 +139,69 @@ JERRY_STATIC_ASSERT (ECMA_BUILTIN_EXTENSIBLE_CHECK == true,
/**
* List of the built-in routines.
*/
-static const ecma_builtin_dispatch_routine_t ecma_builtin_routines[] =
-{
+static const ecma_builtin_dispatch_routine_t ecma_builtin_routines[] = {
/** @cond doxygen_suppress */
#define BUILTIN(a, b, c, d, e)
-#define BUILTIN_ROUTINE(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
- ecma_builtin_ ## lowercase_name ## _dispatch_routine,
+#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
+ ecma_builtin_##lowercase_name##_dispatch_routine,
#include "ecma-builtins.inc.h"
#undef BUILTIN
#undef BUILTIN_ROUTINE
#define BUILTIN_ROUTINE(a, b, c, d, e)
-#define BUILTIN(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
- ecma_builtin_ ## lowercase_name ## _dispatch_routine,
+#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
+ ecma_builtin_##lowercase_name##_dispatch_routine,
#include "ecma-builtins.inc.h"
#undef BUILTIN
#undef BUILTIN_ROUTINE
-/** @endcond */
+ /** @endcond */
};
/**
* List of the built-in call functions.
*/
-static const ecma_builtin_dispatch_call_t ecma_builtin_call_functions[] =
-{
+static const ecma_builtin_dispatch_call_t ecma_builtin_call_functions[] = {
/** @cond doxygen_suppress */
#define BUILTIN(a, b, c, d, e)
-#define BUILTIN_ROUTINE(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
- ecma_builtin_ ## lowercase_name ## _dispatch_call,
+#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
+ ecma_builtin_##lowercase_name##_dispatch_call,
#include "ecma-builtins.inc.h"
#undef BUILTIN_ROUTINE
#undef BUILTIN
-/** @endcond */
+ /** @endcond */
};
/**
* List of the built-in construct functions.
*/
-static const ecma_builtin_dispatch_call_t ecma_builtin_construct_functions[] =
-{
+static const ecma_builtin_dispatch_call_t ecma_builtin_construct_functions[] = {
/** @cond doxygen_suppress */
#define BUILTIN(a, b, c, d, e)
-#define BUILTIN_ROUTINE(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
- ecma_builtin_ ## lowercase_name ## _dispatch_construct,
+#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
+ ecma_builtin_##lowercase_name##_dispatch_construct,
#include "ecma-builtins.inc.h"
#undef BUILTIN_ROUTINE
#undef BUILTIN
-/** @endcond */
+ /** @endcond */
};
/**
* Property descriptor lists for all built-ins.
*/
-static const ecma_builtin_property_list_reference_t ecma_builtin_property_list_references[] =
-{
+static const ecma_builtin_property_list_reference_t ecma_builtin_property_list_references[] = {
/** @cond doxygen_suppress */
#define BUILTIN(a, b, c, d, e)
-#define BUILTIN_ROUTINE(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
- ecma_builtin_ ## lowercase_name ## _property_descriptor_list,
+#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
+ ecma_builtin_##lowercase_name##_property_descriptor_list,
#include "ecma-builtins.inc.h"
#undef BUILTIN
#undef BUILTIN_ROUTINE
#define BUILTIN_ROUTINE(a, b, c, d, e)
-#define BUILTIN(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
- ecma_builtin_ ## lowercase_name ## _property_descriptor_list,
+#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) \
+ ecma_builtin_##lowercase_name##_property_descriptor_list,
#include "ecma-builtins.inc.h"
#undef BUILTIN_ROUTINE
#undef BUILTIN
-/** @endcond */
+ /** @endcond */
};
/**
@@ -291,7 +246,7 @@ ecma_builtin_is_global (ecma_object_t *object_p) /**< pointer to an object */
*
* @return pointer to the global object
*/
-extern inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE
ecma_builtin_get_global (void)
{
JERRY_ASSERT (JERRY_CONTEXT (global_object_p) != NULL);
@@ -330,10 +285,8 @@ ecma_builtin_get_realm (ecma_object_t *builtin_object_p) /**< built-in object */
ecma_object_type_t object_type = ecma_get_object_type (builtin_object_p);
ecma_value_t realm_value;
- JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL
- || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS
- || object_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY
- || object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
+ JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS
+ || object_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY || object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (object_type))
{
@@ -384,15 +337,13 @@ ecma_instantiate_builtin (ecma_global_object_t *global_object_p, /**< global obj
ecma_object_type_t obj_type = (ecma_object_type_t) (builtin_desc & ECMA_BUILTIN_OBJECT_TYPE_MASK);
- JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL
- || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS
- || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY
- || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
+ JERRY_ASSERT (obj_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS
+ || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY || obj_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
bool is_extended_built_in = ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (obj_type);
- size_t ext_object_size = (is_extended_built_in ? sizeof (ecma_extended_built_in_object_t)
- : sizeof (ecma_extended_object_t));
+ size_t ext_object_size =
+ (is_extended_built_in ? sizeof (ecma_extended_built_in_object_t) : sizeof (ecma_extended_object_t));
size_t property_count = ecma_builtin_get_property_count (obj_builtin_id);
@@ -527,8 +478,8 @@ ecma_instantiate_builtin (ecma_global_object_t *global_object_p, /**< global obj
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_REGEXP;
- re_compiled_code_t *bc_p = re_compile_bytecode (ecma_get_magic_string (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP),
- RE_FLAG_EMPTY);
+ re_compiled_code_t *bc_p =
+ re_compile_bytecode (ecma_get_magic_string (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP), RE_FLAG_EMPTY);
JERRY_ASSERT (bc_p != NULL);
@@ -678,7 +629,7 @@ ecma_builtin_get_from_realm (ecma_global_object_t *global_object_p, /**< global
*
* @return pointer to the object's instance
*/
-static inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE
+static inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE
ecma_builtin_get_from_builtin (ecma_object_t *builtin_object_p, /**< built-in object */
ecma_builtin_id_t builtin_id) /**< id of built-in to check on */
{
@@ -706,14 +657,11 @@ ecma_builtin_make_function_object_for_routine (ecma_object_t *builtin_object_p,
uint32_t routine_index, /**< property descriptor index of routine */
uint8_t flags) /**< see also: ecma_builtin_routine_flags */
{
- ecma_object_t *prototype_obj_p = ecma_builtin_get_from_builtin (builtin_object_p,
- ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
+ ecma_object_t *prototype_obj_p = ecma_builtin_get_from_builtin (builtin_object_p, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
size_t ext_object_size = sizeof (ecma_extended_object_t);
- ecma_object_t *func_obj_p = ecma_create_object (prototype_obj_p,
- ext_object_size,
- ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
+ ecma_object_t *func_obj_p = ecma_create_object (prototype_obj_p, ext_object_size, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
JERRY_ASSERT (routine_id > 0);
JERRY_ASSERT (routine_index <= UINT8_MAX);
@@ -799,10 +747,8 @@ ecma_builtin_native_handler_try_to_instantiate_property (ecma_object_t *object_p
{
if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_NAME_INITIALIZED) == 0)
{
- ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- ECMA_PROPERTY_BUILT_IN_CONFIGURABLE,
- &prop_p);
+ ecma_property_value_t *value_p =
+ ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &prop_p);
value_p->value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
}
@@ -811,10 +757,8 @@ ecma_builtin_native_handler_try_to_instantiate_property (ecma_object_t *object_p
{
if ((ext_obj_p->u.built_in.u2.routine_flags & ECMA_NATIVE_HANDLER_FLAGS_LENGTH_INITIALIZED) == 0)
{
- ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- ECMA_PROPERTY_BUILT_IN_CONFIGURABLE,
- &prop_p);
+ ecma_property_value_t *value_p =
+ ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &prop_p);
const uint8_t length = ecma_builtin_handler_get_length (ext_obj_p->u.built_in.routine_id);
value_p->value = ecma_make_integer_value (length);
@@ -869,17 +813,13 @@ ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, /**<
/* We mark that the property was lazily instantiated,
* as it is configurable and so can be deleted (ECMA-262 v6, 19.2.4.1) */
- ecma_property_value_t *len_prop_value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- ECMA_PROPERTY_BUILT_IN_CONFIGURABLE,
- &len_prop_p);
+ ecma_property_value_t *len_prop_value_p =
+ ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &len_prop_p);
#else /* !JERRY_ESNEXT */
/* We don't need to mark that the property was already lazy instantiated,
* as it is non-configurable and so can't be deleted (ECMA-262 v5, 13.2.5) */
- ecma_property_value_t *len_prop_value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- ECMA_PROPERTY_BUILT_IN_FIXED,
- &len_prop_p);
+ ecma_property_value_t *len_prop_value_p =
+ ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_FIXED, &len_prop_p);
#endif /* JERRY_ESNEXT */
uint8_t length = 0;
@@ -920,10 +860,8 @@ ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, /**<
/* We mark that the property was lazily instantiated */
ecma_property_t *name_prop_p;
- ecma_property_value_t *name_prop_value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- ECMA_PROPERTY_BUILT_IN_CONFIGURABLE,
- &name_prop_p);
+ ecma_property_value_t *name_prop_value_p =
+ ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &name_prop_p);
uint8_t routine_index = ext_func_p->u.built_in.u.routine_index;
const ecma_builtin_property_descriptor_t *property_list_p;
@@ -999,8 +937,7 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
lit_magic_string_id_t magic_string_id = ecma_get_string_magic (property_name_p);
#if JERRY_ESNEXT
- if (JERRY_UNLIKELY (ecma_prop_name_is_symbol (property_name_p))
- && property_name_p->u.hash & ECMA_GLOBAL_SYMBOL_FLAG)
+ if (JERRY_UNLIKELY (ecma_prop_name_is_symbol (property_name_p)) && property_name_p->u.hash & ECMA_GLOBAL_SYMBOL_FLAG)
{
magic_string_id = (property_name_p->u.hash >> ECMA_GLOBAL_SYMBOL_SHIFT);
}
@@ -1014,11 +951,9 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
ecma_built_in_props_t *built_in_props_p;
ecma_object_type_t object_type = ecma_get_object_type (object_p);
- JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL
- || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS
+ JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS
|| object_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY
- || (object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION
- && !ecma_builtin_function_is_routine (object_p)));
+ || (object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION && !ecma_builtin_function_is_routine (object_p)));
if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (object_type))
{
@@ -1095,8 +1030,7 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
}
else if (curr_property_p->value < ECMA_BUILTIN_NUMBER_NAN)
{
- static const ecma_number_t builtin_number_list[] =
- {
+ static const ecma_number_t builtin_number_list[] = {
ECMA_NUMBER_MAX_VALUE,
ECMA_NUMBER_MIN_VALUE,
#if JERRY_ESNEXT
@@ -1236,10 +1170,8 @@ ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, /**< object *
}
else
{
- ecma_property_value_t *prop_value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- curr_property_p->attributes,
- &prop_p);
+ ecma_property_value_t *prop_value_p =
+ ecma_create_named_data_property (object_p, property_name_p, curr_property_p->attributes, &prop_p);
prop_value_p->value = value;
/* Reference count of objects must be decreased. */
@@ -1332,11 +1264,9 @@ ecma_builtin_delete_built_in_property (ecma_object_t *object_p, /**< object */
ecma_built_in_props_t *built_in_props_p;
ecma_object_type_t object_type = ecma_get_object_type (object_p);
- JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL
- || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS
+ JERRY_ASSERT (object_type == ECMA_OBJECT_TYPE_BUILT_IN_GENERAL || object_type == ECMA_OBJECT_TYPE_BUILT_IN_CLASS
|| object_type == ECMA_OBJECT_TYPE_BUILT_IN_ARRAY
- || (object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION
- && !ecma_builtin_function_is_routine (object_p)));
+ || (object_type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION && !ecma_builtin_function_is_routine (object_p)));
if (ECMA_BUILTIN_IS_EXTENDED_BUILT_IN (object_type))
{
@@ -1385,7 +1315,7 @@ ecma_builtin_delete_built_in_property (ecma_object_t *object_p, /**< object */
static void
ecma_builtin_native_handler_list_lazy_property_names (ecma_object_t *object_p, /**< function object */
ecma_collection_t *prop_names_p, /**< prop name collection */
- ecma_property_counter_t *prop_counter_p) /**< prop counter */
+ ecma_property_counter_t *prop_counter_p) /**< prop counter */
{
JERRY_ASSERT (ecma_get_object_type (object_p) == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
@@ -1413,7 +1343,7 @@ ecma_builtin_native_handler_list_lazy_property_names (ecma_object_t *object_p, /
*/
void
ecma_builtin_routine_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in object */
- ecma_collection_t *prop_names_p, /**< prop name collection */
+ ecma_collection_t *prop_names_p, /**< prop name collection */
ecma_property_counter_t *prop_counter_p, /**< property counters */
jerry_property_filter_t filter) /**< name filters */
{
@@ -1556,8 +1486,7 @@ ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, /**< a built-in
uint32_t bit_for_index = (uint32_t) 1u << index;
- if (curr_property_p->magic_string_id > LIT_NON_INTERNAL_MAGIC_STRING__COUNT
- && !(bitset & bit_for_index))
+ if (curr_property_p->magic_string_id > LIT_NON_INTERNAL_MAGIC_STRING__COUNT && !(bitset & bit_for_index))
{
ecma_string_t *name_p = ecma_op_get_global_symbol (curr_property_p->magic_string_id);
ecma_collection_push_back (prop_names_p, ecma_make_symbol_value (name_p));
@@ -1610,10 +1539,10 @@ ecma_builtin_dispatch_routine (ecma_extended_object_t *func_obj_p, /**< builtin
arguments_list_p = padded_arguments_list_p;
}
- return ecma_builtin_routines[func_obj_p->u.built_in.id] (func_obj_p->u.built_in.routine_id,
- this_arg_value,
- arguments_list_p,
- arguments_list_len);
+ return ecma_builtin_routines[func_obj_p->u.built_in.id](func_obj_p->u.built_in.routine_id,
+ this_arg_value,
+ arguments_list_p,
+ arguments_list_len);
} /* ecma_builtin_dispatch_routine */
/**
@@ -1641,15 +1570,12 @@ ecma_builtin_dispatch_call (ecma_object_t *obj_p, /**< built-in object */
}
#endif /* !JERRY_ESNEXT */
- return ecma_builtin_dispatch_routine (ext_obj_p,
- this_arg_value,
- arguments_list_p,
- arguments_list_len);
+ return ecma_builtin_dispatch_routine (ext_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
}
ecma_builtin_id_t builtin_object_id = ext_obj_p->u.built_in.id;
JERRY_ASSERT (builtin_object_id < sizeof (ecma_builtin_call_functions) / sizeof (ecma_builtin_dispatch_call_t));
- return ecma_builtin_call_functions[builtin_object_id] (arguments_list_p, arguments_list_len);
+ return ecma_builtin_call_functions[builtin_object_id](arguments_list_p, arguments_list_len);
} /* ecma_builtin_dispatch_call */
/**
@@ -1673,7 +1599,7 @@ ecma_builtin_dispatch_construct (ecma_object_t *obj_p, /**< built-in object */
ecma_builtin_id_t builtin_object_id = ext_obj_p->u.built_in.id;
JERRY_ASSERT (builtin_object_id < sizeof (ecma_builtin_construct_functions) / sizeof (ecma_builtin_dispatch_call_t));
- return ecma_builtin_construct_functions[builtin_object_id] (arguments_list_p, arguments_list_len);
+ return ecma_builtin_construct_functions[builtin_object_id](arguments_list_p, arguments_list_len);
} /* ecma_builtin_dispatch_construct */
/**
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins.h b/jerry-core/ecma/builtin-objects/ecma-builtins.h
index 22578fa1..96040de7 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtins.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtins.h
@@ -25,26 +25,16 @@ typedef enum
{
/** @cond doxygen_suppress */
#define BUILTIN(a, b, c, d, e)
-#define BUILTIN_ROUTINE(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
- builtin_id,
+#define BUILTIN_ROUTINE(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) builtin_id,
#include "ecma-builtins.inc.h"
#undef BUILTIN
#undef BUILTIN_ROUTINE
#define BUILTIN_ROUTINE(a, b, c, d, e)
-#define BUILTIN(builtin_id, \
- object_type, \
- object_prototype_builtin_id, \
- is_extensible, \
- lowercase_name) \
- builtin_id,
+#define BUILTIN(builtin_id, object_type, object_prototype_builtin_id, is_extensible, lowercase_name) builtin_id,
#include "ecma-builtins.inc.h"
#undef BUILTIN
#undef BUILTIN_ROUTINE
-/** @endcond */
+ /** @endcond */
ECMA_BUILTIN_ID__COUNT /**< number of built-in objects */
} ecma_builtin_id_t;
@@ -59,8 +49,7 @@ typedef enum
/**
* Number of global symbols
*/
-#define ECMA_BUILTIN_GLOBAL_SYMBOL_COUNT \
- (LIT_GLOBAL_SYMBOL__LAST - LIT_GLOBAL_SYMBOL__FIRST + 1)
+#define ECMA_BUILTIN_GLOBAL_SYMBOL_COUNT (LIT_GLOBAL_SYMBOL__LAST - LIT_GLOBAL_SYMBOL__FIRST + 1)
#endif /* JERRY_ESNEXT */
@@ -72,7 +61,7 @@ typedef enum
/**
* Get routine length
*/
-#define ECMA_GET_ROUTINE_LENGTH(value) ((uint8_t) ((value) & 0xf))
+#define ECMA_GET_ROUTINE_LENGTH(value) ((uint8_t) ((value) &0xf))
/**
* Get routine ID
@@ -87,7 +76,7 @@ typedef enum
/**
* Get accessor setter ID
*/
-#define ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID(value) ((uint8_t) ((value) & 0xff))
+#define ECMA_ACCESSOR_READ_WRITE_GET_SETTER_ID(value) ((uint8_t) ((value) &0xff))
/**
* Get accessor getter ID
@@ -121,42 +110,35 @@ typedef struct
ecma_global_object_t *ecma_builtin_create_global_object (void);
-ecma_value_t
-ecma_builtin_dispatch_call (ecma_object_t *obj_p, ecma_value_t this_arg_value,
- const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);
-ecma_value_t
-ecma_builtin_dispatch_construct (ecma_object_t *obj_p, const ecma_value_t *arguments_list_p,
- uint32_t arguments_list_len);
-ecma_property_t *
-ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
-ecma_property_t *
-ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
+ecma_value_t ecma_builtin_dispatch_call (ecma_object_t *obj_p,
+ ecma_value_t this_arg_value,
+ const ecma_value_t *arguments_list_p,
+ uint32_t arguments_list_len);
+ecma_value_t ecma_builtin_dispatch_construct (ecma_object_t *obj_p,
+ const ecma_value_t *arguments_list_p,
+ uint32_t arguments_list_len);
+ecma_property_t *ecma_builtin_routine_try_to_instantiate_property (ecma_object_t *object_p,
+ ecma_string_t *property_name_p);
+ecma_property_t *ecma_builtin_try_to_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
#if JERRY_ESNEXT
-void
-ecma_builtin_routine_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
+void ecma_builtin_routine_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
#endif /* JERRY_ESNEXT */
-void
-ecma_builtin_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
-void
-ecma_builtin_routine_list_lazy_property_names (ecma_object_t *object_p, ecma_collection_t *prop_names_p,
- ecma_property_counter_t *prop_counter_p,
- jerry_property_filter_t filter);
-void
-ecma_builtin_list_lazy_property_names (ecma_object_t *object_p, ecma_collection_t *prop_names_p,
- ecma_property_counter_t *prop_counter_p,
- jerry_property_filter_t filter);
-bool
-ecma_builtin_is_global (ecma_object_t *object_p);
-ecma_object_t *
-ecma_builtin_get (ecma_builtin_id_t builtin_id);
-ecma_object_t *
-ecma_builtin_get_global (void);
-bool
-ecma_builtin_function_is_routine (ecma_object_t *func_obj_p);
+void ecma_builtin_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
+void ecma_builtin_routine_list_lazy_property_names (ecma_object_t *object_p,
+ ecma_collection_t *prop_names_p,
+ ecma_property_counter_t *prop_counter_p,
+ jerry_property_filter_t filter);
+void ecma_builtin_list_lazy_property_names (ecma_object_t *object_p,
+ ecma_collection_t *prop_names_p,
+ ecma_property_counter_t *prop_counter_p,
+ jerry_property_filter_t filter);
+bool ecma_builtin_is_global (ecma_object_t *object_p);
+ecma_object_t *ecma_builtin_get (ecma_builtin_id_t builtin_id);
+ecma_object_t *ecma_builtin_get_global (void);
+bool ecma_builtin_function_is_routine (ecma_object_t *func_obj_p);
#if JERRY_BUILTIN_REALMS
-ecma_object_t *
-ecma_builtin_get_from_realm (ecma_global_object_t *global_object_p, ecma_builtin_id_t builtin_id);
+ecma_object_t *ecma_builtin_get_from_realm (ecma_global_object_t *global_object_p, ecma_builtin_id_t builtin_id);
#endif /* JERRY_BUILTIN_REALMS */
#endif /* !ECMA_BUILTINS_H */
diff --git a/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h b/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h
index d03868d1..48cae1ca 100644
--- a/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h
+++ b/jerry-core/ecma/builtin-objects/ecma-builtins.inc.h
@@ -47,50 +47,50 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_ARRAY,
#endif /* JERRY_BUILTIN_ARRAY */
#if JERRY_ESNEXT
-# if JERRY_BUILTIN_DATE
+#if JERRY_BUILTIN_DATE
/* The Date.prototype object (20.3.4) */
BUILTIN (ECMA_BUILTIN_ID_DATE_PROTOTYPE,
ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
true,
date_prototype)
-# endif /* JERRY_BUILTIN_DATE */
+#endif /* JERRY_BUILTIN_DATE */
-# if JERRY_BUILTIN_REGEXP
+#if JERRY_BUILTIN_REGEXP
/* The RegExp.prototype object (21.2.5) */
BUILTIN (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE,
ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
true,
regexp_prototype)
-# endif /* JERRY_BUILTIN_REGEXP */
+#endif /* JERRY_BUILTIN_REGEXP */
#else /* !JERRY_ESNEXT */
-# if JERRY_BUILTIN_DATE
+#if JERRY_BUILTIN_DATE
/* The Date.prototype object (15.9.4) */
BUILTIN (ECMA_BUILTIN_ID_DATE_PROTOTYPE,
ECMA_OBJECT_TYPE_BUILT_IN_CLASS,
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
true,
date_prototype)
-# endif /* JERRY_BUILTIN_DATE */
+#endif /* JERRY_BUILTIN_DATE */
-# if JERRY_BUILTIN_REGEXP
+#if JERRY_BUILTIN_REGEXP
/* The RegExp.prototype object (15.10.6) */
BUILTIN (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE,
ECMA_OBJECT_TYPE_BUILT_IN_CLASS,
ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
true,
regexp_prototype)
-# endif /* JERRY_BUILTIN_REGEXP */
+#endif /* JERRY_BUILTIN_REGEXP */
#endif /* !JERRY_ESNEXT */
#if JERRY_BUILTIN_STRING
/* The String.prototype object (15.5.4) */
BUILTIN (ECMA_BUILTIN_ID_STRING_PROTOTYPE,
- ECMA_OBJECT_TYPE_BUILT_IN_CLASS,
- ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
- true,
- string_prototype)
+ ECMA_OBJECT_TYPE_BUILT_IN_CLASS,
+ ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
+ true,
+ string_prototype)
/* The String object (15.5.1) */
BUILTIN_ROUTINE (ECMA_BUILTIN_ID_STRING,
@@ -148,39 +148,23 @@ BUILTIN_ROUTINE (ECMA_BUILTIN_ID_FUNCTION,
#if JERRY_BUILTIN_MATH
/* The Math object (15.8) */
-BUILTIN (ECMA_BUILTIN_ID_MATH,
- ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,
- ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
- true,
- math)
+BUILTIN (ECMA_BUILTIN_ID_MATH, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, math)
#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_REFLECT
/* The Reflect object (26.1) */
-BUILTIN (ECMA_BUILTIN_ID_REFLECT,
- ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,
- ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
- true,
- reflect)
+BUILTIN (ECMA_BUILTIN_ID_REFLECT, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, reflect)
#endif /* JERRY_BUILTIN_REFLECT */
#if JERRY_BUILTIN_JSON
/* The JSON object (15.12) */
-BUILTIN (ECMA_BUILTIN_ID_JSON,
- ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,
- ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
- true,
- json)
+BUILTIN (ECMA_BUILTIN_ID_JSON, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, json)
#endif /* JERRY_BUILTIN_JSON */
#if JERRY_BUILTIN_ATOMICS
/* The Atomics object (24.4) */
-BUILTIN (ECMA_BUILTIN_ID_ATOMICS,
- ECMA_OBJECT_TYPE_BUILT_IN_GENERAL,
- ECMA_BUILTIN_ID_OBJECT_PROTOTYPE,
- true,
- atomics)
+BUILTIN (ECMA_BUILTIN_ID_ATOMICS, ECMA_OBJECT_TYPE_BUILT_IN_GENERAL, ECMA_BUILTIN_ID_OBJECT_PROTOTYPE, true, atomics)
#endif /* JERRY_BUILTIN_ATOMICS */
#if JERRY_BUILTIN_DATE
@@ -545,11 +529,7 @@ BUILTIN (ECMA_BUILTIN_ID_MAP_PROTOTYPE,
map_prototype)
/* The Map routine (ECMA-262 v6, 23.1.1.1) */
-BUILTIN_ROUTINE (ECMA_BUILTIN_ID_MAP,
- ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,
- ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
- true,
- map)
+BUILTIN_ROUTINE (ECMA_BUILTIN_ID_MAP, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, true, map)
/* The Set prototype object (23.1.3) */
BUILTIN (ECMA_BUILTIN_ID_SET_PROTOTYPE,
@@ -559,11 +539,7 @@ BUILTIN (ECMA_BUILTIN_ID_SET_PROTOTYPE,
set_prototype)
/* The Set routine (ECMA-262 v6, 23.1.1.1) */
-BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SET,
- ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION,
- ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE,
- true,
- set)
+BUILTIN_ROUTINE (ECMA_BUILTIN_ID_SET, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION, ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE, true, set)
/* The WeakMap prototype object (23.1.3) */
BUILTIN (ECMA_BUILTIN_ID_WEAKMAP_PROTOTYPE,
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c
index 373b0580..3b33e033 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.c
@@ -22,7 +22,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-bigint64array-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID bigint64array_prototype
+#define BUILTIN_UNDERSCORED_ID bigint64array_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.inc.h
index e6822117..5e1087bf 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array-prototype.inc.h
@@ -21,7 +21,7 @@
#if JERRY_BUILTIN_BIGINT
#define TYPEDARRAY_BYTES_PER_ELEMENT 8
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGINT64ARRAY
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGINT64ARRAY
#include "ecma-builtin-typedarray-prototype-template.inc.h"
#endif /* JERRY_BUILTIN_BIGINT */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c
index da4f3c8d..1f8b29f6 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -28,9 +29,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-bigint64array.inc.h"
-#define BUILTIN_UNDERSCORED_ID bigint64array
+#define BUILTIN_UNDERSCORED_ID bigint64array
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -50,7 +50,7 @@
*/
ecma_value_t
ecma_builtin_bigint64array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
- uint32_t arguments_list_len) /**< number of arguments */
+ uint32_t arguments_list_len) /**< number of arguments */
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
@@ -64,17 +64,16 @@ ecma_builtin_bigint64array_dispatch_call (const ecma_value_t *arguments_list_p,
*/
ecma_value_t
ecma_builtin_bigint64array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
- uint32_t arguments_list_len) /**< number of arguments */
+ uint32_t arguments_list_len) /**< number of arguments */
{
- return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len,
- ECMA_BIGINT64_ARRAY);
+ return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_BIGINT64_ARRAY);
} /* ecma_builtin_bigint64array_dispatch_construct */
/**
- * @}
- * @}
- * @}
- */
+ * @}
+ * @}
+ * @}
+ */
#endif /* JERRY_BUILTIN_BIGINT */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.inc.h
index b68f3581..176fc26b 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-bigint64array.inc.h
@@ -20,8 +20,8 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 8
-#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_BIGINT64_ARRAY_UL
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGINT64ARRAY_PROTOTYPE
+#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_BIGINT64_ARRAY_UL
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGINT64ARRAY_PROTOTYPE
#include "ecma-builtin-typedarray-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c
index 3cc4006d..9844fbd5 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.c
@@ -22,7 +22,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-biguint64array-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID biguint64array_prototype
+#define BUILTIN_UNDERSCORED_ID biguint64array_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.inc.h
index 6c0da05b..03626442 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array-prototype.inc.h
@@ -21,7 +21,7 @@
#if JERRY_BUILTIN_BIGINT
#define TYPEDARRAY_BYTES_PER_ELEMENT 8
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGUINT64ARRAY
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGUINT64ARRAY
#include "ecma-builtin-typedarray-prototype-template.inc.h"
#endif /* JERRY_BUILTIN_BIGINT */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c
index 6037d081..214fa716 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -28,9 +29,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-biguint64array.inc.h"
-#define BUILTIN_UNDERSCORED_ID biguint64array
+#define BUILTIN_UNDERSCORED_ID biguint64array
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -50,7 +50,7 @@
*/
ecma_value_t
ecma_builtin_biguint64array_dispatch_call (const ecma_value_t *arguments_list_p, /**< arguments list */
- uint32_t arguments_list_len) /**< number of arguments */
+ uint32_t arguments_list_len) /**< number of arguments */
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
@@ -64,17 +64,16 @@ ecma_builtin_biguint64array_dispatch_call (const ecma_value_t *arguments_list_p,
*/
ecma_value_t
ecma_builtin_biguint64array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
- uint32_t arguments_list_len) /**< number of arguments */
+ uint32_t arguments_list_len) /**< number of arguments */
{
- return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len,
- ECMA_BIGUINT64_ARRAY);
+ return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_BIGUINT64_ARRAY);
} /* ecma_builtin_biguint64array_dispatch_construct */
/**
- * @}
- * @}
- * @}
- */
+ * @}
+ * @}
+ * @}
+ */
#endif /* JERRY_BUILTIN_BIGINT */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.inc.h
index f9ba3338..ea38782a 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-biguint64array.inc.h
@@ -21,8 +21,8 @@
#if JERRY_BUILTIN_BIGINT
#define TYPEDARRAY_BYTES_PER_ELEMENT 8
-#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGUINT64ARRAY_PROTOTYPE
+#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_BIGUINT64ARRAY_PROTOTYPE
#include "ecma-builtin-typedarray-template.inc.h"
#endif /* JERRY_BUILTIN_BIGINT */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c
index 3179f97c..1e6a6041 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.c
@@ -21,7 +21,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-float32array-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID float32array_prototype
+#define BUILTIN_UNDERSCORED_ID float32array_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.inc.h
index 6bba9b67..56bfeeae 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array-prototype.inc.h
@@ -20,7 +20,7 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 4
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT32ARRAY
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT32ARRAY
#include "ecma-builtin-typedarray-prototype-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c
index 1998e189..b69cc4c0 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -27,9 +28,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-float32array.inc.h"
-#define BUILTIN_UNDERSCORED_ID float32array
+#define BUILTIN_UNDERSCORED_ID float32array
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -65,14 +65,13 @@ ecma_value_t
ecma_builtin_float32array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len,
- ECMA_FLOAT32_ARRAY);
+ return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_FLOAT32_ARRAY);
} /* ecma_builtin_float32array_dispatch_construct */
/**
- * @}
- * @}
- * @}
- */
+ * @}
+ * @}
+ * @}
+ */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.inc.h
index 0cc3d738..832b5119 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float32array.inc.h
@@ -20,8 +20,8 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 4
-#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_FLOAT32_ARRAY_UL
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT32ARRAY_PROTOTYPE
+#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_FLOAT32_ARRAY_UL
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT32ARRAY_PROTOTYPE
#include "ecma-builtin-typedarray-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c
index 4f6f8a2d..205d23a7 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.c
@@ -22,7 +22,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-float64array-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID float64array_prototype
+#define BUILTIN_UNDERSCORED_ID float64array_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.inc.h
index 68fce0d4..815be714 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array-prototype.inc.h
@@ -21,7 +21,7 @@
#if JERRY_NUMBER_TYPE_FLOAT64
#define TYPEDARRAY_BYTES_PER_ELEMENT 8
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT64ARRAY
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT64ARRAY
#include "ecma-builtin-typedarray-prototype-template.inc.h"
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c
index ed857e0a..997fb5a7 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -28,9 +29,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-float64array.inc.h"
-#define BUILTIN_UNDERSCORED_ID float64array
+#define BUILTIN_UNDERSCORED_ID float64array
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -66,15 +66,14 @@ ecma_value_t
ecma_builtin_float64array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len,
- ECMA_FLOAT64_ARRAY);
+ return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_FLOAT64_ARRAY);
} /* ecma_builtin_float64array_dispatch_construct */
/**
- * @}
- * @}
- * @}
- */
+ * @}
+ * @}
+ * @}
+ */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.inc.h
index e7b053dd..ea8bd422 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-float64array.inc.h
@@ -21,8 +21,8 @@
#if JERRY_NUMBER_TYPE_FLOAT64
#define TYPEDARRAY_BYTES_PER_ELEMENT 8
-#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_FLOAT64_ARRAY_UL
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE
+#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_FLOAT64_ARRAY_UL
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_FLOAT64ARRAY_PROTOTYPE
#include "ecma-builtin-typedarray-template.inc.h"
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c
index 0d4e1675..1b9c435b 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.c
@@ -21,7 +21,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-int16array-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID int16array_prototype
+#define BUILTIN_UNDERSCORED_ID int16array_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.inc.h
index d9a0ef94..7815d9a5 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array-prototype.inc.h
@@ -20,7 +20,7 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 2
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT16ARRAY
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT16ARRAY
#include "ecma-builtin-typedarray-prototype-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c
index 99fd2a8c..6945114a 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -27,9 +28,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-int16array.inc.h"
-#define BUILTIN_UNDERSCORED_ID int16array
+#define BUILTIN_UNDERSCORED_ID int16array
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -65,14 +65,13 @@ ecma_value_t
ecma_builtin_int16array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len,
- ECMA_INT16_ARRAY);
+ return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_INT16_ARRAY);
} /* ecma_builtin_int16array_dispatch_construct */
/**
- * @}
- * @}
- * @}
- */
+ * @}
+ * @}
+ * @}
+ */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.inc.h
index 3427207b..f744ed77 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int16array.inc.h
@@ -20,8 +20,8 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 2
-#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT16_ARRAY_UL
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT16ARRAY_PROTOTYPE
+#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT16_ARRAY_UL
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT16ARRAY_PROTOTYPE
#include "ecma-builtin-typedarray-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c
index 0253bc0a..36fc8470 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.c
@@ -21,7 +21,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-int32array-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID int32array_prototype
+#define BUILTIN_UNDERSCORED_ID int32array_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.inc.h
index ea2f3326..9a31a062 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array-prototype.inc.h
@@ -20,7 +20,7 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 4
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT32ARRAY
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT32ARRAY
#include "ecma-builtin-typedarray-prototype-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c
index 06170fbe..d3d899c1 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -27,9 +28,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-int32array.inc.h"
-#define BUILTIN_UNDERSCORED_ID int32array
+#define BUILTIN_UNDERSCORED_ID int32array
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -65,14 +65,13 @@ ecma_value_t
ecma_builtin_int32array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len,
- ECMA_INT32_ARRAY);
+ return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_INT32_ARRAY);
} /* ecma_builtin_int32array_dispatch_construct */
/**
- * @}
- * @}
- * @}
- */
+ * @}
+ * @}
+ * @}
+ */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.inc.h
index bdc667fb..ac786a0b 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int32array.inc.h
@@ -20,8 +20,8 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 4
-#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT32_ARRAY_UL
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT32ARRAY_PROTOTYPE
+#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT32_ARRAY_UL
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT32ARRAY_PROTOTYPE
#include "ecma-builtin-typedarray-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c
index a7b0b156..8221f309 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.c
@@ -21,7 +21,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-int8array-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID int8array_prototype
+#define BUILTIN_UNDERSCORED_ID int8array_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.inc.h
index 4cb7e582..99d072b1 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array-prototype.inc.h
@@ -20,7 +20,7 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 1
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT8ARRAY
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT8ARRAY
#include "ecma-builtin-typedarray-prototype-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c
index 03522f0b..87ea168c 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -27,9 +28,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-int8array.inc.h"
-#define BUILTIN_UNDERSCORED_ID int8array
+#define BUILTIN_UNDERSCORED_ID int8array
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -65,8 +65,7 @@ ecma_value_t
ecma_builtin_int8array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len,
- ECMA_INT8_ARRAY);
+ return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_INT8_ARRAY);
} /* ecma_builtin_int8array_dispatch_construct */
/**
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.inc.h
index 2e3146fb..25c84de2 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-int8array.inc.h
@@ -20,8 +20,8 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 1
-#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT8_ARRAY_UL
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE
+#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_INT8_ARRAY_UL
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_INT8ARRAY_PROTOTYPE
#include "ecma-builtin-typedarray-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c
index 565a48a1..23681ddb 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.c
@@ -18,10 +18,11 @@
#if JERRY_BUILTIN_TYPEDARRAY
#include "ecma-builtins.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-objects.h"
#include "ecma-typedarray-object.h"
-#include "ecma-function-object.h"
+
#include "jcontext.h"
#define ECMA_BUILTINS_INTERNAL
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.h
index 54972bd9..d4064374 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-helpers.h
@@ -26,10 +26,9 @@
* @{
*/
-ecma_value_t
-ecma_typedarray_helper_dispatch_construct (const ecma_value_t *arguments_list_p,
- uint32_t arguments_list_len,
- ecma_typedarray_type_t typedarray_id);
+ecma_value_t ecma_typedarray_helper_dispatch_construct (const ecma_value_t *arguments_list_p,
+ uint32_t arguments_list_len,
+ ecma_typedarray_type_t typedarray_id);
/**
* @}
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype-template.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype-template.inc.h
index 8715d0d9..beb63352 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype-template.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype-template.inc.h
@@ -16,24 +16,20 @@
#if JERRY_BUILTIN_TYPEDARRAY
#ifndef TYPEDARRAY_BYTES_PER_ELEMENT
-# error "Please define TYPEDARRAY_BYTES_PER_ELEMENT"
+#error "Please define TYPEDARRAY_BYTES_PER_ELEMENT"
#endif /* !TYPEDARRAY_BYTES_PER_ELEMENT */
#ifndef TYPEDARRAY_BUILTIN_ID
-# error "Please define TYPEDARRAY_BUILTIN_ID"
+#error "Please define TYPEDARRAY_BUILTIN_ID"
#endif /* !TYPEDARRAY_BUILTIN_ID */
#include "ecma-builtin-helpers-macro-defines.inc.h"
/* ES2015 22.2.3.4 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- TYPEDARRAY_BUILTIN_ID,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, TYPEDARRAY_BUILTIN_ID, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* ES2015 22.2.6.1 */
-NUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U,
- TYPEDARRAY_BYTES_PER_ELEMENT,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, TYPEDARRAY_BYTES_PER_ELEMENT, ECMA_PROPERTY_FIXED)
#include "ecma-builtin-helpers-macro-undefs.inc.h"
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c
index 0be71d15..b93c429c 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.c
@@ -31,6 +31,7 @@
#include "ecma-number-object.h"
#include "ecma-objects.h"
#include "ecma-typedarray-object.h"
+
#include "jcontext.h"
#include "jmem.h"
#include "jrt-libc-includes.h"
@@ -89,7 +90,7 @@ enum
};
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-typedarray-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID typedarray_prototype
+#define BUILTIN_UNDERSCORED_ID typedarray_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
@@ -168,8 +169,7 @@ ecma_builtin_typedarray_prototype_exec_routine (ecma_value_t this_arg, /**< this
return ECMA_VALUE_FALSE;
}
}
- else if (mode == TYPEDARRAY_ROUTINE_SOME
- && to_bool_result)
+ else if (mode == TYPEDARRAY_ROUTINE_SOME && to_bool_result)
{
return ECMA_VALUE_TRUE;
}
@@ -354,10 +354,7 @@ ecma_builtin_typedarray_prototype_reduce_with_direction (ecma_value_t this_arg,
JERRY_ASSERT (ecma_is_value_number (get_value) || ecma_is_value_bigint (get_value));
- ecma_value_t call_value = ecma_op_function_call (func_object_p,
- ECMA_VALUE_UNDEFINED,
- call_args,
- 4);
+ ecma_value_t call_value = ecma_op_function_call (func_object_p, ECMA_VALUE_UNDEFINED, call_args, 4);
ecma_fast_free_value (accumulator);
ecma_fast_free_value (get_value);
@@ -492,8 +489,7 @@ ecma_builtin_typedarray_prototype_filter (ecma_value_t this_arg, /**< this objec
for (uint32_t idx = 0; idx < collected_p->item_count; idx++)
{
- ecma_value_t set_element = target_typedarray_setter_cb (target_buffer_p,
- collected_p->buffer_p[idx]);
+ ecma_value_t set_element = target_typedarray_setter_cb (target_buffer_p, collected_p->buffer_p[idx]);
if (ECMA_IS_VALUE_ERROR (set_element))
{
@@ -802,8 +798,7 @@ ecma_op_typedarray_get_to_string_at_index (ecma_object_t *obj_p, /**< this objec
return NULL;
}
- if (ecma_is_value_undefined (index_value)
- || ecma_is_value_null (index_value))
+ if (ecma_is_value_undefined (index_value) || ecma_is_value_null (index_value))
{
ecma_free_value (index_value);
return ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
@@ -922,9 +917,7 @@ ecma_builtin_typedarray_prototype_subarray (ecma_value_t this_arg, /**< this obj
uint32_t begin_index_uint32 = 0, end_index_uint32 = 0;
/* 7. relativeBegin */
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (begin,
- info_p->length,
- &begin_index_uint32)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (begin, info_p->length, &begin_index_uint32)))
{
return ECMA_VALUE_ERROR;
}
@@ -936,9 +929,7 @@ ecma_builtin_typedarray_prototype_subarray (ecma_value_t this_arg, /**< this obj
else
{
/* 10. relativeEnd */
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (end,
- info_p->length,
- &end_index_uint32)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (end, info_p->length, &end_index_uint32)))
{
return ECMA_VALUE_ERROR;
}
@@ -955,12 +946,9 @@ ecma_builtin_typedarray_prototype_subarray (ecma_value_t this_arg, /**< this obj
/* 17. beginByteOffset */
uint32_t begin_byte_offset = info_p->offset + (begin_index_uint32 << info_p->shift);
- ecma_value_t arguments_p[3] =
- {
- ecma_make_object_value (info_p->array_buffer_p),
- ecma_make_uint32_value (begin_byte_offset),
- ecma_make_uint32_value (subarray_length)
- };
+ ecma_value_t arguments_p[3] = { ecma_make_object_value (info_p->array_buffer_p),
+ ecma_make_uint32_value (begin_byte_offset),
+ ecma_make_uint32_value (subarray_length) };
ret_value = ecma_typedarray_species_create (this_arg, arguments_p, 3);
@@ -1013,9 +1001,7 @@ ecma_builtin_typedarray_prototype_fill (ecma_value_t this_arg, /**< this object
uint32_t begin_index_uint32 = 0, end_index_uint32 = 0;
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (begin,
- info_p->length,
- &begin_index_uint32)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (begin, info_p->length, &begin_index_uint32)))
{
ecma_free_value (value_to_set);
return ECMA_VALUE_ERROR;
@@ -1027,9 +1013,7 @@ ecma_builtin_typedarray_prototype_fill (ecma_value_t this_arg, /**< this object
}
else
{
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (end,
- info_p->length,
- &end_index_uint32)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (end, info_p->length, &end_index_uint32)))
{
ecma_free_value (value_to_set);
return ECMA_VALUE_ERROR;
@@ -1138,10 +1122,7 @@ ecma_builtin_typedarray_prototype_sort_compare_helper (ecma_value_t lhs, /**< le
ecma_value_t compare_args[] = { lhs, rhs };
- ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p,
- ECMA_VALUE_UNDEFINED,
- compare_args,
- 2);
+ ecma_value_t call_value = ecma_op_function_call (comparefn_obj_p, ECMA_VALUE_UNDEFINED, compare_args, 2);
if (ECMA_IS_VALUE_ERROR (call_value) || ecma_is_value_number (call_value))
{
@@ -1391,10 +1372,8 @@ ecma_builtin_typedarray_prototype_index_of (ecma_typedarray_info_t *info_p, /**<
uint32_t from_index;
- /* 5. */
- if (args_number == 0
- || (!ecma_is_value_number (args[0]) && !is_bigint)
- || info_p->length == 0)
+ /* 5. */
+ if (args_number == 0 || (!ecma_is_value_number (args[0]) && !is_bigint) || info_p->length == 0)
{
return ecma_make_integer_value (-1);
}
@@ -1404,9 +1383,7 @@ ecma_builtin_typedarray_prototype_index_of (ecma_typedarray_info_t *info_p, /**<
}
else
{
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1],
- info_p->length,
- &from_index)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &from_index)))
{
return ECMA_VALUE_ERROR;
}
@@ -1455,8 +1432,8 @@ ecma_builtin_typedarray_prototype_index_of (ecma_typedarray_info_t *info_p, /**<
*/
static ecma_value_t
ecma_builtin_typedarray_prototype_last_index_of (ecma_typedarray_info_t *info_p, /**< object info */
- const ecma_value_t args[], /**< arguments list */
- uint32_t args_number) /**< number of arguments */
+ const ecma_value_t args[], /**< arguments list */
+ uint32_t args_number) /**< number of arguments */
{
#if JERRY_BUILTIN_BIGINT
bool is_bigint = ECMA_TYPEDARRAY_IS_BIGINT_TYPE (info_p->id);
@@ -1467,9 +1444,7 @@ ecma_builtin_typedarray_prototype_last_index_of (ecma_typedarray_info_t *info_p,
uint32_t from_index;
/* 5. */
- if (args_number == 0
- || (!ecma_is_value_number (args[0]) && !is_bigint)
- || info_p->length == 0)
+ if (args_number == 0 || (!ecma_is_value_number (args[0]) && !is_bigint) || info_p->length == 0)
{
return ecma_make_integer_value (-1);
}
@@ -1480,9 +1455,7 @@ ecma_builtin_typedarray_prototype_last_index_of (ecma_typedarray_info_t *info_p,
}
else
{
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1],
- info_p->length,
- &from_index)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &from_index)))
{
return ECMA_VALUE_ERROR;
}
@@ -1547,27 +1520,21 @@ ecma_builtin_typedarray_prototype_copy_within (ecma_value_t this_arg, /**< this
if (args_number > 0)
{
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[0],
- info_p->length,
- &relative_target)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[0], info_p->length, &relative_target)))
{
return ECMA_VALUE_ERROR;
}
if (args_number > 1)
{
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1],
- info_p->length,
- &relative_start)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &relative_start)))
{
return ECMA_VALUE_ERROR;
}
if (args_number > 2 && args[2] != ECMA_VALUE_UNDEFINED)
{
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[2],
- info_p->length,
- &relative_end)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[2], info_p->length, &relative_end)))
{
return ECMA_VALUE_ERROR;
}
@@ -1618,18 +1585,13 @@ ecma_builtin_typedarray_prototype_slice (ecma_value_t this_arg, /**< this argume
if (args_number > 0)
{
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[0],
- info_p->length,
- &relative_start)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[0], info_p->length, &relative_start)))
{
return ECMA_VALUE_ERROR;
}
- if (args_number > 1
- && args[1] != ECMA_VALUE_UNDEFINED
- && ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1],
- info_p->length,
- &relative_end)))
+ if (args_number > 1 && args[1] != ECMA_VALUE_UNDEFINED
+ && ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (args[1], info_p->length, &relative_end)))
{
return ECMA_VALUE_ERROR;
}
@@ -1709,7 +1671,7 @@ ecma_builtin_typedarray_prototype_slice (ecma_value_t this_arg, /**< this argume
*
* @return ecma value
* Returned value must be freed with ecma_free_value.
-*/
+ */
static ecma_value_t
ecma_builtin_typedarray_prototype_to_locale_string_helper (ecma_typedarray_info_t *info_p, /**< object info */
uint32_t index) /** array index */
@@ -1801,9 +1763,7 @@ ecma_builtin_typedarray_prototype_includes (ecma_typedarray_info_t *info_p, /**<
bool is_bigint = false;
#endif /* JERRRY_BUILTIN_BIGINT */
- if (args_number == 0
- || (!ecma_is_value_number (args[0]) && !is_bigint)
- || info_p->length == 0)
+ if (args_number == 0 || (!ecma_is_value_number (args[0]) && !is_bigint) || info_p->length == 0)
{
return ECMA_VALUE_FALSE;
}
@@ -1918,7 +1878,7 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE:
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT:
{
- bool is_reduce = builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT;
+ bool is_reduce = builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_REDUCE_RIGHT;
return ecma_builtin_typedarray_prototype_reduce_with_direction (this_arg,
&info,
arguments_list_p,
@@ -1957,7 +1917,6 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
}
return ecma_builtin_typedarray_prototype_sort (this_arg, &info, arguments_list_p[0]);
-
}
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FIND:
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FIND_INDEX:
@@ -1996,8 +1955,8 @@ ecma_builtin_typedarray_prototype_dispatch_routine (uint8_t builtin_routine_id,
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS:
case ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_ENTRIES:
{
- ecma_iterator_kind_t iter_id = (builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS)
- ? ECMA_ITERATOR_KEYS : ECMA_ITERATOR_ENTRIES;
+ ecma_iterator_kind_t iter_id =
+ (builtin_routine_id == ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS) ? ECMA_ITERATOR_KEYS : ECMA_ITERATOR_ENTRIES;
return ecma_typedarray_iterators_helper (this_arg, iter_id);
}
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.inc.h
index a5bf4cfd..9cace683 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-prototype.inc.h
@@ -22,9 +22,7 @@
#if JERRY_BUILTIN_TYPEDARRAY
/* ES2015 22.2.3.4 */
-OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR,
- ECMA_BUILTIN_ID_TYPEDARRAY,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+OBJECT_VALUE (LIT_MAGIC_STRING_CONSTRUCTOR, ECMA_BUILTIN_ID_TYPEDARRAY, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
/* Readonly accessor properties */
/* ES2015 22.2.3.1 */
@@ -63,7 +61,7 @@ ROUTINE (LIT_MAGIC_STRING_FOR_EACH_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_FOR_EAC
ROUTINE (LIT_MAGIC_STRING_INCLUDES, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INCLUDES, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_AT, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_AT, 1, 1)
ROUTINE (LIT_MAGIC_STRING_INDEX_OF_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_INDEX_OF, NON_FIXED, 1)
-ROUTINE (LIT_MAGIC_STRING_JOIN, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_JOIN, 1, 1)
+ROUTINE (LIT_MAGIC_STRING_JOIN, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_JOIN, 1, 1)
ROUTINE (LIT_MAGIC_STRING_KEYS, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_KEYS, 0, 0)
ROUTINE (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_LAST_INDEX_OF, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_MAP, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_MAP, 2, 1)
@@ -76,11 +74,12 @@ ROUTINE (LIT_MAGIC_STRING_SOME, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SOME, 2, 1)
ROUTINE (LIT_MAGIC_STRING_SORT, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SORT, 1, 1)
ROUTINE (LIT_MAGIC_STRING_SUBARRAY, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_SUBARRAY, 2, 2)
ROUTINE (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, ECMA_TYPEDARRAY_PROTOTYPE_ROUTINE_TO_LOCALE_STRING, 0, 0)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL,
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_TO_STRING_UL, LIT_MAGIC_STRING_TO_STRING_UL, ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
+INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES,
+ LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-INTRINSIC_PROPERTY (LIT_MAGIC_STRING_VALUES, LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
-INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR, LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES,
+INTRINSIC_PROPERTY (LIT_GLOBAL_SYMBOL_ITERATOR,
+ LIT_INTERNAL_MAGIC_STRING_TYPEDARRAY_PROTOTYPE_VALUES,
ECMA_PROPERTY_CONFIGURABLE_WRITABLE)
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-template.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-template.inc.h
index 23c4ce6f..7c9313fc 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-template.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray-template.inc.h
@@ -16,38 +16,30 @@
#if JERRY_BUILTIN_TYPEDARRAY
#ifndef TYPEDARRAY_BYTES_PER_ELEMENT
-# error "Please define TYPEDARRAY_BYTES_PER_ELEMENT"
+#error "Please define TYPEDARRAY_BYTES_PER_ELEMENT"
#endif /* !TYPEDARRAY_BYTES_PER_ELEMENT */
#ifndef TYPEDARRAY_MAGIC_STRING_ID
-# error "Please define TYPEDARRAY_MAGIC_STRING_ID"
+#error "Please define TYPEDARRAY_MAGIC_STRING_ID"
#endif /* !TYPEDARRAY_MAGIC_STRING_ID */
#ifndef TYPEDARRAY_BUILTIN_ID
-# error "Please define TYPEDARRAY_BUILTIN_ID"
+#error "Please define TYPEDARRAY_BUILTIN_ID"
#endif /* !TYPEDARRAY_BUILTIN_ID */
#include "ecma-builtin-helpers-macro-defines.inc.h"
/* ES2015 22.2.5 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 3,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 3, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ES2015 22.2.5.1 */
-NUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U,
- TYPEDARRAY_BYTES_PER_ELEMENT,
- ECMA_PROPERTY_FIXED)
+NUMBER_VALUE (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, TYPEDARRAY_BYTES_PER_ELEMENT, ECMA_PROPERTY_FIXED)
/* ES2015 22.2.5 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- TYPEDARRAY_MAGIC_STRING_ID,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, TYPEDARRAY_MAGIC_STRING_ID, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ES2015 22.2.5.2 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- TYPEDARRAY_BUILTIN_ID,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, TYPEDARRAY_BUILTIN_ID, ECMA_PROPERTY_FIXED)
#include "ecma-builtin-helpers-macro-undefs.inc.h"
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c
index 2631f4db..898492fa 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.c
@@ -13,14 +13,14 @@
* limitations under the License.
*/
-#include "ecma-typedarray-object.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
-#include "ecma-function-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -29,9 +29,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-typedarray.inc.h"
-#define BUILTIN_UNDERSCORED_ID typedarray
+#define BUILTIN_UNDERSCORED_ID typedarray
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -91,10 +90,7 @@ ecma_builtin_typedarray_from (ecma_value_t this_arg, /**< 'this' argument */
}
}
- return ecma_op_typedarray_from (this_arg,
- source,
- map_fn,
- this_in_fn);
+ return ecma_op_typedarray_from (this_arg, source, map_fn, this_in_fn);
} /* ecma_builtin_typedarray_from */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.inc.h
index d362f817..bc8ab47d 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-typedarray.inc.h
@@ -23,19 +23,13 @@
/* ES2015 22.2.2 */
/* ES11 22.2.1.1 - value of length changed to 0 */
-NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH,
- 0,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+NUMBER_VALUE (LIT_MAGIC_STRING_LENGTH, 0, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ES2015 22.2.2 */
-STRING_VALUE (LIT_MAGIC_STRING_NAME,
- LIT_MAGIC_STRING_TYPED_ARRAY_UL,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+STRING_VALUE (LIT_MAGIC_STRING_NAME, LIT_MAGIC_STRING_TYPED_ARRAY_UL, ECMA_PROPERTY_FLAG_CONFIGURABLE)
/* ES2015 22.2.2.3 */
-OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE,
- ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE,
- ECMA_PROPERTY_FIXED)
+OBJECT_VALUE (LIT_MAGIC_STRING_PROTOTYPE, ECMA_BUILTIN_ID_TYPEDARRAY_PROTOTYPE, ECMA_PROPERTY_FIXED)
/* Routine properties:
* (property name, C routine name, arguments number or NON_FIXED, value of the routine's length property) */
@@ -47,9 +41,7 @@ ROUTINE (LIT_MAGIC_STRING_FROM, ecma_builtin_typedarray_from, NON_FIXED, 1)
ROUTINE (LIT_MAGIC_STRING_OF, ecma_builtin_typedarray_of, NON_FIXED, 0)
/* ES2015 22.2.2.4 */
-ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES,
- ecma_builtin_typedarray_species_get,
- ECMA_PROPERTY_FLAG_CONFIGURABLE)
+ACCESSOR_READ_ONLY (LIT_GLOBAL_SYMBOL_SPECIES, ecma_builtin_typedarray_species_get, ECMA_PROPERTY_FLAG_CONFIGURABLE)
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c
index 5e980625..691da4ba 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.c
@@ -21,7 +21,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint16array-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID uint16array_prototype
+#define BUILTIN_UNDERSCORED_ID uint16array_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.inc.h
index 6d0fef96..ec055f66 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array-prototype.inc.h
@@ -20,7 +20,7 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 2
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT16ARRAY
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT16ARRAY
#include "ecma-builtin-typedarray-prototype-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c
index 5b3d33ad..db0367dd 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -27,9 +28,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint16array.inc.h"
-#define BUILTIN_UNDERSCORED_ID uint16array
+#define BUILTIN_UNDERSCORED_ID uint16array
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -65,14 +65,13 @@ ecma_value_t
ecma_builtin_uint16array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len,
- ECMA_UINT16_ARRAY);
+ return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT16_ARRAY);
} /* ecma_builtin_uint16array_dispatch_construct */
/**
- * @}
- * @}
- * @}
- */
+ * @}
+ * @}
+ * @}
+ */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.inc.h
index 8a21218f..2c0af1f0 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint16array.inc.h
@@ -20,8 +20,8 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 2
-#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT16_ARRAY_UL
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT16ARRAY_PROTOTYPE
+#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT16_ARRAY_UL
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT16ARRAY_PROTOTYPE
#include "ecma-builtin-typedarray-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c
index ff721dcd..4b5e3842 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.c
@@ -21,7 +21,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint32array-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID uint32array_prototype
+#define BUILTIN_UNDERSCORED_ID uint32array_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.inc.h
index b4142cb1..a04098a3 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array-prototype.inc.h
@@ -20,7 +20,7 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 4
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT32ARRAY
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT32ARRAY
#include "ecma-builtin-typedarray-prototype-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c
index 17b6d390..51abd555 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -27,9 +28,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint32array.inc.h"
-#define BUILTIN_UNDERSCORED_ID uint32array
+#define BUILTIN_UNDERSCORED_ID uint32array
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -67,14 +67,13 @@ ecma_builtin_uint32array_dispatch_construct (const ecma_value_t *arguments_list_
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
- return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len,
- ECMA_UINT32_ARRAY);
+ return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT32_ARRAY);
} /* ecma_builtin_uint32array_dispatch_construct */
/**
- * @}
- * @}
- * @}
- */
+ * @}
+ * @}
+ * @}
+ */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.inc.h
index c3812083..fd0389a4 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint32array.inc.h
@@ -20,8 +20,8 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 4
-#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT32_ARRAY_UL
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT32ARRAY_PROTOTYPE
+#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT32_ARRAY_UL
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT32ARRAY_PROTOTYPE
#include "ecma-builtin-typedarray-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c
index 67347067..8a8edb4a 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.c
@@ -21,7 +21,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint8array-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID uint8array_prototype
+#define BUILTIN_UNDERSCORED_ID uint8array_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.inc.h
index c047d6c9..07f94b0b 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array-prototype.inc.h
@@ -20,7 +20,7 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 1
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8ARRAY
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8ARRAY
#include "ecma-builtin-typedarray-prototype-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c
index c451327c..d646611c 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -27,9 +28,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint8array.inc.h"
-#define BUILTIN_UNDERSCORED_ID uint8array
+#define BUILTIN_UNDERSCORED_ID uint8array
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -65,14 +65,13 @@ ecma_value_t
ecma_builtin_uint8array_dispatch_construct (const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< number of arguments */
{
- return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len,
- ECMA_UINT8_ARRAY);
+ return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT8_ARRAY);
} /* ecma_builtin_uint8array_dispatch_construct */
/**
- * @}
- * @}
- * @}
- */
+ * @}
+ * @}
+ * @}
+ */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.inc.h
index b108370d..d0259e9b 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8array.inc.h
@@ -20,8 +20,8 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 1
-#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT8_ARRAY_UL
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8ARRAY_PROTOTYPE
+#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT8_ARRAY_UL
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8ARRAY_PROTOTYPE
#include "ecma-builtin-typedarray-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c
index b7526a92..534014b1 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.c
@@ -21,7 +21,7 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint8clampedarray-prototype.inc.h"
-#define BUILTIN_UNDERSCORED_ID uint8clampedarray_prototype
+#define BUILTIN_UNDERSCORED_ID uint8clampedarray_prototype
#include "ecma-builtin-internal-routines-template.inc.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.inc.h
index 3d8f96d1..8564828a 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray-prototype.inc.h
@@ -20,7 +20,7 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 1
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY
#include "ecma-builtin-typedarray-prototype-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c
index 0d6fe212..f3678f47 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.c
@@ -19,6 +19,7 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-typedarray-object.h"
+
#include "jrt.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -27,9 +28,8 @@
#include "ecma-builtins-internal.h"
#define BUILTIN_INC_HEADER_NAME "ecma-builtin-uint8clampedarray.inc.h"
-#define BUILTIN_UNDERSCORED_ID uint8clampedarray
+#define BUILTIN_UNDERSCORED_ID uint8clampedarray
#include "ecma-builtin-internal-routines-template.inc.h"
-
#include "ecma-builtin-typedarray-helpers.h"
/** \addtogroup ecma ECMA
@@ -67,14 +67,13 @@ ecma_builtin_uint8clampedarray_dispatch_construct (const ecma_value_t *arguments
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
- return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len,
- ECMA_UINT8_CLAMPED_ARRAY);
+ return ecma_typedarray_helper_dispatch_construct (arguments_list_p, arguments_list_len, ECMA_UINT8_CLAMPED_ARRAY);
} /* ecma_builtin_uint8clampedarray_dispatch_construct */
/**
- * @}
- * @}
- * @}
- */
+ * @}
+ * @}
+ * @}
+ */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.inc.h b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.inc.h
index 16d21454..d3f0eb1f 100644
--- a/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.inc.h
+++ b/jerry-core/ecma/builtin-objects/typedarray/ecma-builtin-uint8clampedarray.inc.h
@@ -20,8 +20,8 @@
#if JERRY_BUILTIN_TYPEDARRAY
#define TYPEDARRAY_BYTES_PER_ELEMENT 1
-#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL
-#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY_PROTOTYPE
+#define TYPEDARRAY_MAGIC_STRING_ID LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL
+#define TYPEDARRAY_BUILTIN_ID ECMA_BUILTIN_ID_UINT8CLAMPEDARRAY_PROTOTYPE
#include "ecma-builtin-typedarray-template.inc.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
diff --git a/jerry-core/ecma/operations/ecma-arguments-object.c b/jerry-core/ecma/operations/ecma-arguments-object.c
index 35339be7..4d289409 100644
--- a/jerry-core/ecma/operations/ecma-arguments-object.c
+++ b/jerry-core/ecma/operations/ecma-arguments-object.c
@@ -13,6 +13,8 @@
* limitations under the License.
*/
+#include "ecma-arguments-object.h"
+
#include "ecma-alloc.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
@@ -21,9 +23,9 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-lex-env.h"
-#include "ecma-objects.h"
-#include "ecma-arguments-object.h"
#include "ecma-objects-general.h"
+#include "ecma-objects.h"
+
#include "jrt.h"
/** \addtogroup ecma ECMA
@@ -130,10 +132,8 @@ ecma_op_create_arguments_object (vm_frame_ctx_shared_args_t *shared_p, /**< shar
ecma_property_value_t *prop_value_p;
ecma_string_t *prop_name_p = ecma_new_ecma_string_from_uint32 (i);
- prop_value_p = ecma_create_named_data_property (obj_p,
- prop_name_p,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,
- NULL);
+ prop_value_p =
+ ecma_create_named_data_property (obj_p, prop_name_p, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL);
ecma_deref_ecma_string (prop_name_p);
@@ -163,9 +163,7 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, /**< the
* descriptor */
{
/* 3. */
- ecma_value_t ret_value = ecma_op_general_object_define_own_property (object_p,
- property_name_p,
- property_desc_p);
+ ecma_value_t ret_value = ecma_op_general_object_define_own_property (object_p, property_name_p, property_desc_p);
if (ECMA_IS_VALUE_ERROR (ret_value)
|| !(((ecma_extended_object_t *) object_p)->u.cls.u1.arguments_flags & ECMA_ARGUMENTS_OBJECT_MAPPED))
@@ -200,16 +198,12 @@ ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, /**< the
ecma_string_t *name_p = ecma_op_arguments_object_get_formal_parameter (mapped_arguments_p, index);
ecma_object_t *lex_env_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_object_t, mapped_arguments_p->lex_env);
- ecma_value_t completion = ecma_op_set_mutable_binding (lex_env_p,
- name_p,
- property_desc_p->value,
- true);
+ ecma_value_t completion = ecma_op_set_mutable_binding (lex_env_p, name_p, property_desc_p->value, true);
JERRY_ASSERT (ecma_is_value_empty (completion));
}
- if ((property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED)
- && !(property_desc_p->flags & JERRY_PROP_IS_WRITABLE))
+ if ((property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED) && !(property_desc_p->flags & JERRY_PROP_IS_WRITABLE))
{
ecma_free_value_if_not_object (argv_p[index]);
argv_p[index] = ECMA_VALUE_ARGUMENT_NO_TRACK;
@@ -246,8 +240,7 @@ ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object
if (index != ECMA_STRING_NOT_ARRAY_INDEX)
{
- if (index >= arguments_number
- || ecma_is_value_empty (argv_p[index]))
+ if (index >= arguments_number || ecma_is_value_empty (argv_p[index]))
{
return NULL;
}
@@ -389,8 +382,7 @@ ecma_op_arguments_delete_built_in_property (ecma_object_t *object_p, /**< the ob
argv_p = (ecma_value_t *) (((ecma_mapped_arguments_t *) object_p) + 1);
}
- JERRY_ASSERT (argv_p[index] == ECMA_VALUE_UNDEFINED
- || argv_p[index] == ECMA_VALUE_ARGUMENT_NO_TRACK);
+ JERRY_ASSERT (argv_p[index] == ECMA_VALUE_UNDEFINED || argv_p[index] == ECMA_VALUE_ARGUMENT_NO_TRACK);
argv_p[index] = ECMA_VALUE_EMPTY;
} /* ecma_op_arguments_delete_built_in_property */
@@ -455,8 +447,7 @@ ecma_op_arguments_object_list_lazy_property_names (ecma_object_t *obj_p, /**< ar
}
#if JERRY_ESNEXT
- if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS)
- && !(flags & ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED))
+ if (!(filter & JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS) && !(flags & ECMA_ARGUMENTS_OBJECT_ITERATOR_INITIALIZED))
{
ecma_string_t *symbol_p = ecma_op_get_global_symbol (LIT_GLOBAL_SYMBOL_ITERATOR);
ecma_collection_push_back (prop_names_p, ecma_make_symbol_value (symbol_p));
diff --git a/jerry-core/ecma/operations/ecma-arguments-object.h b/jerry-core/ecma/operations/ecma-arguments-object.h
index 08477582..755b755c 100644
--- a/jerry-core/ecma/operations/ecma-arguments-object.h
+++ b/jerry-core/ecma/operations/ecma-arguments-object.h
@@ -18,28 +18,25 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
+
#include "vm-defines.h"
-ecma_value_t
-ecma_op_create_arguments_object (vm_frame_ctx_shared_args_t *shared_p, ecma_object_t *lex_env_p);
+ecma_value_t ecma_op_create_arguments_object (vm_frame_ctx_shared_args_t *shared_p, ecma_object_t *lex_env_p);
-ecma_value_t
-ecma_op_arguments_object_define_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p,
- const ecma_property_descriptor_t *property_desc_p);
+ecma_value_t ecma_op_arguments_object_define_own_property (ecma_object_t *object_p,
+ ecma_string_t *property_name_p,
+ const ecma_property_descriptor_t *property_desc_p);
-ecma_property_t *
-ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object_p,
- ecma_string_t *property_name_p);
+ecma_property_t *ecma_op_arguments_object_try_to_lazy_instantiate_property (ecma_object_t *object_p,
+ ecma_string_t *property_name_p);
-void
-ecma_op_arguments_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
+void ecma_op_arguments_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
-void
-ecma_op_arguments_object_list_lazy_property_names (ecma_object_t *obj_p, ecma_collection_t *prop_names_p,
- ecma_property_counter_t *prop_counter_p,
- jerry_property_filter_t filter);
+void ecma_op_arguments_object_list_lazy_property_names (ecma_object_t *obj_p,
+ ecma_collection_t *prop_names_p,
+ ecma_property_counter_t *prop_counter_p,
+ jerry_property_filter_t filter);
-ecma_string_t *
-ecma_op_arguments_object_get_formal_parameter (ecma_mapped_arguments_t *mapped_arguments_p,
- uint32_t index);
+ecma_string_t *ecma_op_arguments_object_get_formal_parameter (ecma_mapped_arguments_t *mapped_arguments_p,
+ uint32_t index);
#endif /* !ECMA_ARGUMENTS_OBJECT_H */
diff --git a/jerry-core/ecma/operations/ecma-array-object.c b/jerry-core/ecma/operations/ecma-array-object.c
index e52125c8..7ea3e6c6 100644
--- a/jerry-core/ecma/operations/ecma-array-object.c
+++ b/jerry-core/ecma/operations/ecma-array-object.c
@@ -13,20 +13,21 @@
* limitations under the License.
*/
-#include "ecma-alloc.h"
#include "ecma-array-object.h"
-#include "ecma-iterator-object.h"
+
+#include "ecma-alloc.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
-#include "ecma-property-hashmap.h"
#include "ecma-helpers.h"
+#include "ecma-iterator-object.h"
#include "ecma-number-arithmetic.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
-#include "ecma-function-object.h"
+#include "ecma-objects.h"
+#include "ecma-property-hashmap.h"
/** \addtogroup ecma ECMA
* @{
@@ -54,8 +55,7 @@
/**
* Property name type flag for array indices.
*/
-#define ECMA_FAST_ARRAY_UINT_DIRECT_STRING_PROP_TYPE \
- (ECMA_DIRECT_STRING_UINT << ECMA_PROPERTY_NAME_TYPE_SHIFT)
+#define ECMA_FAST_ARRAY_UINT_DIRECT_STRING_PROP_TYPE (ECMA_DIRECT_STRING_UINT << ECMA_PROPERTY_NAME_TYPE_SHIFT)
/**
* Allocate a new array object with the given length
@@ -71,9 +71,8 @@ ecma_op_alloc_array_object (uint32_t length) /**< length of the new array */
ecma_object_t *array_prototype_object_p = ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE);
#endif /* JERRY_BUILTIN_ARRAY */
- ecma_object_t *object_p = ecma_create_object (array_prototype_object_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_ARRAY);
+ ecma_object_t *object_p =
+ ecma_create_object (array_prototype_object_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_ARRAY);
/*
* [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_ARRAY type.
@@ -97,8 +96,8 @@ ecma_op_alloc_array_object (uint32_t length) /**< length of the new array */
extern inline bool JERRY_ATTR_ALWAYS_INLINE
ecma_op_object_is_fast_array (ecma_object_t *object_p) /**< ecma-object */
{
- return (ecma_get_object_base_type (object_p) == ECMA_OBJECT_BASE_TYPE_ARRAY &&
- ecma_op_array_is_fast_array ((ecma_extended_object_t *) object_p));
+ return (ecma_get_object_base_type (object_p) == ECMA_OBJECT_BASE_TYPE_ARRAY
+ && ecma_op_array_is_fast_array ((ecma_extended_object_t *) object_p));
} /* ecma_op_object_is_fast_array */
/**
@@ -229,10 +228,8 @@ ecma_op_new_array_object_from_buffer (const ecma_value_t *args_p, /**< array ele
ecma_string_t *prop_name_p = ecma_new_ecma_string_from_uint32 (i);
ecma_property_value_t *prop_value_p;
- prop_value_p = ecma_create_named_data_property (object_p,
- prop_name_p,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,
- NULL);
+ prop_value_p =
+ ecma_create_named_data_property (object_p, prop_name_p, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL);
ecma_deref_ecma_string (prop_name_p);
prop_value_p->value = ecma_copy_value_if_not_object (args_p[i]);
}
@@ -343,9 +340,9 @@ ecma_fast_array_convert_to_normal (ecma_object_t *object_p) /**< fast access mod
JERRY_ASSERT (index <= ECMA_DIRECT_STRING_MAX_IMM);
property_pair_p->names_cp[prop_index] = (jmem_cpointer_t) index;
- property_pair_p->header.types[prop_index] = (ecma_property_t) (ECMA_PROPERTY_FLAG_DATA
- | ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE
- | ECMA_FAST_ARRAY_UINT_DIRECT_STRING_PROP_TYPE);
+ property_pair_p->header.types[prop_index] =
+ (ecma_property_t) (ECMA_PROPERTY_FLAG_DATA | ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE
+ | ECMA_FAST_ARRAY_UINT_DIRECT_STRING_PROP_TYPE);
property_pair_p->values[prop_index].value = values_p[index];
@@ -766,10 +763,7 @@ ecma_op_array_species_create (ecma_object_t *original_array_p, /**< The object f
ecma_value_t len_val = ecma_make_length_value (length);
ecma_object_t *ctor_object_p = ecma_get_object_from_value (constructor);
- ecma_value_t ret_val = ecma_op_function_construct (ctor_object_p,
- ctor_object_p,
- &len_val,
- 1);
+ ecma_value_t ret_val = ecma_op_function_construct (ctor_object_p, ctor_object_p, &len_val, 1);
ecma_deref_object (ctor_object_p);
ecma_free_value (len_val);
@@ -863,8 +857,7 @@ ecma_delete_array_properties (ecma_object_t *object_p, /**< object */
if (current_prop_p->types[i] != ECMA_PROPERTY_TYPE_DELETED
&& !ecma_is_property_configurable (current_prop_p->types[i]))
{
- uint32_t index = ecma_string_get_property_index (current_prop_p->types[i],
- prop_pair_p->names_cp[i]);
+ uint32_t index = ecma_string_get_property_index (current_prop_p->types[i], prop_pair_p->names_cp[i]);
if (index < old_length && index >= new_length)
{
@@ -914,8 +907,7 @@ ecma_delete_array_properties (ecma_object_t *object_p, /**< object */
if (current_prop_p->types[i] != ECMA_PROPERTY_TYPE_DELETED
&& ecma_is_property_configurable (current_prop_p->types[i]))
{
- uint32_t index = ecma_string_get_property_index (current_prop_p->types[i],
- prop_pair_p->names_cp[i]);
+ uint32_t index = ecma_string_get_property_index (current_prop_p->types[i], prop_pair_p->names_cp[i]);
if (index < old_length && index >= new_length)
{
@@ -924,9 +916,8 @@ ecma_delete_array_properties (ecma_object_t *object_p, /**< object */
#if JERRY_PROPERTY_HASHMAP
if (hashmap_status == ECMA_PROPERTY_HASHMAP_DELETE_HAS_HASHMAP)
{
- hashmap_status = ecma_property_hashmap_delete (object_p,
- prop_pair_p->names_cp[i],
- current_prop_p->types + i);
+ hashmap_status =
+ ecma_property_hashmap_delete (object_p, prop_pair_p->names_cp[i], current_prop_p->types + i);
}
#endif /* JERRY_PROPERTY_HASHMAP */
@@ -1010,10 +1001,8 @@ ecma_op_array_object_set_length (ecma_object_t *object_p, /**< the array object
}
/* Only the writable and data properties can be modified. */
- if (flags & (JERRY_PROP_IS_CONFIGURABLE
- | JERRY_PROP_IS_ENUMERABLE
- | JERRY_PROP_IS_GET_DEFINED
- | JERRY_PROP_IS_SET_DEFINED))
+ if (flags
+ & (JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_ENUMERABLE | JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))
{
return ecma_raise_property_redefinition (ecma_get_magic_string (LIT_MAGIC_STRING_LENGTH), flags);
}
@@ -1061,8 +1050,7 @@ ecma_op_array_object_set_length (ecma_object_t *object_p, /**< the array object
ext_object_p->u.array.length = current_len_uint32;
- if ((flags & JERRY_PROP_IS_WRITABLE_DEFINED)
- && !(flags & JERRY_PROP_IS_WRITABLE))
+ if ((flags & JERRY_PROP_IS_WRITABLE_DEFINED) && !(flags & JERRY_PROP_IS_WRITABLE))
{
if (ecma_op_array_is_fast_array (ext_object_p))
{
@@ -1085,13 +1073,10 @@ ecma_op_array_object_set_length (ecma_object_t *object_p, /**< the array object
* If the property desciptor fields contains all the flags below
* attempt to stay fast access array during [[DefineOwnProperty]] operation.
*/
-#define ECMA_FAST_ARRAY_DATA_PROP_FLAGS (JERRY_PROP_IS_VALUE_DEFINED \
- | JERRY_PROP_IS_ENUMERABLE_DEFINED \
- | JERRY_PROP_IS_ENUMERABLE \
- | JERRY_PROP_IS_CONFIGURABLE_DEFINED \
- | JERRY_PROP_IS_CONFIGURABLE \
- | JERRY_PROP_IS_WRITABLE_DEFINED \
- | JERRY_PROP_IS_WRITABLE)
+#define ECMA_FAST_ARRAY_DATA_PROP_FLAGS \
+ (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE \
+ | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_WRITABLE_DEFINED \
+ | JERRY_PROP_IS_WRITABLE)
/**
* [[DefineOwnProperty]] ecma array object's operation
@@ -1166,8 +1151,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *object_p, /**< the arra
bool update_length = (index >= ext_object_p->u.array.length);
- if (update_length
- && !ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count))
+ if (update_length && !ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count))
{
return ecma_raise_property_redefinition (property_name_p, property_desc_p->flags);
}
@@ -1177,9 +1161,7 @@ ecma_op_array_object_define_own_property (ecma_object_t *object_p, /**< the arra
prop_desc = *property_desc_p;
prop_desc.flags &= (uint16_t) ~JERRY_PROP_SHOULD_THROW;
- ecma_value_t completition = ecma_op_general_object_define_own_property (object_p,
- property_name_p,
- &prop_desc);
+ ecma_value_t completition = ecma_op_general_object_define_own_property (object_p, property_name_p, &prop_desc);
JERRY_ASSERT (ecma_is_value_boolean (completition));
if (ecma_is_value_false (completition))
diff --git a/jerry-core/ecma/operations/ecma-array-object.h b/jerry-core/ecma/operations/ecma-array-object.h
index a56d3bc5..c98fca0a 100644
--- a/jerry-core/ecma/operations/ecma-array-object.h
+++ b/jerry-core/ecma/operations/ecma-array-object.h
@@ -62,66 +62,47 @@
*/
#define ECMA_FAST_ARRAY_MAX_HOLE_COUNT (1 << 24)
-ecma_object_t *
-ecma_op_new_array_object (uint32_t length);
+ecma_object_t *ecma_op_new_array_object (uint32_t length);
-ecma_object_t *
-ecma_op_new_array_object_from_length (ecma_length_t length);
+ecma_object_t *ecma_op_new_array_object_from_length (ecma_length_t length);
-ecma_value_t
-ecma_op_new_array_object_from_buffer (const ecma_value_t *args_p, uint32_t length);
+ecma_value_t ecma_op_new_array_object_from_buffer (const ecma_value_t *args_p, uint32_t length);
-ecma_value_t
-ecma_op_new_array_object_from_collection (ecma_collection_t *collection_p, bool unref_objects);
+ecma_value_t ecma_op_new_array_object_from_collection (ecma_collection_t *collection_p, bool unref_objects);
-bool
-ecma_op_object_is_fast_array (ecma_object_t *object_p);
+bool ecma_op_object_is_fast_array (ecma_object_t *object_p);
-bool
-ecma_op_array_is_fast_array (ecma_extended_object_t *array_p);
+bool ecma_op_array_is_fast_array (ecma_extended_object_t *array_p);
-uint32_t
-ecma_fast_array_get_hole_count (ecma_object_t *obj_p);
+uint32_t ecma_fast_array_get_hole_count (ecma_object_t *obj_p);
-ecma_value_t *
-ecma_fast_array_extend (ecma_object_t *object_p, uint32_t new_lengt);
+ecma_value_t *ecma_fast_array_extend (ecma_object_t *object_p, uint32_t new_lengt);
-bool
-ecma_fast_array_set_property (ecma_object_t *object_p, uint32_t index, ecma_value_t value);
+bool ecma_fast_array_set_property (ecma_object_t *object_p, uint32_t index, ecma_value_t value);
-bool
-ecma_array_object_delete_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
+bool ecma_array_object_delete_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
-uint32_t
-ecma_delete_fast_array_properties (ecma_object_t *object_p, uint32_t new_length);
+uint32_t ecma_delete_fast_array_properties (ecma_object_t *object_p, uint32_t new_length);
-ecma_collection_t *
-ecma_fast_array_object_own_property_keys (ecma_object_t *object_p, jerry_property_filter_t filter);
+ecma_collection_t *ecma_fast_array_object_own_property_keys (ecma_object_t *object_p, jerry_property_filter_t filter);
-void
-ecma_fast_array_convert_to_normal (ecma_object_t *object_p);
+void ecma_fast_array_convert_to_normal (ecma_object_t *object_p);
#if JERRY_ESNEXT
-ecma_object_t *
-ecma_op_array_species_create (ecma_object_t *original_array_p,
- ecma_length_t length);
+ecma_object_t *ecma_op_array_species_create (ecma_object_t *original_array_p, ecma_length_t length);
-ecma_value_t
-ecma_op_create_array_iterator (ecma_object_t *obj_p,
- ecma_iterator_kind_t kind);
+ecma_value_t ecma_op_create_array_iterator (ecma_object_t *obj_p, ecma_iterator_kind_t kind);
#endif /* JERRY_ESNEXT */
-ecma_value_t
-ecma_op_array_object_set_length (ecma_object_t *object_p, ecma_value_t new_value, uint16_t flags);
+ecma_value_t ecma_op_array_object_set_length (ecma_object_t *object_p, ecma_value_t new_value, uint16_t flags);
-ecma_value_t
-ecma_op_array_object_define_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p,
- const ecma_property_descriptor_t *property_desc_p);
+ecma_value_t ecma_op_array_object_define_own_property (ecma_object_t *object_p,
+ ecma_string_t *property_name_p,
+ const ecma_property_descriptor_t *property_desc_p);
uint32_t ecma_array_get_length (ecma_object_t *array_p);
-ecma_value_t
-ecma_array_object_to_string (ecma_value_t this_arg);
+ecma_value_t ecma_array_object_to_string (ecma_value_t this_arg);
/**
* @}
diff --git a/jerry-core/ecma/operations/ecma-arraybuffer-object.c b/jerry-core/ecma/operations/ecma-arraybuffer-object.c
index eebf31f3..3457066c 100644
--- a/jerry-core/ecma/operations/ecma-arraybuffer-object.c
+++ b/jerry-core/ecma/operations/ecma-arraybuffer-object.c
@@ -14,8 +14,9 @@
*/
#include "ecma-arraybuffer-object.h"
-#include "ecma-builtins.h"
+
#include "ecma-builtin-helpers.h"
+#include "ecma-builtins.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
@@ -24,6 +25,7 @@
#include "ecma-objects.h"
#include "ecma-shared-arraybuffer-object.h"
#include "ecma-typedarray-object.h"
+
#include "jcontext.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -47,8 +49,7 @@ ecma_arraybuffer_create_object (uint8_t type, /**< type of the arraybuffer */
ecma_builtin_id_t prototype_id;
#if JERRY_BUILTIN_SHAREDARRAYBUFFER
- JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER
- || type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER);
+ JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER || type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER);
prototype_id = (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER ? ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE
: ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE);
@@ -83,8 +84,7 @@ ecma_arraybuffer_create_object_with_buffer (uint8_t type, /**< type of the array
ecma_builtin_id_t prototype_id;
#if JERRY_BUILTIN_SHAREDARRAYBUFFER
- JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER
- || type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER);
+ JERRY_ASSERT (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER || type == ECMA_OBJECT_CLASS_SHARED_ARRAY_BUFFER);
prototype_id = (type == ECMA_OBJECT_CLASS_ARRAY_BUFFER ? ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE
: ECMA_BUILTIN_ID_SHARED_ARRAYBUFFER_PROTOTYPE);
@@ -94,9 +94,8 @@ ecma_arraybuffer_create_object_with_buffer (uint8_t type, /**< type of the array
prototype_id = ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE;
#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */
- ecma_object_t *object_p = ecma_create_object (ecma_builtin_get (prototype_id),
- sizeof (ecma_arraybuffer_pointer_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p =
+ ecma_create_object (ecma_builtin_get (prototype_id), sizeof (ecma_arraybuffer_pointer_t), ECMA_OBJECT_TYPE_CLASS);
ecma_arraybuffer_pointer_t *arraybuffer_pointer_p = (ecma_arraybuffer_pointer_t *) object_p;
arraybuffer_pointer_p->extended_object.u.cls.type = type;
@@ -266,7 +265,6 @@ ecma_op_create_arraybuffer_object (const ecma_value_t *arguments_list_p, /**< li
if (arguments_list_len > 0)
{
-
if (ecma_is_value_number (arguments_list_p[0]))
{
length_num = ecma_get_number_from_value (arguments_list_p[0]);
@@ -341,7 +339,7 @@ ecma_arraybuffer_get_length (ecma_object_t *object_p) /**< pointer to the ArrayB
*
* @return pointer to the data buffer
*/
-extern inline uint8_t * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
+extern inline uint8_t *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
ecma_arraybuffer_get_buffer (ecma_object_t *object_p) /**< pointer to the ArrayBuffer object */
{
JERRY_ASSERT (ecma_object_class_is (object_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)
@@ -420,9 +418,7 @@ ecma_arraybuffer_detach (ecma_object_t *object_p) /**< pointer to the ArrayBuffe
* Returned value must be freed with ecma_free_value.
*/
ecma_value_t
-ecma_builtin_arraybuffer_slice (ecma_value_t this_arg,
- const ecma_value_t *argument_list_p,
- uint32_t arguments_number)
+ecma_builtin_arraybuffer_slice (ecma_value_t this_arg, const ecma_value_t *argument_list_p, uint32_t arguments_number)
{
ecma_object_t *object_p = ecma_get_object_from_value (this_arg);
@@ -441,9 +437,7 @@ ecma_builtin_arraybuffer_slice (ecma_value_t this_arg,
if (arguments_number > 0)
{
/* 6-7. */
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[0],
- len,
- &start)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[0], len, &start)))
{
return ECMA_VALUE_ERROR;
}
@@ -451,9 +445,7 @@ ecma_builtin_arraybuffer_slice (ecma_value_t this_arg,
if (arguments_number > 1 && !ecma_is_value_undefined (argument_list_p[1]))
{
/* 8-9. */
- if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[1],
- len,
- &end)))
+ if (ECMA_IS_VALUE_ERROR (ecma_builtin_helper_uint32_index_normalize (argument_list_p[1], len, &end)))
{
return ECMA_VALUE_ERROR;
}
@@ -540,7 +532,7 @@ ecma_builtin_arraybuffer_slice (ecma_value_t this_arg,
/* 22. */
memcpy (new_buf, old_buf + start, new_len);
- free_new_arraybuffer:
+free_new_arraybuffer:
if (ret_value != ECMA_VALUE_EMPTY)
{
ecma_deref_object (new_arraybuffer_p);
diff --git a/jerry-core/ecma/operations/ecma-arraybuffer-object.h b/jerry-core/ecma/operations/ecma-arraybuffer-object.h
index f904c1ae..df1f3b3f 100644
--- a/jerry-core/ecma/operations/ecma-arraybuffer-object.h
+++ b/jerry-core/ecma/operations/ecma-arraybuffer-object.h
@@ -36,42 +36,28 @@
/**
* Check whether the backing store is allocated for an array buffer.
*/
-#define ECMA_ARRAYBUFFER_CHECK_BUFFER_ERROR(arraybuffer_p) \
+#define ECMA_ARRAYBUFFER_CHECK_BUFFER_ERROR(arraybuffer_p) \
(JERRY_UNLIKELY (!(ECMA_ARRAYBUFFER_GET_FLAGS (arraybuffer_p) & ECMA_ARRAYBUFFER_ALLOCATED)) \
&& ecma_arraybuffer_allocate_buffer_throw (arraybuffer_p) == ECMA_VALUE_ERROR)
-ecma_value_t
-ecma_op_create_arraybuffer_object (const ecma_value_t *, uint32_t);
+ecma_value_t ecma_op_create_arraybuffer_object (const ecma_value_t *, uint32_t);
/**
* Helper functions for arraybuffer.
*/
-ecma_object_t *
-ecma_arraybuffer_create_object (uint8_t type, uint32_t length);
-ecma_object_t *
-ecma_arraybuffer_create_object_with_buffer (uint8_t type, uint32_t length);
-ecma_object_t *
-ecma_arraybuffer_new_object (uint32_t length);
-uint8_t *
-ecma_arraybuffer_allocate_buffer (ecma_object_t *arraybuffer_p);
-ecma_value_t
-ecma_arraybuffer_allocate_buffer_throw (ecma_object_t *arraybuffer_p);
-void
-ecma_arraybuffer_release_buffer (ecma_object_t *arraybuffer_p);
-uint8_t * JERRY_ATTR_PURE
-ecma_arraybuffer_get_buffer (ecma_object_t *obj_p);
-uint32_t JERRY_ATTR_PURE
-ecma_arraybuffer_get_length (ecma_object_t *obj_p);
-bool JERRY_ATTR_PURE
-ecma_arraybuffer_is_detached (ecma_object_t *obj_p);
-bool
-ecma_arraybuffer_detach (ecma_object_t *obj_p);
-bool
-ecma_is_arraybuffer (ecma_value_t val);
+ecma_object_t *ecma_arraybuffer_create_object (uint8_t type, uint32_t length);
+ecma_object_t *ecma_arraybuffer_create_object_with_buffer (uint8_t type, uint32_t length);
+ecma_object_t *ecma_arraybuffer_new_object (uint32_t length);
+uint8_t *ecma_arraybuffer_allocate_buffer (ecma_object_t *arraybuffer_p);
+ecma_value_t ecma_arraybuffer_allocate_buffer_throw (ecma_object_t *arraybuffer_p);
+void ecma_arraybuffer_release_buffer (ecma_object_t *arraybuffer_p);
+uint8_t *JERRY_ATTR_PURE ecma_arraybuffer_get_buffer (ecma_object_t *obj_p);
+uint32_t JERRY_ATTR_PURE ecma_arraybuffer_get_length (ecma_object_t *obj_p);
+bool JERRY_ATTR_PURE ecma_arraybuffer_is_detached (ecma_object_t *obj_p);
+bool ecma_arraybuffer_detach (ecma_object_t *obj_p);
+bool ecma_is_arraybuffer (ecma_value_t val);
ecma_value_t
-ecma_builtin_arraybuffer_slice (ecma_value_t this_arg,
- const ecma_value_t *argument_list_p,
- uint32_t arguments_number);
+ecma_builtin_arraybuffer_slice (ecma_value_t this_arg, const ecma_value_t *argument_list_p, uint32_t arguments_number);
/**
* @}
diff --git a/jerry-core/ecma/operations/ecma-async-generator-object.c b/jerry-core/ecma/operations/ecma-async-generator-object.c
index 446e9cc9..fcb249d9 100644
--- a/jerry-core/ecma/operations/ecma-async-generator-object.c
+++ b/jerry-core/ecma/operations/ecma-async-generator-object.c
@@ -13,8 +13,9 @@
* limitations under the License.
*/
-#include "ecma-alloc.h"
#include "ecma-async-generator-object.h"
+
+#include "ecma-alloc.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
@@ -24,10 +25,11 @@
#include "ecma-iterator-object.h"
#include "ecma-objects.h"
#include "ecma-promise-object.h"
+
#include "jcontext.h"
#include "opcodes.h"
-#include "vm.h"
#include "vm-stack.h"
+#include "vm.h"
#if JERRY_ESNEXT
@@ -145,9 +147,7 @@ ecma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< a
return ecma_raise_type_error (ECMA_ERR_MSG ("Iterator 'throw' is not available"));
}
- result = ecma_async_yield_call (result,
- async_generator_object_p,
- ECMA_VALUE_EMPTY);
+ result = ecma_async_yield_call (result, async_generator_object_p, ECMA_VALUE_EMPTY);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -158,9 +158,7 @@ ecma_async_yield_throw (vm_executable_object_t *async_generator_object_p, /**< a
return ECMA_VALUE_UNDEFINED;
}
- result = ecma_async_yield_call (result,
- async_generator_object_p,
- value);
+ result = ecma_async_yield_call (result, async_generator_object_p, value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -407,9 +405,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl
return value;
}
- result = ecma_async_yield_call (result,
- executable_object_p,
- value);
+ result = ecma_async_yield_call (result, executable_object_p, value);
ecma_free_value (value);
if (ECMA_IS_VALUE_ERROR (result))
@@ -509,8 +505,7 @@ ecma_await_continue (vm_executable_object_t *executable_object_p, /**< executabl
uint32_t context_end = VM_GET_CONTEXT_END (stack_top_p[-1]);
executable_object_p->frame_ctx.byte_code_p = executable_object_p->frame_ctx.byte_code_start_p + context_end;
- VM_MINUS_EQUAL_U16 (executable_object_p->frame_ctx.context_depth,
- PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION);
+ VM_MINUS_EQUAL_U16 (executable_object_p->frame_ctx.context_depth, PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION);
stack_top_p -= PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION;
executable_object_p->frame_ctx.stack_top_p = stack_top_p;
diff --git a/jerry-core/ecma/operations/ecma-async-generator-object.h b/jerry-core/ecma/operations/ecma-async-generator-object.h
index 7436ba70..b5a94cf4 100644
--- a/jerry-core/ecma/operations/ecma-async-generator-object.h
+++ b/jerry-core/ecma/operations/ecma-async-generator-object.h
@@ -17,6 +17,7 @@
#define ECMA_ASYNC_GENERATOR_OBJECT_H
#include "ecma-globals.h"
+
#include "vm-defines.h"
#if JERRY_ESNEXT
@@ -47,27 +48,24 @@ typedef enum
/**
* Set the state of an async yield iterator.
*/
-#define ECMA_AWAIT_SET_STATE(async_generator_object_p, to) \
- do \
- { \
+#define ECMA_AWAIT_SET_STATE(async_generator_object_p, to) \
+ do \
+ { \
uint16_t extra_info = (async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags; \
- extra_info &= ((1 << ECMA_AWAIT_STATE_SHIFT) - 1); \
- extra_info |= (ECMA_AWAIT_ ## to) << ECMA_AWAIT_STATE_SHIFT; \
- (async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags = extra_info; \
- } \
- while (false)
+ extra_info &= ((1 << ECMA_AWAIT_STATE_SHIFT) - 1); \
+ extra_info |= (ECMA_AWAIT_##to) << ECMA_AWAIT_STATE_SHIFT; \
+ (async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags = extra_info; \
+ } while (false)
/**
* Mask for clearing all ASYNC_AWAIT status bits
*/
-#define ECMA_AWAIT_CLEAR_MASK \
- (((1 << ECMA_AWAIT_STATE_SHIFT) - 1) - ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)
+#define ECMA_AWAIT_CLEAR_MASK (((1 << ECMA_AWAIT_STATE_SHIFT) - 1) - ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD)
/**
* Helper macro for ECMA_AWAIT_CHANGE_STATE.
*/
-#define ECMA_AWAIT_CS_HELPER(from, to) \
- (((ECMA_AWAIT_ ## from) ^ (ECMA_AWAIT_ ## to)) << ECMA_AWAIT_STATE_SHIFT)
+#define ECMA_AWAIT_CS_HELPER(from, to) (((ECMA_AWAIT_##from) ^ (ECMA_AWAIT_##to)) << ECMA_AWAIT_STATE_SHIFT)
/**
* Change the state of an async yield iterator.
@@ -76,7 +74,8 @@ typedef enum
((async_generator_object_p)->extended_object.u.cls.u2.executable_obj_flags ^= ECMA_AWAIT_CS_HELPER (from, to))
ecma_value_t ecma_async_generator_enqueue (vm_executable_object_t *async_generator_object_p,
- ecma_async_generator_operation_type_t operation, ecma_value_t value);
+ ecma_async_generator_operation_type_t operation,
+ ecma_value_t value);
ecma_value_t ecma_async_generator_run (vm_executable_object_t *async_generator_object_p);
void ecma_async_generator_finalize (vm_executable_object_t *async_generator_object_p, ecma_value_t value);
diff --git a/jerry-core/ecma/operations/ecma-atomics-object.c b/jerry-core/ecma/operations/ecma-atomics-object.c
index e598b3d1..24a156c8 100644
--- a/jerry-core/ecma/operations/ecma-atomics-object.c
+++ b/jerry-core/ecma/operations/ecma-atomics-object.c
@@ -14,19 +14,21 @@
*/
#include "ecma-atomics-object.h"
+
#include "ecma-arraybuffer-object.h"
-#include "ecma-shared-arraybuffer-object.h"
#include "ecma-bigint.h"
-#include "ecma-typedarray-object.h"
-#include "ecma-objects.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "jmem.h"
+#include "ecma-objects.h"
+#include "ecma-shared-arraybuffer-object.h"
+#include "ecma-typedarray-object.h"
+
#include "jcontext.h"
-#include "ecma-function-object.h"
+#include "jmem.h"
#if JERRY_BUILTIN_ATOMICS
@@ -56,7 +58,7 @@ ecma_validate_shared_integer_typedarray (ecma_value_t typedarray, /**< typedArra
/* 3-4. */
ecma_object_t *typedarray_p = ecma_get_object_from_value (typedarray);
- ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);
+ ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);
/* 5-6. */
if (waitable)
@@ -68,7 +70,7 @@ ecma_validate_shared_integer_typedarray (ecma_value_t typedarray, /**< typedArra
}
else
{
- if (target_info.id == ECMA_UINT8_CLAMPED_ARRAY || target_info.id == ECMA_FLOAT32_ARRAY
+ if (target_info.id == ECMA_UINT8_CLAMPED_ARRAY || target_info.id == ECMA_FLOAT32_ARRAY
|| target_info.id == ECMA_FLOAT64_ARRAY)
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument is not supported"));
@@ -159,7 +161,7 @@ ecma_atomic_read_modify_write (ecma_value_t typedarray, /**< typedArray argument
/* 3. */
ecma_object_t *typedarray_p = ecma_get_object_from_value (typedarray);
- ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);
+ ecma_typedarray_info_t target_info = ecma_typedarray_get_info (typedarray_p);
/* 4-5. */
ecma_value_t val = ECMA_VALUE_ERROR;
diff --git a/jerry-core/ecma/operations/ecma-atomics-object.h b/jerry-core/ecma/operations/ecma-atomics-object.h
index 62434778..d73ae99b 100644
--- a/jerry-core/ecma/operations/ecma-atomics-object.h
+++ b/jerry-core/ecma/operations/ecma-atomics-object.h
@@ -41,20 +41,11 @@ typedef enum
ECMA_ATOMICS_COMPARE_EXCHANGE /**< Atomics compare exchange operation */
} ecma_atomics_op_t;
+ecma_value_t ecma_validate_shared_integer_typedarray (ecma_value_t typedarray, bool waitable);
+ecma_value_t ecma_validate_atomic_access (ecma_value_t typedarray, ecma_value_t request_index);
ecma_value_t
-ecma_validate_shared_integer_typedarray (ecma_value_t typedarray,
- bool waitable);
-ecma_value_t
-ecma_validate_atomic_access (ecma_value_t typedarray,
- ecma_value_t request_index);
-ecma_value_t
-ecma_atomic_read_modify_write (ecma_value_t typedarray,
- ecma_value_t index,
- ecma_value_t value,
- ecma_atomics_op_t op);
-ecma_value_t
-ecma_atomic_load (ecma_value_t typedarray,
- ecma_value_t index);
+ecma_atomic_read_modify_write (ecma_value_t typedarray, ecma_value_t index, ecma_value_t value, ecma_atomics_op_t op);
+ecma_value_t ecma_atomic_load (ecma_value_t typedarray, ecma_value_t index);
/**
* @}
* @}
diff --git a/jerry-core/ecma/operations/ecma-big-uint.c b/jerry-core/ecma/operations/ecma-big-uint.c
index fa9ca1f0..990318e9 100644
--- a/jerry-core/ecma/operations/ecma-big-uint.c
+++ b/jerry-core/ecma/operations/ecma-big-uint.c
@@ -14,7 +14,9 @@
*/
#include "ecma-big-uint.h"
+
#include "ecma-helpers.h"
+
#include "jmem.h"
#include "lit-char-helpers.h"
@@ -113,8 +115,7 @@ ecma_big_uint_count_leading_zero (ecma_bigint_digit_t digit) /**< digit value */
result -= shift;
}
shift >>= 1;
- }
- while (shift > 0);
+ } while (shift > 0);
return result - digit;
} /* ecma_big_uint_count_leading_zero */
@@ -139,8 +140,7 @@ ecma_big_uint_normalize_result (ecma_extended_primitive_t *value_p, /**< BigUInt
do
{
--last_digit_p;
- }
- while (last_digit_p[-1] == 0);
+ } while (last_digit_p[-1] == 0);
JERRY_ASSERT (last_digit_p >= first_digit_p);
@@ -251,8 +251,7 @@ ecma_big_uint_compare (ecma_extended_primitive_t *left_value_p, /**< left BigUIn
{
return 1;
}
- }
- while (left_p > start_p);
+ } while (left_p > start_p);
return 0;
} /* ecma_big_uint_compare */
@@ -309,8 +308,7 @@ ecma_big_uint_mul_digit (ecma_extended_primitive_t *value_p, /**< BigUInt value
*current_p++ = multiply_result_low;
carry = new_carry;
- }
- while (current_p < end_p);
+ } while (current_p < end_p);
if (carry == 0)
{
@@ -390,8 +388,7 @@ ecma_big_uint_to_string (ecma_extended_primitive_t *value_p, /**< BigUInt value
*current_p = (ecma_bigint_digit_t) (result / radix);
remainder = (ecma_bigint_digit_t) (result % radix);
- }
- while (current_p > end_p);
+ } while (current_p > end_p);
}
else
{
@@ -434,16 +431,15 @@ ecma_big_uint_to_string (ecma_extended_primitive_t *value_p, /**< BigUInt value
}
}
- *(--string_p) = (lit_utf8_byte_t) ((remainder < 10) ? (remainder + LIT_CHAR_0)
- : (remainder + (LIT_CHAR_LOWERCASE_A - 10)));
+ *(--string_p) =
+ (lit_utf8_byte_t) ((remainder < 10) ? (remainder + LIT_CHAR_0) : (remainder + (LIT_CHAR_LOWERCASE_A - 10)));
JERRY_ASSERT (string_p >= (lit_utf8_byte_t *) start_p);
if (start_p[-1] == 0)
{
start_p--;
}
- }
- while (start_p > end_p);
+ } while (start_p > end_p);
*char_start_p = (uint32_t) (string_p - result_p);
return result_p;
@@ -469,8 +465,7 @@ ecma_big_uint_increase (ecma_extended_primitive_t *value_p) /**< BigUInt value *
do
{
digits_p++;
- }
- while (digits_p < digits_end_p && digits_p[0] == ~((ecma_bigint_digit_t) 0));
+ } while (digits_p < digits_end_p && digits_p[0] == ~((ecma_bigint_digit_t) 0));
if (digits_p == digits_end_p)
{
@@ -537,8 +532,7 @@ ecma_big_uint_decrease (ecma_extended_primitive_t *value_p) /**< BigUInt value *
{
digits_p++;
JERRY_ASSERT (digits_p < digits_end_p);
- }
- while (digits_p[0] == 0);
+ } while (digits_p[0] == 0);
if (digits_p + 1 == digits_end_p)
{
@@ -648,8 +642,7 @@ ecma_big_uint_add (ecma_extended_primitive_t *left_value_p, /**< left BigUInt va
}
*current_p++ = left;
- }
- while (current_p < end_p);
+ } while (current_p < end_p);
end_p = (ecma_bigint_digit_t *) (((uint8_t *) end_p) + left_size);
@@ -730,8 +723,7 @@ ecma_big_uint_sub (ecma_extended_primitive_t *left_value_p, /**< left BigUInt va
}
*current_p++ = left - right;
- }
- while (current_p < end_p);
+ } while (current_p < end_p);
end_p = (ecma_bigint_digit_t *) (((uint8_t *) end_p) + left_size);
@@ -870,8 +862,7 @@ ecma_big_uint_mul (ecma_extended_primitive_t *left_value_p, /**< left BigUInt va
{
destination_p = (ecma_bigint_digit_t *) extra_space;
}
- }
- while (left_p < left_end_p);
+ } while (left_p < left_end_p);
while (carry > 0)
{
@@ -891,8 +882,7 @@ ecma_big_uint_mul (ecma_extended_primitive_t *left_value_p, /**< left BigUInt va
}
result_start_p++;
- }
- while (right_p < right_end_p);
+ } while (right_p < right_end_p);
if (extra_space[0] == 0)
{
@@ -1038,8 +1028,7 @@ ecma_big_uint_div_shift_left (ecma_extended_primitive_t *value_p, /**< BigUInt v
*destination_p++ = (value << shift_left) | carry;
carry = value >> shift_right;
- }
- while (source_p < end_p);
+ } while (source_p < end_p);
if (extend)
{
@@ -1156,8 +1145,7 @@ ecma_big_uint_div_mod (ecma_extended_primitive_t *dividend_value_p, /**< divider
/* Subtraction is faster than recomputing result_div * divisor_low. */
low_digits -= divisor_low;
}
- }
- while (false);
+ } while (false);
/* D4. [Multiply and subtract] */
ecma_bigint_digit_t *destination_p = dividend_p;
@@ -1188,8 +1176,7 @@ ecma_big_uint_div_mod (ecma_extended_primitive_t *dividend_value_p, /**< divider
*destination_p++ = value - carry;
carry = new_carry;
- }
- while (source_p < divisor_end_p);
+ } while (source_p < divisor_end_p);
bool negative_result = *destination_p < carry;
*destination_p -= carry;
@@ -1228,16 +1215,14 @@ ecma_big_uint_div_mod (ecma_extended_primitive_t *dividend_value_p, /**< divider
}
*destination_p++ = left;
- }
- while (source_p < divisor_end_p);
+ } while (source_p < divisor_end_p);
}
*dividend_end_p = result_div;
dividend_p--;
dividend_end_p--;
- }
- while (dividend_p >= buffer_p);
+ } while (dividend_p >= buffer_p);
ecma_bigint_digit_t *source_p;
ecma_bigint_digit_t *source_end_p;
@@ -1295,8 +1280,7 @@ ecma_big_uint_div_mod (ecma_extended_primitive_t *dividend_value_p, /**< divider
*(--destination_p) = (value >> shift_right) | carry;
carry = value << shift_left;
- }
- while (source_end_p > source_p);
+ } while (source_end_p > source_p);
}
else
{
@@ -1378,8 +1362,7 @@ ecma_big_uint_shift_left (ecma_extended_primitive_t *left_value_p, /**< left Big
*result_p++ = (value << shift_left) | carry;
carry = value >> shift_right;
- }
- while (left_p < left_end_p);
+ } while (left_p < left_end_p);
if (carry > 0)
{
@@ -1395,7 +1378,7 @@ ecma_big_uint_shift_left (ecma_extended_primitive_t *left_value_p, /**< left Big
* @return new BigUInt value, NULL on error
*/
ecma_extended_primitive_t *
-ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */
+ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left BigUInt value */
uint32_t right_value, /**< shift value */
bool increase_result) /**< increase result */
{
@@ -1410,8 +1393,7 @@ ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left B
uint32_t shift_left = (1 << ECMA_BIGINT_DIGIT_SHIFT) - shift_right;
ecma_bigint_digit_t carry = 0;
- if (shift_right > 0
- && (ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) >> shift_right) == 0)
+ if (shift_right > 0 && (ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) >> shift_right) == 0)
{
carry = ECMA_BIGINT_GET_LAST_DIGIT (left_value_p, left_size) << shift_left;
left_size -= (uint32_t) sizeof (ecma_bigint_digit_t);
@@ -1433,8 +1415,7 @@ ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left B
}
if (JERRY_UNLIKELY (increase_result)
- && (shift_right == 0
- || (*ECMA_BIGINT_GET_DIGITS (left_value_p, crop_size) << shift_left) == 0))
+ && (shift_right == 0 || (*ECMA_BIGINT_GET_DIGITS (left_value_p, crop_size) << shift_left) == 0))
{
ecma_bigint_digit_t *left_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);
ecma_bigint_digit_t *left_end_p = ECMA_BIGINT_GET_DIGITS (left_value_p, crop_size);
@@ -1483,8 +1464,7 @@ ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, /**< left B
*(--result_p) = (value >> shift_right) | carry;
carry = value << shift_left;
- }
- while (result_p > end_p);
+ } while (result_p > end_p);
if (JERRY_LIKELY (!increase_result))
{
@@ -1606,8 +1586,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation
}
default:
{
- JERRY_ASSERT (operation_type == ECMA_BIG_UINT_BITWISE_OR
- || operation_type == ECMA_BIG_UINT_BITWISE_XOR);
+ JERRY_ASSERT (operation_type == ECMA_BIG_UINT_BITWISE_OR || operation_type == ECMA_BIG_UINT_BITWISE_XOR);
if (right_size <= left_size)
{
@@ -1626,8 +1605,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation
uint32_t decrease_opts = (operation_and_options & ECMA_BIG_UINT_BITWISE_DECREASE_BOTH);
/* When exactly one bit is set, invert both bits. */
- if (decrease_opts >= ECMA_BIG_UINT_BITWISE_DECREASE_LEFT
- && decrease_opts <= ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT)
+ if (decrease_opts >= ECMA_BIG_UINT_BITWISE_DECREASE_LEFT && decrease_opts <= ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT)
{
operation_and_options ^= ECMA_BIG_UINT_BITWISE_DECREASE_BOTH;
}
@@ -1656,8 +1634,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation
do
{
*result_p++ = *left_p++ & *right_p++;
- }
- while (result_p < result_end_p);
+ } while (result_p < result_end_p);
if (result_p[-1] == 0)
{
@@ -1671,8 +1648,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation
do
{
*result_p++ = *left_p++ | *right_p++;
- }
- while (result_p < result_end_p);
+ } while (result_p < result_end_p);
if (left_size > right_size)
{
@@ -1686,8 +1662,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation
do
{
*result_p++ = *left_p++ ^ *right_p++;
- }
- while (result_p < result_end_p);
+ } while (result_p < result_end_p);
if (left_size > right_size)
{
@@ -1754,8 +1729,7 @@ ecma_big_uint_bitwise_op (uint32_t operation_and_options, /**< bitwise operation
break;
}
}
- }
- while (result_p < result_end_p);
+ } while (result_p < result_end_p);
if (operation_type != ECMA_BIG_UINT_BITWISE_AND)
{
diff --git a/jerry-core/ecma/operations/ecma-big-uint.h b/jerry-core/ecma/operations/ecma-big-uint.h
index 913387a0..7eec2dd5 100644
--- a/jerry-core/ecma/operations/ecma-big-uint.h
+++ b/jerry-core/ecma/operations/ecma-big-uint.h
@@ -44,20 +44,17 @@ typedef uint64_t ecma_bigint_two_digits_t;
/**
* Return with the digits of a BigInt value.
*/
-#define ECMA_BIGINT_GET_LAST_DIGIT(value_p, size) \
- *ECMA_BIGINT_GET_DIGITS (value_p, size - sizeof (ecma_bigint_digit_t))
+#define ECMA_BIGINT_GET_LAST_DIGIT(value_p, size) *ECMA_BIGINT_GET_DIGITS (value_p, size - sizeof (ecma_bigint_digit_t))
/**
* Returns true if size is an odd number.
*/
-#define ECMA_BIGINT_SIZE_IS_ODD(size) \
- (((size) & sizeof (ecma_bigint_digit_t)) != 0)
+#define ECMA_BIGINT_SIZE_IS_ODD(size) (((size) & sizeof (ecma_bigint_digit_t)) != 0)
/**
* Returns a two digit value where the high digit is set to the passed digit.
*/
-#define ECMA_BIGINT_HIGH_DIGIT(digit) \
- (((ecma_bigint_two_digits_t) digit) << (8 * sizeof (ecma_bigint_digit_t)))
+#define ECMA_BIGINT_HIGH_DIGIT(digit) (((ecma_bigint_two_digits_t) digit) << (8 * sizeof (ecma_bigint_digit_t)))
/**
* Tells whether a number (usually a digit or uint32_t value) is an odd number.
@@ -78,8 +75,7 @@ typedef enum
/**
* Returns with the type of the operation.
*/
-#define ECMA_BIGINT_BITWISE_GET_OPERATION_TYPE(operation_and_options) \
- ((operation_and_options) & 0xf)
+#define ECMA_BIGINT_BITWISE_GET_OPERATION_TYPE(operation_and_options) ((operation_and_options) &0xf)
/**
* Options for bitwise operations.
@@ -94,8 +90,7 @@ typedef enum
/**
* Subtract 1 from both left and right values.
*/
-#define ECMA_BIG_UINT_BITWISE_DECREASE_BOTH \
- (ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT)
+#define ECMA_BIG_UINT_BITWISE_DECREASE_BOTH (ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT)
ecma_extended_primitive_t *ecma_bigint_create (uint32_t size);
ecma_extended_primitive_t *ecma_big_uint_extend (ecma_extended_primitive_t *value_p, ecma_bigint_digit_t digit);
@@ -104,11 +99,13 @@ ecma_bigint_digit_t ecma_big_uint_count_leading_zero (ecma_bigint_digit_t digit)
int ecma_big_uint_compare (ecma_extended_primitive_t *left_value_p, ecma_extended_primitive_t *right_value_p);
-ecma_extended_primitive_t *ecma_big_uint_mul_digit (ecma_extended_primitive_t *value_p,
- ecma_bigint_digit_t mul, ecma_bigint_digit_t add);
+ecma_extended_primitive_t *
+ecma_big_uint_mul_digit (ecma_extended_primitive_t *value_p, ecma_bigint_digit_t mul, ecma_bigint_digit_t add);
-uint8_t *ecma_big_uint_to_string (ecma_extended_primitive_t *value_p, uint32_t radix,
- uint32_t *char_start_p, uint32_t *char_size_p);
+uint8_t *ecma_big_uint_to_string (ecma_extended_primitive_t *value_p,
+ uint32_t radix,
+ uint32_t *char_start_p,
+ uint32_t *char_size_p);
ecma_extended_primitive_t *ecma_big_uint_increase (ecma_extended_primitive_t *value_p);
ecma_extended_primitive_t *ecma_big_uint_decrease (ecma_extended_primitive_t *value_p);
@@ -124,8 +121,8 @@ ecma_extended_primitive_t *ecma_big_uint_div_mod (ecma_extended_primitive_t *div
bool is_mod);
ecma_extended_primitive_t *ecma_big_uint_shift_left (ecma_extended_primitive_t *left_value_p, uint32_t right_value);
-ecma_extended_primitive_t *ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, uint32_t right_value,
- bool increase_result);
+ecma_extended_primitive_t *
+ecma_big_uint_shift_right (ecma_extended_primitive_t *left_value_p, uint32_t right_value, bool increase_result);
#if JERRY_ESNEXT
ecma_extended_primitive_t *ecma_big_uint_pow (ecma_extended_primitive_t *left_value_p, uint32_t right_value);
diff --git a/jerry-core/ecma/operations/ecma-bigint-object.c b/jerry-core/ecma/operations/ecma-bigint-object.c
index cb089f06..6d03cd51 100644
--- a/jerry-core/ecma/operations/ecma-bigint-object.c
+++ b/jerry-core/ecma/operations/ecma-bigint-object.c
@@ -13,15 +13,16 @@
* limitations under the License.
*/
-#include "ecma-alloc.h"
#include "ecma-bigint-object.h"
+
+#include "ecma-alloc.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
+#include "ecma-objects.h"
#if JERRY_BUILTIN_BIGINT
@@ -47,9 +48,8 @@ ecma_op_create_bigint_object (ecma_value_t arg) /**< argument passed to the toOb
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_BIGINT_PROTOTYPE);
- ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p =
+ ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_BIGINT;
diff --git a/jerry-core/ecma/operations/ecma-bigint.c b/jerry-core/ecma/operations/ecma-bigint.c
index de11b815..66c25843 100644
--- a/jerry-core/ecma/operations/ecma-bigint.c
+++ b/jerry-core/ecma/operations/ecma-bigint.c
@@ -14,10 +14,12 @@
*/
#include "ecma-bigint.h"
+
#include "ecma-big-uint.h"
#include "ecma-exceptions.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
+
#include "lit-char-helpers.h"
#if JERRY_BUILTIN_BIGINT
@@ -179,8 +181,7 @@ ecma_bigint_parse_string (const lit_utf8_byte_t *string_p, /**< string represena
{
break;
}
- }
- while (++string_p < string_end_p);
+ } while (++string_p < string_end_p);
if (JERRY_UNLIKELY (result_p == NULL))
{
@@ -259,8 +260,7 @@ ecma_bigint_to_string (ecma_value_t value, /**< BigInt value */
/**
* Get the size of zero digits from the result of ecma_bigint_number_to_digits
*/
-#define ECMA_BIGINT_NUMBER_TO_DIGITS_GET_ZERO_SIZE(value) \
- (((value) & 0xffff) * (uint32_t) sizeof (ecma_bigint_digit_t))
+#define ECMA_BIGINT_NUMBER_TO_DIGITS_GET_ZERO_SIZE(value) (((value) &0xffff) * (uint32_t) sizeof (ecma_bigint_digit_t))
/**
* Get the number of digits from the result of ecma_bigint_number_to_digits
@@ -723,7 +723,7 @@ ecma_bigint_create_from_digits (const uint64_t *digits_p, /**< BigInt digits */
result_p[0] = (ecma_bigint_digit_t) digit;
result_p[1] = (ecma_bigint_digit_t) (digit >> (8 * sizeof (ecma_bigint_digit_t)));
- result_p+= 2;
+ result_p += 2;
}
return ecma_make_extended_primitive_value (result_value_p, ECMA_TYPE_BIGINT);
@@ -1052,8 +1052,7 @@ ecma_bigint_compare_to_number (ecma_value_t left_value, /**< left BigInt value *
{
return left > right ? left_sign : -left_sign;
}
- }
- while (left_p > left_end_p);
+ } while (left_p > left_end_p);
left_end_p = ECMA_BIGINT_GET_DIGITS (left_value_p, 0);
@@ -1613,9 +1612,8 @@ ecma_bigint_and (ecma_value_t left_value, /**< left BigInt value */
}
/* (-x) & (-y) == ~(x-1) & ~(y-1) == ~((x-1) | (y-1)) == -(((x-1) | (y-1)) + 1) */
- uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_OR
- | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH
- | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
+ uint32_t operation_and_options =
+ (ECMA_BIG_UINT_BITWISE_OR | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);
} /* ecma_bigint_and */
@@ -1650,25 +1648,22 @@ ecma_bigint_or (ecma_value_t left_value, /**< left BigInt value */
}
/* x | (-y) == x | ~(y-1) == ~((y-1) &~ x) == -(((y-1) &~ x) + 1) */
- uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_AND_NOT
- | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT
- | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
+ uint32_t operation_and_options =
+ (ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
return ecma_bigint_bitwise_op (operation_and_options, right_p, left_p);
}
if (!(right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))
{
/* (-x) | y == ~(x-1) | y == ~((x-1) &~ y) == -(((x-1) &~ y) + 1) */
- uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_AND_NOT
- | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT
- | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
+ uint32_t operation_and_options =
+ (ECMA_BIG_UINT_BITWISE_AND_NOT | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);
}
/* (-x) | (-y) == ~(x-1) | ~(y-1) == ~((x-1) & (y-1)) = -(((x-1) & (y-1)) + 1) */
- uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_AND
- | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH
- | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
+ uint32_t operation_and_options =
+ (ECMA_BIG_UINT_BITWISE_AND | ECMA_BIG_UINT_BITWISE_DECREASE_BOTH | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);
} /* ecma_bigint_or */
@@ -1703,18 +1698,16 @@ ecma_bigint_xor (ecma_value_t left_value, /**< left BigInt value */
}
/* x ^ (-y) == x ^ ~(y-1) == ~(x ^ (y-1)) == -((x ^ (y-1)) + 1) */
- uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_XOR
- | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT
- | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
+ uint32_t operation_and_options =
+ (ECMA_BIG_UINT_BITWISE_XOR | ECMA_BIG_UINT_BITWISE_DECREASE_RIGHT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);
}
if (!(right_p->u.bigint_sign_and_size & ECMA_BIGINT_SIGN))
{
/* (-x) | y == ~(x-1) ^ y == ~((x-1) ^ y) == -(((x-1) ^ y) + 1) */
- uint32_t operation_and_options = (ECMA_BIG_UINT_BITWISE_XOR
- | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT
- | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
+ uint32_t operation_and_options =
+ (ECMA_BIG_UINT_BITWISE_XOR | ECMA_BIG_UINT_BITWISE_DECREASE_LEFT | ECMA_BIG_UINT_BITWISE_INCREASE_RESULT);
return ecma_bigint_bitwise_op (operation_and_options, left_p, right_p);
}
diff --git a/jerry-core/ecma/operations/ecma-bigint.h b/jerry-core/ecma/operations/ecma-bigint.h
index 128c903c..33ad30d9 100644
--- a/jerry-core/ecma/operations/ecma-bigint.h
+++ b/jerry-core/ecma/operations/ecma-bigint.h
@@ -36,7 +36,7 @@ typedef enum
* return with ECMA_VALUE_FALSE */
ECMA_BIGINT_PARSE_DISALLOW_MEMORY_ERROR = (1 << 2), /**< don't throw out-of-memory error,
* return with ECMA_VALUE_NULL instead */
- ECMA_BIGINT_PARSE_ALLOW_UNDERSCORE = (1 << 3), /** allow parse underscore characters */
+ ECMA_BIGINT_PARSE_ALLOW_UNDERSCORE = (1 << 3), /** allow parse underscore characters */
} ecma_bigint_parse_string_options_t;
/**
@@ -49,8 +49,7 @@ typedef enum
ECMA_BIGINT_UNARY_DECREASE, /**< decrease operation */
} ecma_bigint_unary_operation_type;
-ecma_value_t ecma_bigint_parse_string (const lit_utf8_byte_t *string_p, lit_utf8_size_t size,
- uint32_t options);
+ecma_value_t ecma_bigint_parse_string (const lit_utf8_byte_t *string_p, lit_utf8_size_t size, uint32_t options);
ecma_value_t ecma_bigint_parse_string_value (ecma_value_t string, uint32_t options);
ecma_string_t *ecma_bigint_to_string (ecma_value_t value, ecma_bigint_digit_t radix);
ecma_value_t ecma_bigint_to_bigint (ecma_value_t value, bool allow_numbers);
diff --git a/jerry-core/ecma/operations/ecma-boolean-object.c b/jerry-core/ecma/operations/ecma-boolean-object.c
index ec6a5c71..e33299c6 100644
--- a/jerry-core/ecma/operations/ecma-boolean-object.c
+++ b/jerry-core/ecma/operations/ecma-boolean-object.c
@@ -13,17 +13,19 @@
* limitations under the License.
*/
-#include "jcontext.h"
-#include "ecma-alloc.h"
#include "ecma-boolean-object.h"
+
+#include "ecma-alloc.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
-#include "ecma-function-object.h"
+#include "ecma-objects.h"
+
+#include "jcontext.h"
/** \addtogroup ecma ECMA
* @{
@@ -66,9 +68,8 @@ ecma_op_create_boolean_object (ecma_value_t arg) /**< argument passed to the Boo
}
}
#endif /* JERRY_ESNEXT */
- ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p =
+ ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_BOOLEAN;
diff --git a/jerry-core/ecma/operations/ecma-comparison.c b/jerry-core/ecma/operations/ecma-comparison.c
index 5e1f22b9..68135fa2 100644
--- a/jerry-core/ecma/operations/ecma-comparison.c
+++ b/jerry-core/ecma/operations/ecma-comparison.c
@@ -13,11 +13,13 @@
* limitations under the License.
*/
-#include "ecma-bigint.h"
#include "ecma-comparison.h"
+
+#include "ecma-bigint.h"
#include "ecma-conversion.h"
#include "ecma-globals.h"
#include "ecma-objects.h"
+
#include "jrt.h"
/** \addtogroup ecma ECMA
@@ -68,14 +70,11 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
#ifndef JERRY_NDEBUG
bool is_x_equal_to_y_check;
- if (ecma_number_is_nan (x_num)
- || ecma_number_is_nan (y_num))
+ if (ecma_number_is_nan (x_num) || ecma_number_is_nan (y_num))
{
is_x_equal_to_y_check = false;
}
- else if (x_num == y_num
- || (ecma_number_is_zero (x_num)
- && ecma_number_is_zero (y_num)))
+ else if (x_num == y_num || (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num)))
{
is_x_equal_to_y_check = true;
}
@@ -163,8 +162,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
{
ecma_value_t bigint = ecma_bigint_parse_string_value (y, ECMA_BIGINT_PARSE_DISALLOW_SYNTAX_ERROR);
- if (ECMA_IS_VALUE_ERROR (bigint)
- || bigint == ECMA_VALUE_FALSE)
+ if (ECMA_IS_VALUE_ERROR (bigint) || bigint == ECMA_VALUE_FALSE)
{
return bigint;
}
@@ -189,8 +187,7 @@ ecma_op_abstract_equality_compare (ecma_value_t x, /**< first operand */
}
#endif /* JERRY_BUILTIN_BIGINT */
- if (ecma_is_value_undefined (x)
- || ecma_is_value_null (x))
+ if (ecma_is_value_undefined (x) || ecma_is_value_null (x))
{
/* 1. a., b. */
/* 2., 3. */
@@ -257,26 +254,17 @@ bool
ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */
ecma_value_t y) /**< second operand */
{
- if (ecma_is_value_direct (x)
- || ecma_is_value_direct (y)
+ if (ecma_is_value_direct (x) || ecma_is_value_direct (y)
#if JERRY_ESNEXT
- || ecma_is_value_symbol (x)
- || ecma_is_value_symbol (y)
+ || ecma_is_value_symbol (x) || ecma_is_value_symbol (y)
#endif /* JERRY_ESNEXT */
- || ecma_is_value_object (x)
- || ecma_is_value_object (y))
+ || ecma_is_value_object (x) || ecma_is_value_object (y))
{
- JERRY_ASSERT (!ecma_is_value_direct (x)
- || ecma_is_value_undefined (x)
- || ecma_is_value_null (x)
- || ecma_is_value_boolean (x)
- || ecma_is_value_integer_number (x));
-
- JERRY_ASSERT (!ecma_is_value_direct (y)
- || ecma_is_value_undefined (y)
- || ecma_is_value_null (y)
- || ecma_is_value_boolean (y)
- || ecma_is_value_integer_number (y));
+ JERRY_ASSERT (!ecma_is_value_direct (x) || ecma_is_value_undefined (x) || ecma_is_value_null (x)
+ || ecma_is_value_boolean (x) || ecma_is_value_integer_number (x));
+
+ JERRY_ASSERT (!ecma_is_value_direct (y) || ecma_is_value_undefined (y) || ecma_is_value_null (y)
+ || ecma_is_value_boolean (y) || ecma_is_value_integer_number (y));
if ((x != ecma_make_integer_value (0) || !ecma_is_value_float_number (y))
&& (y != ecma_make_integer_value (0) || !ecma_is_value_float_number (x)))
@@ -287,10 +275,8 @@ ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */
/* The +0 === -0 case handled below. */
}
- JERRY_ASSERT (ecma_is_value_number (x) || ecma_is_value_string (x) ||
- ecma_is_value_bigint (x));
- JERRY_ASSERT (ecma_is_value_number (y) || ecma_is_value_string (y) ||
- ecma_is_value_bigint (y));
+ JERRY_ASSERT (ecma_is_value_number (x) || ecma_is_value_string (x) || ecma_is_value_bigint (x));
+ JERRY_ASSERT (ecma_is_value_number (y) || ecma_is_value_string (y) || ecma_is_value_bigint (y));
if (ecma_is_value_string (x))
{
@@ -330,14 +316,11 @@ ecma_op_strict_equality_compare (ecma_value_t x, /**< first operand */
#ifndef JERRY_NDEBUG
bool is_x_equal_to_y_check;
- if (ecma_number_is_nan (x_num)
- || ecma_number_is_nan (y_num))
+ if (ecma_number_is_nan (x_num) || ecma_number_is_nan (y_num))
{
is_x_equal_to_y_check = false;
}
- else if (x_num == y_num
- || (ecma_number_is_zero (x_num)
- && ecma_number_is_zero (y_num)))
+ else if (x_num == y_num || (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num)))
{
is_x_equal_to_y_check = true;
}
@@ -390,8 +373,7 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
if (!(is_px_string && is_py_string))
{
#if JERRY_BUILTIN_BIGINT
- if (JERRY_LIKELY (!ecma_is_value_bigint (px))
- && JERRY_LIKELY (!ecma_is_value_bigint (py)))
+ if (JERRY_LIKELY (!ecma_is_value_bigint (px)) && JERRY_LIKELY (!ecma_is_value_bigint (py)))
{
#endif /* JERRY_BUILTIN_BIGINT */
/* 3. */
@@ -401,16 +383,14 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
ecma_number_t nx;
ecma_number_t ny;
- if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (px, &nx))
- || ECMA_IS_VALUE_ERROR (ecma_op_to_number (py, &ny)))
+ if (ECMA_IS_VALUE_ERROR (ecma_op_to_number (px, &nx)) || ECMA_IS_VALUE_ERROR (ecma_op_to_number (py, &ny)))
{
ret_value = ECMA_VALUE_ERROR;
goto end;
}
/* b. */
- if (ecma_number_is_nan (nx)
- || ecma_number_is_nan (ny))
+ if (ecma_number_is_nan (nx) || ecma_number_is_nan (ny))
{
/* c., d. */
ret_value = ECMA_VALUE_UNDEFINED;
@@ -422,33 +402,27 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
#ifndef JERRY_NDEBUG
bool is_x_less_than_y_check;
- if (nx == ny
- || (ecma_number_is_zero (nx)
- && ecma_number_is_zero (ny)))
+ if (nx == ny || (ecma_number_is_zero (nx) && ecma_number_is_zero (ny)))
{
/* e., f., g. */
is_x_less_than_y_check = false;
}
- else if (ecma_number_is_infinity (nx)
- && !ecma_number_is_negative (nx))
+ else if (ecma_number_is_infinity (nx) && !ecma_number_is_negative (nx))
{
/* h. */
is_x_less_than_y_check = false;
}
- else if (ecma_number_is_infinity (ny)
- && !ecma_number_is_negative (ny))
+ else if (ecma_number_is_infinity (ny) && !ecma_number_is_negative (ny))
{
/* i. */
is_x_less_than_y_check = true;
}
- else if (ecma_number_is_infinity (ny)
- && ecma_number_is_negative (ny))
+ else if (ecma_number_is_infinity (ny) && ecma_number_is_negative (ny))
{
/* j. */
is_x_less_than_y_check = false;
}
- else if (ecma_number_is_infinity (nx)
- && ecma_number_is_negative (nx))
+ else if (ecma_number_is_infinity (nx) && ecma_number_is_negative (nx))
{
/* k. */
is_x_less_than_y_check = true;
@@ -456,12 +430,9 @@ ecma_op_abstract_relational_compare (ecma_value_t x, /**< first operand */
else
{
/* l. */
- JERRY_ASSERT (!ecma_number_is_nan (nx)
- && !ecma_number_is_infinity (nx));
- JERRY_ASSERT (!ecma_number_is_nan (ny)
- && !ecma_number_is_infinity (ny));
- JERRY_ASSERT (!(ecma_number_is_zero (nx)
- && ecma_number_is_zero (ny)));
+ JERRY_ASSERT (!ecma_number_is_nan (nx) && !ecma_number_is_infinity (nx));
+ JERRY_ASSERT (!ecma_number_is_nan (ny) && !ecma_number_is_infinity (ny));
+ JERRY_ASSERT (!(ecma_number_is_zero (nx) && ecma_number_is_zero (ny)));
if (nx < ny)
{
diff --git a/jerry-core/ecma/operations/ecma-container-object.c b/jerry-core/ecma/operations/ecma-container-object.c
index 8bbe8466..e0491041 100644
--- a/jerry-core/ecma/operations/ecma-container-object.c
+++ b/jerry-core/ecma/operations/ecma-container-object.c
@@ -12,19 +12,21 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
-#include "jcontext.h"
+#include "ecma-container-object.h"
+
#include "ecma-alloc.h"
#include "ecma-array-object.h"
-#include "ecma-builtins.h"
#include "ecma-builtin-helpers.h"
+#include "ecma-builtins.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-helpers.h"
#include "ecma-iterator-object.h"
-#include "ecma-container-object.h"
-#include "ecma-property-hashmap.h"
#include "ecma-objects.h"
+#include "ecma-property-hashmap.h"
+
+#include "jcontext.h"
#if JERRY_BUILTIN_CONTAINER
@@ -307,8 +309,7 @@ ecma_op_container_free_entries (ecma_object_t *object_p) /**< collection object
JERRY_ASSERT (object_p != NULL);
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) object_p;
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
switch (map_object_p->u.cls.u2.container_id)
{
@@ -353,10 +354,8 @@ ecma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments l
ecma_builtin_id_t proto_id) /**< prototype builtin id */
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
- JERRY_ASSERT (lit_id == LIT_MAGIC_STRING_MAP_UL
- || lit_id == LIT_MAGIC_STRING_SET_UL
- || lit_id == LIT_MAGIC_STRING_WEAKMAP_UL
- || lit_id == LIT_MAGIC_STRING_WEAKSET_UL);
+ JERRY_ASSERT (lit_id == LIT_MAGIC_STRING_MAP_UL || lit_id == LIT_MAGIC_STRING_SET_UL
+ || lit_id == LIT_MAGIC_STRING_WEAKMAP_UL || lit_id == LIT_MAGIC_STRING_WEAKSET_UL);
JERRY_ASSERT (JERRY_CONTEXT (current_new_target_p) != NULL);
ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), proto_id);
@@ -367,9 +366,7 @@ ecma_op_container_create (const ecma_value_t *arguments_list_p, /**< arguments l
}
ecma_collection_t *container_p = ecma_op_create_internal_buffer ();
- ecma_object_t *object_p = ecma_create_object (proto_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_deref_object (proto_p);
ecma_extended_object_t *map_obj_p = (ecma_extended_object_t *) object_p;
map_obj_p->u.cls.type = ECMA_OBJECT_CLASS_CONTAINER;
@@ -577,8 +574,7 @@ ecma_op_container_get_object (ecma_value_t this_arg, /**< this argument */
ecma_value_t
ecma_op_container_size (ecma_extended_object_t *map_object_p) /**< internal class id */
{
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
return ecma_make_uint32_value (ECMA_CONTAINER_GET_SIZE (container_p));
} /* ecma_op_container_size */
@@ -599,8 +595,7 @@ ecma_op_container_get (ecma_extended_object_t *map_object_p, /**< map object */
return ECMA_VALUE_UNDEFINED;
}
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
if (ECMA_CONTAINER_GET_SIZE (container_p) == 0)
{
@@ -628,11 +623,9 @@ ecma_op_container_has (ecma_extended_object_t *map_object_p, /**< map object */
ecma_value_t key_arg, /**< key argument */
lit_magic_string_id_t lit_id) /**< internal class id */
{
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
- if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0
- && !ecma_is_value_object (key_arg))
+ if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0 && !ecma_is_value_object (key_arg))
{
return ECMA_VALUE_FALSE;
}
@@ -684,11 +677,9 @@ ecma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */
ecma_value_t value_arg, /**< value argument */
lit_magic_string_id_t lit_id) /**< internal class id */
{
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
- if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0
- && !ecma_is_value_object (key_arg))
+ if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0 && !ecma_is_value_object (key_arg))
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Key must be an object"));
}
@@ -697,10 +688,7 @@ ecma_op_container_set (ecma_extended_object_t *map_object_p, /**< map object */
if (entry_p == NULL)
{
- ecma_op_internal_buffer_append (container_p,
- ecma_op_container_set_noramlize_zero (key_arg),
- value_arg,
- lit_id);
+ ecma_op_internal_buffer_append (container_p, ecma_op_container_set_noramlize_zero (key_arg), value_arg, lit_id);
if ((map_object_p->u.cls.u1.container_flags & ECMA_CONTAINER_FLAGS_WEAK) != 0)
{
@@ -739,8 +727,7 @@ ecma_op_container_foreach (ecma_extended_object_t *map_object_p, /**< map object
ecma_object_t *func_object_p = ecma_get_object_from_value (predicate);
ecma_value_t ret_value = ECMA_VALUE_UNDEFINED;
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
uint8_t entry_size = ecma_op_container_entry_size (lit_id);
@@ -781,7 +768,6 @@ ecma_op_container_foreach (ecma_extended_object_t *map_object_p, /**< map object
ecma_value_t
ecma_op_container_clear (ecma_extended_object_t *map_object_p) /**< this argument */
{
-
ecma_op_container_free_entries ((ecma_object_t *) map_object_p);
return ECMA_VALUE_UNDEFINED;
@@ -798,8 +784,7 @@ ecma_op_container_delete (ecma_extended_object_t *map_object_p, /**< map object
ecma_value_t key_arg, /**< key argument */
lit_magic_string_id_t lit_id) /**< internal class id */
{
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);
@@ -828,8 +813,7 @@ ecma_op_container_delete_weak (ecma_extended_object_t *map_object_p, /**< map ob
return ECMA_VALUE_FALSE;
}
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, lit_id);
@@ -860,8 +844,7 @@ ecma_op_container_find_weak_value (ecma_object_t *object_p, /**< internal contai
JERRY_ASSERT (map_object_p->u.cls.type == ECMA_OBJECT_CLASS_CONTAINER
&& map_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKMAP_UL);
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, map_object_p->u.cls.u2.container_id);
@@ -883,8 +866,7 @@ ecma_op_container_remove_weak_entry (ecma_object_t *object_p, /**< internal cont
&& (map_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKSET_UL
|| map_object_p->u.cls.u2.container_id == LIT_MAGIC_STRING_WEAKMAP_UL));
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
ecma_value_t *entry_p = ecma_op_internal_buffer_find (container_p, key_arg, map_object_p->u.cls.u2.container_id);
@@ -914,10 +896,7 @@ ecma_op_container_create_iterator (ecma_value_t this_arg, /**< this argument */
ecma_object_class_type_t iterator_type, /**< iterator type */
ecma_iterator_kind_t kind) /**< iterator kind */
{
- return ecma_op_create_iterator_object (this_arg,
- ecma_builtin_get (proto_id),
- iterator_type,
- kind);
+ return ecma_op_create_iterator_object (this_arg, ecma_builtin_get (proto_id), iterator_type, kind);
} /* ecma_op_container_create_iterator */
/**
@@ -926,7 +905,7 @@ ecma_op_container_create_iterator (ecma_value_t this_arg, /**< this argument */
* @return index of the iterator.
*/
static uint32_t
-ecma_op_iterator_get_index (ecma_object_t *iter_obj_p) /**< iterator object pointer */
+ecma_op_iterator_get_index (ecma_object_t *iter_obj_p) /**< iterator object pointer */
{
uint32_t index = ((ecma_extended_object_t *) iter_obj_p)->u.cls.u2.iterator_index;
@@ -1014,8 +993,7 @@ ecma_op_container_iterator_next (ecma_value_t this_val, /**< this argument */
ecma_extended_object_t *map_object_p = (ecma_extended_object_t *) (ecma_get_object_from_value (iterated_value));
lit_magic_string_id_t lit_id = map_object_p->u.cls.u2.container_id;
- ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- map_object_p->u.cls.u3.value);
+ ecma_collection_t *container_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, map_object_p->u.cls.u3.value);
uint32_t entry_count = ECMA_CONTAINER_ENTRY_COUNT (container_p);
uint32_t index = ecma_op_iterator_get_index (obj_p);
@@ -1150,10 +1128,7 @@ ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_id, /**< built
ecma_iterator_kind_t kind = (ecma_iterator_kind_t) (builtin_routine_id - ECMA_CONTAINER_ROUTINE_KEYS);
- return ecma_op_container_create_iterator (this_arg,
- builtin_iterator_prototype,
- iterator_type,
- kind);
+ return ecma_op_container_create_iterator (this_arg, builtin_iterator_prototype, iterator_type, kind);
}
default:
{
diff --git a/jerry-core/ecma/operations/ecma-container-object.h b/jerry-core/ecma/operations/ecma-container-object.h
index 9e538f71..92fc6eb2 100644
--- a/jerry-core/ecma/operations/ecma-container-object.h
+++ b/jerry-core/ecma/operations/ecma-container-object.h
@@ -16,8 +16,8 @@
#ifndef ECMA_CONTAINER_OBJECT_H
#define ECMA_CONTAINER_OBJECT_H
-#include "ecma-globals.h"
#include "ecma-builtins.h"
+#include "ecma-globals.h"
#if JERRY_BUILTIN_CONTAINER
@@ -51,21 +51,28 @@ enum
uint8_t ecma_op_container_entry_size (lit_magic_string_id_t lit_id);
ecma_extended_object_t *ecma_op_container_get_object (ecma_value_t this_arg, lit_magic_string_id_t lit_id);
-ecma_value_t ecma_op_container_create (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len,
- lit_magic_string_id_t lit_id, ecma_builtin_id_t proto_id);
+ecma_value_t ecma_op_container_create (const ecma_value_t *arguments_list_p,
+ uint32_t arguments_list_len,
+ lit_magic_string_id_t lit_id,
+ ecma_builtin_id_t proto_id);
ecma_value_t ecma_op_container_size (ecma_extended_object_t *map_object_p);
-ecma_value_t ecma_op_container_get (ecma_extended_object_t *map_object_p, ecma_value_t key_arg,
- lit_magic_string_id_t lit_id);
-ecma_value_t ecma_op_container_foreach (ecma_extended_object_t *map_object_p, ecma_value_t predicate,
- ecma_value_t predicate_this_arg, lit_magic_string_id_t lit_id);
-ecma_value_t ecma_op_container_has (ecma_extended_object_t *map_object_p, ecma_value_t key_arg,
+ecma_value_t
+ecma_op_container_get (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, lit_magic_string_id_t lit_id);
+ecma_value_t ecma_op_container_foreach (ecma_extended_object_t *map_object_p,
+ ecma_value_t predicate,
+ ecma_value_t predicate_this_arg,
+ lit_magic_string_id_t lit_id);
+ecma_value_t
+ecma_op_container_has (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, lit_magic_string_id_t lit_id);
+ecma_value_t ecma_op_container_set (ecma_extended_object_t *map_object_p,
+ ecma_value_t key_arg,
+ ecma_value_t value_arg,
lit_magic_string_id_t lit_id);
-ecma_value_t ecma_op_container_set (ecma_extended_object_t *map_object_p, ecma_value_t key_arg,
- ecma_value_t value_arg, lit_magic_string_id_t lit_id);
ecma_value_t ecma_op_container_clear (ecma_extended_object_t *map_object_p);
-ecma_value_t ecma_op_container_delete (ecma_extended_object_t *map_object_p, ecma_value_t key_arg,
- lit_magic_string_id_t lit_id);
-ecma_value_t ecma_op_container_delete_weak (ecma_extended_object_t *map_object_p, ecma_value_t key_arg,
+ecma_value_t
+ecma_op_container_delete (ecma_extended_object_t *map_object_p, ecma_value_t key_arg, lit_magic_string_id_t lit_id);
+ecma_value_t ecma_op_container_delete_weak (ecma_extended_object_t *map_object_p,
+ ecma_value_t key_arg,
lit_magic_string_id_t lit_id);
ecma_value_t ecma_op_container_find_weak_value (ecma_object_t *object_p, ecma_value_t key_arg);
void ecma_op_container_remove_weak_entry (ecma_object_t *object_p, ecma_value_t key_arg);
@@ -75,7 +82,8 @@ ecma_value_t ecma_op_container_create_iterator (ecma_value_t this_arg,
ecma_object_class_type_t iterator_type,
ecma_iterator_kind_t kind);
ecma_value_t ecma_op_container_iterator_next (ecma_value_t this_val, ecma_object_class_type_t iterator_type);
-ecma_value_t ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_id, ecma_value_t this_arg,
+ecma_value_t ecma_builtin_container_dispatch_routine (uint16_t builtin_routine_id,
+ ecma_value_t this_arg,
const ecma_value_t arguments_list_p[],
lit_magic_string_id_t lit_id);
diff --git a/jerry-core/ecma/operations/ecma-conversion.c b/jerry-core/ecma/operations/ecma-conversion.c
index a217d30f..8cc82e08 100644
--- a/jerry-core/ecma/operations/ecma-conversion.c
+++ b/jerry-core/ecma/operations/ecma-conversion.c
@@ -17,23 +17,25 @@
* Implementation of ECMA-defined conversion routines
*/
+#include "ecma-conversion.h"
+
#include <math.h>
#include "ecma-alloc.h"
-#include "ecma-bigint.h"
#include "ecma-bigint-object.h"
+#include "ecma-bigint.h"
#include "ecma-boolean-object.h"
-#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-number-object.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
+#include "ecma-objects.h"
#include "ecma-string-object.h"
#include "ecma-symbol-object.h"
+
#include "jrt-libc-includes.h"
/** \addtogroup ecma ECMA
@@ -86,8 +88,7 @@ ecma_op_same_value (ecma_value_t x, /**< ecma value */
ecma_type_t type_of_x = ecma_get_value_type_field (x);
- if (type_of_x != ecma_get_value_type_field (y)
- || type_of_x == ECMA_TYPE_DIRECT)
+ if (type_of_x != ecma_get_value_type_field (y) || type_of_x == ECMA_TYPE_DIRECT)
{
return false;
}
@@ -105,8 +106,7 @@ ecma_op_same_value (ecma_value_t x, /**< ecma value */
return is_x_nan && is_y_nan;
}
- if (ecma_number_is_zero (x_num)
- && ecma_number_is_zero (y_num)
+ if (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num)
&& ecma_number_is_negative (x_num) != ecma_number_is_negative (y_num))
{
return false;
@@ -158,9 +158,7 @@ ecma_op_same_value_zero (ecma_value_t x, /**< ecma value */
bool is_x_nan = ecma_number_is_nan (x_num);
bool is_y_nan = ecma_number_is_nan (y_num);
- if (strict_equality
- && is_x_nan
- && is_y_nan)
+ if (strict_equality && is_x_nan && is_y_nan)
{
return false;
}
@@ -170,8 +168,7 @@ ecma_op_same_value_zero (ecma_value_t x, /**< ecma value */
return (is_x_nan && is_y_nan);
}
- if (ecma_number_is_zero (x_num)
- && ecma_number_is_zero (y_num)
+ if (ecma_number_is_zero (x_num) && ecma_number_is_zero (y_num)
&& ecma_number_is_negative (x_num) != ecma_number_is_negative (y_num))
{
return true;
@@ -227,9 +224,7 @@ ecma_op_to_boolean (ecma_value_t value) /**< ecma value */
if (ecma_is_value_simple (value))
{
- JERRY_ASSERT (ecma_is_value_boolean (value)
- || ecma_is_value_undefined (value)
- || ecma_is_value_null (value));
+ JERRY_ASSERT (ecma_is_value_boolean (value) || ecma_is_value_undefined (value) || ecma_is_value_null (value));
return ecma_is_value_true (value);
}
@@ -537,7 +532,7 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */
if (ecma_is_value_number (value))
{
#if JERRY_BUILTIN_NUMBER
- proto_id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE;
+ proto_id = ECMA_BUILTIN_ID_NUMBER_PROTOTYPE;
#endif /* JERRY_BUILTIN_NUMBER */
class_type = ECMA_OBJECT_CLASS_NUMBER;
}
@@ -567,8 +562,7 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */
#endif /* JERRY_BUILTIN_BIGINT */
else
{
- if (ecma_is_value_undefined (value)
- || ecma_is_value_null (value))
+ if (ecma_is_value_undefined (value) || ecma_is_value_null (value))
{
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument cannot be converted to an object"));
}
@@ -582,9 +576,8 @@ ecma_op_to_object (ecma_value_t value) /**< ecma value */
}
}
- ecma_object_t *object_p = ecma_create_object (ecma_builtin_get (proto_id),
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p =
+ ecma_create_object (ecma_builtin_get (proto_id), sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
ext_object_p->u.cls.type = class_type;
@@ -610,35 +603,28 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des
ecma_value_t completion;
ecma_property_descriptor_t prop_desc = ecma_make_empty_property_descriptor ();
{
- prop_desc.flags = (JERRY_PROP_IS_VALUE_DEFINED
- | JERRY_PROP_IS_WRITABLE_DEFINED
- | JERRY_PROP_IS_WRITABLE
- | JERRY_PROP_IS_ENUMERABLE_DEFINED
- | JERRY_PROP_IS_ENUMERABLE
- | JERRY_PROP_IS_CONFIGURABLE_DEFINED
- | JERRY_PROP_IS_CONFIGURABLE);
+ prop_desc.flags = (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE
+ | JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE
+ | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE);
}
/* 3. */
if (src_prop_desc_p->flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED))
{
JERRY_ASSERT ((prop_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED))
- == (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED));
+ == (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED));
/* a. */
prop_desc.value = src_prop_desc_p->value;
- completion = ecma_op_object_define_own_property (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_VALUE),
- &prop_desc);
+ completion = ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_VALUE), &prop_desc);
JERRY_ASSERT (ecma_is_value_true (completion));
/* b. */
prop_desc.value = ecma_make_boolean_value (src_prop_desc_p->flags & JERRY_PROP_IS_WRITABLE);
- completion = ecma_op_object_define_own_property (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE),
- &prop_desc);
+ completion =
+ ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE), &prop_desc);
JERRY_ASSERT (ecma_is_value_true (completion));
}
else
@@ -659,9 +645,7 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des
prop_desc.value = ecma_make_object_value (src_prop_desc_p->get_p);
}
- completion = ecma_op_object_define_own_property (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_GET),
- &prop_desc);
+ completion = ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_GET), &prop_desc);
JERRY_ASSERT (ecma_is_value_true (completion));
/* b. */
@@ -674,25 +658,21 @@ ecma_op_from_property_descriptor (const ecma_property_descriptor_t *src_prop_des
prop_desc.value = ecma_make_object_value (src_prop_desc_p->set_p);
}
- completion = ecma_op_object_define_own_property (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_SET),
- &prop_desc);
+ completion = ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_SET), &prop_desc);
JERRY_ASSERT (ecma_is_value_true (completion));
}
}
prop_desc.value = ecma_make_boolean_value (src_prop_desc_p->flags & JERRY_PROP_IS_ENUMERABLE);
- completion = ecma_op_object_define_own_property (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE),
- &prop_desc);
+ completion =
+ ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE), &prop_desc);
JERRY_ASSERT (ecma_is_value_true (completion));
prop_desc.value = ecma_make_boolean_value (src_prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE);
- completion = ecma_op_object_define_own_property (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE),
- &prop_desc);
+ completion =
+ ecma_op_object_define_own_property (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE), &prop_desc);
JERRY_ASSERT (ecma_is_value_true (completion));
return obj_p;
@@ -722,8 +702,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
ecma_value_t ret_value = ECMA_VALUE_ERROR;
/* 3. */
- ecma_value_t enumerable_prop_value = ecma_op_object_find (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE));
+ ecma_value_t enumerable_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_ENUMERABLE));
if (ECMA_IS_VALUE_ERROR (enumerable_prop_value))
{
@@ -735,8 +714,8 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
if (ecma_is_value_found (enumerable_prop_value))
{
- uint32_t is_enumerable = (ecma_op_to_boolean (enumerable_prop_value) ? JERRY_PROP_IS_ENUMERABLE
- : JERRY_PROP_NO_OPTS);
+ uint32_t is_enumerable =
+ (ecma_op_to_boolean (enumerable_prop_value) ? JERRY_PROP_IS_ENUMERABLE : JERRY_PROP_NO_OPTS);
prop_desc.flags |= (uint16_t) (JERRY_PROP_IS_ENUMERABLE_DEFINED | is_enumerable);
@@ -744,8 +723,8 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
}
/* 4. */
- ecma_value_t configurable_prop_value = ecma_op_object_find (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE));
+ ecma_value_t configurable_prop_value =
+ ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_CONFIGURABLE));
if (ECMA_IS_VALUE_ERROR (configurable_prop_value))
{
@@ -754,8 +733,8 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
if (ecma_is_value_found (configurable_prop_value))
{
- uint32_t is_configurable = (ecma_op_to_boolean (configurable_prop_value) ? JERRY_PROP_IS_CONFIGURABLE
- : JERRY_PROP_NO_OPTS);
+ uint32_t is_configurable =
+ (ecma_op_to_boolean (configurable_prop_value) ? JERRY_PROP_IS_CONFIGURABLE : JERRY_PROP_NO_OPTS);
prop_desc.flags |= (uint16_t) (JERRY_PROP_IS_CONFIGURABLE_DEFINED | is_configurable);
@@ -763,8 +742,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
}
/* 5. */
- ecma_value_t value_prop_value = ecma_op_object_find (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_VALUE));
+ ecma_value_t value_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_VALUE));
if (ECMA_IS_VALUE_ERROR (value_prop_value))
{
@@ -779,8 +757,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
}
/* 6. */
- ecma_value_t writable_prop_value = ecma_op_object_find (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE));
+ ecma_value_t writable_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_WRITABLE));
if (ECMA_IS_VALUE_ERROR (writable_prop_value))
{
@@ -789,8 +766,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
if (ecma_is_value_found (writable_prop_value))
{
- uint32_t is_writable = (ecma_op_to_boolean (writable_prop_value) ? JERRY_PROP_IS_WRITABLE
- : JERRY_PROP_NO_OPTS);
+ uint32_t is_writable = (ecma_op_to_boolean (writable_prop_value) ? JERRY_PROP_IS_WRITABLE : JERRY_PROP_NO_OPTS);
prop_desc.flags |= (uint16_t) (JERRY_PROP_IS_WRITABLE_DEFINED | is_writable);
@@ -798,8 +774,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
}
/* 7. */
- ecma_value_t get_prop_value = ecma_op_object_find (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_GET));
+ ecma_value_t get_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_GET));
if (ECMA_IS_VALUE_ERROR (get_prop_value))
{
@@ -808,8 +783,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
if (ecma_is_value_found (get_prop_value))
{
- if (!ecma_op_is_callable (get_prop_value)
- && !ecma_is_value_undefined (get_prop_value))
+ if (!ecma_op_is_callable (get_prop_value) && !ecma_is_value_undefined (get_prop_value))
{
ecma_free_value (get_prop_value);
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function));
@@ -836,8 +810,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
}
/* 8. */
- ecma_value_t set_prop_value = ecma_op_object_find (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_SET));
+ ecma_value_t set_prop_value = ecma_op_object_find (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_SET));
if (ECMA_IS_VALUE_ERROR (set_prop_value))
{
@@ -846,8 +819,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
if (ecma_is_value_found (set_prop_value))
{
- if (!ecma_op_is_callable (set_prop_value)
- && !ecma_is_value_undefined (set_prop_value))
+ if (!ecma_op_is_callable (set_prop_value) && !ecma_is_value_undefined (set_prop_value))
{
ecma_free_value (set_prop_value);
ret_value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function));
@@ -875,7 +847,7 @@ ecma_op_to_property_descriptor (ecma_value_t obj_value, /**< object value */
/* 9. */
if ((prop_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED))
- && (prop_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)))
+ && (prop_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)))
{
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Accessors cannot be writable"));
}
@@ -907,7 +879,6 @@ free_desc:
bool
ecma_op_is_integer (ecma_number_t num) /**< ecma number */
{
-
if (ecma_number_is_nan (num) || ecma_number_is_infinity (num))
{
return false;
@@ -917,7 +888,8 @@ ecma_op_is_integer (ecma_number_t num) /**< ecma number */
ecma_number_t fabs_value = (ecma_number_t) fabs (num);
return (floor_fabs == fabs_value);
-} /* ecma_op_is_integer*/
+} /* ecma_op_is_integer */
+
/**
* ToInteger operation.
*
@@ -1082,7 +1054,7 @@ ecma_op_to_index (ecma_value_t value, /**< ecma value */
* NULL otherwise
*/
ecma_collection_t *
-ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */
+ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */
bool prop_names_only) /**< true - accept only property names
false - otherwise */
{
@@ -1117,8 +1089,7 @@ ecma_op_create_list_from_array_like (ecma_value_t arr, /**< array value */
return NULL;
}
- if (prop_names_only
- && !ecma_is_value_prop_name (next))
+ if (prop_names_only && !ecma_is_value_prop_name (next))
{
ecma_free_value (next);
ecma_collection_free (list_ptr);
diff --git a/jerry-core/ecma/operations/ecma-conversion.h b/jerry-core/ecma/operations/ecma-conversion.h
index 31c58eae..559b8552 100644
--- a/jerry-core/ecma/operations/ecma-conversion.h
+++ b/jerry-core/ecma/operations/ecma-conversion.h
@@ -16,9 +16,9 @@
#ifndef ECMA_CONVERSION_H
#define ECMA_CONVERSION_H
+#include "ecma-builtins.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-builtins.h"
/** \addtogroup ecma ECMA
* @{
diff --git a/jerry-core/ecma/operations/ecma-dataview-object.c b/jerry-core/ecma/operations/ecma-dataview-object.c
index 8ef71c1f..06741073 100644
--- a/jerry-core/ecma/operations/ecma-dataview-object.c
+++ b/jerry-core/ecma/operations/ecma-dataview-object.c
@@ -13,18 +13,20 @@
* limitations under the License.
*/
-#include "jcontext.h"
-#include "ecma-function-object.h"
+#include "ecma-dataview-object.h"
+
#include "ecma-arraybuffer-object.h"
-#include "ecma-shared-arraybuffer-object.h"
#include "ecma-bigint.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-helpers.h"
-#include "ecma-dataview-object.h"
-#include "ecma-typedarray-object.h"
#include "ecma-objects.h"
+#include "ecma-shared-arraybuffer-object.h"
+#include "ecma-typedarray-object.h"
+
+#include "jcontext.h"
#if JERRY_BUILTIN_DATAVIEW
@@ -123,8 +125,8 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li
}
/* 9. */
- ecma_object_t *prototype_obj_p = ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p),
- ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE);
+ ecma_object_t *prototype_obj_p =
+ ecma_op_get_prototype_from_constructor (JERRY_CONTEXT (current_new_target_p), ECMA_BUILTIN_ID_DATAVIEW_PROTOTYPE);
if (JERRY_UNLIKELY (prototype_obj_p == NULL))
{
return ECMA_VALUE_ERROR;
@@ -139,9 +141,8 @@ ecma_op_dataview_create (const ecma_value_t *arguments_list_p, /**< arguments li
/* 9. */
/* It must happen after 10., because uninitialized object can't be destroyed properly. */
- ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
- sizeof (ecma_dataview_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p =
+ ecma_create_object (prototype_obj_p, sizeof (ecma_dataview_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_deref_object (prototype_obj_p);
@@ -223,7 +224,7 @@ ecma_dataview_swap_order (bool system_is_little_endian, /**< true - if the syste
for (uint32_t i = 0; i < element_size / 2; i++)
{
lit_utf8_byte_t tmp = block_p[i];
- block_p[i] = block_p[element_size - i - 1];
+ block_p[i] = block_p[element_size - i - 1];
block_p[element_size - i - 1] = tmp;
}
}
diff --git a/jerry-core/ecma/operations/ecma-dataview-object.h b/jerry-core/ecma/operations/ecma-dataview-object.h
index cac99a25..1d56c9be 100644
--- a/jerry-core/ecma/operations/ecma-dataview-object.h
+++ b/jerry-core/ecma/operations/ecma-dataview-object.h
@@ -29,8 +29,10 @@
ecma_value_t ecma_op_dataview_create (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);
ecma_dataview_object_t *ecma_op_dataview_get_object (ecma_value_t this_arg);
-ecma_value_t ecma_op_dataview_get_set_view_value (ecma_value_t view, ecma_value_t request_index,
- ecma_value_t little_endian, ecma_value_t value_to_set,
+ecma_value_t ecma_op_dataview_get_set_view_value (ecma_value_t view,
+ ecma_value_t request_index,
+ ecma_value_t little_endian,
+ ecma_value_t value_to_set,
ecma_typedarray_type_t id);
bool ecma_is_dataview (ecma_value_t value);
diff --git a/jerry-core/ecma/operations/ecma-eval.c b/jerry-core/ecma/operations/ecma-eval.c
index c64ccb4b..d28a0d53 100644
--- a/jerry-core/ecma/operations/ecma-eval.c
+++ b/jerry-core/ecma/operations/ecma-eval.c
@@ -13,16 +13,18 @@
* limitations under the License.
*/
+#include "ecma-eval.h"
+
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
-#include "ecma-eval.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-lex-env.h"
+
+#include "jcontext.h"
#include "js-parser.h"
#include "vm.h"
-#include "jcontext.h"
/** \addtogroup ecma ECMA
* @{
@@ -51,8 +53,7 @@ ecma_op_eval (ecma_value_t source_code, /**< source code */
return ECMA_VALUE_UNDEFINED;
}
- return ecma_op_eval_chars_buffer ((void *) &source_code,
- parse_opts | ECMA_PARSE_HAS_SOURCE_VALUE);
+ return ecma_op_eval_chars_buffer ((void *) &source_code, parse_opts | ECMA_PARSE_HAS_SOURCE_VALUE);
} /* ecma_op_eval */
/**
diff --git a/jerry-core/ecma/operations/ecma-eval.h b/jerry-core/ecma/operations/ecma-eval.h
index fad3b02d..c06ad5d5 100644
--- a/jerry-core/ecma/operations/ecma-eval.h
+++ b/jerry-core/ecma/operations/ecma-eval.h
@@ -25,11 +25,9 @@
* @{
*/
-ecma_value_t
-ecma_op_eval (ecma_value_t source_code, uint32_t parse_opts);
+ecma_value_t ecma_op_eval (ecma_value_t source_code, uint32_t parse_opts);
-ecma_value_t
-ecma_op_eval_chars_buffer (void *source_p, uint32_t parse_opts);
+ecma_value_t ecma_op_eval_chars_buffer (void *source_p, uint32_t parse_opts);
/**
* @}
diff --git a/jerry-core/ecma/operations/ecma-exceptions.c b/jerry-core/ecma/operations/ecma-exceptions.c
index 8afb5d8e..3c24240f 100644
--- a/jerry-core/ecma/operations/ecma-exceptions.c
+++ b/jerry-core/ecma/operations/ecma-exceptions.c
@@ -13,17 +13,20 @@
* limitations under the License.
*/
+#include "ecma-exceptions.h"
+
#include <stdarg.h>
+
+#include "ecma-array-object.h"
#include "ecma-builtins.h"
#include "ecma-conversion.h"
-#include "ecma-exceptions.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
+#include "ecma-iterator-object.h"
#include "ecma-objects.h"
#include "ecma-symbol-object.h"
-#include "ecma-iterator-object.h"
-#include "ecma-array-object.h"
+
#include "jcontext.h"
#include "jrt.h"
@@ -111,16 +114,15 @@ ecma_new_standard_error (jerry_error_t error_type, /**< native error type */
break;
}
}
-#else
+#else /* !JERRY_BUILTIN_ERRORS */
JERRY_UNUSED (error_type);
ecma_builtin_id_t prototype_id = ECMA_BUILTIN_ID_ERROR_PROTOTYPE;
#endif /* JERRY_BUILTIN_ERRORS */
ecma_object_t *prototype_obj_p = ecma_builtin_get (prototype_id);
- ecma_object_t *error_object_p = ecma_create_object (prototype_obj_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *error_object_p =
+ ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_extended_object_t *extended_object_p = (ecma_extended_object_t *) error_object_p;
extended_object_p->u.cls.type = ECMA_OBJECT_CLASS_ERROR;
@@ -143,8 +145,8 @@ ecma_new_standard_error (jerry_error_t error_type, /**< native error type */
&& !(JERRY_CONTEXT (status_flags) & ECMA_STATUS_ERROR_UPDATE))
{
JERRY_CONTEXT (status_flags) |= ECMA_STATUS_ERROR_UPDATE;
- JERRY_CONTEXT (error_object_created_callback_p) (ecma_make_object_value (error_object_p),
- JERRY_CONTEXT (error_object_created_callback_user_p));
+ JERRY_CONTEXT (error_object_created_callback_p)
+ (ecma_make_object_value (error_object_p), JERRY_CONTEXT (error_object_created_callback_user_p));
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_ERROR_UPDATE;
}
else
@@ -153,10 +155,8 @@ ecma_new_standard_error (jerry_error_t error_type, /**< native error type */
/* Default decorator when line info is enabled. */
ecma_string_t *stack_str_p = ecma_get_magic_string (LIT_MAGIC_STRING_STACK);
- ecma_property_value_t *prop_value_p = ecma_create_named_data_property (error_object_p,
- stack_str_p,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE,
- NULL);
+ ecma_property_value_t *prop_value_p =
+ ecma_create_named_data_property (error_object_p, stack_str_p, ECMA_PROPERTY_CONFIGURABLE_WRITABLE, NULL);
ecma_deref_ecma_string (stack_str_p);
ecma_value_t backtrace_value = vm_get_backtrace (0);
@@ -306,8 +306,7 @@ ecma_raise_standard_error (jerry_error_t error_type, /**< error type */
if (msg_p != NULL)
{
- ecma_string_t *error_msg_p = ecma_new_ecma_string_from_utf8 (msg_p,
- lit_zt_utf8_string_size (msg_p));
+ ecma_string_t *error_msg_p = ecma_new_ecma_string_from_utf8 (msg_p, lit_zt_utf8_string_size (msg_p));
error_obj_p = ecma_new_standard_error (error_type, error_msg_p);
ecma_deref_ecma_string (error_msg_p);
}
@@ -465,7 +464,7 @@ ecma_raise_syntax_error (const char *msg_p) /**< error message */
/**
* Raise a TypeError with the given message.
*
-* See also: ECMA-262 v5, 15.11.6.5
+ * See also: ECMA-262 v5, 15.11.6.5
*
* @return ecma value
* Returned value must be freed with ecma_free_value
@@ -479,7 +478,7 @@ ecma_raise_type_error (const char *msg_p) /**< error message */
/**
* Raise a URIError with the given message.
*
-* See also: ECMA-262 v5, 15.11.6.6
+ * See also: ECMA-262 v5, 15.11.6.6
*
* @return ecma value
* Returned value must be freed with ecma_free_value
diff --git a/jerry-core/ecma/operations/ecma-exceptions.h b/jerry-core/ecma/operations/ecma-exceptions.h
index b23281ef..f8e525e3 100644
--- a/jerry-core/ecma/operations/ecma-exceptions.h
+++ b/jerry-core/ecma/operations/ecma-exceptions.h
@@ -17,6 +17,7 @@
#define ECMA_EXCEPTIONS_H
#include "ecma-globals.h"
+
#include "jrt.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/operations/ecma-function-object.c b/jerry-core/ecma/operations/ecma-function-object.c
index 0850a417..8cbf3ce2 100644
--- a/jerry-core/ecma/operations/ecma-function-object.c
+++ b/jerry-core/ecma/operations/ecma-function-object.c
@@ -13,22 +13,24 @@
* limitations under the License.
*/
+#include "ecma-function-object.h"
+
#include "ecma-alloc.h"
-#include "ecma-builtin-helpers.h"
#include "ecma-builtin-handlers.h"
+#include "ecma-builtin-helpers.h"
#include "ecma-exceptions.h"
#include "ecma-extended-info.h"
-#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-helpers.h"
-#include "ecma-promise-object.h"
-#include "lit-char-helpers.h"
#include "ecma-lex-env.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
+#include "ecma-objects.h"
+#include "ecma-promise-object.h"
#include "ecma-proxy-object.h"
#include "ecma-symbol-object.h"
+
#include "jcontext.h"
+#include "lit-char-helpers.h"
#include "opcodes.h"
/** \addtogroup ecma ECMA
@@ -143,8 +145,7 @@ ecma_op_object_is_callable (ecma_object_t *obj_p) /**< ecma object */
bool
ecma_op_is_callable (ecma_value_t value) /**< ecma value */
{
- return (ecma_is_value_object (value)
- && ecma_op_object_is_callable (ecma_get_object_from_value (value)));
+ return (ecma_is_value_object (value) && ecma_op_object_is_callable (ecma_get_object_from_value (value)));
} /* ecma_op_is_callable */
/**
@@ -170,8 +171,8 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
{
ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) obj_p;
- obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- bound_func_p->header.u.bound_function.target_function);
+ obj_p =
+ ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);
type = ecma_get_object_type (obj_p);
}
@@ -241,8 +242,7 @@ ecma_object_check_constructor (ecma_object_t *obj_p) /**< ecma object */
}
#endif /* JERRY_BUILTIN_PROXY */
- JERRY_ASSERT (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION
- || type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION
+ JERRY_ASSERT (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION || type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION
|| type == ECMA_OBJECT_TYPE_CONSTRUCTOR_FUNCTION);
if (type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION)
@@ -298,8 +298,7 @@ ecma_object_is_constructor (ecma_object_t *obj_p) /**< ecma object */
bool
ecma_is_constructor (ecma_value_t value) /**< ecma value */
{
- return (ecma_is_value_object (value)
- && ecma_object_is_constructor (ecma_get_object_from_value (value)));
+ return (ecma_is_value_object (value) && ecma_object_is_constructor (ecma_get_object_from_value (value)));
} /* ecma_is_constructor */
/**
@@ -382,9 +381,7 @@ ecma_op_create_function_object (ecma_object_t *scope_p, /**< function's scope */
}
#endif /* JERRY_SNAPSHOT_EXEC */
- ecma_object_t *func_p = ecma_create_object (prototype_obj_p,
- function_object_size,
- ECMA_OBJECT_TYPE_FUNCTION);
+ ecma_object_t *func_p = ecma_create_object (prototype_obj_p, function_object_size, ECMA_OBJECT_TYPE_FUNCTION);
/* 2., 6., 7., 8. */
/*
@@ -447,8 +444,8 @@ ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p, /**< argu
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
- ecma_string_t *arguments_str_p = ecma_op_create_dynamic_function_arguments_helper (arguments_list_p,
- arguments_list_len);
+ ecma_string_t *arguments_str_p =
+ ecma_op_create_dynamic_function_arguments_helper (arguments_list_p, arguments_list_len);
if (JERRY_UNLIKELY (arguments_str_p == NULL))
{
@@ -637,9 +634,7 @@ ecma_op_create_arrow_function_object (ecma_object_t *scope_p, /**< function's sc
}
#endif /* JERRY_SNAPSHOT_EXEC */
- ecma_object_t *func_p = ecma_create_object (prototype_obj_p,
- arrow_function_object_size,
- ECMA_OBJECT_TYPE_FUNCTION);
+ ecma_object_t *func_p = ecma_create_object (prototype_obj_p, arrow_function_object_size, ECMA_OBJECT_TYPE_FUNCTION);
ecma_arrow_function_t *arrow_func_p = (ecma_arrow_function_t *) func_p;
@@ -686,9 +681,8 @@ ecma_op_create_external_function_object (ecma_native_handler_t handler_cb) /**<
{
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
- ecma_object_t *function_obj_p = ecma_create_object (prototype_obj_p,
- sizeof (ecma_native_function_t),
- ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
+ ecma_object_t *function_obj_p =
+ ecma_create_object (prototype_obj_p, sizeof (ecma_native_function_t), ECMA_OBJECT_TYPE_NATIVE_FUNCTION);
/*
* [[Class]] property is not stored explicitly for objects of ECMA_OBJECT_TYPE_NATIVE_FUNCTION type.
@@ -698,8 +692,7 @@ ecma_op_create_external_function_object (ecma_native_handler_t handler_cb) /**<
ecma_native_function_t *native_function_p = (ecma_native_function_t *) function_obj_p;
#if JERRY_BUILTIN_REALMS
- ECMA_SET_INTERNAL_VALUE_POINTER (native_function_p->realm_value,
- ecma_builtin_get_global ());
+ ECMA_SET_INTERNAL_VALUE_POINTER (native_function_p->realm_value, ecma_builtin_get_global ());
#endif /* JERRY_BUILTIN_REALMS */
native_function_p->native_handler_cb = handler_cb;
@@ -719,9 +712,7 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */
{
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_FUNCTION_PROTOTYPE);
- ecma_object_t *function_obj_p = ecma_create_object (prototype_obj_p,
- object_size,
- ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
+ ecma_object_t *function_obj_p = ecma_create_object (prototype_obj_p, object_size, ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION);
ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) function_obj_p;
ext_func_obj_p->u.built_in.id = ECMA_BUILTIN_ID_HANDLER;
@@ -729,8 +720,7 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */
ext_func_obj_p->u.built_in.u2.routine_flags = ECMA_NATIVE_HANDLER_FLAGS_NONE;
#if JERRY_BUILTIN_REALMS
- ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_obj_p->u.built_in.realm_value,
- ecma_builtin_get_global ());
+ ECMA_SET_INTERNAL_VALUE_POINTER (ext_func_obj_p->u.built_in.realm_value, ecma_builtin_get_global ());
#endif /* JERRY_BUILTIN_REALMS */
return function_obj_p;
@@ -743,20 +733,18 @@ ecma_op_create_native_handler (ecma_native_handler_id_t id, /**< handler id */
*
* @return compiled code
*/
-extern inline const ecma_compiled_code_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline const ecma_compiled_code_t *JERRY_ATTR_ALWAYS_INLINE
ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< function pointer */
{
#if JERRY_SNAPSHOT_EXEC
if (JERRY_LIKELY (function_p->u.function.bytecode_cp != ECMA_NULL_POINTER))
{
- return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
- function_p->u.function.bytecode_cp);
+ return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t, function_p->u.function.bytecode_cp);
}
return ((ecma_static_function_t *) function_p)->bytecode_p;
#else /* !JERRY_SNAPSHOT_EXEC */
- return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t,
- function_p->u.function.bytecode_cp);
+ return ECMA_GET_INTERNAL_VALUE_POINTER (const ecma_compiled_code_t, function_p->u.function.bytecode_cp);
#endif /* JERRY_SNAPSHOT_EXEC */
} /* ecma_op_function_get_compiled_code */
@@ -770,7 +758,7 @@ ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p) /**< fun
*
* @return pointer to realm (global) object
*/
-extern inline ecma_global_object_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_global_object_t *JERRY_ATTR_ALWAYS_INLINE
ecma_op_function_get_realm (const ecma_compiled_code_t *bytecode_header_p) /**< byte code header */
{
#if JERRY_SNAPSHOT_EXEC
@@ -811,15 +799,13 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob
if (type == ECMA_OBJECT_TYPE_BUILT_IN_FUNCTION)
{
ecma_extended_object_t *ext_function_obj_p = (ecma_extended_object_t *) func_obj_p;
- return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
- ext_function_obj_p->u.built_in.realm_value);
+ return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, ext_function_obj_p->u.built_in.realm_value);
}
if (type == ECMA_OBJECT_TYPE_NATIVE_FUNCTION)
{
ecma_native_function_t *native_function_p = (ecma_native_function_t *) func_obj_p;
- return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
- native_function_p->realm_value);
+ return ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value);
}
#if JERRY_ESNEXT
@@ -848,8 +834,8 @@ ecma_op_function_get_function_realm (ecma_object_t *func_obj_p) /**< function ob
JERRY_ASSERT (type == ECMA_OBJECT_TYPE_BOUND_FUNCTION);
ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p;
- func_obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- bound_func_p->header.u.bound_function.target_function);
+ func_obj_p =
+ ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);
}
} /* ecma_op_function_get_function_realm */
@@ -866,8 +852,7 @@ ecma_value_t
ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object */
ecma_value_t value) /**< argument 'V' */
{
- JERRY_ASSERT (func_obj_p != NULL
- && !ecma_is_lexical_environment (func_obj_p));
+ JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p));
if (!ecma_is_value_object (value))
{
@@ -881,8 +866,8 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
/* 1. 3. */
ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p;
- func_obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- bound_func_p->header.u.bound_function.target_function);
+ func_obj_p =
+ ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);
}
JERRY_ASSERT (ecma_get_object_type (func_obj_p) == ECMA_OBJECT_TYPE_FUNCTION
@@ -893,8 +878,7 @@ ecma_op_function_has_instance (ecma_object_t *func_obj_p, /**< Function object *
ecma_object_t *v_obj_p = ecma_get_object_from_value (value);
- ecma_value_t prototype_obj_value = ecma_op_object_get_by_magic_id (func_obj_p,
- LIT_MAGIC_STRING_PROTOTYPE);
+ ecma_value_t prototype_obj_value = ecma_op_object_get_by_magic_id (func_obj_p, LIT_MAGIC_STRING_PROTOTYPE);
if (ECMA_IS_VALUE_ERROR (prototype_obj_value))
{
@@ -1133,8 +1117,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
/* Entering Function Code (ECMA-262 v5, 10.4.3) */
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) func_obj_p;
- ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- ext_func_p->u.function.scope_cp);
+ ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_func_p->u.function.scope_cp);
/* 8. */
const ecma_compiled_code_t *bytecode_data_p = ecma_op_function_get_compiled_code (ext_func_p);
@@ -1190,8 +1173,7 @@ ecma_op_function_call_simple (ecma_object_t *func_obj_p, /**< Function object */
break;
}
- if (ecma_is_value_undefined (this_binding)
- || ecma_is_value_null (this_binding))
+ if (ecma_is_value_undefined (this_binding) || ecma_is_value_null (this_binding))
{
/* 2. */
#if JERRY_BUILTIN_REALMS
@@ -1253,14 +1235,12 @@ ecma_op_function_call_native_built_in (ecma_object_t *func_obj_p, /**< Function
ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);
ecma_extended_object_t *ext_func_obj_p = (ecma_extended_object_t *) func_obj_p;
- JERRY_CONTEXT (global_object_p) = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
- ext_func_obj_p->u.built_in.realm_value);
+ JERRY_CONTEXT (global_object_p) =
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, ext_func_obj_p->u.built_in.realm_value);
#endif /* JERRY_BUILTIN_REALMS */
- ecma_value_t ret_value = ecma_builtin_dispatch_call (func_obj_p,
- this_arg_value,
- arguments_list_p,
- arguments_list_len);
+ ecma_value_t ret_value =
+ ecma_builtin_dispatch_call (func_obj_p, this_arg_value, arguments_list_p, arguments_list_len);
#if JERRY_BUILTIN_REALMS
JERRY_CONTEXT (global_object_p) = saved_global_object_p;
@@ -1285,8 +1265,8 @@ ecma_op_function_call_native (ecma_object_t *func_obj_p, /**< Function object */
#if JERRY_BUILTIN_REALMS
ecma_global_object_t *saved_global_object_p = JERRY_CONTEXT (global_object_p);
- JERRY_CONTEXT (global_object_p) = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
- native_function_p->realm_value);
+ JERRY_CONTEXT (global_object_p) =
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value);
#endif /* JERRY_BUILTIN_REALMS */
jerry_call_info_t call_info;
@@ -1301,9 +1281,7 @@ ecma_op_function_call_native (ecma_object_t *func_obj_p, /**< Function object */
#endif /* JERRY_ESNEXT */
JERRY_ASSERT (native_function_p->native_handler_cb != NULL);
- ecma_value_t ret_value = native_function_p->native_handler_cb (&call_info,
- arguments_list_p,
- arguments_list_len);
+ ecma_value_t ret_value = native_function_p->native_handler_cb (&call_info, arguments_list_p, arguments_list_len);
#if JERRY_BUILTIN_REALMS
JERRY_CONTEXT (global_object_p) = saved_global_object_p;
#endif /* JERRY_BUILTIN_REALMS */
@@ -1337,8 +1315,8 @@ ecma_op_bound_function_get_argument_list (ecma_object_t *func_obj_p, /**< bound
ecma_bound_function_t *bound_func_p = (ecma_bound_function_t *) func_obj_p;
- func_obj_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- bound_func_p->header.u.bound_function.target_function);
+ func_obj_p =
+ ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);
ecma_value_t args_len_or_this = bound_func_p->header.u.bound_function.args_len_or_this;
@@ -1438,8 +1416,7 @@ ecma_op_function_call (ecma_object_t *func_obj_p, /**< Function object */
const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< length of arguments list */
{
- JERRY_ASSERT (func_obj_p != NULL
- && !ecma_is_lexical_environment (func_obj_p));
+ JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p));
ECMA_CHECK_STACK_USAGE ();
@@ -1702,10 +1679,7 @@ ecma_op_function_construct_constructor (ecma_object_t *func_obj_p, /**< Function
}
ecma_object_t *super_ctor_p = ecma_get_object_from_value (super_ctor);
- ecma_value_t result = ecma_op_function_construct (super_ctor_p,
- new_target_p,
- arguments_list_p,
- arguments_list_len);
+ ecma_value_t result = ecma_op_function_construct (super_ctor_p, new_target_p, arguments_list_p, arguments_list_len);
ecma_deref_object (super_ctor_p);
if (ecma_is_value_object (result))
@@ -1785,8 +1759,7 @@ ecma_op_function_construct (ecma_object_t *func_obj_p, /**< Function object */
const ecma_value_t *arguments_list_p, /**< arguments list */
uint32_t arguments_list_len) /**< length of arguments list */
{
- JERRY_ASSERT (func_obj_p != NULL
- && !ecma_is_lexical_environment (func_obj_p));
+ JERRY_ASSERT (func_obj_p != NULL && !ecma_is_lexical_environment (func_obj_p));
switch (ecma_get_object_type (func_obj_p))
{
@@ -1852,8 +1825,7 @@ ecma_op_lazy_instantiate_prototype_object (ecma_object_t *object_p) /**< the fun
{
ecma_native_function_t *native_function_p = (ecma_native_function_t *) object_p;
- global_object_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t,
- native_function_p->realm_value);
+ global_object_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_global_object_t, native_function_p->realm_value);
}
#endif /* JERRY_BUILTIN_REALMS */
@@ -1997,10 +1969,8 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
}
ecma_property_t *value_prop_p;
- ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- ECMA_PROPERTY_BUILT_IN_CONFIGURABLE,
- &value_prop_p);
+ ecma_property_value_t *value_p =
+ ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &value_prop_p);
value_p->value = ecma_make_uint32_value (len);
return value_prop_p;
}
@@ -2026,10 +1996,8 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
/* Initialize 'name' property */
ecma_property_t *value_prop_p;
- ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- ECMA_PROPERTY_BUILT_IN_CONFIGURABLE,
- &value_prop_p);
+ ecma_property_value_t *value_p =
+ ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_CONFIGURABLE, &value_prop_p);
value_p->value = ecma_copy_value (value);
return value_prop_p;
}
@@ -2043,8 +2011,7 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
const bool is_arguments = ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_ARGUMENTS);
- if (is_arguments
- || ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER))
+ if (is_arguments || ecma_compare_ecma_string_to_magic_id (property_name_p, LIT_MAGIC_STRING_CALLER))
{
const ecma_compiled_code_t *bytecode_data_p;
bytecode_data_p = ecma_op_function_get_compiled_code ((ecma_extended_object_t *) object_p);
@@ -2055,10 +2022,8 @@ ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, /**<
{
ecma_property_t *value_prop_p;
/* The property_name_p argument contains the name. */
- ecma_property_value_t *value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- ECMA_PROPERTY_BUILT_IN_FIXED,
- &value_prop_p);
+ ecma_property_value_t *value_p =
+ ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_BUILT_IN_FIXED, &value_prop_p);
value_p->value = is_arguments ? ECMA_VALUE_NULL : ECMA_VALUE_UNDEFINED;
return value_prop_p;
}
@@ -2146,8 +2111,8 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
length_attributes = ECMA_PROPERTY_BUILT_IN_FIXED;
ecma_object_t *target_func_p;
- target_func_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- bound_func_p->header.u.bound_function.target_function);
+ target_func_p =
+ ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, bound_func_p->header.u.bound_function.target_function);
if (ecma_object_get_class_name (target_func_p) == LIT_MAGIC_STRING_FUNCTION_UL)
{
@@ -2167,10 +2132,8 @@ ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p
}
ecma_property_t *len_prop_p;
- ecma_property_value_t *len_prop_value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- length_attributes,
- &len_prop_p);
+ ecma_property_value_t *len_prop_value_p =
+ ecma_create_named_data_property (object_p, property_name_p, length_attributes, &len_prop_p);
len_prop_value_p->value = ecma_make_number_value (length);
return len_prop_p;
diff --git a/jerry-core/ecma/operations/ecma-function-object.h b/jerry-core/ecma/operations/ecma-function-object.h
index 76c833a1..1531d85e 100644
--- a/jerry-core/ecma/operations/ecma-function-object.h
+++ b/jerry-core/ecma/operations/ecma-function-object.h
@@ -16,9 +16,10 @@
#ifndef ECMA_FUNCTION_OBJECT_H
#define ECMA_FUNCTION_OBJECT_H
-#include "ecma-globals.h"
-#include "ecma-builtins.h"
#include "ecma-builtin-handlers.h"
+#include "ecma-builtins.h"
+#include "ecma-globals.h"
+
#include "vm.h"
/** \addtogroup ecma ECMA
@@ -50,93 +51,84 @@ bool ecma_object_is_constructor (ecma_object_t *obj_p);
char *ecma_object_check_constructor (ecma_object_t *obj_p);
char *ecma_check_constructor (ecma_value_t value);
-ecma_object_t *
-ecma_op_create_simple_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p);
+ecma_object_t *ecma_op_create_simple_function_object (ecma_object_t *scope_p,
+ const ecma_compiled_code_t *bytecode_data_p);
-ecma_object_t *
-ecma_op_create_external_function_object (ecma_native_handler_t handler_cb);
+ecma_object_t *ecma_op_create_external_function_object (ecma_native_handler_t handler_cb);
-const ecma_compiled_code_t *
-ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p);
+const ecma_compiled_code_t *ecma_op_function_get_compiled_code (ecma_extended_object_t *function_p);
#if JERRY_BUILTIN_REALMS
-ecma_global_object_t *
-ecma_op_function_get_realm (const ecma_compiled_code_t *bytecode_header_p);
+ecma_global_object_t *ecma_op_function_get_realm (const ecma_compiled_code_t *bytecode_header_p);
-ecma_global_object_t *
-ecma_op_function_get_function_realm (ecma_object_t *func_obj_p);
+ecma_global_object_t *ecma_op_function_get_function_realm (ecma_object_t *func_obj_p);
#endif /* JERRY_BUILTIN_REALMS */
-ecma_value_t
-ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p,
- uint32_t arguments_list_len,
- ecma_parse_opts_t opts);
+ecma_value_t ecma_op_create_dynamic_function (const ecma_value_t *arguments_list_p,
+ uint32_t arguments_list_len,
+ ecma_parse_opts_t opts);
#if JERRY_ESNEXT
-ecma_value_t
-ecma_op_function_get_super_constructor (ecma_object_t *func_obj_p);
+ecma_value_t ecma_op_function_get_super_constructor (ecma_object_t *func_obj_p);
-ecma_object_t *
-ecma_op_create_any_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p);
+ecma_object_t *ecma_op_create_any_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p);
-ecma_object_t *
-ecma_op_create_arrow_function_object (ecma_object_t *scope_p, const ecma_compiled_code_t *bytecode_data_p,
- ecma_value_t this_binding);
+ecma_object_t *ecma_op_create_arrow_function_object (ecma_object_t *scope_p,
+ const ecma_compiled_code_t *bytecode_data_p,
+ ecma_value_t this_binding);
-ecma_object_t *
-ecma_op_create_native_handler (ecma_native_handler_id_t id, size_t object_size);
+ecma_object_t *ecma_op_create_native_handler (ecma_native_handler_id_t id, size_t object_size);
#endif /* JERRY_ESNEXT */
-ecma_object_t *
-ecma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, ecma_builtin_id_t default_proto_id);
+ecma_object_t *ecma_op_get_prototype_from_constructor (ecma_object_t *ctor_obj_p, ecma_builtin_id_t default_proto_id);
-ecma_value_t
-ecma_op_function_has_instance (ecma_object_t *func_obj_p, ecma_value_t value);
+ecma_value_t ecma_op_function_has_instance (ecma_object_t *func_obj_p, ecma_value_t value);
-ecma_value_t
-ecma_op_function_validated_call (ecma_value_t callee, ecma_value_t this_arg_value,
- const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);
+ecma_value_t ecma_op_function_validated_call (ecma_value_t callee,
+ ecma_value_t this_arg_value,
+ const ecma_value_t *arguments_list_p,
+ uint32_t arguments_list_len);
-ecma_value_t
-ecma_op_function_call (ecma_object_t *func_obj_p, ecma_value_t this_arg_value,
- const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);
+ecma_value_t ecma_op_function_call (ecma_object_t *func_obj_p,
+ ecma_value_t this_arg_value,
+ const ecma_value_t *arguments_list_p,
+ uint32_t arguments_list_len);
-ecma_value_t
-ecma_op_function_construct (ecma_object_t *func_obj_p, ecma_object_t *new_target_p,
- const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);
+ecma_value_t ecma_op_function_construct (ecma_object_t *func_obj_p,
+ ecma_object_t *new_target_p,
+ const ecma_value_t *arguments_list_p,
+ uint32_t arguments_list_len);
-ecma_property_t *
-ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
+ecma_property_t *ecma_op_function_try_to_lazy_instantiate_property (ecma_object_t *object_p,
+ ecma_string_t *property_name_p);
-ecma_property_t *
-ecma_op_external_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
+ecma_property_t *ecma_op_external_function_try_to_lazy_instantiate_property (ecma_object_t *object_p,
+ ecma_string_t *property_name_p);
-ecma_property_t *
-ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
+ecma_property_t *ecma_op_bound_function_try_to_lazy_instantiate_property (ecma_object_t *object_p,
+ ecma_string_t *property_name_p);
#if JERRY_ESNEXT
-void
-ecma_op_function_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
+void ecma_op_function_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
-void
-ecma_op_bound_function_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
+void ecma_op_bound_function_delete_built_in_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
#endif /* JERRY_ESNEXT */
-void
-ecma_op_function_list_lazy_property_names (ecma_object_t *object_p, ecma_collection_t *prop_names_p,
- ecma_property_counter_t *prop_counter_p,
- jerry_property_filter_t filter);
+void ecma_op_function_list_lazy_property_names (ecma_object_t *object_p,
+ ecma_collection_t *prop_names_p,
+ ecma_property_counter_t *prop_counter_p,
+ jerry_property_filter_t filter);
-void
-ecma_op_external_function_list_lazy_property_names (ecma_object_t *object_p, ecma_collection_t *prop_names_p,
- ecma_property_counter_t *prop_counter_p,
- jerry_property_filter_t filter);
+void ecma_op_external_function_list_lazy_property_names (ecma_object_t *object_p,
+ ecma_collection_t *prop_names_p,
+ ecma_property_counter_t *prop_counter_p,
+ jerry_property_filter_t filter);
-void
-ecma_op_bound_function_list_lazy_property_names (ecma_object_t *object_p, ecma_collection_t *prop_names_p,
- ecma_property_counter_t *prop_counter_p,
- jerry_property_filter_t filter);
+void ecma_op_bound_function_list_lazy_property_names (ecma_object_t *object_p,
+ ecma_collection_t *prop_names_p,
+ ecma_property_counter_t *prop_counter_p,
+ jerry_property_filter_t filter);
/**
* @}
diff --git a/jerry-core/ecma/operations/ecma-get-put-value.c b/jerry-core/ecma/operations/ecma-get-put-value.c
index 110858e1..86dbc81b 100644
--- a/jerry-core/ecma/operations/ecma-get-put-value.c
+++ b/jerry-core/ecma/operations/ecma-get-put-value.c
@@ -19,13 +19,12 @@
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-helpers.h"
#include "ecma-lex-env.h"
-#include "ecma-objects.h"
-#include "ecma-function-object.h"
#include "ecma-objects-general.h"
-
+#include "ecma-objects.h"
#include "ecma-reference.h"
/** \addtogroup ecma ECMA
@@ -48,8 +47,7 @@ ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
ecma_object_t **ref_base_lex_env_p, /**< [out] reference's base (lexical environment) */
ecma_string_t *name_p) /**< variable name */
{
- JERRY_ASSERT (lex_env_p != NULL
- && ecma_is_lexical_environment (lex_env_p));
+ JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));
while (true)
{
@@ -174,8 +172,7 @@ ecma_op_get_value_object_base (ecma_value_t base_value, /**< base value */
uint32_t index = ecma_string_get_array_index (property_name_p);
- if (index != ECMA_STRING_NOT_ARRAY_INDEX
- && index < ecma_string_get_length (string_p))
+ if (index != ECMA_STRING_NOT_ARRAY_INDEX && index < ecma_string_get_length (string_p))
{
ecma_char_t char_at_idx = ecma_string_get_char_at_pos (string_p, index);
return ecma_make_string_value (ecma_new_ecma_string_from_code_unit (char_at_idx));
@@ -231,8 +228,7 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
bool is_strict, /**< flag indicating strict mode */
ecma_value_t value) /**< ECMA-value */
{
- JERRY_ASSERT (lex_env_p != NULL
- && ecma_is_lexical_environment (lex_env_p));
+ JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));
while (true)
{
@@ -257,11 +253,9 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
#if JERRY_ESNEXT
ecma_property_value_t *property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
- JERRY_ASSERT (!(*property_p & ECMA_PROPERTY_FLAG_WRITABLE)
- || (*property_p & ECMA_PROPERTY_FLAG_DATA));
+ JERRY_ASSERT (!(*property_p & ECMA_PROPERTY_FLAG_WRITABLE) || (*property_p & ECMA_PROPERTY_FLAG_DATA));
- if ((*property_p & ECMA_PROPERTY_FLAG_WRITABLE)
- && property_value_p->value != ECMA_VALUE_UNINITIALIZED)
+ if ((*property_p & ECMA_PROPERTY_FLAG_WRITABLE) && property_value_p->value != ECMA_VALUE_UNINITIALIZED)
{
ecma_named_data_property_assign_value (lex_env_p, property_value_p, value);
return ECMA_VALUE_EMPTY;
@@ -296,10 +290,7 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
if (ecma_is_value_true (has_property))
{
- ecma_value_t completion = ecma_op_object_put (binding_obj_p,
- name_p,
- value,
- is_strict);
+ ecma_value_t completion = ecma_op_object_put (binding_obj_p, name_p, value, is_strict);
if (ECMA_IS_VALUE_ERROR (completion))
{
@@ -335,10 +326,7 @@ ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, /**< lexical environme
#endif /* JERRY_ERROR_MESSAGES */
}
- ecma_value_t completion = ecma_op_object_put (ecma_get_lex_env_binding_object (lex_env_p),
- name_p,
- value,
- false);
+ ecma_value_t completion = ecma_op_object_put (ecma_get_lex_env_binding_object (lex_env_p), name_p, value, false);
JERRY_ASSERT (ecma_is_value_boolean (completion));
diff --git a/jerry-core/ecma/operations/ecma-iterator-object.c b/jerry-core/ecma/operations/ecma-iterator-object.c
index badb795e..a40c9e02 100644
--- a/jerry-core/ecma/operations/ecma-iterator-object.c
+++ b/jerry-core/ecma/operations/ecma-iterator-object.c
@@ -13,19 +13,21 @@
* limitations under the License.
*/
+#include "ecma-iterator-object.h"
+
#include "ecma-alloc.h"
#include "ecma-array-object.h"
-#include "ecma-iterator-object.h"
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-number-arithmetic.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
-#include "ecma-function-object.h"
+#include "ecma-objects.h"
+
#include "jcontext.h"
/** \addtogroup ecma ECMA
@@ -57,18 +59,14 @@ ecma_create_array_from_iter_element (ecma_value_t value, /**< value */
/* 3-4. */
ecma_value_t completion;
- completion = ecma_builtin_helper_def_prop_by_index (new_array_p,
- 0,
- index_value,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
+ completion =
+ ecma_builtin_helper_def_prop_by_index (new_array_p, 0, index_value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
/* 4.b */
JERRY_ASSERT (ecma_is_value_true (completion));
- completion = ecma_builtin_helper_def_prop_by_index (new_array_p,
- 1,
- value,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
+ completion =
+ ecma_builtin_helper_def_prop_by_index (new_array_p, 1, value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
JERRY_ASSERT (ecma_is_value_true (completion));
/* 5. */
@@ -95,9 +93,8 @@ ecma_create_iter_result_object (ecma_value_t value, /**< value */
JERRY_ASSERT (ecma_is_value_boolean (done));
/* 2. */
- ecma_object_t *object_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE),
- 0,
- ECMA_OBJECT_TYPE_GENERAL);
+ ecma_object_t *object_p =
+ ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL);
/* 3. */
ecma_property_value_t *prop_value_p;
@@ -136,17 +133,15 @@ ecma_op_create_iterator_object (ecma_value_t iterated_value, /**< value from cre
ecma_iterator_kind_t kind) /**< iterator kind*/
{
/* 1. */
- JERRY_ASSERT (iterator_type == ECMA_OBJECT_CLASS_ARRAY_ITERATOR
- || iterator_type == ECMA_OBJECT_CLASS_SET_ITERATOR
+ JERRY_ASSERT (iterator_type == ECMA_OBJECT_CLASS_ARRAY_ITERATOR || iterator_type == ECMA_OBJECT_CLASS_SET_ITERATOR
|| iterator_type == ECMA_OBJECT_CLASS_MAP_ITERATOR
|| iterator_type == ECMA_OBJECT_CLASS_REGEXP_STRING_ITERATOR
|| iterator_type == ECMA_OBJECT_CLASS_STRING_ITERATOR);
JERRY_ASSERT (kind < ECMA_ITERATOR__COUNT);
/* 2. */
- ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p =
+ ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_extended_object_t *ext_obj_p = (ecma_extended_object_t *) object_p;
ext_obj_p->u.cls.type = (uint8_t) iterator_type;
@@ -235,9 +230,8 @@ ecma_op_get_iterator (ecma_value_t value, /**< value to get iterator from */
return sync_iterator;
}
- ecma_value_t async_iterator = ecma_op_create_async_from_sync_iterator (sync_iterator,
- sync_next_method,
- next_method_p);
+ ecma_value_t async_iterator =
+ ecma_op_create_async_from_sync_iterator (sync_iterator, sync_next_method, next_method_p);
ecma_free_value (method);
ecma_free_value (sync_iterator);
@@ -716,8 +710,8 @@ ecma_async_from_sync_iterator_unwrap_cb (ecma_object_t *function_obj_p, /**< fun
/* 2. */
ecma_value_t arg = args_count > 0 ? args_p[0] : ECMA_VALUE_UNDEFINED;
- ecma_value_t done = ecma_make_boolean_value (unwrap_p->u.built_in.u2.routine_flags
- >> ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT);
+ ecma_value_t done =
+ ecma_make_boolean_value (unwrap_p->u.built_in.u2.routine_flags >> ECMA_NATIVE_HANDLER_COMMON_FLAGS_SHIFT);
return ecma_create_iter_result_object (arg, done);
} /* ecma_async_from_sync_iterator_unwrap_cb */
diff --git a/jerry-core/ecma/operations/ecma-iterator-object.h b/jerry-core/ecma/operations/ecma-iterator-object.h
index 157b3432..f0903508 100644
--- a/jerry-core/ecma/operations/ecma-iterator-object.h
+++ b/jerry-core/ecma/operations/ecma-iterator-object.h
@@ -43,48 +43,40 @@ typedef enum
*/
#define ECMA_ITERATOR_INDEX_LIMIT UINT16_MAX
-ecma_value_t
-ecma_op_create_iterator_object (ecma_value_t iterated_value,
- ecma_object_t *prototype_obj_p,
- ecma_object_class_type_t iterator_type,
- ecma_iterator_kind_t kind);
+ecma_value_t ecma_op_create_iterator_object (ecma_value_t iterated_value,
+ ecma_object_t *prototype_obj_p,
+ ecma_object_class_type_t iterator_type,
+ ecma_iterator_kind_t kind);
-ecma_value_t
-ecma_create_iter_result_object (ecma_value_t value, ecma_value_t done);
+ecma_value_t ecma_create_iter_result_object (ecma_value_t value, ecma_value_t done);
-ecma_value_t
-ecma_create_array_from_iter_element (ecma_value_t value, ecma_value_t index_value);
+ecma_value_t ecma_create_array_from_iter_element (ecma_value_t value, ecma_value_t index_value);
-ecma_value_t
-ecma_op_get_iterator (ecma_value_t value, ecma_value_t method, ecma_value_t *next_method_p);
+ecma_value_t ecma_op_get_iterator (ecma_value_t value, ecma_value_t method, ecma_value_t *next_method_p);
-ecma_value_t
-ecma_op_iterator_complete (ecma_value_t iter_result);
+ecma_value_t ecma_op_iterator_complete (ecma_value_t iter_result);
-ecma_value_t
-ecma_op_iterator_value (ecma_value_t iter_result);
+ecma_value_t ecma_op_iterator_value (ecma_value_t iter_result);
-ecma_value_t
-ecma_op_iterator_next (ecma_value_t iterator, ecma_value_t next_method, ecma_value_t value);
+ecma_value_t ecma_op_iterator_next (ecma_value_t iterator, ecma_value_t next_method, ecma_value_t value);
-ecma_value_t
-ecma_op_iterator_close (ecma_value_t iterator);
+ecma_value_t ecma_op_iterator_close (ecma_value_t iterator);
-ecma_value_t
-ecma_op_iterator_step (ecma_value_t iterator, ecma_value_t next_method);
+ecma_value_t ecma_op_iterator_step (ecma_value_t iterator, ecma_value_t next_method);
-ecma_value_t
-ecma_op_iterator_do (ecma_iterator_command_type_t command, ecma_value_t iterator,
- ecma_value_t next_method, ecma_value_t value, bool *done_p);
+ecma_value_t ecma_op_iterator_do (ecma_iterator_command_type_t command,
+ ecma_value_t iterator,
+ ecma_value_t next_method,
+ ecma_value_t value,
+ bool *done_p);
-ecma_value_t
-ecma_op_create_async_from_sync_iterator (ecma_value_t sync_iterator, ecma_value_t sync_next_method,
- ecma_value_t *async_next_method_p);
+ecma_value_t ecma_op_create_async_from_sync_iterator (ecma_value_t sync_iterator,
+ ecma_value_t sync_next_method,
+ ecma_value_t *async_next_method_p);
-ecma_value_t
-ecma_async_from_sync_iterator_unwrap_cb (ecma_object_t *function_obj_p,
- const ecma_value_t args_p[],
- const uint32_t args_count);
+ecma_value_t ecma_async_from_sync_iterator_unwrap_cb (ecma_object_t *function_obj_p,
+ const ecma_value_t args_p[],
+ const uint32_t args_count);
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/ecma/operations/ecma-jobqueue.c b/jerry-core/ecma/operations/ecma-jobqueue.c
index 17ad9913..990e3b7a 100644
--- a/jerry-core/ecma/operations/ecma-jobqueue.c
+++ b/jerry-core/ecma/operations/ecma-jobqueue.c
@@ -13,13 +13,15 @@
* limitations under the License.
*/
+#include "ecma-jobqueue.h"
+
#include "ecma-async-generator-object.h"
#include "ecma-function-object.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-jobqueue.h"
#include "ecma-objects.h"
#include "ecma-promise-object.h"
+
#include "jcontext.h"
#include "opcodes.h"
#include "vm-stack.h"
@@ -82,7 +84,8 @@ typedef struct
/**
* Initialize the jobqueue.
*/
-void ecma_job_queue_init (void)
+void
+ecma_job_queue_init (void)
{
JERRY_CONTEXT (job_queue_head_p) = NULL;
JERRY_CONTEXT (job_queue_tail_p) = NULL;
@@ -182,8 +185,8 @@ static ecma_value_t
ecma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the job to be operated */
{
/* 2. */
- JERRY_ASSERT (ecma_object_class_is (ecma_get_object_from_value (job_p->capability),
- ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));
+ JERRY_ASSERT (
+ ecma_object_class_is (ecma_get_object_from_value (job_p->capability), ECMA_OBJECT_CLASS_PROMISE_CAPABILITY));
ecma_promise_capabality_t *capability_p;
capability_p = (ecma_promise_capabality_t *) ecma_get_object_from_value (job_p->capability);
@@ -191,10 +194,11 @@ ecma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_REACTION_JOB))
{
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB,
- capability_p->header.u.cls.u3.promise,
- ECMA_VALUE_UNDEFINED,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (JERRY_PROMISE_EVENT_BEFORE_REACTION_JOB,
+ capability_p->header.u.cls.u3.promise,
+ ECMA_VALUE_UNDEFINED,
+ JERRY_CONTEXT (promise_callback_user_p));
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -213,10 +217,8 @@ ecma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the
else
{
/* 6. */
- handler_result = ecma_op_function_call (ecma_get_object_from_value (handler),
- ECMA_VALUE_UNDEFINED,
- &(job_p->argument),
- 1);
+ handler_result =
+ ecma_op_function_call (ecma_get_object_from_value (handler), ECMA_VALUE_UNDEFINED, &(job_p->argument), 1);
}
ecma_value_t status;
@@ -249,10 +251,11 @@ ecma_process_promise_reaction_job (ecma_job_promise_reaction_t *job_p) /**< the
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_REACTION_JOB))
{
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_AFTER_REACTION_JOB,
- capability_p->header.u.cls.u3.promise,
- ECMA_VALUE_UNDEFINED,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (JERRY_PROMISE_EVENT_AFTER_REACTION_JOB,
+ capability_p->header.u.cls.u3.promise,
+ ECMA_VALUE_UNDEFINED,
+ JERRY_CONTEXT (promise_callback_user_p));
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -281,10 +284,8 @@ ecma_process_promise_async_reaction_job (ecma_job_promise_async_reaction_t *job_
}
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (type,
- job_p->executable_object,
- job_p->argument,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (type, job_p->executable_object, job_p->argument, JERRY_CONTEXT (promise_callback_user_p));
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -385,10 +386,8 @@ free_job:
}
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (type,
- job_p->executable_object,
- job_p->argument,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (type, job_p->executable_object, job_p->argument, JERRY_CONTEXT (promise_callback_user_p));
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -494,8 +493,8 @@ ecma_enqueue_promise_async_reaction_job (ecma_value_t executable_object, /**< ex
{
ecma_job_promise_async_reaction_t *job_p;
job_p = (ecma_job_promise_async_reaction_t *) jmem_heap_alloc_block (sizeof (ecma_job_promise_async_reaction_t));
- job_p->header.next_and_type = (is_rejected ? ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED
- : ECMA_JOB_PROMISE_ASYNC_REACTION_FULFILLED);
+ job_p->header.next_and_type =
+ (is_rejected ? ECMA_JOB_PROMISE_ASYNC_REACTION_REJECTED : ECMA_JOB_PROMISE_ASYNC_REACTION_FULFILLED);
job_p->executable_object = ecma_copy_value (executable_object);
job_p->argument = ecma_copy_value (argument);
diff --git a/jerry-core/ecma/operations/ecma-jobqueue.h b/jerry-core/ecma/operations/ecma-jobqueue.h
index e75f05f6..72128c2e 100644
--- a/jerry-core/ecma/operations/ecma-jobqueue.h
+++ b/jerry-core/ecma/operations/ecma-jobqueue.h
@@ -16,6 +16,8 @@
#ifndef ECMA_JOB_QUEUE_H
#define ECMA_JOB_QUEUE_H
+#include "ecma-globals.h"
+
#if JERRY_ESNEXT
/** \addtogroup ecma ECMA
@@ -48,8 +50,7 @@ typedef struct
void ecma_job_queue_init (void);
void ecma_enqueue_promise_reaction_job (ecma_value_t capability, ecma_value_t handler, ecma_value_t argument);
-void ecma_enqueue_promise_async_reaction_job (ecma_value_t executable_object,
- ecma_value_t argument, bool is_rejected);
+void ecma_enqueue_promise_async_reaction_job (ecma_value_t executable_object, ecma_value_t argument, bool is_rejected);
void ecma_enqueue_promise_async_generator_job (ecma_value_t executable_object);
void ecma_enqueue_promise_resolve_thenable_job (ecma_value_t promise, ecma_value_t thenable, ecma_value_t then);
void ecma_free_all_enqueued_jobs (void);
diff --git a/jerry-core/ecma/operations/ecma-lex-env.c b/jerry-core/ecma/operations/ecma-lex-env.c
index 31a832d4..804822bc 100644
--- a/jerry-core/ecma/operations/ecma-lex-env.c
+++ b/jerry-core/ecma/operations/ecma-lex-env.c
@@ -13,15 +13,17 @@
* limitations under the License.
*/
+#include "ecma-lex-env.h"
+
#include "ecma-builtin-helpers.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-lex-env.h"
#include "ecma-objects.h"
#include "ecma-proxy-object.h"
+
#include "jcontext.h"
/** \addtogroup ecma ECMA
@@ -156,8 +158,7 @@ ecma_value_t
ecma_op_has_binding (ecma_object_t *lex_env_p, /**< lexical environment */
ecma_string_t *name_p) /**< argument N */
{
- JERRY_ASSERT (lex_env_p != NULL
- && ecma_is_lexical_environment (lex_env_p));
+ JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));
ecma_lexical_environment_type_t lex_env_type = ecma_get_lex_env_type (lex_env_p);
@@ -204,8 +205,7 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
ecma_string_t *name_p, /**< argument N */
bool is_deletable) /**< argument D */
{
- JERRY_ASSERT (lex_env_p != NULL
- && ecma_is_lexical_environment (lex_env_p));
+ JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));
JERRY_ASSERT (name_p != NULL);
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
@@ -219,10 +219,7 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
ecma_property_t *prop_p;
- ecma_create_named_data_property (lex_env_p,
- name_p,
- prop_attributes,
- &prop_p);
+ ecma_create_named_data_property (lex_env_p, name_p, prop_attributes, &prop_p);
return prop_p;
}
else
@@ -259,11 +256,11 @@ ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environme
const uint32_t flags = ECMA_PROPERTY_ENUMERABLE_WRITABLE | JERRY_PROP_SHOULD_THROW;
- ecma_value_t completion = ecma_builtin_helper_def_prop (binding_obj_p,
- name_p,
- ECMA_VALUE_UNDEFINED,
- is_deletable ? flags | ECMA_PROPERTY_FLAG_CONFIGURABLE
- : flags);
+ ecma_value_t completion =
+ ecma_builtin_helper_def_prop (binding_obj_p,
+ name_p,
+ ECMA_VALUE_UNDEFINED,
+ is_deletable ? flags | ECMA_PROPERTY_FLAG_CONFIGURABLE : flags);
if (ECMA_IS_VALUE_ERROR (completion))
{
@@ -292,8 +289,7 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
ecma_value_t value, /**< argument V */
bool is_strict) /**< argument S */
{
- JERRY_ASSERT (lex_env_p != NULL
- && ecma_is_lexical_environment (lex_env_p));
+ JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));
JERRY_ASSERT (name_p != NULL);
switch (ecma_get_lex_env_type (lex_env_p))
@@ -319,8 +315,7 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
}
JERRY_ASSERT (property_p != NULL && ECMA_PROPERTY_IS_RAW_DATA (*property_p));
- JERRY_ASSERT (!(*property_p & ECMA_PROPERTY_FLAG_WRITABLE)
- || (*property_p & ECMA_PROPERTY_FLAG_DATA));
+ JERRY_ASSERT (!(*property_p & ECMA_PROPERTY_FLAG_WRITABLE) || (*property_p & ECMA_PROPERTY_FLAG_DATA));
if ((*property_p & ECMA_PROPERTY_FLAG_WRITABLE))
{
@@ -340,10 +335,7 @@ ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, /**< lexical environment
ecma_object_t *binding_obj_p = ecma_get_lex_env_binding_object (lex_env_p);
- ecma_value_t completion = ecma_op_object_put (binding_obj_p,
- name_p,
- value,
- is_strict);
+ ecma_value_t completion = ecma_op_object_put (binding_obj_p, name_p, value, is_strict);
if (ECMA_IS_VALUE_ERROR (completion))
{
@@ -369,8 +361,7 @@ ecma_op_get_binding_value (ecma_object_t *lex_env_p, /**< lexical environment */
ecma_string_t *name_p, /**< argument N */
bool is_strict) /**< argument S */
{
- JERRY_ASSERT (lex_env_p != NULL
- && ecma_is_lexical_environment (lex_env_p));
+ JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));
JERRY_ASSERT (name_p != NULL);
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
@@ -421,8 +412,7 @@ ecma_value_t
ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */
ecma_string_t *name_p) /**< argument N */
{
- JERRY_ASSERT (lex_env_p != NULL
- && ecma_is_lexical_environment (lex_env_p));
+ JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));
JERRY_ASSERT (name_p != NULL);
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
@@ -473,8 +463,7 @@ ecma_op_delete_binding (ecma_object_t *lex_env_p, /**< lexical environment */
ecma_value_t
ecma_op_implicit_this_value (ecma_object_t *lex_env_p) /**< lexical environment */
{
- JERRY_ASSERT (lex_env_p != NULL
- && ecma_is_lexical_environment (lex_env_p));
+ JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));
if (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE)
{
@@ -501,18 +490,14 @@ ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, /**< lexical environ
ecma_string_t *name_p, /**< argument N */
ecma_value_t value) /**< argument V */
{
- JERRY_ASSERT (lex_env_p != NULL
- && ecma_is_lexical_environment (lex_env_p));
+ JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
/*
* Warning:
* Whether immutable bindings are deletable seems not to be defined by ECMA v5.
*/
- ecma_property_value_t *prop_value_p = ecma_create_named_data_property (lex_env_p,
- name_p,
- ECMA_PROPERTY_FIXED,
- NULL);
+ ecma_property_value_t *prop_value_p = ecma_create_named_data_property (lex_env_p, name_p, ECMA_PROPERTY_FIXED, NULL);
prop_value_p->value = ecma_copy_value_if_not_object (value);
} /* ecma_op_create_immutable_binding */
@@ -528,8 +513,7 @@ ecma_op_initialize_binding (ecma_object_t *lex_env_p, /**< lexical environment *
ecma_string_t *name_p, /**< argument N */
ecma_value_t value) /**< argument V */
{
- JERRY_ASSERT (lex_env_p != NULL
- && ecma_is_lexical_environment (lex_env_p));
+ JERRY_ASSERT (lex_env_p != NULL && ecma_is_lexical_environment (lex_env_p));
JERRY_ASSERT (ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
ecma_property_t *prop_p = ecma_find_named_property (lex_env_p, name_p);
diff --git a/jerry-core/ecma/operations/ecma-lex-env.h b/jerry-core/ecma/operations/ecma-lex-env.h
index e77f4f1e..5b59559c 100644
--- a/jerry-core/ecma/operations/ecma-lex-env.h
+++ b/jerry-core/ecma/operations/ecma-lex-env.h
@@ -18,6 +18,7 @@
#include "ecma-globals.h"
#include "ecma-reference.h"
+
#include "jrt.h"
/** \addtogroup ecma ECMA
@@ -49,17 +50,19 @@ void ecma_module_finalize_lex_envs (void);
*/
/* ECMA-262 v5, 8.7.1 and 8.7.2 */
-ecma_value_t ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, ecma_object_t **ref_base_lex_env_p,
- ecma_string_t *name_p);
+ecma_value_t
+ecma_op_get_value_lex_env_base (ecma_object_t *lex_env_p, ecma_object_t **ref_base_lex_env_p, ecma_string_t *name_p);
ecma_value_t ecma_op_get_value_object_base (ecma_value_t base_value, ecma_string_t *property_name_p);
-ecma_value_t ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p, ecma_string_t *var_name_string_p,
- bool is_strict, ecma_value_t value);
+ecma_value_t ecma_op_put_value_lex_env_base (ecma_object_t *lex_env_p,
+ ecma_string_t *var_name_string_p,
+ bool is_strict,
+ ecma_value_t value);
/* ECMA-262 v5, Table 17. Abstract methods of Environment Records */
ecma_value_t ecma_op_has_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p);
ecma_property_t *ecma_op_create_mutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, bool is_deletable);
-ecma_value_t ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value,
- bool is_strict);
+ecma_value_t
+ecma_op_set_mutable_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value, bool is_strict);
ecma_value_t ecma_op_get_binding_value (ecma_object_t *lex_env_p, ecma_string_t *name_p, bool is_strict);
ecma_value_t ecma_op_delete_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p);
ecma_value_t ecma_op_implicit_this_value (ecma_object_t *lex_env_p);
@@ -70,8 +73,7 @@ void ecma_op_create_immutable_binding (ecma_object_t *lex_env_p, ecma_string_t *
#if JERRY_ESNEXT
void ecma_op_initialize_binding (ecma_object_t *lex_env_p, ecma_string_t *name_p, ecma_value_t value);
-void ecma_op_create_environment_record (ecma_object_t *lex_env_p, ecma_value_t this_binding,
- ecma_object_t *func_obj_p);
+void ecma_op_create_environment_record (ecma_object_t *lex_env_p, ecma_value_t this_binding, ecma_object_t *func_obj_p);
ecma_environment_record_t *ecma_op_get_environment_record (ecma_object_t *lex_env_p);
bool ecma_op_this_binding_is_initialized (ecma_environment_record_t *environment_record_p);
diff --git a/jerry-core/ecma/operations/ecma-number-arithmetic.c b/jerry-core/ecma/operations/ecma-number-arithmetic.c
index 0440b5fa..2d17900a 100644
--- a/jerry-core/ecma/operations/ecma-number-arithmetic.c
+++ b/jerry-core/ecma/operations/ecma-number-arithmetic.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
+#include "ecma-number-arithmetic.h"
+
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-number-arithmetic.h"
/** \addtogroup ecma ECMA
* @{
@@ -36,16 +37,12 @@ ecma_number_t
ecma_op_number_remainder (ecma_number_t left_num, /**< left operand */
ecma_number_t right_num) /**< right operand */
{
- if (ecma_number_is_nan (left_num)
- || ecma_number_is_nan (right_num)
- || ecma_number_is_infinity (left_num)
+ if (ecma_number_is_nan (left_num) || ecma_number_is_nan (right_num) || ecma_number_is_infinity (left_num)
|| ecma_number_is_zero (right_num))
{
return ecma_number_make_nan ();
}
- else if (ecma_number_is_infinity (right_num)
- || (ecma_number_is_zero (left_num)
- && !ecma_number_is_zero (right_num)))
+ else if (ecma_number_is_infinity (right_num) || (ecma_number_is_zero (left_num) && !ecma_number_is_zero (right_num)))
{
return left_num;
}
diff --git a/jerry-core/ecma/operations/ecma-number-object.c b/jerry-core/ecma/operations/ecma-number-object.c
index 38e21695..4160e765 100644
--- a/jerry-core/ecma/operations/ecma-number-object.c
+++ b/jerry-core/ecma/operations/ecma-number-object.c
@@ -13,16 +13,18 @@
* limitations under the License.
*/
+#include "ecma-number-object.h"
+
#include "ecma-alloc.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-number-object.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
-#include "ecma-function-object.h"
+#include "ecma-objects.h"
+
#include "jcontext.h"
/** \addtogroup ecma ECMA
@@ -70,9 +72,8 @@ ecma_op_create_number_object (ecma_value_t arg) /**< argument passed to the Numb
}
}
#endif /* JERRY_ESNEXT */
- ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p =
+ ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_NUMBER;
diff --git a/jerry-core/ecma/operations/ecma-objects-general.c b/jerry-core/ecma/operations/ecma-objects-general.c
index be9ef803..438bfd75 100644
--- a/jerry-core/ecma/operations/ecma-objects-general.c
+++ b/jerry-core/ecma/operations/ecma-objects-general.c
@@ -13,6 +13,8 @@
* limitations under the License.
*/
+#include "ecma-objects-general.h"
+
#include "ecma-arguments-object.h"
#include "ecma-array-object.h"
#include "ecma-builtins.h"
@@ -22,7 +24,6 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
-#include "ecma-objects-general.h"
#include "ecma-proxy-object.h"
/** \addtogroup ecma ECMA
@@ -89,23 +90,19 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */
ecma_string_t *property_name_p, /**< property name */
bool is_throw) /**< flag that controls failure handling */
{
- JERRY_ASSERT (obj_p != NULL
- && !ecma_is_lexical_environment (obj_p));
+ JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));
JERRY_ASSERT (property_name_p != NULL);
/* 1. */
ecma_property_ref_t property_ref;
- ecma_property_t property = ecma_op_object_get_own_property (obj_p,
- property_name_p,
- &property_ref,
- ECMA_PROPERTY_GET_NO_OPTIONS);
+ ecma_property_t property =
+ ecma_op_object_get_own_property (obj_p, property_name_p, &property_ref, ECMA_PROPERTY_GET_NO_OPTIONS);
/* 2. */
if (!ECMA_PROPERTY_IS_FOUND (property))
{
- JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND
- || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);
+ JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);
return ECMA_VALUE_TRUE;
}
@@ -124,8 +121,7 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */
ecma_object_type_t type = ecma_get_object_type (obj_p);
- if (type == ECMA_OBJECT_TYPE_ARRAY
- && ecma_array_object_delete_property (obj_p, property_name_p))
+ if (type == ECMA_OBJECT_TYPE_ARRAY && ecma_array_object_delete_property (obj_p, property_name_p))
{
return ECMA_VALUE_TRUE;
}
@@ -196,8 +192,7 @@ ecma_op_general_object_delete (ecma_object_t *obj_p, /**< the object */
/**
* Property invocation order during [[DefaultValue]] operation with string hint
*/
-static const lit_magic_string_id_t to_primitive_string_hint_method_names[2] =
-{
+static const lit_magic_string_id_t to_primitive_string_hint_method_names[2] = {
LIT_MAGIC_STRING_TO_STRING_UL, /**< toString operation */
LIT_MAGIC_STRING_VALUE_OF_UL, /**< valueOf operation */
};
@@ -205,8 +200,7 @@ static const lit_magic_string_id_t to_primitive_string_hint_method_names[2] =
/**
* Property invocation order during [[DefaultValue]] operation with non string hint
*/
-static const lit_magic_string_id_t to_primitive_non_string_hint_method_names[2] =
-{
+static const lit_magic_string_id_t to_primitive_non_string_hint_method_names[2] = {
LIT_MAGIC_STRING_VALUE_OF_UL, /**< valueOf operation */
LIT_MAGIC_STRING_TO_STRING_UL, /**< toString operation */
};
@@ -215,8 +209,7 @@ static const lit_magic_string_id_t to_primitive_non_string_hint_method_names[2]
/**
* Hints for the ecma general object's toPrimitve operation
*/
-static const lit_magic_string_id_t hints[3] =
-{
+static const lit_magic_string_id_t hints[3] = {
LIT_MAGIC_STRING_DEFAULT, /**< "default" hint */
LIT_MAGIC_STRING_NUMBER, /**< "number" hint */
LIT_MAGIC_STRING_STRING, /**< "string" hint */
@@ -237,14 +230,12 @@ ecma_value_t
ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
ecma_preferred_type_hint_t hint) /**< hint on preferred result type */
{
- JERRY_ASSERT (obj_p != NULL
- && !ecma_is_lexical_environment (obj_p));
+ JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));
#if JERRY_ESNEXT
ecma_value_t obj_value = ecma_make_object_value (obj_p);
- ecma_value_t exotic_to_prim = ecma_op_get_method_by_symbol_id (obj_value,
- LIT_GLOBAL_SYMBOL_TO_PRIMITIVE);
+ ecma_value_t exotic_to_prim = ecma_op_get_method_by_symbol_id (obj_value, LIT_GLOBAL_SYMBOL_TO_PRIMITIVE);
if (ECMA_IS_VALUE_ERROR (exotic_to_prim))
{
@@ -256,15 +247,11 @@ ecma_op_general_object_default_value (ecma_object_t *obj_p, /**< the object */
ecma_object_t *call_func_p = ecma_get_object_from_value (exotic_to_prim);
ecma_value_t argument = ecma_make_magic_string_value (hints[hint]);
- ecma_value_t result = ecma_op_function_call (call_func_p,
- obj_value,
- &argument,
- 1);
+ ecma_value_t result = ecma_op_function_call (call_func_p, obj_value, &argument, 1);
ecma_free_value (exotic_to_prim);
- if (ECMA_IS_VALUE_ERROR (result)
- || !ecma_is_value_object (result))
+ if (ECMA_IS_VALUE_ERROR (result) || !ecma_is_value_object (result))
{
return result;
}
@@ -310,9 +297,9 @@ ecma_value_t
ecma_op_general_object_ordinary_value (ecma_object_t *obj_p, /**< the object */
ecma_preferred_type_hint_t hint) /**< hint on preferred result type */
{
- const lit_magic_string_id_t *function_name_ids_p = (hint == ECMA_PREFERRED_TYPE_STRING
- ? to_primitive_string_hint_method_names
- : to_primitive_non_string_hint_method_names);
+ const lit_magic_string_id_t *function_name_ids_p =
+ (hint == ECMA_PREFERRED_TYPE_STRING ? to_primitive_string_hint_method_names
+ : to_primitive_non_string_hint_method_names);
for (uint32_t i = 0; i < 2; i++)
{
@@ -329,17 +316,13 @@ ecma_op_general_object_ordinary_value (ecma_object_t *obj_p, /**< the object */
{
ecma_object_t *func_obj_p = ecma_get_object_from_value (function_value);
- call_completion = ecma_op_function_call (func_obj_p,
- ecma_make_object_value (obj_p),
- NULL,
- 0);
+ call_completion = ecma_op_function_call (func_obj_p, ecma_make_object_value (obj_p), NULL, 0);
}
ecma_free_value (function_value);
if (ECMA_IS_VALUE_ERROR (call_completion)
- || (!ecma_is_value_empty (call_completion)
- && !ecma_is_value_object (call_completion)))
+ || (!ecma_is_value_empty (call_completion) && !ecma_is_value_object (call_completion)))
{
return call_completion;
}
@@ -383,8 +366,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
}
#endif /* JERRY_BUILTIN_PROXY */
- JERRY_ASSERT (object_p != NULL
- && !ecma_is_lexical_environment (object_p));
+ JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));
JERRY_ASSERT (!ecma_op_object_is_fast_array (object_p));
JERRY_ASSERT (property_name_p != NULL);
@@ -394,7 +376,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
{
/* A property descriptor cannot be both named data and named accessor. */
JERRY_ASSERT ((property_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))
- != (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED));
+ != (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED));
property_desc_type = ECMA_OP_OBJECT_DEFINE_DATA;
}
else if (property_desc_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))
@@ -444,10 +426,8 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
JERRY_ASSERT (property_desc_type == ECMA_OP_OBJECT_DEFINE_GENERIC
|| property_desc_type == ECMA_OP_OBJECT_DEFINE_DATA);
- ecma_property_value_t *new_prop_value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- prop_attributes,
- NULL);
+ ecma_property_value_t *new_prop_value_p =
+ ecma_create_named_data_property (object_p, property_name_p, prop_attributes, NULL);
JERRY_ASSERT ((property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)
|| ecma_is_value_undefined (property_desc_p->value));
@@ -513,11 +493,9 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
ecma_value_t result = ECMA_VALUE_TRUE;
- if (property_desc_type == ECMA_OP_OBJECT_DEFINE_ACCESSOR
- || writable_check_failed
+ if (property_desc_type == ECMA_OP_OBJECT_DEFINE_ACCESSOR || writable_check_failed
|| ((property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)
- && !ecma_op_same_value (property_desc_p->value,
- ext_property_ref.property_ref.virtual_value)))
+ && !ecma_op_same_value (property_desc_p->value, ext_property_ref.property_ref.virtual_value)))
{
result = ecma_raise_property_redefinition (property_name_p, property_desc_p->flags);
}
@@ -542,8 +520,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
if (!ecma_is_property_writable (current_prop)
&& ((property_desc_p->flags & JERRY_PROP_IS_WRITABLE)
|| ((property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)
- && !ecma_op_same_value (property_desc_p->value,
- ext_property_ref.property_ref.value_p->value))))
+ && !ecma_op_same_value (property_desc_p->value, ext_property_ref.property_ref.value_p->value))))
{
return ecma_raise_property_redefinition (property_name_p, property_desc_p->flags);
}
@@ -560,8 +537,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
ECMA_SET_POINTER (prop_desc_getter_cp, property_desc_p->get_p);
ECMA_SET_POINTER (prop_desc_setter_cp, property_desc_p->set_p);
- if (((property_desc_p->flags & JERRY_PROP_IS_GET_DEFINED)
- && prop_desc_getter_cp != get_set_pair_p->getter_cp)
+ if (((property_desc_p->flags & JERRY_PROP_IS_GET_DEFINED) && prop_desc_getter_cp != get_set_pair_p->getter_cp)
|| ((property_desc_p->flags & JERRY_PROP_IS_SET_DEFINED)
&& prop_desc_setter_cp != get_set_pair_p->setter_cp))
{
@@ -603,8 +579,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
JERRY_ASSERT (!(current_prop & ECMA_PROPERTY_FLAG_DATA));
#if JERRY_CPOINTER_32_BIT
ecma_getter_setter_pointers_t *getter_setter_pair_p;
- getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t,
- value_p->getter_setter_pair_cp);
+ getter_setter_pair_p = ECMA_GET_NON_NULL_POINTER (ecma_getter_setter_pointers_t, value_p->getter_setter_pair_cp);
jmem_pools_free (getter_setter_pair_p, sizeof (ecma_getter_setter_pointers_t));
#endif /* JERRY_CPOINTER_32_BIT */
value_p->value = ECMA_VALUE_UNDEFINED;
@@ -624,9 +599,7 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
if (property_desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)
{
- ecma_named_data_property_assign_value (object_p,
- ext_property_ref.property_ref.value_p,
- property_desc_p->value);
+ ecma_named_data_property_assign_value (object_p, ext_property_ref.property_ref.value_p, property_desc_p->value);
}
if (property_desc_p->flags & JERRY_PROP_IS_WRITABLE_DEFINED)
@@ -640,16 +613,12 @@ ecma_op_general_object_define_own_property (ecma_object_t *object_p, /**< the ob
if (property_desc_p->flags & JERRY_PROP_IS_GET_DEFINED)
{
- ecma_set_named_accessor_property_getter (object_p,
- ext_property_ref.property_ref.value_p,
- property_desc_p->get_p);
+ ecma_set_named_accessor_property_getter (object_p, ext_property_ref.property_ref.value_p, property_desc_p->get_p);
}
if (property_desc_p->flags & JERRY_PROP_IS_SET_DEFINED)
{
- ecma_set_named_accessor_property_setter (object_p,
- ext_property_ref.property_ref.value_p,
- property_desc_p->set_p);
+ ecma_set_named_accessor_property_setter (object_p, ext_property_ref.property_ref.value_p, property_desc_p->set_p);
}
}
@@ -700,14 +669,12 @@ ecma_op_is_compatible_property_descriptor (const ecma_property_descriptor_t *des
/* 4. */
if ((current_p->flags & desc_p->flags) == desc_p->flags)
{
- if ((current_p->flags & JERRY_PROP_IS_VALUE_DEFINED)
- && ecma_op_same_value (current_p->value, desc_p->value))
+ if ((current_p->flags & JERRY_PROP_IS_VALUE_DEFINED) && ecma_op_same_value (current_p->value, desc_p->value))
{
return true;
}
- if ((current_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED)
- && current_p->get_p == desc_p->get_p
+ if ((current_p->flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED) && current_p->get_p == desc_p->get_p
&& current_p->set_p == desc_p->set_p))
{
return true;
@@ -752,15 +719,13 @@ ecma_op_is_compatible_property_descriptor (const ecma_property_descriptor_t *des
{
if (!(current_p->flags & JERRY_PROP_IS_CONFIGURABLE))
{
- if (!(current_p->flags & JERRY_PROP_IS_WRITABLE)
- && (desc_p->flags & JERRY_PROP_IS_WRITABLE))
+ if (!(current_p->flags & JERRY_PROP_IS_WRITABLE) && (desc_p->flags & JERRY_PROP_IS_WRITABLE))
{
return false;
}
- if (!(current_p->flags & JERRY_PROP_IS_WRITABLE)
- && (desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)
- && !ecma_op_same_value (desc_p->value, current_p->value))
+ if (!(current_p->flags & JERRY_PROP_IS_WRITABLE) && (desc_p->flags & JERRY_PROP_IS_VALUE_DEFINED)
+ && !ecma_op_same_value (desc_p->value, current_p->value))
{
return false;
}
@@ -775,14 +740,12 @@ ecma_op_is_compatible_property_descriptor (const ecma_property_descriptor_t *des
/* 9. */
if (!(current_p->flags & JERRY_PROP_IS_CONFIGURABLE))
{
- if ((desc_p->flags & JERRY_PROP_IS_SET_DEFINED)
- && desc_p->set_p != current_p->set_p)
+ if ((desc_p->flags & JERRY_PROP_IS_SET_DEFINED) && desc_p->set_p != current_p->set_p)
{
return false;
}
- if ((desc_p->flags & JERRY_PROP_IS_GET_DEFINED)
- && desc_p->get_p != current_p->get_p)
+ if ((desc_p->flags & JERRY_PROP_IS_GET_DEFINED) && desc_p->get_p != current_p->get_p)
{
return false;
}
diff --git a/jerry-core/ecma/operations/ecma-objects-general.h b/jerry-core/ecma/operations/ecma-objects-general.h
index 783b576b..aea9959d 100644
--- a/jerry-core/ecma/operations/ecma-objects-general.h
+++ b/jerry-core/ecma/operations/ecma-objects-general.h
@@ -32,7 +32,8 @@ ecma_object_t *ecma_op_create_object_object_noarg_and_set_prototype (ecma_object
ecma_value_t ecma_op_general_object_delete (ecma_object_t *obj_p, ecma_string_t *property_name_p, bool is_throw);
ecma_value_t ecma_op_general_object_default_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint);
ecma_value_t ecma_op_general_object_ordinary_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint);
-ecma_value_t ecma_op_general_object_define_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p,
+ecma_value_t ecma_op_general_object_define_own_property (ecma_object_t *object_p,
+ ecma_string_t *property_name_p,
const ecma_property_descriptor_t *property_desc_p);
#if JERRY_ESNEXT
diff --git a/jerry-core/ecma/operations/ecma-objects.c b/jerry-core/ecma/operations/ecma-objects.c
index c096d1b1..730ddbe8 100644
--- a/jerry-core/ecma/operations/ecma-objects.c
+++ b/jerry-core/ecma/operations/ecma-objects.c
@@ -13,27 +13,29 @@
* limitations under the License.
*/
+#include "ecma-objects.h"
+
+#include "ecma-arguments-object.h"
#include "ecma-array-object.h"
-#include "ecma-builtins.h"
+#include "ecma-bigint.h"
#include "ecma-builtin-helpers.h"
+#include "ecma-builtins.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-function-object.h"
-#include "ecma-lex-env.h"
#include "ecma-lcache.h"
-#include "ecma-string-object.h"
-#include "ecma-arguments-object.h"
+#include "ecma-lex-env.h"
#include "ecma-objects-general.h"
-#include "ecma-objects.h"
#include "ecma-proxy-object.h"
-#include "ecma-bigint.h"
+#include "ecma-string-object.h"
+
#include "jcontext.h"
#if JERRY_BUILTIN_TYPEDARRAY
-#include "ecma-typedarray-object.h"
#include "ecma-arraybuffer-object.h"
+#include "ecma-typedarray-object.h"
#endif /* JERRY_BUILTIN_TYPEDARRAY */
/** \addtogroup ecma ECMA
@@ -54,8 +56,7 @@
* @param type object's implementation-defined type
*/
#ifndef JERRY_NDEBUG
-#define JERRY_ASSERT_OBJECT_TYPE_IS_VALID(type) \
- JERRY_ASSERT (type < ECMA_OBJECT_TYPE__MAX);
+#define JERRY_ASSERT_OBJECT_TYPE_IS_VALID(type) JERRY_ASSERT (type < ECMA_OBJECT_TYPE__MAX);
#else /* JERRY_NDEBUG */
#define JERRY_ASSERT_OBJECT_TYPE_IS_VALID(type)
#endif /* !JERRY_NDEBUG */
@@ -75,14 +76,12 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
ecma_property_ref_t *property_ref_p, /**< property reference */
uint32_t options) /**< option bits */
{
- JERRY_ASSERT (object_p != NULL
- && !ecma_is_lexical_environment (object_p));
+ JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));
#if JERRY_BUILTIN_PROXY
JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));
#endif /* JERRY_BUILTIN_PROXY */
JERRY_ASSERT (property_name_p != NULL);
- JERRY_ASSERT (options == ECMA_PROPERTY_GET_NO_OPTIONS
- || property_ref_p != NULL);
+ JERRY_ASSERT (options == ECMA_PROPERTY_GET_NO_OPTIONS || property_ref_p != NULL);
ecma_object_base_type_t base_type = ecma_get_object_base_type (object_p);
@@ -407,9 +406,7 @@ ecma_op_object_get_own_property (ecma_object_t *object_p, /**< the object */
ecma_value_t binding_value = ecma_op_get_binding_value (lex_env_p, name_p, true);
- ecma_named_data_property_assign_value (object_p,
- ECMA_PROPERTY_VALUE_PTR (property_p),
- binding_value);
+ ecma_named_data_property_assign_value (object_p, ECMA_PROPERTY_VALUE_PTR (property_p), binding_value);
ecma_free_value (binding_value);
}
}
@@ -451,10 +448,8 @@ ecma_op_object_has_property (ecma_object_t *object_p, /**< the object */
#endif /* JERRY_BUILTIN_PROXY */
/* 2 - 3. */
- ecma_property_t property = ecma_op_object_get_own_property (object_p,
- property_name_p,
- NULL,
- ECMA_PROPERTY_GET_NO_OPTIONS);
+ ecma_property_t property =
+ ecma_op_object_get_own_property (object_p, property_name_p, NULL, ECMA_PROPERTY_GET_NO_OPTIONS);
if (property != ECMA_PROPERTY_TYPE_NOT_FOUND)
{
@@ -465,8 +460,7 @@ ecma_op_object_has_property (ecma_object_t *object_p, /**< the object */
}
#endif /* JERRY_BUILTIN_TYPEDARRAY */
- JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP
- || ECMA_PROPERTY_IS_FOUND (property));
+ JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP || ECMA_PROPERTY_IS_FOUND (property));
return ecma_make_boolean_value (property != ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);
}
@@ -497,8 +491,7 @@ ecma_op_object_find_own (ecma_value_t base_value, /**< base value */
ecma_object_t *object_p, /**< target object */
ecma_string_t *property_name_p) /**< property name */
{
- JERRY_ASSERT (object_p != NULL
- && !ecma_is_lexical_environment (object_p));
+ JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));
JERRY_ASSERT (property_name_p != NULL);
JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));
@@ -978,20 +971,11 @@ ecma_op_object_get_by_magic_id (ecma_object_t *object_p, /**< the object */
/**
* Descriptor string for each global symbol
*/
-static const uint16_t ecma_global_symbol_descriptions[] =
-{
- LIT_MAGIC_STRING_ASYNC_ITERATOR,
- LIT_MAGIC_STRING_HAS_INSTANCE,
- LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE,
- LIT_MAGIC_STRING_ITERATOR,
- LIT_MAGIC_STRING_MATCH,
- LIT_MAGIC_STRING_REPLACE,
- LIT_MAGIC_STRING_SEARCH,
- LIT_MAGIC_STRING_SPECIES,
- LIT_MAGIC_STRING_SPLIT,
- LIT_MAGIC_STRING_TO_PRIMITIVE,
- LIT_MAGIC_STRING_TO_STRING_TAG,
- LIT_MAGIC_STRING_UNSCOPABLES,
+static const uint16_t ecma_global_symbol_descriptions[] = {
+ LIT_MAGIC_STRING_ASYNC_ITERATOR, LIT_MAGIC_STRING_HAS_INSTANCE, LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE,
+ LIT_MAGIC_STRING_ITERATOR, LIT_MAGIC_STRING_MATCH, LIT_MAGIC_STRING_REPLACE,
+ LIT_MAGIC_STRING_SEARCH, LIT_MAGIC_STRING_SPECIES, LIT_MAGIC_STRING_SPLIT,
+ LIT_MAGIC_STRING_TO_PRIMITIVE, LIT_MAGIC_STRING_TO_STRING_TAG, LIT_MAGIC_STRING_UNSCOPABLES,
LIT_MAGIC_STRING_MATCH_ALL,
};
@@ -1047,8 +1031,7 @@ ecma_op_compare_string_to_global_symbol (ecma_string_t *string_p, /**< string to
uint32_t symbol_index = (uint32_t) property_id - (uint32_t) LIT_GLOBAL_SYMBOL__FIRST;
jmem_cpointer_t symbol_cp = JERRY_CONTEXT (global_symbols_cp)[symbol_index];
- return (symbol_cp != JMEM_CP_NULL
- && string_p == ECMA_GET_NON_NULL_POINTER (ecma_string_t, symbol_cp));
+ return (symbol_cp != JMEM_CP_NULL && string_p == ECMA_GET_NON_NULL_POINTER (ecma_string_t, symbol_cp));
} /* ecma_op_compare_string_to_global_symbol */
/**
@@ -1177,10 +1160,7 @@ ecma_op_object_put_by_index (ecma_object_t *object_p, /**< the object */
{
if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))
{
- return ecma_op_object_put (object_p,
- ECMA_CREATE_DIRECT_UINT32_STRING (index),
- value,
- is_throw);
+ return ecma_op_object_put (object_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), value, is_throw);
}
ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);
@@ -1246,9 +1226,7 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
ecma_property_descriptor_t prop_desc;
/* 5.c */
- ecma_value_t status = ecma_op_object_get_own_property_descriptor (receiver_obj_p,
- property_name_p,
- &prop_desc);
+ ecma_value_t status = ecma_op_object_get_own_property_descriptor (receiver_obj_p, property_name_p, &prop_desc);
/* 5.d */
if (ECMA_IS_VALUE_ERROR (status))
@@ -1293,12 +1271,8 @@ ecma_op_object_put_apply_receiver (ecma_value_t receiver, /**< receiver */
{
ecma_property_descriptor_t desc;
/* Based on: ES6 9.1.9 [[Set]] 4.d.i. / ES11 9.1.9.2 OrdinarySetWithOwnDescriptor 2.c.i. */
- desc.flags = (JERRY_PROP_IS_CONFIGURABLE
- | JERRY_PROP_IS_CONFIGURABLE_DEFINED
- | JERRY_PROP_IS_ENUMERABLE
- | JERRY_PROP_IS_ENUMERABLE_DEFINED
- | JERRY_PROP_IS_WRITABLE
- | JERRY_PROP_IS_WRITABLE_DEFINED
+ desc.flags = (JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE
+ | JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_WRITABLE_DEFINED
| JERRY_PROP_IS_VALUE_DEFINED);
desc.value = value;
ecma_value_t ret_value = ecma_proxy_object_define_own_property (receiver_obj_p, property_name_p, &desc);
@@ -1356,8 +1330,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
ecma_value_t receiver, /**< receiver */
bool is_throw) /**< flag that controls failure handling */
{
- JERRY_ASSERT (object_p != NULL
- && !ecma_is_lexical_environment (object_p));
+ JERRY_ASSERT (object_p != NULL && !ecma_is_lexical_environment (object_p));
JERRY_ASSERT (property_name_p != NULL);
#if JERRY_BUILTIN_PROXY
@@ -1578,9 +1551,7 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
/* There is no need for special casing arrays here because changing the
* value of an existing property never changes the length of an array. */
- ecma_named_data_property_assign_value (object_p,
- ECMA_PROPERTY_VALUE_PTR (property_p),
- value);
+ ecma_named_data_property_assign_value (object_p, ECMA_PROPERTY_VALUE_PTR (property_p), value);
return ECMA_VALUE_TRUE;
}
}
@@ -1614,18 +1585,12 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
#if JERRY_BUILTIN_PROXY
if (ECMA_OBJECT_IS_PROXY (proto_p))
{
- return ecma_op_object_put_with_receiver (proto_p,
- property_name_p,
- value,
- receiver,
- is_throw);
+ return ecma_op_object_put_with_receiver (proto_p, property_name_p, value, receiver, is_throw);
}
#endif /* JERRY_BUILTIN_PROXY */
- ecma_property_t inherited_property = ecma_op_object_get_own_property (proto_p,
- property_name_p,
- &property_ref,
- ECMA_PROPERTY_GET_NO_OPTIONS);
+ ecma_property_t inherited_property =
+ ecma_op_object_get_own_property (proto_p, property_name_p, &property_ref, ECMA_PROPERTY_GET_NO_OPTIONS);
if (ECMA_PROPERTY_IS_FOUND (inherited_property))
{
@@ -1647,16 +1612,14 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
}
#if JERRY_BUILTIN_PROXY
- if (create_new_property
- && ecma_is_value_object (receiver)
+ if (create_new_property && ecma_is_value_object (receiver)
&& ECMA_OBJECT_IS_PROXY (ecma_get_object_from_value (receiver)))
{
return ecma_op_object_put_apply_receiver (receiver, property_name_p, value, is_throw);
}
#endif /* JERRY_BUILTIN_PROXY */
- if (create_new_property
- && ecma_op_ordinary_object_is_extensible (object_p))
+ if (create_new_property && ecma_op_ordinary_object_is_extensible (object_p))
{
const ecma_object_base_type_t obj_base_type = ecma_get_object_base_type (object_p);
@@ -1674,13 +1637,11 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
uint32_t index = ecma_string_get_array_index (property_name_p);
- if (obj_base_type == ECMA_OBJECT_BASE_TYPE_ARRAY
- && index != ECMA_STRING_NOT_ARRAY_INDEX)
+ if (obj_base_type == ECMA_OBJECT_BASE_TYPE_ARRAY && index != ECMA_STRING_NOT_ARRAY_INDEX)
{
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
- if (index < UINT32_MAX
- && index >= ext_object_p->u.array.length)
+ if (index < UINT32_MAX && index >= ext_object_p->u.array.length)
{
if (!ecma_is_property_writable ((ecma_property_t) ext_object_p->u.array.length_prop_and_hole_count))
{
@@ -1712,10 +1673,8 @@ ecma_op_object_put_with_receiver (ecma_object_t *object_p, /**< the object */
return ecma_raise_readonly_assignment (property_name_p, is_throw);
}
- ecma_value_t ret_value = ecma_op_function_call (ECMA_GET_NON_NULL_POINTER (ecma_object_t, setter_cp),
- receiver,
- &value,
- 1);
+ ecma_value_t ret_value =
+ ecma_op_function_call (ECMA_GET_NON_NULL_POINTER (ecma_object_t, setter_cp), receiver, &value, 1);
if (!ECMA_IS_VALUE_ERROR (ret_value))
{
@@ -1742,7 +1701,8 @@ ecma_op_object_delete_by_index (ecma_object_t *obj_p, /**< the object */
{
if (JERRY_LIKELY (index <= ECMA_DIRECT_STRING_MAX_IMM))
{
- return ecma_op_object_delete (obj_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), is_throw);;
+ return ecma_op_object_delete (obj_p, ECMA_CREATE_DIRECT_UINT32_STRING (index), is_throw);
+ ;
}
ecma_string_t *index_str_p = ecma_new_ecma_string_from_length (index);
@@ -1769,8 +1729,7 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */
ecma_string_t *property_name_p, /**< property name */
bool is_strict) /**< flag that controls failure handling */
{
- JERRY_ASSERT (obj_p != NULL
- && !ecma_is_lexical_environment (obj_p));
+ JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));
JERRY_ASSERT (property_name_p != NULL);
#if JERRY_BUILTIN_PROXY
@@ -1782,9 +1741,7 @@ ecma_op_object_delete (ecma_object_t *obj_p, /**< the object */
JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p));
- return ecma_op_general_object_delete (obj_p,
- property_name_p,
- is_strict);
+ return ecma_op_general_object_delete (obj_p, property_name_p, is_strict);
} /* ecma_op_object_delete */
/**
@@ -1800,8 +1757,7 @@ ecma_value_t
ecma_op_object_default_value (ecma_object_t *obj_p, /**< the object */
ecma_preferred_type_hint_t hint) /**< hint on preferred result type */
{
- JERRY_ASSERT (obj_p != NULL
- && !ecma_is_lexical_environment (obj_p));
+ JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));
JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p));
@@ -1839,8 +1795,7 @@ ecma_op_object_define_own_property (ecma_object_t *obj_p, /**< the object */
const ecma_property_descriptor_t *property_desc_p) /**< property
* descriptor */
{
- JERRY_ASSERT (obj_p != NULL
- && !ecma_is_lexical_environment (obj_p));
+ JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));
JERRY_ASSERT (property_name_p != NULL);
const ecma_object_type_t type = ecma_get_object_type (obj_p);
@@ -1918,10 +1873,8 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
ecma_property_ref_t property_ref;
property_ref.virtual_value = ECMA_VALUE_EMPTY;
- ecma_property_t property = ecma_op_object_get_own_property (object_p,
- property_name_p,
- &property_ref,
- ECMA_PROPERTY_GET_VALUE);
+ ecma_property_t property =
+ ecma_op_object_get_own_property (object_p, property_name_p, &property_ref, ECMA_PROPERTY_GET_VALUE);
if (!ECMA_PROPERTY_IS_FOUND (property))
{
@@ -1932,14 +1885,13 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
}
#endif /* JERRY_BUILTIN_TYPEDARRAY */
- JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND
- || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);
+ JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND || property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);
return ECMA_VALUE_FALSE;
}
uint32_t flags = ecma_is_property_enumerable (property) ? JERRY_PROP_IS_ENUMERABLE : JERRY_PROP_NO_OPTS;
- flags |= ecma_is_property_configurable (property) ? JERRY_PROP_IS_CONFIGURABLE: JERRY_PROP_NO_OPTS;
+ flags |= ecma_is_property_configurable (property) ? JERRY_PROP_IS_CONFIGURABLE : JERRY_PROP_NO_OPTS;
prop_desc_p->flags = (uint16_t) (JERRY_PROP_IS_ENUMERABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE_DEFINED | flags);
@@ -1961,8 +1913,8 @@ ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, /**< the ob
}
prop_desc_p->flags |= (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED);
- prop_desc_p->flags = (uint16_t) (prop_desc_p->flags | (ecma_is_property_writable (property) ? JERRY_PROP_IS_WRITABLE
- : JERRY_PROP_NO_OPTS));
+ prop_desc_p->flags = (uint16_t) (
+ prop_desc_p->flags | (ecma_is_property_writable (property) ? JERRY_PROP_IS_WRITABLE : JERRY_PROP_NO_OPTS));
}
else
{
@@ -2029,8 +1981,7 @@ ecma_value_t
ecma_op_object_has_instance (ecma_object_t *obj_p, /**< the object */
ecma_value_t value) /**< argument 'V' */
{
- JERRY_ASSERT (obj_p != NULL
- && !ecma_is_lexical_environment (obj_p));
+ JERRY_ASSERT (obj_p != NULL && !ecma_is_lexical_environment (obj_p));
JERRY_ASSERT_OBJECT_TYPE_IS_VALID (ecma_get_object_type (obj_p));
@@ -2128,8 +2079,7 @@ ecma_op_object_is_prototype_of (ecma_object_t *base_p, /**< base object */
/* Advance up on prototype chain. */
target_p = proto_p;
- }
- while (true);
+ } while (true);
} /* ecma_op_object_is_prototype_of */
/**
@@ -2219,10 +2169,7 @@ ecma_op_object_get_enumerable_property_names (ecma_object_t *obj_p, /**< routine
0,
names_buffer_p[i],
ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
- ecma_builtin_helper_def_prop_by_index (entry_p,
- 1,
- value,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
+ ecma_builtin_helper_def_prop_by_index (entry_p, 1, value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
ecma_free_value (value);
/* 4.a.ii.2.c.iii */
@@ -2405,7 +2352,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
}
ecma_collection_t *prop_names_p = ecma_new_collection ();
- ecma_property_counter_t prop_counter = {0, 0, 0};
+ ecma_property_counter_t prop_counter = { 0, 0, 0 };
ecma_object_list_lazy_property_names (obj_p, prop_names_p, &prop_counter, filter);
@@ -2440,8 +2387,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
{
ecma_property_t *property_p = prop_iter_p->types + i;
- if (!ECMA_PROPERTY_IS_RAW (*property_p)
- || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN))
+ if (!ECMA_PROPERTY_IS_RAW (*property_p) || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN))
{
continue;
}
@@ -2455,8 +2401,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
continue;
}
- ecma_string_t *name_p = ecma_string_from_property_name (*property_p,
- prop_pair_p->names_cp[i]);
+ ecma_string_t *name_p = ecma_string_from_property_name (*property_p, prop_pair_p->names_cp[i]);
if (ecma_string_get_array_index (name_p) != ECMA_STRING_NOT_ARRAY_INDEX)
{
@@ -2518,8 +2463,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
#if JERRY_ESNEXT
ecma_value_t *symbol_current_p = string_current_p + symbol_named_props + prop_counter.symbol_named_props;
- if (prop_counter.symbol_named_props > 0
- && (array_index_named_props + string_named_props) > 0)
+ if (prop_counter.symbol_named_props > 0 && (array_index_named_props + string_named_props) > 0)
{
memmove ((void *) string_current_p,
(void *) (buffer_p + prop_counter.array_index_named_props + prop_counter.string_named_props),
@@ -2527,8 +2471,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
}
#endif /* JERRY_ESNEXT */
- if (prop_counter.string_named_props > 0
- && array_index_named_props > 0)
+ if (prop_counter.string_named_props > 0 && array_index_named_props > 0)
{
memmove ((void *) array_index_current_p,
(void *) (buffer_p + prop_counter.array_index_named_props),
@@ -2544,8 +2487,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
{
ecma_property_t *property_p = prop_iter_p->types + i;
- if (!ECMA_PROPERTY_IS_RAW (*property_p)
- || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN))
+ if (!ECMA_PROPERTY_IS_RAW (*property_p) || (*property_p & ECMA_PROPERTY_FLAG_BUILT_IN))
{
continue;
}
@@ -2559,8 +2501,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
continue;
}
- ecma_string_t *name_p = ecma_string_from_property_name (*property_p,
- prop_pair_p->names_cp[i]);
+ ecma_string_t *name_p = ecma_string_from_property_name (*property_p, prop_pair_p->names_cp[i]);
if (ecma_string_get_array_index (name_p) != ECMA_STRING_NOT_ARRAY_INDEX)
{
@@ -2595,8 +2536,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
prop_iter_cp = prop_iter_p->next_property_cp;
}
- if (array_index_named_props > 1
- || (array_index_named_props == 1 && prop_counter.array_index_named_props > 0))
+ if (array_index_named_props > 1 || (array_index_named_props == 1 && prop_counter.array_index_named_props > 0))
{
uint32_t prev_value = 0;
ecma_value_t *array_index_p = buffer_p + prop_counter.array_index_named_props;
@@ -2619,8 +2559,7 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
do
{
ecma_op_object_heap_sort_shift_down (buffer_p, array_props, i);
- }
- while (i-- > 0);
+ } while (i-- > 0);
i = array_props - 1;
@@ -2631,15 +2570,13 @@ ecma_op_object_own_property_keys (ecma_object_t *obj_p, /**< object */
buffer_p[0] = tmp;
ecma_op_object_heap_sort_shift_down (buffer_p, i, 0);
- }
- while (--i > 0);
+ } while (--i > 0);
break;
}
prev_value = value;
- }
- while (array_index_p < array_index_end_p);
+ } while (array_index_p < array_index_end_p);
}
return prop_names_p;
@@ -2774,8 +2711,7 @@ ecma_builtin_is (ecma_object_t *object_p, /**< pointer to an object */
{
ecma_extended_object_t *built_in_object_p = (ecma_extended_object_t *) object_p;
- return (built_in_object_p->u.built_in.id == builtin_id
- && built_in_object_p->u.built_in.routine_id == 0);
+ return (built_in_object_p->u.built_in.id == builtin_id && built_in_object_p->u.built_in.routine_id == 0);
}
case ECMA_OBJECT_TYPE_BUILT_IN_CLASS:
case ECMA_OBJECT_TYPE_BUILT_IN_ARRAY:
@@ -2874,8 +2810,7 @@ ecma_object_check_class_name_is_object (ecma_object_t *obj_p) /**< object */
/**
* Used by ecma_object_get_class_name to get the magic string id of class objects
*/
-static const uint16_t ecma_class_object_magic_string_id[] =
-{
+static const uint16_t ecma_class_object_magic_string_id[] = {
/* These objects require custom property resolving. */
LIT_MAGIC_STRING_STRING_UL, /**< magic string id of ECMA_OBJECT_CLASS_STRING */
LIT_MAGIC_STRING_ARGUMENTS_UL, /**< magic string id of ECMA_OBJECT_CLASS_ARGUMENTS */
@@ -2884,9 +2819,9 @@ static const uint16_t ecma_class_object_magic_string_id[] =
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_MODULE_SYSTEM
LIT_MAGIC_STRING_MODULE_UL, /**< magic string id of ECMA_OBJECT_CLASS_MODULE_NAMESPACE */
-#endif
+#endif /* JERRY_MODULE_SYSTEM */
- /* These objects are marked by Garbage Collector. */
+/* These objects are marked by Garbage Collector. */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_GENERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_GENERATOR */
LIT_MAGIC_STRING_ASYNC_GENERATOR_UL, /**< magic string id of ECMA_OBJECT_CLASS_ASYNC_GENERATOR */
@@ -2899,7 +2834,7 @@ static const uint16_t ecma_class_object_magic_string_id[] =
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
LIT_MAGIC_STRING_MODULE_UL, /**< magic string id of ECMA_OBJECT_CLASS_MODULE */
-#endif
+#endif /* JERRY_MODULE_SYSTEM */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_PROMISE_UL, /**< magic string id of ECMA_OBJECT_CLASS_PROMISE */
LIT_MAGIC_STRING_OBJECT_UL, /**< magic string id of ECMA_OBJECT_CLASS_PROMISE_CAPABILITY */
@@ -3073,8 +3008,7 @@ ecma_object_get_class_name (ecma_object_t *obj_p) /**< object */
}
default:
{
- JERRY_ASSERT (type == ECMA_OBJECT_TYPE_GENERAL
- || type == ECMA_OBJECT_TYPE_PROXY);
+ JERRY_ASSERT (type == ECMA_OBJECT_TYPE_GENERAL || type == ECMA_OBJECT_TYPE_PROXY);
return LIT_MAGIC_STRING_OBJECT_UL;
}
@@ -3116,8 +3050,8 @@ ecma_op_is_concat_spreadable (ecma_value_t arg) /**< argument */
return ECMA_VALUE_FALSE;
}
- ecma_value_t spreadable = ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg),
- LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE);
+ ecma_value_t spreadable =
+ ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg), LIT_GLOBAL_SYMBOL_IS_CONCAT_SPREADABLE);
if (ECMA_IS_VALUE_ERROR (spreadable))
{
@@ -3152,8 +3086,7 @@ ecma_op_is_regexp (ecma_value_t arg) /**< argument */
return ECMA_VALUE_FALSE;
}
- ecma_value_t is_regexp = ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg),
- LIT_GLOBAL_SYMBOL_MATCH);
+ ecma_value_t is_regexp = ecma_op_object_get_by_symbol_id (ecma_get_object_from_value (arg), LIT_GLOBAL_SYMBOL_MATCH);
if (ECMA_IS_VALUE_ERROR (is_regexp))
{
@@ -3452,10 +3385,8 @@ ecma_op_ordinary_object_has_own_property (ecma_object_t *object_p, /**< the obje
{
JERRY_ASSERT (!ECMA_OBJECT_IS_PROXY (object_p));
- ecma_property_t property = ecma_op_object_get_own_property (object_p,
- property_name_p,
- NULL,
- ECMA_PROPERTY_GET_NO_OPTIONS);
+ ecma_property_t property =
+ ecma_op_object_get_own_property (object_p, property_name_p, NULL, ECMA_PROPERTY_GET_NO_OPTIONS);
#if JERRY_BUILTIN_TYPEDARRAY
if (JERRY_UNLIKELY (property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_THROW))
@@ -3464,8 +3395,7 @@ ecma_op_ordinary_object_has_own_property (ecma_object_t *object_p, /**< the obje
}
#endif /* JERRY_BUILTIN_TYPEDARRAY */
- JERRY_ASSERT (ECMA_PROPERTY_IS_FOUND (property)
- || property == ECMA_PROPERTY_TYPE_NOT_FOUND
+ JERRY_ASSERT (ECMA_PROPERTY_IS_FOUND (property) || property == ECMA_PROPERTY_TYPE_NOT_FOUND
|| property == ECMA_PROPERTY_TYPE_NOT_FOUND_AND_STOP);
return ecma_make_boolean_value (ECMA_PROPERTY_IS_FOUND (property));
@@ -3530,8 +3460,8 @@ ecma_op_object_unref_weak (ecma_object_t *object_p, /**< this argument */
ecma_property_t *property_p = ecma_find_named_property (object_p, weak_refs_string_p);
JERRY_ASSERT (property_p != NULL);
- ecma_collection_t *refs_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- ECMA_PROPERTY_VALUE_PTR (property_p)->value);
+ ecma_collection_t *refs_p =
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, ECMA_PROPERTY_VALUE_PTR (property_p)->value);
ecma_value_t *buffer_p = refs_p->buffer_p;
while (true)
diff --git a/jerry-core/ecma/operations/ecma-objects.h b/jerry-core/ecma/operations/ecma-objects.h
index 3044cde1..c4382cb2 100644
--- a/jerry-core/ecma/operations/ecma-objects.h
+++ b/jerry-core/ecma/operations/ecma-objects.h
@@ -37,35 +37,34 @@
/**
* Reject with TypeError depending on 'is_throw' with the given message
*/
-#define ECMA_REJECT(is_throw, msg) \
- ((is_throw) ? ecma_raise_type_error (msg) : ECMA_VALUE_FALSE)
+#define ECMA_REJECT(is_throw, msg) ((is_throw) ? ecma_raise_type_error (msg) : ECMA_VALUE_FALSE)
#else /* !JERRY_ERROR_MESSAGES */
/**
* Reject with TypeError depending on is_throw flags wit the given format
*/
-#define ECMA_REJECT_WITH_FORMAT(is_throw, msg, ...) \
- ECMA_REJECT((is_throw), (msg))
+#define ECMA_REJECT_WITH_FORMAT(is_throw, msg, ...) ECMA_REJECT ((is_throw), (msg))
/**
* Reject with TypeError depending on is_throw flags wit the given message
*/
-#define ECMA_REJECT(is_throw, msg) \
- ((is_throw) ? ecma_raise_type_error (NULL) : ECMA_VALUE_FALSE)
+#define ECMA_REJECT(is_throw, msg) ((is_throw) ? ecma_raise_type_error (NULL) : ECMA_VALUE_FALSE)
#endif /* JERRY_ERROR_MESSAGES */
ecma_value_t ecma_raise_property_redefinition (ecma_string_t *property_name_p, uint16_t flags);
ecma_value_t ecma_raise_readonly_assignment (ecma_string_t *property_name_p, bool is_throw);
-ecma_property_t ecma_op_object_get_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p,
- ecma_property_ref_t *property_ref_p, uint32_t options);
+ecma_property_t ecma_op_object_get_own_property (ecma_object_t *object_p,
+ ecma_string_t *property_name_p,
+ ecma_property_ref_t *property_ref_p,
+ uint32_t options);
ecma_value_t ecma_op_ordinary_object_has_own_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
ecma_value_t ecma_op_object_has_property (ecma_object_t *object_p, ecma_string_t *property_name_p);
ecma_value_t ecma_op_object_find_own (ecma_value_t base_value, ecma_object_t *object_p, ecma_string_t *property_name_p);
ecma_value_t ecma_op_object_find (ecma_object_t *object_p, ecma_string_t *property_name_p);
ecma_value_t ecma_op_object_find_by_index (ecma_object_t *object_p, ecma_length_t index);
ecma_value_t ecma_op_object_get (ecma_object_t *object_p, ecma_string_t *property_name_p);
-ecma_value_t ecma_op_object_get_with_receiver (ecma_object_t *object_p, ecma_string_t *property_name_p,
- ecma_value_t receiver);
+ecma_value_t
+ecma_op_object_get_with_receiver (ecma_object_t *object_p, ecma_string_t *property_name_p, ecma_value_t receiver);
ecma_value_t ecma_op_object_get_length (ecma_object_t *object_p, ecma_length_t *length_p);
ecma_value_t ecma_op_object_get_by_index (ecma_object_t *object_p, ecma_length_t index);
ecma_value_t ecma_op_object_get_by_magic_id (ecma_object_t *object_p, lit_magic_string_id_t property_id);
@@ -76,27 +75,35 @@ ecma_value_t ecma_op_object_get_by_symbol_id (ecma_object_t *object_p, lit_magic
ecma_value_t ecma_op_get_method_by_symbol_id (ecma_value_t value, lit_magic_string_id_t symbol_id);
ecma_value_t ecma_op_get_method_by_magic_id (ecma_value_t value, lit_magic_string_id_t magic_id);
#endif /* JERRY_ESNEXT */
-ecma_value_t ecma_op_object_put_with_receiver (ecma_object_t *object_p, ecma_string_t *property_name_p,
- ecma_value_t value, ecma_value_t receiver, bool is_throw);
-ecma_value_t ecma_op_object_put (ecma_object_t *object_p, ecma_string_t *property_name_p, ecma_value_t value,
- bool is_throw);
-ecma_value_t ecma_op_object_put_with_receiver (ecma_object_t *object_p, ecma_string_t *property_name_p,
- ecma_value_t value, ecma_value_t receiver, bool is_throw);
-ecma_value_t ecma_op_object_put_by_index (ecma_object_t *object_p, ecma_length_t index,
- ecma_value_t value, bool is_throw);
+ecma_value_t ecma_op_object_put_with_receiver (ecma_object_t *object_p,
+ ecma_string_t *property_name_p,
+ ecma_value_t value,
+ ecma_value_t receiver,
+ bool is_throw);
+ecma_value_t
+ecma_op_object_put (ecma_object_t *object_p, ecma_string_t *property_name_p, ecma_value_t value, bool is_throw);
+ecma_value_t ecma_op_object_put_with_receiver (ecma_object_t *object_p,
+ ecma_string_t *property_name_p,
+ ecma_value_t value,
+ ecma_value_t receiver,
+ bool is_throw);
+ecma_value_t
+ecma_op_object_put_by_index (ecma_object_t *object_p, ecma_length_t index, ecma_value_t value, bool is_throw);
ecma_value_t ecma_op_object_delete (ecma_object_t *obj_p, ecma_string_t *property_name_p, bool is_throw);
ecma_value_t ecma_op_object_delete_by_index (ecma_object_t *obj_p, ecma_length_t index, bool is_throw);
ecma_value_t ecma_op_object_default_value (ecma_object_t *obj_p, ecma_preferred_type_hint_t hint);
-ecma_value_t ecma_op_object_define_own_property (ecma_object_t *obj_p, ecma_string_t *property_name_p,
+ecma_value_t ecma_op_object_define_own_property (ecma_object_t *obj_p,
+ ecma_string_t *property_name_p,
const ecma_property_descriptor_t *property_desc_p);
-ecma_value_t ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p, ecma_string_t *property_name_p,
+ecma_value_t ecma_op_object_get_own_property_descriptor (ecma_object_t *object_p,
+ ecma_string_t *property_name_p,
ecma_property_descriptor_t *prop_desc_p);
ecma_value_t ecma_op_object_has_instance (ecma_object_t *obj_p, ecma_value_t value);
ecma_object_t *ecma_op_object_get_prototype_of (ecma_object_t *obj_p);
ecma_value_t ecma_op_object_is_prototype_of (ecma_object_t *base_p, ecma_object_t *target_p);
-ecma_collection_t * ecma_op_object_get_enumerable_property_names (ecma_object_t *obj_p,
- ecma_enumerable_property_names_options_t option);
+ecma_collection_t *ecma_op_object_get_enumerable_property_names (ecma_object_t *obj_p,
+ ecma_enumerable_property_names_options_t option);
ecma_collection_t *ecma_op_object_own_property_keys (ecma_object_t *obj_p, jerry_property_filter_t filter);
ecma_collection_t *ecma_op_object_enumerate (ecma_object_t *obj_p);
@@ -108,17 +115,21 @@ bool ecma_object_is_regexp_object (ecma_value_t arg);
ecma_value_t ecma_op_is_concat_spreadable (ecma_value_t arg);
ecma_value_t ecma_op_is_regexp (ecma_value_t arg);
ecma_value_t ecma_op_species_constructor (ecma_object_t *this_value, ecma_builtin_id_t default_constructor_id);
-ecma_value_t ecma_op_invoke_by_symbol_id (ecma_value_t object, lit_magic_string_id_t magic_string_id,
- ecma_value_t *args_p, uint32_t args_len);
+ecma_value_t ecma_op_invoke_by_symbol_id (ecma_value_t object,
+ lit_magic_string_id_t magic_string_id,
+ ecma_value_t *args_p,
+ uint32_t args_len);
#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER
void ecma_op_object_set_weak (ecma_object_t *object_p, ecma_object_t *target_p);
void ecma_op_object_unref_weak (ecma_object_t *object_p, ecma_value_t ref_holder);
#endif /* JERRY_BUILTIN_WEAKREF || JERRY_BUILTIN_CONTAINER */
-ecma_value_t ecma_op_invoke (ecma_value_t object, ecma_string_t *property_name_p, ecma_value_t *args_p,
- uint32_t args_len);
-ecma_value_t ecma_op_invoke_by_magic_id (ecma_value_t object, lit_magic_string_id_t magic_string_id,
- ecma_value_t *args_p, uint32_t args_len);
+ecma_value_t
+ecma_op_invoke (ecma_value_t object, ecma_string_t *property_name_p, ecma_value_t *args_p, uint32_t args_len);
+ecma_value_t ecma_op_invoke_by_magic_id (ecma_value_t object,
+ lit_magic_string_id_t magic_string_id,
+ ecma_value_t *args_p,
+ uint32_t args_len);
jmem_cpointer_t ecma_op_ordinary_object_get_prototype_of (ecma_object_t *obj_p);
ecma_value_t ecma_op_ordinary_object_set_prototype_of (ecma_object_t *base_p, ecma_value_t proto);
diff --git a/jerry-core/ecma/operations/ecma-promise-object.c b/jerry-core/ecma/operations/ecma-promise-object.c
index a1966dd6..e23112ce 100644
--- a/jerry-core/ecma/operations/ecma-promise-object.c
+++ b/jerry-core/ecma/operations/ecma-promise-object.c
@@ -13,20 +13,22 @@
* limitations under the License.
*/
+#include "ecma-promise-object.h"
+
#include "ecma-alloc.h"
#include "ecma-array-object.h"
#include "ecma-boolean-object.h"
-#include "ecma-builtins.h"
#include "ecma-builtin-handlers.h"
+#include "ecma-builtins.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-jobqueue.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
-#include "ecma-promise-object.h"
+#include "ecma-objects.h"
+
#include "jcontext.h"
#if JERRY_ESNEXT
@@ -105,8 +107,8 @@ ecma_promise_set_state (ecma_object_t *obj_p, /**< points to promise object */
JERRY_ASSERT (ecma_is_promise (obj_p));
JERRY_ASSERT (ecma_promise_get_flags (obj_p) & ECMA_PROMISE_IS_PENDING);
- uint8_t flags_to_invert = (is_fulfilled ? (ECMA_PROMISE_IS_PENDING | ECMA_PROMISE_IS_FULFILLED)
- : ECMA_PROMISE_IS_PENDING);
+ uint8_t flags_to_invert =
+ (is_fulfilled ? (ECMA_PROMISE_IS_PENDING | ECMA_PROMISE_IS_FULFILLED) : ECMA_PROMISE_IS_PENDING);
((ecma_extended_object_t *) obj_p)->u.cls.u1.promise_flags ^= flags_to_invert;
} /* ecma_promise_set_state */
@@ -198,10 +200,8 @@ ecma_reject_promise (ecma_value_t promise, /**< promise */
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_REJECT))
{
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_REJECT,
- promise,
- reason,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (JERRY_PROMISE_EVENT_REJECT, promise, reason, JERRY_CONTEXT (promise_callback_user_p));
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -224,10 +224,8 @@ ecma_reject_promise (ecma_value_t promise, /**< promise */
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))
{
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER,
- promise,
- reason,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER, promise, reason, JERRY_CONTEXT (promise_callback_user_p));
}
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -285,10 +283,8 @@ ecma_fulfill_promise (ecma_value_t promise, /**< promise */
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_RESOLVE))
{
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_RESOLVE,
- promise,
- value,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (JERRY_PROMISE_EVENT_RESOLVE, promise, value, JERRY_CONTEXT (promise_callback_user_p));
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -330,10 +326,8 @@ ecma_reject_promise_with_checks (ecma_value_t promise, /**< promise */
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))
{
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_REJECT_FULFILLED,
- promise,
- reason,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (JERRY_PROMISE_EVENT_REJECT_FULFILLED, promise, reason, JERRY_CONTEXT (promise_callback_user_p));
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -370,10 +364,8 @@ ecma_fulfill_promise_with_checks (ecma_value_t promise, /**< promise */
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))
{
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_RESOLVE_FULFILLED,
- promise,
- value,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (JERRY_PROMISE_EVENT_RESOLVE_FULFILLED, promise, value, JERRY_CONTEXT (promise_callback_user_p));
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -450,16 +442,11 @@ ecma_promise_run_executor (ecma_object_t *promise_p, /**< Promise Object */
ecma_value_t this_value) /**< this value */
{
ecma_object_t *resolve_func_p, *reject_func_p;
- resolve_func_p = ecma_promise_create_resolving_function (promise_p,
- ECMA_NATIVE_HANDLER_PROMISE_RESOLVE);
- reject_func_p = ecma_promise_create_resolving_function (promise_p,
- ECMA_NATIVE_HANDLER_PROMISE_REJECT);
+ resolve_func_p = ecma_promise_create_resolving_function (promise_p, ECMA_NATIVE_HANDLER_PROMISE_RESOLVE);
+ reject_func_p = ecma_promise_create_resolving_function (promise_p, ECMA_NATIVE_HANDLER_PROMISE_REJECT);
ecma_value_t argv[] = { ecma_make_object_value (resolve_func_p), ecma_make_object_value (reject_func_p) };
- ecma_value_t result = ecma_op_function_call (ecma_get_object_from_value (executor),
- this_value,
- argv,
- 2);
+ ecma_value_t result = ecma_op_function_call (ecma_get_object_from_value (executor), this_value, argv, 2);
ecma_deref_object (resolve_func_p);
ecma_deref_object (reject_func_p);
@@ -487,8 +474,7 @@ ecma_op_create_promise_object (ecma_value_t executor, /**< the executor function
}
/* 3. */
- ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (new_target_p,
- ECMA_BUILTIN_ID_PROMISE_PROTOTYPE);
+ ecma_object_t *proto_p = ecma_op_get_prototype_from_constructor (new_target_p, ECMA_BUILTIN_ID_PROMISE_PROTOTYPE);
if (JERRY_UNLIKELY (proto_p == NULL))
{
@@ -499,9 +485,7 @@ ecma_op_create_promise_object (ecma_value_t executor, /**< the executor function
* allocation is performed before the object is constructed. */
ecma_collection_t *reactions = ecma_new_collection ();
- ecma_object_t *object_p = ecma_create_object (proto_p,
- sizeof (ecma_promise_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_promise_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_deref_object (proto_p);
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_PROMISE;
@@ -517,10 +501,8 @@ ecma_op_create_promise_object (ecma_value_t executor, /**< the executor function
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_CREATE))
{
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_CREATE,
- ecma_make_object_value (object_p),
- parent,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (JERRY_PROMISE_EVENT_CREATE, ecma_make_object_value (object_p), parent, JERRY_CONTEXT (promise_callback_user_p));
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -634,9 +616,8 @@ ecma_promise_all_or_all_settled_handler_cb (ecma_object_t *function_obj_p, /**<
data_propery_name = LIT_MAGIC_STRING_VALUE;
}
- ecma_object_t *obj_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE),
- 0,
- ECMA_OBJECT_TYPE_GENERAL);
+ ecma_object_t *obj_p =
+ ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL);
ecma_property_value_t *prop_value_p;
prop_value_p = ecma_create_named_data_property (obj_p,
ecma_get_magic_string (LIT_MAGIC_STRING_STATUS),
@@ -659,7 +640,7 @@ ecma_promise_all_or_all_settled_handler_cb (ecma_object_t *function_obj_p, /**<
ecma_value_t obj_val = ecma_make_object_value (obj_p);
/* 12. */
ecma_op_object_put_by_index (ecma_get_object_from_value (executor_p->values),
- (uint32_t) (executor_p->index - 1),
+ (uint32_t) (executor_p->index - 1),
obj_val,
false);
ecma_deref_object (obj_p);
@@ -676,10 +657,8 @@ ecma_promise_all_or_all_settled_handler_cb (ecma_object_t *function_obj_p, /**<
if (promise_type == ECMA_PROMISE_ANY_REJECT)
{
ecma_value_t error_val = ecma_new_aggregate_error (executor_p->values, ECMA_VALUE_UNDEFINED);
- ret = ecma_op_function_call (ecma_get_object_from_value (capability_p->reject),
- ECMA_VALUE_UNDEFINED,
- &error_val,
- 1);
+ ret =
+ ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), ECMA_VALUE_UNDEFINED, &error_val, 1);
ecma_free_value (error_val);
}
else
@@ -842,9 +821,7 @@ ecma_promise_reject_or_resolve (ecma_value_t this_arg, /**< "this" argument */
return ecma_raise_type_error (ECMA_ERR_MSG ("Argument 'this' is not an object"));
}
- if (is_resolve
- && ecma_is_value_object (value)
- && ecma_is_promise (ecma_get_object_from_value (value)))
+ if (is_resolve && ecma_is_value_object (value) && ecma_is_promise (ecma_get_object_from_value (value)))
{
ecma_object_t *object_p = ecma_get_object_from_value (value);
ecma_value_t constructor = ecma_op_object_get_by_magic_id (object_p, LIT_MAGIC_STRING_CONSTRUCTOR);
@@ -875,10 +852,7 @@ ecma_promise_reject_or_resolve (ecma_value_t this_arg, /**< "this" argument */
ecma_value_t func = is_resolve ? capability_p->resolve : capability_p->reject;
- ecma_value_t call_ret = ecma_op_function_call (ecma_get_object_from_value (func),
- ECMA_VALUE_UNDEFINED,
- &value,
- 1);
+ ecma_value_t call_ret = ecma_op_function_call (ecma_get_object_from_value (func), ECMA_VALUE_UNDEFINED, &value, 1);
if (ECMA_IS_VALUE_ERROR (call_ret))
{
@@ -1001,10 +975,8 @@ ecma_promise_then_catch_finally_helper (ecma_object_t *function_obj_p, /**< func
JERRY_ASSERT (ecma_op_is_callable (finally_func_obj->on_finally));
/* 4. */
- ecma_value_t result = ecma_op_function_call (ecma_get_object_from_value (finally_func_obj->on_finally),
- ECMA_VALUE_UNDEFINED,
- NULL,
- 0);
+ ecma_value_t result =
+ ecma_op_function_call (ecma_get_object_from_value (finally_func_obj->on_finally), ECMA_VALUE_UNDEFINED, NULL, 0);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -1112,14 +1084,14 @@ ecma_promise_finally (ecma_value_t promise, /**< the promise which call 'finally
if (!ecma_op_is_callable (on_finally))
{
ecma_free_value (species);
- ecma_value_t invoke_args[2] = {on_finally, on_finally};
+ ecma_value_t invoke_args[2] = { on_finally, on_finally };
return ecma_op_invoke_by_magic_id (promise, LIT_MAGIC_STRING_THEN, invoke_args, 2);
}
/* 6.a-b */
ecma_object_t *then_finally_obj_p;
- then_finally_obj_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY,
- sizeof (ecma_promise_finally_function_t));
+ then_finally_obj_p =
+ ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_THEN_FINALLY, sizeof (ecma_promise_finally_function_t));
/* 6.c-d */
ecma_promise_finally_function_t *then_finally_func_obj_p = (ecma_promise_finally_function_t *) then_finally_obj_p;
@@ -1128,8 +1100,8 @@ ecma_promise_finally (ecma_value_t promise, /**< the promise which call 'finally
/* 6.e-f */
ecma_object_t *catch_finally_obj_p;
- catch_finally_obj_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY,
- sizeof (ecma_promise_finally_function_t));
+ catch_finally_obj_p =
+ ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROMISE_CATCH_FINALLY, sizeof (ecma_promise_finally_function_t));
/* 6.g-h */
ecma_promise_finally_function_t *catch_finally_func_obj = (ecma_promise_finally_function_t *) catch_finally_obj_p;
@@ -1139,11 +1111,8 @@ ecma_promise_finally (ecma_value_t promise, /**< the promise which call 'finally
ecma_deref_object (ecma_get_object_from_value (species));
/* 7. */
- ecma_value_t invoke_args[2] =
- {
- ecma_make_object_value (then_finally_obj_p),
- ecma_make_object_value (catch_finally_obj_p)
- };
+ ecma_value_t invoke_args[2] = { ecma_make_object_value (then_finally_obj_p),
+ ecma_make_object_value (catch_finally_obj_p) };
ecma_value_t ret_value = ecma_op_invoke_by_magic_id (promise, LIT_MAGIC_STRING_THEN, invoke_args, 2);
@@ -1164,10 +1133,8 @@ ecma_promise_async_then (ecma_value_t promise, /**< promise object */
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ASYNC_MAIN))
{
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_ASYNC_AWAIT,
- executable_object,
- promise,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (JERRY_PROMISE_EVENT_ASYNC_AWAIT, executable_object, promise, JERRY_CONTEXT (promise_callback_user_p));
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -1196,10 +1163,8 @@ ecma_promise_async_then (ecma_value_t promise, /**< promise object */
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))
{
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED,
- promise,
- ECMA_VALUE_UNDEFINED,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED, promise, ECMA_VALUE_UNDEFINED, JERRY_CONTEXT (promise_callback_user_p));
}
}
#endif /* JERRY_PROMISE_CALLBACK */
@@ -1252,10 +1217,8 @@ ecma_op_if_abrupt_reject_promise (ecma_value_t *value_p, /**< [in - out] complet
ecma_value_t reason = jcontext_take_exception ();
ecma_promise_capabality_t *capability_p = (ecma_promise_capabality_t *) capability_obj_p;
- ecma_value_t call_ret = ecma_op_function_call (ecma_get_object_from_value (capability_p->reject),
- ECMA_VALUE_UNDEFINED,
- &reason,
- 1);
+ ecma_value_t call_ret =
+ ecma_op_function_call (ecma_get_object_from_value (capability_p->reject), ECMA_VALUE_UNDEFINED, &reason, 1);
ecma_free_value (reason);
if (ECMA_IS_VALUE_ERROR (call_ret))
@@ -1354,10 +1317,11 @@ ecma_promise_perform_then (ecma_value_t promise, /**< the promise which call 'th
if (JERRY_UNLIKELY (JERRY_CONTEXT (promise_callback_filters) & JERRY_PROMISE_EVENT_FILTER_ERROR))
{
JERRY_ASSERT (JERRY_CONTEXT (promise_callback) != NULL);
- JERRY_CONTEXT (promise_callback) (JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED,
- promise,
- ECMA_VALUE_UNDEFINED,
- JERRY_CONTEXT (promise_callback_user_p));
+ JERRY_CONTEXT (promise_callback)
+ (JERRY_PROMISE_EVENT_CATCH_HANDLER_ADDED,
+ promise,
+ ECMA_VALUE_UNDEFINED,
+ JERRY_CONTEXT (promise_callback_user_p));
}
}
#endif /* JERRY_PROMISE_CALLBACK */
diff --git a/jerry-core/ecma/operations/ecma-promise-object.h b/jerry-core/ecma/operations/ecma-promise-object.h
index df9cb2ce..54c88d9a 100644
--- a/jerry-core/ecma/operations/ecma-promise-object.h
+++ b/jerry-core/ecma/operations/ecma-promise-object.h
@@ -16,9 +16,10 @@
#ifndef ECMA_PROMISE_OBJECT_H
#define ECMA_PROMISE_OBJECT_H
-#if JERRY_ESNEXT
#include "ecma-globals.h"
+#if JERRY_ESNEXT
+
/** \addtogroup ecma ECMA
* @{
*
@@ -96,8 +97,7 @@ typedef struct
*/
bool ecma_is_promise (ecma_object_t *obj_p);
-ecma_value_t ecma_op_create_promise_object (ecma_value_t executor, ecma_value_t parent,
- ecma_object_t *new_target_p);
+ecma_value_t ecma_op_create_promise_object (ecma_value_t executor, ecma_value_t parent, ecma_object_t *new_target_p);
uint8_t ecma_promise_get_flags (ecma_object_t *promise_p);
ecma_value_t ecma_promise_get_result (ecma_object_t *promise_p);
void ecma_reject_promise (ecma_value_t promise, ecma_value_t reason);
@@ -108,22 +108,24 @@ ecma_object_t *ecma_promise_new_capability (ecma_value_t constructor, ecma_value
ecma_value_t ecma_promise_reject_or_resolve (ecma_value_t this_arg, ecma_value_t value, bool is_resolve);
ecma_value_t ecma_promise_then (ecma_value_t promise, ecma_value_t on_fulfilled, ecma_value_t on_rejected);
-ecma_value_t ecma_value_thunk_helper_cb (ecma_object_t *function_obj_p,
- const ecma_value_t args_p[], const uint32_t args_count);
-ecma_value_t ecma_value_thunk_thrower_cb (ecma_object_t *function_obj_p,
- const ecma_value_t args_p[], const uint32_t args_count);
-ecma_value_t ecma_promise_then_finally_cb (ecma_object_t *function_obj_p,
- const ecma_value_t args_p[], const uint32_t args_count);
-ecma_value_t ecma_promise_catch_finally_cb (ecma_object_t *function_obj_p,
- const ecma_value_t args_p[], const uint32_t args_count);
-ecma_value_t ecma_promise_reject_handler (ecma_object_t *function_obj_p,
- const ecma_value_t argv[], const uint32_t args_count);
-ecma_value_t ecma_promise_resolve_handler (ecma_object_t *function_obj_p,
- const ecma_value_t argv[], const uint32_t args_count);
+ecma_value_t
+ecma_value_thunk_helper_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count);
+ecma_value_t
+ecma_value_thunk_thrower_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count);
+ecma_value_t
+ecma_promise_then_finally_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count);
+ecma_value_t
+ecma_promise_catch_finally_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count);
+ecma_value_t
+ecma_promise_reject_handler (ecma_object_t *function_obj_p, const ecma_value_t argv[], const uint32_t args_count);
+ecma_value_t
+ecma_promise_resolve_handler (ecma_object_t *function_obj_p, const ecma_value_t argv[], const uint32_t args_count);
ecma_value_t ecma_promise_all_or_all_settled_handler_cb (ecma_object_t *function_obj_p,
- const ecma_value_t args_p[], const uint32_t args_count);
+ const ecma_value_t args_p[],
+ const uint32_t args_count);
ecma_value_t ecma_op_get_capabilities_executor_cb (ecma_object_t *function_obj_p,
- const ecma_value_t args_p[], const uint32_t args_count);
+ const ecma_value_t args_p[],
+ const uint32_t args_count);
ecma_value_t ecma_promise_finally (ecma_value_t promise, ecma_value_t on_finally);
void ecma_promise_async_then (ecma_value_t promise, ecma_value_t executable_object);
diff --git a/jerry-core/ecma/operations/ecma-proxy-object.c b/jerry-core/ecma/operations/ecma-proxy-object.c
index 744805cb..5d218106 100644
--- a/jerry-core/ecma/operations/ecma-proxy-object.c
+++ b/jerry-core/ecma/operations/ecma-proxy-object.c
@@ -13,19 +13,21 @@
* limitations under the License.
*/
+#include "ecma-proxy-object.h"
+
#include "ecma-alloc.h"
#include "ecma-array-object.h"
-#include "ecma-builtins.h"
#include "ecma-builtin-handlers.h"
#include "ecma-builtin-object.h"
+#include "ecma-builtins.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
-#include "ecma-proxy-object.h"
+#include "ecma-objects.h"
+
#include "jcontext.h"
/** \addtogroup ecma ECMA
@@ -162,8 +164,7 @@ ecma_proxy_create_revocable (ecma_value_t target, /**< target argument */
/* 3. */
ecma_object_t *func_obj_p;
- func_obj_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROXY_REVOKE,
- sizeof (ecma_revocable_proxy_object_t));
+ func_obj_p = ecma_op_create_native_handler (ECMA_NATIVE_HANDLER_PROXY_REVOKE, sizeof (ecma_revocable_proxy_object_t));
/* 4. */
ecma_revocable_proxy_object_t *rev_proxy_p = (ecma_revocable_proxy_object_t *) func_obj_p;
@@ -173,9 +174,8 @@ ecma_proxy_create_revocable (ecma_value_t target, /**< target argument */
ecma_value_t revoker = ecma_make_object_value (func_obj_p);
/* 5. */
- ecma_object_t *obj_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE),
- 0,
- ECMA_OBJECT_TYPE_GENERAL);
+ ecma_object_t *obj_p =
+ ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL);
/* 6. */
prop_value_p = ecma_create_named_data_property (obj_p,
@@ -640,8 +640,7 @@ ecma_proxy_object_prevent_extensions (ecma_object_t *obj_p) /**< proxy object */
ecma_free_value (trap_result);
/* 10. */
- if (boolean_trap_result
- && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
+ if (boolean_trap_result && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
{
ecma_value_t target_is_ext = ecma_builtin_object_object_is_extensible (target_obj_p);
@@ -834,7 +833,7 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy
is_extensible);
bool target_has_desc = ecma_is_value_true (target_status);
- bool target_is_writable = (target_desc.flags & JERRY_PROP_IS_WRITABLE) ;
+ bool target_is_writable = (target_desc.flags & JERRY_PROP_IS_WRITABLE);
bool target_is_configurable = false;
if (target_has_desc)
@@ -855,10 +854,8 @@ ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p, /**< proxy
{
const uint16_t mask = (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE);
- if (!target_has_desc
- || target_is_configurable
- || ((prop_desc_p->flags & mask) == JERRY_PROP_IS_WRITABLE_DEFINED
- && target_is_writable))
+ if (!target_has_desc || target_is_configurable
+ || ((prop_desc_p->flags & mask) == JERRY_PROP_IS_WRITABLE_DEFINED && target_is_writable))
{
ecma_free_property_descriptor (prop_desc_p);
return ecma_raise_type_error (ECMA_ERR_MSG ("The two descriptors are incompatible"));
@@ -917,7 +914,7 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object *
ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);
ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p);
ecma_value_t desc_obj_value = ecma_make_object_value (desc_obj);
- ecma_value_t args[] = {target, prop_value, desc_obj_value};
+ ecma_value_t args[] = { target, prop_value, desc_obj_value };
/* 10. */
ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 3);
@@ -976,8 +973,8 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object *
}
/* 17. */
- bool setting_config_false = ((prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED)
- && !(prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE));
+ bool setting_config_false =
+ ((prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE_DEFINED) && !(prop_desc_p->flags & JERRY_PROP_IS_CONFIGURABLE));
/* 19. */
if (!target_prop_found)
@@ -1012,7 +1009,7 @@ ecma_proxy_object_define_own_property (ecma_object_t *obj_p, /**< proxy object *
/* ES11: 16.c */
else if ((target_desc.flags & (JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED)) != 0
&& (prop_desc_p->flags & (JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_WRITABLE))
- == JERRY_PROP_IS_WRITABLE_DEFINED
+ == JERRY_PROP_IS_WRITABLE_DEFINED
&& (target_desc.flags & (JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_CONFIGURABLE)) == JERRY_PROP_IS_WRITABLE)
{
@@ -1076,7 +1073,7 @@ ecma_proxy_object_has (ecma_object_t *obj_p, /**< proxy object */
ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);
ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p);
- ecma_value_t args[] = {target, prop_value};
+ ecma_value_t args[] = { target, prop_value };
/* 9. */
ecma_value_t trap_result = ecma_op_function_call (func_obj_p, handler, args, 2);
@@ -1094,8 +1091,7 @@ ecma_proxy_object_has (ecma_object_t *obj_p, /**< proxy object */
ecma_free_value (trap_result);
/* 11. */
- if (!boolean_trap_result
- && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
+ if (!boolean_trap_result && !(obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
{
ecma_property_descriptor_t target_desc;
@@ -1189,8 +1185,7 @@ ecma_proxy_object_get (ecma_object_t *obj_p, /**< proxy object */
ecma_deref_object (func_obj_p);
/* 10. */
- if (ECMA_IS_VALUE_ERROR (trap_result)
- || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
+ if (ECMA_IS_VALUE_ERROR (trap_result) || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
{
return trap_result;
}
@@ -1211,17 +1206,14 @@ ecma_proxy_object_get (ecma_object_t *obj_p, /**< proxy object */
{
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
- if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED)
- && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)
- && !(target_desc.flags & JERRY_PROP_IS_WRITABLE)
- && !ecma_op_same_value (trap_result, target_desc.value))
+ if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)
+ && !(target_desc.flags & JERRY_PROP_IS_WRITABLE) && !ecma_op_same_value (trap_result, target_desc.value))
{
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incorrect value is returned by a Proxy 'get' trap"));
}
else if (!(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)
&& (target_desc.flags & (JERRY_PROP_IS_GET_DEFINED | JERRY_PROP_IS_SET_DEFINED))
- && target_desc.get_p == NULL
- && !ecma_is_value_undefined (trap_result))
+ && target_desc.get_p == NULL && !ecma_is_value_undefined (trap_result))
{
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Property of a Proxy is non-configurable and "
"does not have a getter function"));
@@ -1338,10 +1330,8 @@ ecma_proxy_object_set (ecma_object_t *obj_p, /**< proxy object */
{
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
- if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED)
- && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)
- && !(target_desc.flags & JERRY_PROP_IS_WRITABLE)
- && !ecma_op_same_value (value, target_desc.value))
+ if ((target_desc.flags & JERRY_PROP_IS_VALUE_DEFINED) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE)
+ && !(target_desc.flags & JERRY_PROP_IS_WRITABLE) && !ecma_op_same_value (value, target_desc.value))
{
ret_value = ecma_raise_type_error (ECMA_ERR_MSG ("Incorrect value is returned by a Proxy 'set' trap"));
}
@@ -1650,8 +1640,7 @@ ecma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */
ecma_free_value (trap_result_array);
- if (trap_result == NULL
- || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
+ if (trap_result == NULL || (obj_p->u2.prototype_cp & JERRY_PROXY_SKIP_RESULT_VALIDATION))
{
return trap_result;
}
@@ -1697,9 +1686,7 @@ ecma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */
ecma_string_t *prop_name_p = ecma_get_prop_name_from_value (target_keys->buffer_p[i]);
- ecma_value_t status = ecma_op_object_get_own_property_descriptor (target_obj_p,
- prop_name_p,
- &target_desc);
+ ecma_value_t status = ecma_op_object_get_own_property_descriptor (target_obj_p, prop_name_p, &target_desc);
if (ECMA_IS_VALUE_ERROR (status))
{
@@ -1709,8 +1696,7 @@ ecma_proxy_object_own_property_keys (ecma_object_t *obj_p) /**< proxy object */
ecma_value_t prop_value = ecma_make_prop_name_value (prop_name_p);
- if (ecma_is_value_true (status)
- && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE))
+ if (ecma_is_value_true (status) && !(target_desc.flags & JERRY_PROP_IS_CONFIGURABLE))
{
ecma_collection_push_back (target_non_configurable_keys, prop_value);
}
@@ -1806,7 +1792,7 @@ ecma_proxy_object_call (ecma_object_t *obj_p, /**< proxy object */
/* 8. */
ecma_value_t args_array = ecma_op_new_array_object_from_buffer (args_p, argc);
- ecma_value_t value_array[] = {target, this_argument, args_array};
+ ecma_value_t value_array[] = { target, this_argument, args_array };
ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);
/* 9. */
ecma_value_t ret_value = ecma_op_function_call (func_obj_p, handler, value_array, 3);
@@ -1836,7 +1822,7 @@ ecma_proxy_object_construct (ecma_object_t *obj_p, /**< proxy object */
JERRY_ASSERT (ECMA_OBJECT_IS_PROXY (obj_p));
ECMA_CHECK_STACK_USAGE ();
- ecma_proxy_object_t * proxy_obj_p = (ecma_proxy_object_t *) obj_p;
+ ecma_proxy_object_t *proxy_obj_p = (ecma_proxy_object_t *) obj_p;
/* 1. */
ecma_value_t handler = proxy_obj_p->handler;
@@ -1868,7 +1854,7 @@ ecma_proxy_object_construct (ecma_object_t *obj_p, /**< proxy object */
ecma_object_t *func_obj_p = ecma_get_object_from_value (trap);
ecma_value_t new_target_value = ecma_make_object_value (new_target_p);
- ecma_value_t function_call_args[] = {target, args_array, new_target_value};
+ ecma_value_t function_call_args[] = { target, args_array, new_target_value };
/* 9. */
ecma_value_t new_obj = ecma_op_function_call (func_obj_p, handler, function_call_args, 3);
diff --git a/jerry-core/ecma/operations/ecma-proxy-object.h b/jerry-core/ecma/operations/ecma-proxy-object.h
index 1fa23522..82537bca 100644
--- a/jerry-core/ecma/operations/ecma-proxy-object.h
+++ b/jerry-core/ecma/operations/ecma-proxy-object.h
@@ -27,84 +27,54 @@
#if JERRY_BUILTIN_PROXY
-ecma_object_t *
-ecma_proxy_create (ecma_value_t target,
- ecma_value_t handler,
- uint32_t options);
+ecma_object_t *ecma_proxy_create (ecma_value_t target, ecma_value_t handler, uint32_t options);
-ecma_object_t *
-ecma_proxy_create_revocable (ecma_value_t target,
- ecma_value_t handler);
+ecma_object_t *ecma_proxy_create_revocable (ecma_value_t target, ecma_value_t handler);
ecma_value_t
-ecma_proxy_revoke_cb (ecma_object_t *function_obj_p,
- const ecma_value_t args_p[],
- const uint32_t args_count);
+ecma_proxy_revoke_cb (ecma_object_t *function_obj_p, const ecma_value_t args_p[], const uint32_t args_count);
-ecma_value_t
-ecma_proxy_object_find (ecma_object_t *obj_p,
- ecma_string_t *prop_name_p);
+ecma_value_t ecma_proxy_object_find (ecma_object_t *obj_p, ecma_string_t *prop_name_p);
/* Interal operations */
-ecma_value_t
-ecma_proxy_object_get_prototype_of (ecma_object_t *obj_p);
+ecma_value_t ecma_proxy_object_get_prototype_of (ecma_object_t *obj_p);
-ecma_value_t
-ecma_proxy_object_set_prototype_of (ecma_object_t *obj_p,
- ecma_value_t proto);
+ecma_value_t ecma_proxy_object_set_prototype_of (ecma_object_t *obj_p, ecma_value_t proto);
-ecma_value_t
-ecma_proxy_object_is_extensible (ecma_object_t *obj_p);
+ecma_value_t ecma_proxy_object_is_extensible (ecma_object_t *obj_p);
-ecma_value_t
-ecma_proxy_object_prevent_extensions (ecma_object_t *obj_p);
+ecma_value_t ecma_proxy_object_prevent_extensions (ecma_object_t *obj_p);
-ecma_value_t
-ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p,
- ecma_string_t *prop_name_p,
- ecma_property_descriptor_t *prop_desc_p);
+ecma_value_t ecma_proxy_object_get_own_property_descriptor (ecma_object_t *obj_p,
+ ecma_string_t *prop_name_p,
+ ecma_property_descriptor_t *prop_desc_p);
-ecma_value_t
-ecma_proxy_object_define_own_property (ecma_object_t *obj_p,
- ecma_string_t *prop_name_p,
- const ecma_property_descriptor_t *prop_desc_p);
+ecma_value_t ecma_proxy_object_define_own_property (ecma_object_t *obj_p,
+ ecma_string_t *prop_name_p,
+ const ecma_property_descriptor_t *prop_desc_p);
-ecma_value_t
-ecma_proxy_object_has (ecma_object_t *obj_p,
- ecma_string_t *prop_name_p);
+ecma_value_t ecma_proxy_object_has (ecma_object_t *obj_p, ecma_string_t *prop_name_p);
-ecma_value_t
-ecma_proxy_object_get (ecma_object_t *obj_p,
- ecma_string_t *prop_name_p,
- ecma_value_t receiver);
+ecma_value_t ecma_proxy_object_get (ecma_object_t *obj_p, ecma_string_t *prop_name_p, ecma_value_t receiver);
-ecma_value_t
-ecma_proxy_object_set (ecma_object_t *obj_p,
- ecma_string_t *prop_name_p,
- ecma_value_t name,
- ecma_value_t receiver,
- bool is_strict);
+ecma_value_t ecma_proxy_object_set (ecma_object_t *obj_p,
+ ecma_string_t *prop_name_p,
+ ecma_value_t name,
+ ecma_value_t receiver,
+ bool is_strict);
-ecma_value_t
-ecma_proxy_object_delete_property (ecma_object_t *obj_p,
- ecma_string_t *prop_name_p,
- bool is_strict);
+ecma_value_t ecma_proxy_object_delete_property (ecma_object_t *obj_p, ecma_string_t *prop_name_p, bool is_strict);
-ecma_collection_t *
-ecma_proxy_object_own_property_keys (ecma_object_t *obj_p);
+ecma_collection_t *ecma_proxy_object_own_property_keys (ecma_object_t *obj_p);
ecma_value_t
-ecma_proxy_object_call (ecma_object_t *obj_p,
- ecma_value_t this_argument,
- const ecma_value_t *args_p,
- uint32_t argc);
+ecma_proxy_object_call (ecma_object_t *obj_p, ecma_value_t this_argument, const ecma_value_t *args_p, uint32_t argc);
-ecma_value_t
-ecma_proxy_object_construct (ecma_object_t *obj_p,
- ecma_object_t *new_target_p,
- const ecma_value_t *args_p,
- uint32_t argc);
+ecma_value_t ecma_proxy_object_construct (ecma_object_t *obj_p,
+ ecma_object_t *new_target_p,
+ const ecma_value_t *args_p,
+ uint32_t argc);
#endif /* JERRY_BUILTIN_PROXY */
diff --git a/jerry-core/ecma/operations/ecma-reference.c b/jerry-core/ecma/operations/ecma-reference.c
index 44cf03e3..4693ef15 100644
--- a/jerry-core/ecma/operations/ecma-reference.c
+++ b/jerry-core/ecma/operations/ecma-reference.c
@@ -13,6 +13,8 @@
* limitations under the License.
*/
+#include "ecma-reference.h"
+
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
#include "ecma-gc.h"
@@ -22,7 +24,7 @@
#include "ecma-lex-env.h"
#include "ecma-objects.h"
#include "ecma-proxy-object.h"
-#include "ecma-reference.h"
+
#include "jrt.h"
/** \addtogroup ecma ECMA
@@ -405,9 +407,8 @@ ecma_op_resolve_reference_value (ecma_object_t *lex_env_p, /**< starting lexical
#if JERRY_ERROR_MESSAGES
ecma_value_t name_val = ecma_make_string_value (name_p);
- ecma_value_t error_value = ecma_raise_standard_error_with_format (JERRY_ERROR_REFERENCE,
- "% is not defined",
- name_val);
+ ecma_value_t error_value =
+ ecma_raise_standard_error_with_format (JERRY_ERROR_REFERENCE, "% is not defined", name_val);
#else /* JERRY_ERROR_MESSAGES */
ecma_value_t error_value = ecma_raise_reference_error (NULL);
#endif /* !JERRY_ERROR_MESSAGES */
diff --git a/jerry-core/ecma/operations/ecma-reference.h b/jerry-core/ecma/operations/ecma-reference.h
index 5cf6b415..ece9b497 100644
--- a/jerry-core/ecma/operations/ecma-reference.h
+++ b/jerry-core/ecma/operations/ecma-reference.h
@@ -17,6 +17,7 @@
#define ECMA_REFERENCE_H
#include "ecma-globals.h"
+
#include "jrt.h"
/** \addtogroup ecma ECMA
diff --git a/jerry-core/ecma/operations/ecma-regexp-object.c b/jerry-core/ecma/operations/ecma-regexp-object.c
index 9d2ca38d..a392b141 100644
--- a/jerry-core/ecma/operations/ecma-regexp-object.c
+++ b/jerry-core/ecma/operations/ecma-regexp-object.c
@@ -13,15 +13,17 @@
* limitations under the License.
*/
+#include "ecma-regexp-object.h"
+
#include "ecma-alloc.h"
#include "ecma-array-object.h"
#include "ecma-builtin-helpers.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-objects.h"
-#include "ecma-function-object.h"
-#include "ecma-regexp-object.h"
+
#include "jcontext.h"
#include "jrt-libc-includes.h"
#include "lit-char-helpers.h"
@@ -220,8 +222,7 @@ ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer
ctr_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP);
}
- ecma_object_t *proto_obj_p = ecma_op_get_prototype_from_constructor (ctr_obj_p,
- ECMA_BUILTIN_ID_REGEXP_PROTOTYPE);
+ ecma_object_t *proto_obj_p = ecma_op_get_prototype_from_constructor (ctr_obj_p, ECMA_BUILTIN_ID_REGEXP_PROTOTYPE);
if (JERRY_UNLIKELY (proto_obj_p == NULL))
{
@@ -233,9 +234,8 @@ ecma_op_regexp_alloc (ecma_object_t *ctr_obj_p) /**< constructor object pointer
ecma_object_t *proto_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_REGEXP_PROTOTYPE);
#endif /* JERRY_ESNEXT */
- ecma_object_t *new_object_p = ecma_create_object (proto_obj_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *new_object_p =
+ ecma_create_object (proto_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
#if JERRY_ESNEXT
ecma_deref_object (proto_obj_p);
@@ -437,9 +437,7 @@ ecma_regexp_canonicalize_char (lit_code_point_t ch, /**< character */
JERRY_UNUSED (unicode);
lit_code_point_t cu = lit_char_to_upper_case (ch, NULL);
- if (ch <= LIT_UTF8_1_BYTE_CODE_POINT_MAX
- || (cu > LIT_UTF8_1_BYTE_CODE_POINT_MAX
- && cu != LIT_MULTIPLE_CU))
+ if (ch <= LIT_UTF8_1_BYTE_CODE_POINT_MAX || (cu > LIT_UTF8_1_BYTE_CODE_POINT_MAX && cu != LIT_MULTIPLE_CU))
{
return cu;
}
@@ -523,8 +521,7 @@ ecma_regexp_advance (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */
lit_code_point_t cp = lit_cesu8_read_next (str_p);
#if JERRY_ESNEXT
- if (JERRY_UNLIKELY (re_ctx_p->flags & RE_FLAG_UNICODE)
- && lit_is_code_point_utf16_high_surrogate ((ecma_char_t) cp)
+ if (JERRY_UNLIKELY (re_ctx_p->flags & RE_FLAG_UNICODE) && lit_is_code_point_utf16_high_surrogate ((ecma_char_t) cp)
&& *str_p < re_ctx_p->input_end_p)
{
const ecma_char_t next_ch = lit_cesu8_peek_next (*str_p);
@@ -553,8 +550,7 @@ ecma_regexp_unicode_advance (const lit_utf8_byte_t **str_p, /**< reference to st
const lit_utf8_byte_t *current_p = *str_p;
lit_code_point_t ch = lit_cesu8_read_next (&current_p);
- if (lit_is_code_point_utf16_high_surrogate ((ecma_char_t) ch)
- && current_p < end_p)
+ if (lit_is_code_point_utf16_high_surrogate ((ecma_char_t) ch) && current_p < end_p)
{
const ecma_char_t next_ch = lit_cesu8_peek_next (current_p);
if (lit_is_code_point_utf16_low_surrogate (next_ch))
@@ -581,8 +577,7 @@ ecma_regexp_step_back (ecma_regexp_ctx_t *re_ctx_p, /**< regexp context */
JERRY_ASSERT (str_p != NULL);
#if JERRY_ESNEXT
lit_code_point_t ch = lit_cesu8_read_prev (&str_p);
- if (JERRY_UNLIKELY (re_ctx_p->flags & RE_FLAG_UNICODE)
- && lit_is_code_point_utf16_low_surrogate (ch)
+ if (JERRY_UNLIKELY (re_ctx_p->flags & RE_FLAG_UNICODE) && lit_is_code_point_utf16_low_surrogate (ch)
&& lit_is_code_point_utf16_high_surrogate (lit_cesu8_peek_prev (str_p)))
{
str_p -= LIT_UTF8_MAX_BYTES_IN_CODE_UNIT;
@@ -1270,8 +1265,7 @@ ecma_regexp_run (ecma_regexp_ctx_t *re_ctx_p, /**< RegExp matcher context */
const lit_utf8_size_t capture_size = (lit_utf8_size_t) (capture_p->end_p - capture_p->begin_p);
- if (str_curr_p + capture_size > re_ctx_p->input_end_p
- || memcmp (str_curr_p, capture_p->begin_p, capture_size))
+ if (str_curr_p + capture_size > re_ctx_p->input_end_p || memcmp (str_curr_p, capture_p->begin_p, capture_size))
{
goto fail;
}
@@ -1489,7 +1483,7 @@ ecma_regexp_run (ecma_regexp_ctx_t *re_ctx_p, /**< RegExp matcher context */
goto fail;
-class_found:
+ class_found:
if (flags & RE_CLASS_INVERT)
{
goto fail;
@@ -1511,8 +1505,7 @@ class_found:
const lit_code_point_t cp = ecma_regexp_unicode_advance (&str_curr_p, re_ctx_p->input_end_p);
if (!(re_ctx_p->flags & RE_FLAG_DOTALL)
- && JERRY_UNLIKELY (cp <= LIT_UTF16_CODE_UNIT_MAX
- && lit_char_is_line_terminator ((ecma_char_t) cp)))
+ && JERRY_UNLIKELY (cp <= LIT_UTF16_CODE_UNIT_MAX && lit_char_is_line_terminator ((ecma_char_t) cp)))
{
goto fail;
}
@@ -1562,8 +1555,7 @@ class_found:
{
JERRY_ASSERT (op == RE_OP_BYTE);
- if (str_curr_p >= re_ctx_p->input_end_p
- || *bc_p++ != *str_curr_p++)
+ if (str_curr_p >= re_ctx_p->input_end_p || *bc_p++ != *str_curr_p++)
{
goto fail;
}
@@ -1573,7 +1565,7 @@ class_found:
}
JERRY_UNREACHABLE ();
-fail:
+ fail:
bc_p = next_alternative_p;
if (bc_p == NULL || *bc_p++ != RE_OP_ALTERNATIVE_NEXT)
@@ -1645,10 +1637,7 @@ ecma_regexp_create_result_object (ecma_regexp_ctx_t *re_ctx_p, /**< regexp conte
for (uint32_t i = 0; i < re_ctx_p->captures_count; i++)
{
ecma_value_t capture_value = ecma_regexp_get_capture_value (re_ctx_p->captures_p + i);
- ecma_builtin_helper_def_prop_by_index (result_p,
- i,
- capture_value,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
+ ecma_builtin_helper_def_prop_by_index (result_p, i, capture_value, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE);
ecma_free_value (capture_value);
}
@@ -1742,20 +1731,14 @@ ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, /**< RegExp object */
lit_utf8_size_t input_size;
lit_utf8_size_t input_length;
uint8_t input_flags = ECMA_STRING_FLAG_IS_ASCII;
- const lit_utf8_byte_t *input_buffer_p = ecma_string_get_chars (input_string_p,
- &input_size,
- &input_length,
- NULL,
- &input_flags);
+ const lit_utf8_byte_t *input_buffer_p =
+ ecma_string_get_chars (input_string_p, &input_size, &input_length, NULL, &input_flags);
const lit_utf8_byte_t *input_curr_p = input_buffer_p;
const lit_utf8_byte_t *input_end_p = input_buffer_p + input_size;
ecma_regexp_ctx_t re_ctx;
- ecma_regexp_initialize_context (&re_ctx,
- bc_p,
- input_buffer_p,
- input_end_p);
+ ecma_regexp_initialize_context (&re_ctx, bc_p, input_buffer_p, input_end_p);
/* 4. */
ecma_length_t index = 0;
@@ -1920,8 +1903,7 @@ match_found:
}
else
{
- match_length = lit_utf8_string_length (match_begin_p,
- (lit_utf8_size_t) (match_end_p - match_begin_p));
+ match_length = lit_utf8_string_length (match_begin_p, (lit_utf8_size_t) (match_end_p - match_begin_p));
}
ret_value = ecma_op_object_put (regexp_object_p,
@@ -2016,10 +1998,8 @@ ecma_regexp_search_helper (ecma_value_t regexp_arg, /**< regexp argument */
/* 5. */
if (prev_last_index != ecma_make_uint32_value (0))
{
- const ecma_value_t status = ecma_op_object_put (regexp_object_p,
- last_index_str_p,
- ecma_make_uint32_value (0),
- true);
+ const ecma_value_t status =
+ ecma_op_object_put (regexp_object_p, last_index_str_p, ecma_make_uint32_value (0), true);
if (ECMA_IS_VALUE_ERROR (status))
{
@@ -2140,11 +2120,8 @@ ecma_regexp_split_helper (ecma_value_t this_arg, /**< this value */
lit_utf8_size_t flags_size;
uint8_t flags_str_flags = ECMA_STRING_FLAG_IS_ASCII;
- const lit_utf8_byte_t *flags_buffer_p = ecma_string_get_chars (flags_str_p,
- &flags_size,
- NULL,
- NULL,
- &flags_str_flags);
+ const lit_utf8_byte_t *flags_buffer_p =
+ ecma_string_get_chars (flags_str_p, &flags_size, NULL, NULL, &flags_str_flags);
bool unicode = false;
bool sticky = false;
@@ -2260,10 +2237,7 @@ ecma_regexp_split_helper (ecma_value_t this_arg, /**< this value */
{
/* 24.a-b. */
ecma_value_t index_value = ecma_make_length_value (current_index);
- result = ecma_op_object_put (splitter_obj_p,
- lastindex_str_p,
- index_value,
- true);
+ result = ecma_op_object_put (splitter_obj_p, lastindex_str_p, index_value, true);
ecma_free_value (index_value);
@@ -2325,9 +2299,8 @@ ecma_regexp_split_helper (ecma_value_t this_arg, /**< this value */
/* 24.f.iv.1-4. */
JERRY_ASSERT (previous_index <= string_length && current_index <= string_length);
- ecma_string_t *const split_str_p = ecma_string_substr (string_p,
- (lit_utf8_size_t) previous_index,
- (lit_utf8_size_t) current_index);
+ ecma_string_t *const split_str_p =
+ ecma_string_substr (string_p, (lit_utf8_size_t) previous_index, (lit_utf8_size_t) current_index);
result = ecma_builtin_helper_def_prop_by_index (array_p,
array_length++,
@@ -2456,21 +2429,15 @@ cleanup_string:
lit_utf8_size_t string_size;
lit_utf8_size_t string_length;
uint8_t string_flags = ECMA_STRING_FLAG_IS_ASCII;
- const lit_utf8_byte_t *string_buffer_p = ecma_string_get_chars (string_p,
- &string_size,
- &string_length,
- NULL,
- &string_flags);
+ const lit_utf8_byte_t *string_buffer_p =
+ ecma_string_get_chars (string_p, &string_size, &string_length, NULL, &string_flags);
const lit_utf8_byte_t *current_str_p = string_buffer_p;
const lit_utf8_byte_t *previous_str_p = string_buffer_p;
const lit_utf8_byte_t *const string_end_p = string_buffer_p + string_size;
ecma_regexp_ctx_t re_ctx;
- ecma_regexp_initialize_context (&re_ctx,
- bc_p,
- string_buffer_p,
- string_buffer_p + string_size);
+ ecma_regexp_initialize_context (&re_ctx, bc_p, string_buffer_p, string_buffer_p + string_size);
uint8_t *const bc_start_p = (uint8_t *) (bc_p + 1);
@@ -2516,8 +2483,8 @@ cleanup_string:
}
/* 13.c.iii.1. */
- ecma_string_t *const str_p = ecma_new_ecma_string_from_utf8 (previous_str_p,
- (lit_utf8_size_t) (current_str_p - previous_str_p));
+ ecma_string_t *const str_p =
+ ecma_new_ecma_string_from_utf8 (previous_str_p, (lit_utf8_size_t) (current_str_p - previous_str_p));
result = ecma_builtin_helper_def_prop_by_index (array_p,
array_length++,
@@ -2559,8 +2526,8 @@ cleanup_string:
current_str_p = matched_p;
}
- ecma_string_t *const str_p = ecma_new_ecma_string_from_utf8 (previous_str_p,
- (lit_utf8_size_t) (string_end_p - previous_str_p));
+ ecma_string_t *const str_p =
+ ecma_new_ecma_string_from_utf8 (previous_str_p, (lit_utf8_size_t) (string_end_p - previous_str_p));
result = ecma_builtin_helper_def_prop_by_index (array_p,
array_length++,
@@ -2616,11 +2583,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
uint8_t string_flags = ECMA_STRING_FLAG_IS_ASCII;
lit_utf8_size_t string_length;
- ctx_p->string_p = ecma_string_get_chars (string_p,
- &(ctx_p->string_size),
- &string_length,
- NULL,
- &string_flags);
+ ctx_p->string_p = ecma_string_get_chars (string_p, &(ctx_p->string_size), &string_length, NULL, &string_flags);
const lit_utf8_byte_t *const string_end_p = ctx_p->string_p + ctx_p->string_size;
const uint8_t *const bc_start_p = (const uint8_t *) (bc_p + 1);
@@ -2630,14 +2593,11 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
ecma_length_t index;
ecma_regexp_ctx_t re_ctx;
- ecma_regexp_initialize_context (&re_ctx,
- bc_p,
- ctx_p->string_p,
- string_end_p);
+ ecma_regexp_initialize_context (&re_ctx, bc_p, ctx_p->string_p, string_end_p);
/* lastIndex must be accessed to remain consistent with the standard, even though we may not need the value. */
- ecma_value_t lastindex_value = ecma_op_object_get_by_magic_id ((ecma_object_t *) re_obj_p,
- LIT_MAGIC_STRING_LASTINDEX_UL);
+ ecma_value_t lastindex_value =
+ ecma_op_object_get_by_magic_id ((ecma_object_t *) re_obj_p, LIT_MAGIC_STRING_LASTINDEX_UL);
ecma_value_t result = ecma_op_to_length (lastindex_value, &index);
ecma_free_value (lastindex_value);
@@ -2729,10 +2689,8 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
ecma_collection_push_back (arguments_p, ecma_make_string_value (string_p));
ecma_object_t *function_p = ecma_get_object_from_value (replace_arg);
- result = ecma_op_function_call (function_p,
- ECMA_VALUE_UNDEFINED,
- arguments_p->buffer_p,
- arguments_p->item_count);
+ result =
+ ecma_op_function_call (function_p, ECMA_VALUE_UNDEFINED, arguments_p->buffer_p, arguments_p->item_count);
ecma_collection_free (arguments_p);
@@ -2818,8 +2776,7 @@ ecma_regexp_replace_helper_fast (ecma_replace_context_t *ctx_p, /**<replace cont
if ((ctx_p->flags & RE_FLAG_UNICODE) != 0)
{
index++;
- const lit_code_point_t cp = ecma_regexp_unicode_advance (&current_p,
- string_end_p);
+ const lit_code_point_t cp = ecma_regexp_unicode_advance (&current_p, string_end_p);
if (cp > LIT_UTF16_CODE_UNIT_MAX)
{
@@ -2951,10 +2908,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
}
#if !JERRY_ESNEXT
- result = ecma_regexp_replace_helper_fast (&replace_ctx,
- (ecma_extended_object_t *) this_obj_p,
- string_p,
- replace_arg);
+ result = ecma_regexp_replace_helper_fast (&replace_ctx, (ecma_extended_object_t *) this_obj_p, string_p, replace_arg);
goto cleanup_replace;
#else /* JERRY_ESNEXT */
@@ -2969,15 +2923,12 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
if (ecma_op_is_callable (result))
{
ecma_extended_object_t *function_p = (ecma_extended_object_t *) ecma_get_object_from_value (result);
- if (ecma_object_class_is (this_obj_p, ECMA_OBJECT_CLASS_REGEXP)
- && ecma_builtin_is_regexp_exec (function_p))
+ if (ecma_object_class_is (this_obj_p, ECMA_OBJECT_CLASS_REGEXP) && ecma_builtin_is_regexp_exec (function_p))
{
ecma_deref_object ((ecma_object_t *) function_p);
- result = ecma_regexp_replace_helper_fast (&replace_ctx,
- (ecma_extended_object_t *) this_obj_p,
- string_p,
- replace_arg);
+ result =
+ ecma_regexp_replace_helper_fast (&replace_ctx, (ecma_extended_object_t *) this_obj_p, string_p, replace_arg);
goto cleanup_replace;
}
@@ -3079,10 +3030,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
last_index = ecma_make_length_value (index);
/* 10.d.iii.3.c */
- result = ecma_op_object_put (this_obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
- last_index,
- true);
+ result = ecma_op_object_put (this_obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), last_index, true);
ecma_free_value (last_index);
@@ -3103,11 +3051,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
}
uint8_t string_flags = ECMA_STRING_FLAG_IS_ASCII;
- replace_ctx.string_p = ecma_string_get_chars (string_p,
- &(replace_ctx.string_size),
- NULL,
- NULL,
- &string_flags);
+ replace_ctx.string_p = ecma_string_get_chars (string_p, &(replace_ctx.string_size), NULL, NULL, &string_flags);
/* 14. */
replace_ctx.builder = ecma_stringbuilder_create ();
@@ -3120,8 +3064,7 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
const lit_utf8_byte_t *const string_end_p = replace_ctx.string_p + replace_ctx.string_size;
/* 16. */
- for (ecma_value_t *current_p = results_p->buffer_p;
- current_p < results_p->buffer_p + results_p->item_count;
+ for (ecma_value_t *current_p = results_p->buffer_p; current_p < results_p->buffer_p + results_p->item_count;
current_p++)
{
/* 16.a */
@@ -3236,8 +3179,8 @@ ecma_regexp_replace_helper (ecma_value_t this_arg, /**< this argument */
}
ecma_stringbuilder_append_raw (&replace_ctx.builder,
- source_position_p,
- (lit_utf8_size_t) (match_position_p - source_position_p));
+ source_position_p,
+ (lit_utf8_size_t) (match_position_p - source_position_p));
replace_ctx.match_byte_pos = (lit_utf8_size_t) (match_position_p - replace_ctx.string_p);
if ((string_flags & ECMA_STRING_FLAG_IS_ASCII) && matched_str_size == matched_str_length)
@@ -3407,10 +3350,8 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
ecma_free_value (full_unicode_value);
#endif /* JERRY_ESNEXT */
- ecma_value_t set_status = ecma_op_object_put (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
- ecma_make_uint32_value (0),
- true);
+ ecma_value_t set_status =
+ ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), ecma_make_uint32_value (0), true);
if (ECMA_IS_VALUE_ERROR (set_status))
{
@@ -3494,19 +3435,15 @@ ecma_regexp_match_helper (ecma_value_t this_arg, /**< this argument */
index = ecma_op_advance_string_index (str_p, index, full_unicode);
last_index = ecma_make_length_value (index);
- ecma_value_t next_set_status = ecma_op_object_put (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
- last_index,
- true);
+ ecma_value_t next_set_status =
+ ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), last_index, true);
#else /* !JERRY_ESNEXT */
ecma_number_t index = ecma_get_number_from_value (last_index);
ecma_free_value (last_index);
last_index = ecma_make_number_value (index + 1);
- ecma_value_t next_set_status = ecma_op_object_put (obj_p,
- ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL),
- last_index,
- true);
+ ecma_value_t next_set_status =
+ ecma_op_object_put (obj_p, ecma_get_magic_string (LIT_MAGIC_STRING_LASTINDEX_UL), last_index, true);
#endif /* JERRY_ESNEXT */
ecma_free_value (last_index);
diff --git a/jerry-core/ecma/operations/ecma-regexp-object.h b/jerry-core/ecma/operations/ecma-regexp-object.h
index f4cf98d7..5c97049f 100644
--- a/jerry-core/ecma/operations/ecma-regexp-object.h
+++ b/jerry-core/ecma/operations/ecma-regexp-object.h
@@ -16,11 +16,12 @@
#ifndef ECMA_REGEXP_OBJECT_H
#define ECMA_REGEXP_OBJECT_H
-#if JERRY_BUILTIN_REGEXP
-
#include "ecma-globals.h"
+
#include "re-compiler.h"
+#if JERRY_BUILTIN_REGEXP
+
/** \addtogroup ecma ECMA
* @{
*
@@ -35,13 +36,13 @@
*/
typedef enum
{
- RE_FLAG_EMPTY = 0u, /* Empty RegExp flags */
- RE_FLAG_GLOBAL = (1u << 1), /**< ECMA-262 v5, 15.10.7.2 */
+ RE_FLAG_EMPTY = 0u, /* Empty RegExp flags */
+ RE_FLAG_GLOBAL = (1u << 1), /**< ECMA-262 v5, 15.10.7.2 */
RE_FLAG_IGNORE_CASE = (1u << 2), /**< ECMA-262 v5, 15.10.7.3 */
- RE_FLAG_MULTILINE = (1u << 3), /**< ECMA-262 v5, 15.10.7.4 */
- RE_FLAG_STICKY = (1u << 4), /**< ECMA-262 v6, 21.2.5.12 */
- RE_FLAG_UNICODE = (1u << 5), /**< ECMA-262 v6, 21.2.5.15 */
- RE_FLAG_DOTALL = (1u << 6) /**< ECMA-262 v9, 21.2.5.3 */
+ RE_FLAG_MULTILINE = (1u << 3), /**< ECMA-262 v5, 15.10.7.4 */
+ RE_FLAG_STICKY = (1u << 4), /**< ECMA-262 v6, 21.2.5.12 */
+ RE_FLAG_UNICODE = (1u << 5), /**< ECMA-262 v6, 21.2.5.15 */
+ RE_FLAG_DOTALL = (1u << 6) /**< ECMA-262 v9, 21.2.5.3 */
/* Bits from bit 13 is reserved for function types (see CBC_FUNCTION_TYPE_SHIFT). */
} ecma_regexp_flags_t;
@@ -51,14 +52,14 @@ typedef enum
*/
typedef enum
{
- RE_ESCAPE__START, /**< escapes start */
+ RE_ESCAPE__START, /**< escapes start */
RE_ESCAPE_DIGIT = RE_ESCAPE__START, /**< digit */
- RE_ESCAPE_NOT_DIGIT, /**< not digit */
- RE_ESCAPE_WORD_CHAR, /**< word char */
- RE_ESCAPE_NOT_WORD_CHAR, /**< not word char */
- RE_ESCAPE_WHITESPACE, /**< whitespace */
- RE_ESCAPE_NOT_WHITESPACE, /**< not whitespace */
- RE_ESCAPE__COUNT, /**< escape count */
+ RE_ESCAPE_NOT_DIGIT, /**< not digit */
+ RE_ESCAPE_WORD_CHAR, /**< word char */
+ RE_ESCAPE_NOT_WORD_CHAR, /**< not word char */
+ RE_ESCAPE_WHITESPACE, /**< whitespace */
+ RE_ESCAPE_NOT_WHITESPACE, /**< not whitespace */
+ RE_ESCAPE__COUNT, /**< escape count */
} ecma_class_escape_t;
/**
@@ -77,9 +78,9 @@ typedef enum
*/
typedef enum
{
- RE_CLASS_HAS_CHARS = (1 << 5), /**< contains individual characters */
- RE_CLASS_HAS_RANGES = (1 << 6), /**< contains character ranges */
- RE_CLASS_INVERT = (1 << 7), /**< inverted */
+ RE_CLASS_HAS_CHARS = (1 << 5), /**< contains individual characters */
+ RE_CLASS_HAS_RANGES = (1 << 6), /**< contains character ranges */
+ RE_CLASS_INVERT = (1 << 7), /**< inverted */
} ecma_char_class_flags_t;
/**
@@ -88,10 +89,10 @@ typedef enum
typedef struct
{
const lit_utf8_byte_t *begin_p; /**< capture start pointer */
- const lit_utf8_byte_t *end_p; /**< capture end pointer */
- const uint8_t *bc_p; /**< group bytecode pointer */
- uint32_t iterator; /**< iteration counter */
- uint32_t subcapture_count; /**< number of nested capturing groups */
+ const lit_utf8_byte_t *end_p; /**< capture end pointer */
+ const uint8_t *bc_p; /**< group bytecode pointer */
+ uint32_t iterator; /**< iteration counter */
+ uint32_t subcapture_count; /**< number of nested capturing groups */
} ecma_regexp_capture_t;
/**
@@ -100,10 +101,10 @@ typedef struct
typedef struct
{
const lit_utf8_byte_t *begin_p; /**< substring start pointer */
- const uint8_t *bc_p; /**< group bytecode pointer */
- uint32_t iterator; /**< iteration counter */
- uint32_t subcapture_start; /**< first nested capturing group index */
- uint32_t subcapture_count; /**< number of nested capturing groups */
+ const uint8_t *bc_p; /**< group bytecode pointer */
+ uint32_t iterator; /**< iteration counter */
+ uint32_t subcapture_start; /**< first nested capturing group index */
+ uint32_t subcapture_count; /**< number of nested capturing groups */
} ecma_regexp_non_capture_t;
/**
@@ -111,8 +112,7 @@ typedef struct
*/
#define ECMA_RE_IS_CAPTURE_DEFINED(c) ((c)->begin_p != NULL)
-ecma_value_t
-ecma_regexp_get_capture_value (const ecma_regexp_capture_t *const capture_p);
+ecma_value_t ecma_regexp_get_capture_value (const ecma_regexp_capture_t *const capture_p);
#if (JERRY_STACK_LIMIT != 0)
/**
@@ -141,14 +141,14 @@ ecma_regexp_get_capture_value (const ecma_regexp_capture_t *const capture_p);
*/
typedef struct
{
- const lit_utf8_byte_t *input_start_p; /**< start of input string */
- const lit_utf8_byte_t *input_end_p; /**< end of input string */
- uint32_t captures_count; /**< number of capture groups */
- uint32_t non_captures_count; /**< number of non-capture groups */
- ecma_regexp_capture_t *captures_p; /**< capturing groups */
- ecma_regexp_non_capture_t *non_captures_p; /**< non-capturing groups */
- uint16_t flags; /**< RegExp flags */
- uint8_t char_size; /**< size of encoded characters */
+ const lit_utf8_byte_t *input_start_p; /**< start of input string */
+ const lit_utf8_byte_t *input_end_p; /**< end of input string */
+ uint32_t captures_count; /**< number of capture groups */
+ uint32_t non_captures_count; /**< number of non-capture groups */
+ ecma_regexp_capture_t *captures_p; /**< capturing groups */
+ ecma_regexp_non_capture_t *non_captures_p; /**< non-capturing groups */
+ uint16_t flags; /**< RegExp flags */
+ uint8_t char_size; /**< size of encoded characters */
} ecma_regexp_ctx_t;
/**
@@ -169,14 +169,11 @@ lit_code_point_t ecma_regexp_unicode_advance (const lit_utf8_byte_t **str_p, con
#endif /* JERRY_ESNEXT */
ecma_object_t *ecma_op_regexp_alloc (ecma_object_t *new_target_obj_p);
-ecma_value_t ecma_regexp_exec_helper (ecma_object_t *regexp_object_p,
- ecma_string_t *input_string_p);
+ecma_value_t ecma_regexp_exec_helper (ecma_object_t *regexp_object_p, ecma_string_t *input_string_p);
ecma_string_t *ecma_regexp_read_pattern_str_helper (ecma_value_t pattern_arg);
lit_code_point_t ecma_regexp_canonicalize_char (lit_code_point_t ch, bool unicode);
ecma_value_t ecma_regexp_parse_flags (ecma_string_t *flags_str_p, uint16_t *flags_p);
-void ecma_regexp_create_and_initialize_props (ecma_object_t *re_object_p,
- ecma_string_t *source_p,
- uint16_t flags);
+void ecma_regexp_create_and_initialize_props (ecma_object_t *re_object_p, ecma_string_t *source_p, uint16_t flags);
ecma_value_t ecma_regexp_replace_helper (ecma_value_t this_arg, ecma_value_t string_arg, ecma_value_t replace_arg);
ecma_value_t ecma_regexp_search_helper (ecma_value_t regexp_arg, ecma_value_t string_arg);
ecma_value_t ecma_regexp_split_helper (ecma_value_t this_arg, ecma_value_t string_arg, ecma_value_t limit_arg);
@@ -185,12 +182,9 @@ ecma_value_t ecma_regexp_match_helper (ecma_value_t this_arg, ecma_value_t strin
ecma_value_t ecma_op_regexp_exec (ecma_value_t this_arg, ecma_string_t *str_p);
ecma_value_t ecma_op_create_regexp_from_bytecode (ecma_object_t *regexp_obj_p, re_compiled_code_t *bc_p);
-ecma_value_t ecma_op_create_regexp_from_pattern (ecma_object_t *regexp_obj_p,
- ecma_value_t pattern_value,
- ecma_value_t flags_value);
-ecma_value_t ecma_op_create_regexp_with_flags (ecma_object_t *regexp_obj_p,
- ecma_value_t pattern_value,
- uint16_t flags);
+ecma_value_t
+ecma_op_create_regexp_from_pattern (ecma_object_t *regexp_obj_p, ecma_value_t pattern_value, ecma_value_t flags_value);
+ecma_value_t ecma_op_create_regexp_with_flags (ecma_object_t *regexp_obj_p, ecma_value_t pattern_value, uint16_t flags);
/**
* @}
* @}
diff --git a/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.c b/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.c
index 2ac0c691..d08031e3 100644
--- a/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.c
+++ b/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.c
@@ -13,6 +13,8 @@
* limitations under the License.
*/
+#include "ecma-shared-arraybuffer-object.h"
+
#include "ecma-arraybuffer-object.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
@@ -21,8 +23,8 @@
#include "ecma-globals.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
-#include "ecma-shared-arraybuffer-object.h"
#include "ecma-typedarray-object.h"
+
#include "jcontext.h"
/** \addtogroup ecma ECMA
@@ -60,7 +62,7 @@ ecma_shared_arraybuffer_new_object (uint32_t length) /**< length of the SharedAr
*/
ecma_value_t
ecma_op_create_shared_arraybuffer_object (const ecma_value_t *arguments_list_p, /**< list of arguments that
- * are passed to String constructor */
+ * are passed to String constructor */
uint32_t arguments_list_len) /**< length of the arguments' list */
{
JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
diff --git a/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.h b/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.h
index f0bc2ede..1053a4b9 100644
--- a/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.h
+++ b/jerry-core/ecma/operations/ecma-shared-arraybuffer-object.h
@@ -27,19 +27,15 @@
* @{
*/
-ecma_value_t
-ecma_op_create_shared_arraybuffer_object (const ecma_value_t *, uint32_t);
+ecma_value_t ecma_op_create_shared_arraybuffer_object (const ecma_value_t *, uint32_t);
/**
* Helper functions for SharedArrayBuffer.
*/
-ecma_object_t *
-ecma_shared_arraybuffer_new_object (uint32_t lengh);
+ecma_object_t *ecma_shared_arraybuffer_new_object (uint32_t lengh);
#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */
-bool
-ecma_is_shared_arraybuffer (ecma_value_t val);
-bool
-ecma_object_is_shared_arraybuffer (ecma_object_t *val);
+bool ecma_is_shared_arraybuffer (ecma_value_t val);
+bool ecma_object_is_shared_arraybuffer (ecma_object_t *val);
/**
* @}
diff --git a/jerry-core/ecma/operations/ecma-string-object.c b/jerry-core/ecma/operations/ecma-string-object.c
index 23f53a7b..72f7f3aa 100644
--- a/jerry-core/ecma/operations/ecma-string-object.c
+++ b/jerry-core/ecma/operations/ecma-string-object.c
@@ -13,16 +13,18 @@
* limitations under the License.
*/
+#include "ecma-string-object.h"
+
#include "ecma-alloc.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
-#include "ecma-string-object.h"
-#include "ecma-function-object.h"
+#include "ecma-objects.h"
+
#include "jcontext.h"
/** \addtogroup ecma ECMA
@@ -45,8 +47,7 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of
are passed to String constructor */
uint32_t arguments_list_len) /**< length of the arguments' list */
{
- JERRY_ASSERT (arguments_list_len == 0
- || arguments_list_p != NULL);
+ JERRY_ASSERT (arguments_list_len == 0 || arguments_list_p != NULL);
ecma_value_t prim_value = ecma_make_magic_string_value (LIT_MAGIC_STRING__EMPTY);
@@ -80,9 +81,8 @@ ecma_op_create_string_object (const ecma_value_t *arguments_list_p, /**< list of
}
}
#endif /* JERRY_ESNEXT */
- ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p =
+ ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_STRING;
diff --git a/jerry-core/ecma/operations/ecma-string-object.h b/jerry-core/ecma/operations/ecma-string-object.h
index da0d7431..0ebb2c12 100644
--- a/jerry-core/ecma/operations/ecma-string-object.h
+++ b/jerry-core/ecma/operations/ecma-string-object.h
@@ -25,13 +25,12 @@
* @{
*/
-ecma_value_t
-ecma_op_create_string_object (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);
+ecma_value_t ecma_op_create_string_object (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);
-void
-ecma_op_string_list_lazy_property_names (ecma_object_t *obj_p, ecma_collection_t *prop_names_p,
- ecma_property_counter_t *prop_counter_p,
- jerry_property_filter_t filter);
+void ecma_op_string_list_lazy_property_names (ecma_object_t *obj_p,
+ ecma_collection_t *prop_names_p,
+ ecma_property_counter_t *prop_counter_p,
+ jerry_property_filter_t filter);
/**
* @}
diff --git a/jerry-core/ecma/operations/ecma-symbol-object.c b/jerry-core/ecma/operations/ecma-symbol-object.c
index 589ef7f1..22cd9d49 100644
--- a/jerry-core/ecma/operations/ecma-symbol-object.c
+++ b/jerry-core/ecma/operations/ecma-symbol-object.c
@@ -13,15 +13,17 @@
* limitations under the License.
*/
+#include "ecma-symbol-object.h"
+
#include "ecma-alloc.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
-#include "ecma-symbol-object.h"
+#include "ecma-objects.h"
+
#include "lit-char-helpers.h"
#if JERRY_ESNEXT
@@ -85,9 +87,8 @@ ecma_op_create_symbol_object (const ecma_value_t value) /**< symbol value */
JERRY_ASSERT (ecma_is_value_symbol (value));
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_SYMBOL_PROTOTYPE);
- ecma_object_t *object_p = ecma_create_object (prototype_obj_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p =
+ ecma_create_object (prototype_obj_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_SYMBOL;
diff --git a/jerry-core/ecma/operations/ecma-symbol-object.h b/jerry-core/ecma/operations/ecma-symbol-object.h
index 01336767..1ca59930 100644
--- a/jerry-core/ecma/operations/ecma-symbol-object.h
+++ b/jerry-core/ecma/operations/ecma-symbol-object.h
@@ -16,9 +16,10 @@
#ifndef ECMA_SYMBOL_H
#define ECMA_SYMBOL_H
-#if JERRY_ESNEXT
#include "ecma-globals.h"
+#if JERRY_ESNEXT
+
/** \addtogroup ecma ECMA
* @{
*
@@ -26,23 +27,17 @@
* @{
*/
-ecma_value_t
-ecma_op_create_symbol (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);
+ecma_value_t ecma_op_create_symbol (const ecma_value_t *arguments_list_p, uint32_t arguments_list_len);
-ecma_value_t
-ecma_op_create_symbol_object (const ecma_value_t value);
+ecma_value_t ecma_op_create_symbol_object (const ecma_value_t value);
-bool
-ecma_prop_name_is_symbol (ecma_string_t *string_p);
+bool ecma_prop_name_is_symbol (ecma_string_t *string_p);
-ecma_value_t
-ecma_get_symbol_description (ecma_string_t *symbol_p);
+ecma_value_t ecma_get_symbol_description (ecma_string_t *symbol_p);
-ecma_value_t
-ecma_symbol_this_value (ecma_value_t this_arg);
+ecma_value_t ecma_symbol_this_value (ecma_value_t this_arg);
-ecma_value_t
-ecma_get_symbol_descriptive_string (ecma_value_t symbol_value);
+ecma_value_t ecma_get_symbol_descriptive_string (ecma_value_t symbol_value);
#endif /* JERRY_ESNEXT */
/**
diff --git a/jerry-core/ecma/operations/ecma-typedarray-object.c b/jerry-core/ecma/operations/ecma-typedarray-object.c
index 79245cb8..95af9216 100644
--- a/jerry-core/ecma/operations/ecma-typedarray-object.c
+++ b/jerry-core/ecma/operations/ecma-typedarray-object.c
@@ -13,23 +13,25 @@
* limitations under the License.
*/
+#include "ecma-typedarray-object.h"
+
#include <math.h>
-#include "ecma-iterator-object.h"
-#include "ecma-typedarray-object.h"
#include "ecma-arraybuffer-object.h"
-#include "ecma-shared-arraybuffer-object.h"
-#include "ecma-function-object.h"
-#include "ecma-bigint.h"
#include "ecma-big-uint.h"
+#include "ecma-bigint.h"
#include "ecma-builtin-helpers.h"
-#include "ecma-objects.h"
-#include "ecma-objects-general.h"
#include "ecma-builtins.h"
#include "ecma-exceptions.h"
+#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
+#include "ecma-iterator-object.h"
+#include "ecma-objects-general.h"
+#include "ecma-objects.h"
+#include "ecma-shared-arraybuffer-object.h"
+
#include "jcontext.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -44,36 +46,34 @@
/**
* Read and copy a number from a given buffer to a value.
**/
-#define ECMA_TYPEDARRAY_GET_ELEMENT(src_p, num, type) \
- do \
- { \
- if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \
- { \
- num = *(type *) ((void*) src_p); \
- } \
- else \
- { \
- memcpy (&num, (void *) src_p, sizeof (type)); \
- } \
- } \
- while (0)
+#define ECMA_TYPEDARRAY_GET_ELEMENT(src_p, num, type) \
+ do \
+ { \
+ if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \
+ { \
+ num = *(type *) ((void *) src_p); \
+ } \
+ else \
+ { \
+ memcpy (&num, (void *) src_p, sizeof (type)); \
+ } \
+ } while (0)
/**
* Copy a number from a value to the given buffer
**/
-#define ECMA_TYPEDARRAY_SET_ELEMENT(src_p, num, type) \
- do \
- { \
- if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \
- { \
- *(type *) ((void*) src_p) = num; \
- } \
- else \
- { \
- memcpy ((void*) src_p, &num, sizeof (type)); \
- } \
- } \
- while (0)
+#define ECMA_TYPEDARRAY_SET_ELEMENT(src_p, num, type) \
+ do \
+ { \
+ if (JERRY_LIKELY ((((uintptr_t) (src_p)) & (sizeof (type) - 1)) == 0)) \
+ { \
+ *(type *) ((void *) src_p) = num; \
+ } \
+ else \
+ { \
+ memcpy ((void *) src_p, &num, sizeof (type)); \
+ } \
+ } while (0)
/**
* Read an int8_t value from the given arraybuffer
@@ -304,10 +304,9 @@ ecma_typedarray_set_uint8_clamped_element (lit_utf8_byte_t *dst_p, /**< the loca
{
clamped = (uint8_t) result_num;
- if (clamped + 0.5 < result_num
- || (clamped + 0.5 == result_num && (clamped % 2) == 1))
+ if (clamped + 0.5 < result_num || (clamped + 0.5 == result_num && (clamped % 2) == 1))
{
- clamped ++;
+ clamped++;
}
}
@@ -520,21 +519,20 @@ ecma_typedarray_set_bigint_element (lit_utf8_byte_t *dst_p, /**< the location in
/**
* List of typedarray getters based on their builtin id
*/
-static const ecma_typedarray_getter_fn_t ecma_typedarray_getters[] =
-{
- ecma_typedarray_get_int8_element, /**< Int8Array */
- ecma_typedarray_get_uint8_element, /**< Uint8Array */
- ecma_typedarray_get_uint8_element, /**< Uint8ClampedArray */
- ecma_typedarray_get_int16_element, /**< Int16Array */
+static const ecma_typedarray_getter_fn_t ecma_typedarray_getters[] = {
+ ecma_typedarray_get_int8_element, /**< Int8Array */
+ ecma_typedarray_get_uint8_element, /**< Uint8Array */
+ ecma_typedarray_get_uint8_element, /**< Uint8ClampedArray */
+ ecma_typedarray_get_int16_element, /**< Int16Array */
ecma_typedarray_get_uint16_element, /**< Int32Array */
- ecma_typedarray_get_int32_element, /**< Uint32Array */
+ ecma_typedarray_get_int32_element, /**< Uint32Array */
ecma_typedarray_get_uint32_element, /**< Uint32Array */
- ecma_typedarray_get_float_element, /**< Float32Array */
+ ecma_typedarray_get_float_element, /**< Float32Array */
#if JERRY_NUMBER_TYPE_FLOAT64
ecma_typedarray_get_double_element, /**< Float64Array */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_BIGINT
- ecma_typedarray_get_bigint64_element, /**< BigInt64Array*/
+ ecma_typedarray_get_bigint64_element, /**< BigInt64Array*/
ecma_typedarray_get_biguint64_element, /**< BigUint64Array */
#endif /* JERRY_BUILTIN_BIGINT */
};
@@ -542,30 +540,28 @@ static const ecma_typedarray_getter_fn_t ecma_typedarray_getters[] =
/**
* List of typedarray setters based on their builtin id
*/
-static const ecma_typedarray_setter_fn_t ecma_typedarray_setters[] =
-{
- ecma_typedarray_set_int8_element, /**< Int8Array */
- ecma_typedarray_set_uint8_element, /**< Uint8Array */
+static const ecma_typedarray_setter_fn_t ecma_typedarray_setters[] = {
+ ecma_typedarray_set_int8_element, /**< Int8Array */
+ ecma_typedarray_set_uint8_element, /**< Uint8Array */
ecma_typedarray_set_uint8_clamped_element, /**< Uint8ClampedArray */
- ecma_typedarray_set_int16_element, /**< Int16Array */
- ecma_typedarray_set_uint16_element, /**< Int32Array */
- ecma_typedarray_set_int32_element, /**< Uint32Array */
- ecma_typedarray_set_uint32_element, /**< Uint32Array */
- ecma_typedarray_set_float_element, /**< Float32Array */
+ ecma_typedarray_set_int16_element, /**< Int16Array */
+ ecma_typedarray_set_uint16_element, /**< Int32Array */
+ ecma_typedarray_set_int32_element, /**< Uint32Array */
+ ecma_typedarray_set_uint32_element, /**< Uint32Array */
+ ecma_typedarray_set_float_element, /**< Float32Array */
#if JERRY_NUMBER_TYPE_FLOAT64
- ecma_typedarray_set_double_element, /**< Float64Array */
+ ecma_typedarray_set_double_element, /**< Float64Array */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_BIGINT
- ecma_typedarray_set_bigint_element, /**< BigInt64Array */
- ecma_typedarray_set_bigint_element, /**< BigUInt64Array */
+ ecma_typedarray_set_bigint_element, /**< BigInt64Array */
+ ecma_typedarray_set_bigint_element, /**< BigUInt64Array */
#endif /* JERRY_BUILTIN_BIGINT */
};
/**
* List of typedarray element shift sizes based on their builtin id
*/
-static const uint8_t ecma_typedarray_element_shift_sizes[] =
-{
+static const uint8_t ecma_typedarray_element_shift_sizes[] = {
0, /**< Int8Array */
0, /**< Uint8Array */
0, /**< Uint8ClampedArray */
@@ -586,22 +582,21 @@ static const uint8_t ecma_typedarray_element_shift_sizes[] =
/**
* List of typedarray class magic strings based on their builtin id
*/
-static const uint16_t ecma_typedarray_magic_string_list[] =
-{
- (uint16_t) LIT_MAGIC_STRING_INT8_ARRAY_UL, /**< Int8Array */
- (uint16_t) LIT_MAGIC_STRING_UINT8_ARRAY_UL, /**< Uint8Array */
+static const uint16_t ecma_typedarray_magic_string_list[] = {
+ (uint16_t) LIT_MAGIC_STRING_INT8_ARRAY_UL, /**< Int8Array */
+ (uint16_t) LIT_MAGIC_STRING_UINT8_ARRAY_UL, /**< Uint8Array */
(uint16_t) LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL, /**< Uint8ClampedArray */
- (uint16_t) LIT_MAGIC_STRING_INT16_ARRAY_UL, /**< Int16Array */
- (uint16_t) LIT_MAGIC_STRING_UINT16_ARRAY_UL, /**< Uint16Array */
- (uint16_t) LIT_MAGIC_STRING_INT32_ARRAY_UL, /**< Int32Array */
- (uint16_t) LIT_MAGIC_STRING_UINT32_ARRAY_UL, /**< Uint32Array */
- (uint16_t) LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, /**< Float32Array */
+ (uint16_t) LIT_MAGIC_STRING_INT16_ARRAY_UL, /**< Int16Array */
+ (uint16_t) LIT_MAGIC_STRING_UINT16_ARRAY_UL, /**< Uint16Array */
+ (uint16_t) LIT_MAGIC_STRING_INT32_ARRAY_UL, /**< Int32Array */
+ (uint16_t) LIT_MAGIC_STRING_UINT32_ARRAY_UL, /**< Uint32Array */
+ (uint16_t) LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, /**< Float32Array */
#if JERRY_NUMBER_TYPE_FLOAT64
- (uint16_t) LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, /**< Float64Array */
+ (uint16_t) LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, /**< Float64Array */
#endif /* JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_BIGINT
- (uint16_t) LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, /**< BigInt64Array */
- (uint16_t) LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, /**< BigUInt64Array */
+ (uint16_t) LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, /**< BigInt64Array */
+ (uint16_t) LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, /**< BigUInt64Array */
#endif /* JERRY_BUILTIN_BIGINT */
};
@@ -811,9 +806,8 @@ ecma_typedarray_create_object_with_length (uint32_t array_length, /**< length of
#if JERRY_ERROR_MESSAGES
ecma_value_t array_length_value = ecma_make_number_value (array_length);
- ecma_value_t result = ecma_raise_standard_error_with_format (JERRY_ERROR_RANGE,
- "Invalid typed array length: %",
- array_length_value);
+ ecma_value_t result =
+ ecma_raise_standard_error_with_format (JERRY_ERROR_RANGE, "Invalid typed array length: %", array_length_value);
ecma_free_value (array_length_value);
return result;
#else /* !JERRY_ERROR_MESSAGES */
@@ -837,8 +831,8 @@ ecma_typedarray_create_object_with_length (uint32_t array_length, /**< length of
ecma_object_t *ctor_proto_p = ecma_get_object_from_value (ctor_proto);
- ecma_object_t *prototype_p = ecma_op_get_prototype_from_constructor (ctor_proto_p,
- ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE);
+ ecma_object_t *prototype_p =
+ ecma_op_get_prototype_from_constructor (ctor_proto_p, ECMA_BUILTIN_ID_ARRAYBUFFER_PROTOTYPE);
ecma_deref_object (ctor_proto_p);
@@ -860,9 +854,7 @@ ecma_typedarray_create_object_with_length (uint32_t array_length, /**< length of
}
}
- ecma_object_t *object_p = ecma_create_object (proto_p,
- sizeof (ecma_extended_object_t),
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p = ecma_create_object (proto_p, sizeof (ecma_extended_object_t), ECMA_OBJECT_TYPE_CLASS);
ecma_extended_object_t *ext_object_p = (ecma_extended_object_t *) object_p;
ext_object_p->u.cls.type = ECMA_OBJECT_CLASS_TYPEDARRAY;
@@ -1173,11 +1165,8 @@ ecma_typedarray_create_object_with_object (ecma_value_t items_val, /**< the sour
uint32_t len = (uint32_t) length_index;
/* 10 */
- ecma_value_t new_typedarray = ecma_typedarray_create_object_with_length (len,
- NULL,
- proto_p,
- element_size_shift,
- typedarray_id);
+ ecma_value_t new_typedarray =
+ ecma_typedarray_create_object_with_length (len, NULL, proto_p, element_size_shift, typedarray_id);
if (ECMA_IS_VALUE_ERROR (new_typedarray))
{
@@ -1351,12 +1340,8 @@ ecma_op_typedarray_from (ecma_value_t this_val, /**< this value */
/* 6.e */
for (uint32_t index = 0; index < values_p->item_count; index++)
{
- ecma_value_t set_value = ecma_op_typedarray_from_helper (this_arg,
- *next_value_p++,
- index,
- func_object_p,
- buffer_p,
- setter_cb);
+ ecma_value_t set_value =
+ ecma_op_typedarray_from_helper (this_arg, *next_value_p++, index, func_object_p, buffer_p, setter_cb);
if (ECMA_IS_VALUE_ERROR (set_value))
{
@@ -1451,12 +1436,8 @@ ecma_op_typedarray_from (ecma_value_t this_val, /**< this value */
value = ECMA_VALUE_UNDEFINED;
}
- ecma_value_t set_value = ecma_op_typedarray_from_helper (this_arg,
- value,
- index,
- func_object_p,
- buffer_p,
- setter_cb);
+ ecma_value_t set_value =
+ ecma_op_typedarray_from_helper (this_arg, value, index, func_object_p, buffer_p, setter_cb);
if (ECMA_IS_VALUE_ERROR (set_value))
{
@@ -1483,7 +1464,7 @@ ecma_op_typedarray_from (ecma_value_t this_val, /**< this value */
*
* @return the pointer to the internal arraybuffer
*/
-extern inline ecma_object_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline ecma_object_t *JERRY_ATTR_ALWAYS_INLINE
ecma_typedarray_get_arraybuffer (ecma_object_t *typedarray_p) /**< the pointer to the typedarray object */
{
JERRY_ASSERT (ecma_object_is_typedarray (typedarray_p));
@@ -1637,11 +1618,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
#endif /* JERRY_ERROR_MESSAGES */
}
- return ecma_typedarray_create_object_with_length ((uint32_t) num,
- NULL,
- proto_p,
- element_size_shift,
- typedarray_id);
+ return ecma_typedarray_create_object_with_length ((uint32_t) num, NULL, proto_p, element_size_shift, typedarray_id);
}
ecma_object_t *obj_p = ecma_get_object_from_value (arguments_list_p[0]);
@@ -1650,29 +1627,20 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
{
/* 22.2.1.3 */
ecma_object_t *typedarray_p = obj_p;
- return ecma_typedarray_create_object_with_typedarray (typedarray_p,
- proto_p,
- element_size_shift,
- typedarray_id);
+ return ecma_typedarray_create_object_with_typedarray (typedarray_p, proto_p, element_size_shift, typedarray_id);
}
- if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER)
- && !ecma_object_is_shared_arraybuffer (obj_p))
+ if (!ecma_object_class_is (obj_p, ECMA_OBJECT_CLASS_ARRAY_BUFFER) && !ecma_object_is_shared_arraybuffer (obj_p))
{
/* 22.2.1.4 */
- return ecma_typedarray_create_object_with_object (arguments_list_p[0],
- proto_p,
- element_size_shift,
- typedarray_id);
+ return ecma_typedarray_create_object_with_object (arguments_list_p[0], proto_p, element_size_shift, typedarray_id);
}
/* 22.2.1.5 */
ecma_object_t *arraybuffer_p = obj_p;
- ecma_value_t byte_offset_value = ((arguments_list_len > 1) ? arguments_list_p[1]
- : ECMA_VALUE_UNDEFINED);
+ ecma_value_t byte_offset_value = ((arguments_list_len > 1) ? arguments_list_p[1] : ECMA_VALUE_UNDEFINED);
- ecma_value_t length_value = ((arguments_list_len > 2) ? arguments_list_p[2]
- : ECMA_VALUE_UNDEFINED);
+ ecma_value_t length_value = ((arguments_list_len > 2) ? arguments_list_p[2] : ECMA_VALUE_UNDEFINED);
ecma_number_t offset;
@@ -1720,8 +1688,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
if (ecma_is_value_undefined (length_value))
{
- if ((buf_byte_length % (uint32_t) (1 << element_size_shift) != 0)
- || (buf_byte_length < byte_offset))
+ if ((buf_byte_length % (uint32_t) (1 << element_size_shift) != 0) || (buf_byte_length < byte_offset))
{
return ecma_raise_range_error (invalid_length_p);
}
@@ -1737,8 +1704,7 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
new_byte_length = (uint32_t) new_length << element_size_shift;
- if (byte_offset > buf_byte_length
- || new_byte_length > (buf_byte_length - byte_offset))
+ if (byte_offset > buf_byte_length || new_byte_length > (buf_byte_length - byte_offset))
{
return ecma_raise_range_error (invalid_length_p);
}
@@ -1746,8 +1712,8 @@ ecma_op_create_typedarray (const ecma_value_t *arguments_list_p, /**< the arg li
bool needs_ext_typedarray_obj = (byte_offset != 0 || new_byte_length != buf_byte_length);
- size_t object_size = (needs_ext_typedarray_obj ? sizeof (ecma_extended_typedarray_object_t)
- : sizeof (ecma_extended_object_t));
+ size_t object_size =
+ (needs_ext_typedarray_obj ? sizeof (ecma_extended_typedarray_object_t) : sizeof (ecma_extended_object_t));
ecma_object_t *object_p = ecma_create_object (proto_p, object_size, ECMA_OBJECT_TYPE_CLASS);
@@ -1792,10 +1758,7 @@ ecma_typedarray_iterators_helper (ecma_value_t this_arg, /**< this argument */
JERRY_ASSERT (ecma_is_typedarray (this_arg));
ecma_object_t *prototype_obj_p = ecma_builtin_get (ECMA_BUILTIN_ID_ARRAY_ITERATOR_PROTOTYPE);
- return ecma_op_create_iterator_object (this_arg,
- prototype_obj_p,
- ECMA_OBJECT_CLASS_ARRAY_ITERATOR,
- kind);
+ return ecma_op_create_iterator_object (this_arg, prototype_obj_p, ECMA_OBJECT_CLASS_ARRAY_ITERATOR, kind);
} /* ecma_typedarray_iterators_helper */
/**
@@ -1857,7 +1820,7 @@ ecma_typedarray_is_element_index (ecma_string_t *property_name_p) /**< property
void
ecma_op_typedarray_list_lazy_property_names (ecma_object_t *obj_p, /**< a TypedArray object */
ecma_collection_t *prop_names_p, /**< prop name collection */
- ecma_property_counter_t *prop_counter_p, /**< property counters */
+ ecma_property_counter_t *prop_counter_p, /**< property counters */
jerry_property_filter_t filter) /**< property name filter options */
{
JERRY_ASSERT (ecma_object_is_typedarray (obj_p));
@@ -1901,8 +1864,7 @@ ecma_op_typedarray_define_own_property (ecma_object_t *obj_p, /**< TypedArray ob
uint32_t index = ecma_string_get_array_index (property_name_p);
- if (index == ECMA_STRING_NOT_ARRAY_INDEX
- && !ecma_typedarray_is_element_index (property_name_p))
+ if (index == ECMA_STRING_NOT_ARRAY_INDEX && !ecma_typedarray_is_element_index (property_name_p))
{
return ecma_op_general_object_define_own_property (obj_p, property_name_p, property_desc_p);
}
@@ -1920,8 +1882,7 @@ ecma_op_typedarray_define_own_property (ecma_object_t *obj_p, /**< TypedArray ob
ecma_typedarray_info_t info = ecma_typedarray_get_info (obj_p);
- if (index == ECMA_STRING_NOT_ARRAY_INDEX
- || index >= info.length)
+ if (index == ECMA_STRING_NOT_ARRAY_INDEX || index >= info.length)
{
return ECMA_VALUE_FALSE;
}
@@ -1956,10 +1917,8 @@ ecma_typedarray_create (ecma_object_t *constructor_p, /**< constructor function
ecma_value_t *arguments_list_p, /**< argument list */
uint32_t arguments_list_len) /**< length of argument list */
{
- ecma_value_t ret_val = ecma_op_function_construct (constructor_p,
- constructor_p,
- arguments_list_p,
- arguments_list_len);
+ ecma_value_t ret_val =
+ ecma_op_function_construct (constructor_p, constructor_p, arguments_list_p, arguments_list_len);
if (ECMA_IS_VALUE_ERROR (ret_val))
{
return ret_val;
@@ -2062,11 +2021,8 @@ ecma_op_create_typedarray_with_type_and_length (ecma_typedarray_type_t typedarra
ecma_object_t *proto_p = ecma_builtin_get (ecma_typedarray_helper_get_prototype_id (typedarray_id));
uint8_t element_size_shift = ecma_typedarray_helper_get_shift_size (typedarray_id);
- ecma_value_t new_obj = ecma_typedarray_create_object_with_length (array_length,
- NULL,
- proto_p,
- element_size_shift,
- typedarray_id);
+ ecma_value_t new_obj =
+ ecma_typedarray_create_object_with_length (array_length, NULL, proto_p, element_size_shift, typedarray_id);
return new_obj;
} /* ecma_op_create_typedarray_with_type_and_length */
diff --git a/jerry-core/ecma/operations/ecma-typedarray-object.h b/jerry-core/ecma/operations/ecma-typedarray-object.h
index bf728e88..ab004265 100644
--- a/jerry-core/ecma/operations/ecma-typedarray-object.h
+++ b/jerry-core/ecma/operations/ecma-typedarray-object.h
@@ -16,8 +16,8 @@
#ifndef ECMA_TYPEDARRAY_OBJECT_H
#define ECMA_TYPEDARRAY_OBJECT_H
-#include "ecma-globals.h"
#include "ecma-builtins.h"
+#include "ecma-globals.h"
#if JERRY_BUILTIN_TYPEDARRAY
@@ -32,21 +32,16 @@ uint8_t ecma_typedarray_helper_get_shift_size (ecma_typedarray_type_t typedarray
lit_magic_string_id_t ecma_get_typedarray_magic_string_id (ecma_typedarray_type_t typedarray_id);
ecma_typedarray_getter_fn_t ecma_get_typedarray_getter_fn (ecma_typedarray_type_t typedarray_id);
ecma_typedarray_setter_fn_t ecma_get_typedarray_setter_fn (ecma_typedarray_type_t typedarray_id);
-ecma_value_t ecma_get_typedarray_element (ecma_typedarray_info_t *info_p,
- uint32_t index);
-ecma_value_t ecma_set_typedarray_element (ecma_typedarray_info_t *info_p,
- ecma_value_t value,
- uint32_t index);
+ecma_value_t ecma_get_typedarray_element (ecma_typedarray_info_t *info_p, uint32_t index);
+ecma_value_t ecma_set_typedarray_element (ecma_typedarray_info_t *info_p, ecma_value_t value, uint32_t index);
bool ecma_typedarray_helper_is_typedarray (ecma_builtin_id_t builtin_id);
ecma_typedarray_type_t ecma_get_typedarray_id (ecma_object_t *obj_p);
ecma_builtin_id_t ecma_typedarray_helper_get_prototype_id (ecma_typedarray_type_t typedarray_id);
ecma_builtin_id_t ecma_typedarray_helper_get_constructor_id (ecma_typedarray_type_t typedarray_id);
ecma_typedarray_type_t ecma_typedarray_helper_builtin_to_typedarray_id (ecma_builtin_id_t builtin_id);
-ecma_value_t ecma_op_typedarray_from (ecma_value_t this_val,
- ecma_value_t source_val,
- ecma_value_t mapfn_val,
- ecma_value_t this_arg);
+ecma_value_t
+ecma_op_typedarray_from (ecma_value_t this_val, ecma_value_t source_val, ecma_value_t mapfn_val, ecma_value_t this_arg);
uint32_t ecma_typedarray_get_length (ecma_object_t *typedarray_p);
uint32_t ecma_typedarray_get_offset (ecma_object_t *typedarray_p);
uint8_t *ecma_typedarray_get_buffer (ecma_typedarray_info_t *info_p);
@@ -57,13 +52,13 @@ ecma_value_t ecma_op_create_typedarray (const ecma_value_t *arguments_list_p,
ecma_object_t *proto_p,
uint8_t element_size_shift,
ecma_typedarray_type_t typedarray_id);
-ecma_value_t
-ecma_typedarray_iterators_helper (ecma_value_t this_arg, ecma_iterator_kind_t kind);
+ecma_value_t ecma_typedarray_iterators_helper (ecma_value_t this_arg, ecma_iterator_kind_t kind);
bool ecma_object_is_typedarray (ecma_object_t *obj_p);
bool ecma_is_typedarray (ecma_value_t target);
bool ecma_typedarray_is_element_index (ecma_string_t *property_name_p);
-void ecma_op_typedarray_list_lazy_property_names (ecma_object_t *obj_p, ecma_collection_t *prop_names_p,
+void ecma_op_typedarray_list_lazy_property_names (ecma_object_t *obj_p,
+ ecma_collection_t *prop_names_p,
ecma_property_counter_t *prop_counter_p,
jerry_property_filter_t filter);
ecma_value_t ecma_op_typedarray_define_own_property (ecma_object_t *obj_p,
@@ -81,11 +76,9 @@ ecma_value_t ecma_typedarray_create_object_with_object (ecma_value_t items_val,
ecma_object_t *proto_p,
uint8_t element_size_shift,
ecma_typedarray_type_t typedarray_id);
-ecma_value_t ecma_typedarray_create (ecma_object_t *constructor_p, ecma_value_t *arguments_list_p,
- uint32_t arguments_list_len);
-ecma_value_t ecma_typedarray_species_create (ecma_value_t this_arg,
- ecma_value_t *length,
- uint32_t arguments_list_len);
+ecma_value_t
+ecma_typedarray_create (ecma_object_t *constructor_p, ecma_value_t *arguments_list_p, uint32_t arguments_list_len);
+ecma_value_t ecma_typedarray_species_create (ecma_value_t this_arg, ecma_value_t *length, uint32_t arguments_list_len);
/**
* @}
diff --git a/jerry-core/include/jerryscript-compiler.h b/jerry-core/include/jerryscript-compiler.h
index 0d3339c5..90832f8c 100644
--- a/jerry-core/include/jerryscript-compiler.h
+++ b/jerry-core/include/jerryscript-compiler.h
@@ -17,10 +17,15 @@
#define JERRYSCRIPT_COMPILER_H
#ifdef __cplusplus
-extern "C"
-{
+#define JERRY_C_API_BEGIN extern "C" {
+#define JERRY_C_API_END }
+#else /* !__cplusplus */
+#define JERRY_C_API_BEGIN
+#define JERRY_C_API_END
#endif /* __cplusplus */
+JERRY_C_API_BEGIN
+
/** \addtogroup jerry-compiler Jerry compiler compatibility components
* @{
*/
@@ -30,23 +35,23 @@ extern "C"
/*
* Compiler-specific macros relevant for GCC.
*/
-#define JERRY_ATTR_ALIGNED(ALIGNMENT) __attribute__((aligned(ALIGNMENT)))
-#define JERRY_ATTR_ALWAYS_INLINE __attribute__((always_inline))
-#define JERRY_ATTR_CONST __attribute__((const))
-#define JERRY_ATTR_DEPRECATED __attribute__((deprecated))
-#define JERRY_ATTR_FORMAT(...) __attribute__((format(__VA_ARGS__)))
-#define JERRY_ATTR_HOT __attribute__((hot))
-#define JERRY_ATTR_NOINLINE __attribute__((noinline))
-#define JERRY_ATTR_NORETURN __attribute__((noreturn))
-#define JERRY_ATTR_PURE __attribute__((pure))
-#define JERRY_ATTR_WARN_UNUSED_RESULT __attribute__((warn_unused_result))
+#define JERRY_ATTR_ALIGNED(ALIGNMENT) __attribute__ ((aligned (ALIGNMENT)))
+#define JERRY_ATTR_ALWAYS_INLINE __attribute__ ((always_inline))
+#define JERRY_ATTR_CONST __attribute__ ((const))
+#define JERRY_ATTR_DEPRECATED __attribute__ ((deprecated))
+#define JERRY_ATTR_FORMAT(...) __attribute__ ((format (__VA_ARGS__)))
+#define JERRY_ATTR_HOT __attribute__ ((hot))
+#define JERRY_ATTR_NOINLINE __attribute__ ((noinline))
+#define JERRY_ATTR_NORETURN __attribute__ ((noreturn))
+#define JERRY_ATTR_PURE __attribute__ ((pure))
+#define JERRY_ATTR_WARN_UNUSED_RESULT __attribute__ ((warn_unused_result))
#ifndef JERRY_LIKELY
-#define JERRY_LIKELY(x) __builtin_expect(!!(x), 1)
+#define JERRY_LIKELY(x) __builtin_expect (!!(x), 1)
#endif /* !JERRY_LIKELY */
#ifndef JERRY_UNLIKELY
-#define JERRY_UNLIKELY(x) __builtin_expect(!!(x), 0)
+#define JERRY_UNLIKELY(x) __builtin_expect (!!(x), 0)
#endif /* !JERRY_UNLIKELY */
#endif /* __GNUC__ */
@@ -57,14 +62,14 @@ extern "C"
* Compiler-specific macros relevant for Microsoft Visual C/C++ Compiler.
*/
#define JERRY_ATTR_DEPRECATED __declspec(deprecated)
-#define JERRY_ATTR_NOINLINE __declspec(noinline)
-#define JERRY_ATTR_NORETURN __declspec(noreturn)
+#define JERRY_ATTR_NOINLINE __declspec(noinline)
+#define JERRY_ATTR_NORETURN __declspec(noreturn)
/*
* Microsoft Visual C/C++ Compiler doesn't support for VLA, using _alloca
* instead.
*/
-void * __cdecl _alloca (size_t _Size);
+void *__cdecl _alloca (size_t _Size);
#define JERRY_VLA(type, name, size) type *name = (type *) (_alloca (sizeof (type) * size))
#endif /* _MSC_VER */
@@ -174,7 +179,6 @@ void * __cdecl _alloca (size_t _Size);
* @}
*/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYSCRIPT_COMPILER_H */
diff --git a/jerry-core/include/jerryscript-core.h b/jerry-core/include/jerryscript-core.h
index 2490cd80..59bef3a4 100644
--- a/jerry-core/include/jerryscript-core.h
+++ b/jerry-core/include/jerryscript-core.h
@@ -18,10 +18,7 @@
#include "jerryscript-types.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
/** \addtogroup jerry Jerry engine interface
* @{
@@ -32,7 +29,7 @@ extern "C"
*/
void jerry_init (jerry_init_flag_t flags);
void jerry_cleanup (void);
-void jerry_register_magic_strings (const jerry_char_t * const *ex_str_items_p,
+void jerry_register_magic_strings (const jerry_char_t *const *ex_str_items_p,
uint32_t count,
const jerry_length_t *str_lengths_p);
void jerry_gc (jerry_gc_mode_t mode);
@@ -44,8 +41,7 @@ bool jerry_get_memory_stats (jerry_heap_stats_t *out_stats_p);
* Parser and executor functions.
*/
bool jerry_run_simple (const jerry_char_t *script_source_p, size_t script_source_size, jerry_init_flag_t flags);
-jerry_value_t jerry_parse (const jerry_char_t *source_p, size_t source_size,
- const jerry_parse_options_t *options_p);
+jerry_value_t jerry_parse (const jerry_char_t *source_p, size_t source_size, const jerry_parse_options_t *options_p);
jerry_value_t jerry_parse_value (const jerry_value_t source_value, const jerry_parse_options_t *options_p);
jerry_value_t jerry_run (const jerry_value_t func_val);
jerry_value_t jerry_eval (const jerry_char_t *source_p, size_t source_size, uint32_t parse_opts);
@@ -92,9 +88,7 @@ bool jerry_is_feature_enabled (const jerry_feature_t feature);
/**
* Binary operations
*/
-jerry_value_t jerry_binary_operation (jerry_binary_operation_t op,
- const jerry_value_t lhs,
- const jerry_value_t rhs);
+jerry_value_t jerry_binary_operation (jerry_binary_operation_t op, const jerry_value_t lhs, const jerry_value_t rhs);
/**
* Error manipulation functions.
@@ -125,9 +119,8 @@ jerry_size_t jerry_get_utf8_string_size (const jerry_value_t value);
jerry_length_t jerry_get_string_length (const jerry_value_t value);
jerry_length_t jerry_get_utf8_string_length (const jerry_value_t value);
jerry_size_t jerry_string_to_char_buffer (const jerry_value_t value, jerry_char_t *buffer_p, jerry_size_t buffer_size);
-jerry_size_t jerry_string_to_utf8_char_buffer (const jerry_value_t value,
- jerry_char_t *buffer_p,
- jerry_size_t buffer_size);
+jerry_size_t
+jerry_string_to_utf8_char_buffer (const jerry_value_t value, jerry_char_t *buffer_p, jerry_size_t buffer_size);
jerry_size_t jerry_substring_to_char_buffer (const jerry_value_t value,
jerry_length_t start_pos,
jerry_length_t end_pos,
@@ -175,8 +168,8 @@ void jerry_release_value (jerry_value_t value);
jerry_value_t jerry_create_array (uint32_t size);
jerry_value_t jerry_create_boolean (bool value);
jerry_value_t jerry_create_error (jerry_error_t error_type, const jerry_char_t *message_p);
-jerry_value_t jerry_create_error_sz (jerry_error_t error_type, const jerry_char_t *message_p,
- jerry_size_t message_size);
+jerry_value_t
+jerry_create_error_sz (jerry_error_t error_type, const jerry_char_t *message_p, jerry_size_t message_size);
jerry_value_t jerry_create_external_function (jerry_external_handler_t handler_p);
jerry_value_t jerry_create_number (double value);
jerry_value_t jerry_create_number_infinity (bool sign);
@@ -185,8 +178,7 @@ jerry_value_t jerry_create_null (void);
jerry_value_t jerry_create_object (void);
jerry_value_t jerry_create_promise (void);
jerry_value_t jerry_create_proxy (const jerry_value_t target, const jerry_value_t handler);
-jerry_value_t jerry_create_special_proxy (const jerry_value_t target, const jerry_value_t handler,
- uint32_t options);
+jerry_value_t jerry_create_special_proxy (const jerry_value_t target, const jerry_value_t handler, uint32_t options);
jerry_value_t jerry_create_regexp (const jerry_char_t *pattern, uint16_t flags);
jerry_value_t jerry_create_regexp_sz (const jerry_char_t *pattern, jerry_size_t pattern_size, uint16_t flags);
jerry_value_t jerry_create_string_from_utf8 (const jerry_char_t *str_p);
@@ -212,14 +204,17 @@ bool jerry_delete_internal_property (const jerry_value_t obj_val, const jerry_va
jerry_value_t jerry_get_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
jerry_value_t jerry_get_property_by_index (const jerry_value_t obj_val, uint32_t index);
-jerry_value_t jerry_get_own_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val,
- const jerry_value_t receiver_val, bool *found_p);
+jerry_value_t jerry_get_own_property (const jerry_value_t obj_val,
+ const jerry_value_t prop_name_val,
+ const jerry_value_t receiver_val,
+ bool *found_p);
jerry_value_t jerry_get_internal_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val);
-jerry_value_t jerry_set_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val,
- const jerry_value_t value_to_set);
-jerry_value_t jerry_set_property_by_index (const jerry_value_t obj_val, uint32_t index,
- const jerry_value_t value_to_set);
-bool jerry_set_internal_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val,
+jerry_value_t
+jerry_set_property (const jerry_value_t obj_val, const jerry_value_t prop_name_val, const jerry_value_t value_to_set);
+jerry_value_t
+jerry_set_property_by_index (const jerry_value_t obj_val, uint32_t index, const jerry_value_t value_to_set);
+bool jerry_set_internal_property (const jerry_value_t obj_val,
+ const jerry_value_t prop_name_val,
const jerry_value_t value_to_set);
jerry_property_descriptor_t jerry_property_descriptor_create (void);
@@ -232,10 +227,12 @@ jerry_value_t jerry_get_own_property_descriptor (const jerry_value_t obj_val,
jerry_property_descriptor_t *prop_desc_p);
void jerry_property_descriptor_free (const jerry_property_descriptor_t *prop_desc_p);
-jerry_value_t jerry_call_function (const jerry_value_t func_obj_val, const jerry_value_t this_val,
- const jerry_value_t args_p[], jerry_size_t args_count);
-jerry_value_t jerry_construct_object (const jerry_value_t func_obj_val, const jerry_value_t args_p[],
- jerry_size_t args_count);
+jerry_value_t jerry_call_function (const jerry_value_t func_obj_val,
+ const jerry_value_t this_val,
+ const jerry_value_t args_p[],
+ jerry_size_t args_count);
+jerry_value_t
+jerry_construct_object (const jerry_value_t func_obj_val, const jerry_value_t args_p[], jerry_size_t args_count);
jerry_value_t jerry_get_object_keys (const jerry_value_t obj_val);
jerry_value_t jerry_get_prototype (const jerry_value_t obj_val);
@@ -247,21 +244,18 @@ bool jerry_get_object_native_pointer (const jerry_value_t obj_val,
void jerry_set_object_native_pointer (const jerry_value_t obj_val,
void *native_pointer_p,
const jerry_object_native_info_t *native_info_p);
-bool jerry_delete_object_native_pointer (const jerry_value_t obj_val,
- const jerry_object_native_info_t *native_info_p);
-void jerry_native_pointer_init_references (void *native_pointer_p,
- const jerry_object_native_info_t *native_info_p);
-void jerry_native_pointer_release_references (void *native_pointer_p,
- const jerry_object_native_info_t *native_info_p);
+bool jerry_delete_object_native_pointer (const jerry_value_t obj_val, const jerry_object_native_info_t *native_info_p);
+void jerry_native_pointer_init_references (void *native_pointer_p, const jerry_object_native_info_t *native_info_p);
+void jerry_native_pointer_release_references (void *native_pointer_p, const jerry_object_native_info_t *native_info_p);
void jerry_native_pointer_set_reference (jerry_value_t *reference_p, jerry_value_t value);
-bool jerry_objects_foreach (jerry_objects_foreach_t foreach_p,
- void *user_data);
+bool jerry_objects_foreach (jerry_objects_foreach_t foreach_p, void *user_data);
bool jerry_objects_foreach_by_native_info (const jerry_object_native_info_t *native_info_p,
jerry_objects_foreach_by_native_info_t foreach_p,
void *user_data_p);
-bool jerry_foreach_object_property (const jerry_value_t obj_val, jerry_object_property_foreach_t foreach_p,
+bool jerry_foreach_object_property (const jerry_value_t obj_val,
+ jerry_object_property_foreach_t foreach_p,
void *user_data_p);
jerry_value_t jerry_object_get_property_names (const jerry_value_t obj_val, jerry_property_filter_t filter);
@@ -272,8 +266,8 @@ jerry_value_t jerry_to_property_descriptor (jerry_value_t obj_value, jerry_prope
* Module functions.
*/
-jerry_value_t jerry_module_link (const jerry_value_t module_val,
- jerry_module_resolve_callback_t callback_p, void *user_p);
+jerry_value_t
+jerry_module_link (const jerry_value_t module_val, jerry_module_resolve_callback_t callback_p, void *user_p);
jerry_value_t jerry_module_evaluate (const jerry_value_t module_val);
jerry_module_state_t jerry_module_get_state (const jerry_value_t module_val);
void jerry_module_set_state_changed_callback (jerry_module_state_changed_callback_t callback, void *user_p);
@@ -284,7 +278,8 @@ jerry_value_t jerry_module_get_namespace (const jerry_value_t module_val);
void jerry_module_set_import_callback (jerry_module_import_callback_t callback_p, void *user_p);
jerry_value_t jerry_native_module_create (jerry_native_module_evaluate_callback_t callback,
- const jerry_value_t * const exports_p, size_t number_of_exports);
+ const jerry_value_t *const exports_p,
+ size_t number_of_exports);
jerry_value_t jerry_native_module_get_export (const jerry_value_t native_module_val,
const jerry_value_t export_name_val);
jerry_value_t jerry_native_module_set_export (const jerry_value_t native_module_val,
@@ -300,8 +295,7 @@ jerry_value_t jerry_resolve_or_reject_promise (jerry_value_t promise, jerry_valu
jerry_value_t jerry_get_promise_result (const jerry_value_t promise);
jerry_promise_state_t jerry_get_promise_state (const jerry_value_t promise);
-void jerry_promise_set_callback (jerry_promise_event_filter_t filters, jerry_promise_callback_t callback,
- void *user_p);
+void jerry_promise_set_callback (jerry_promise_event_filter_t filters, jerry_promise_callback_t callback, void *user_p);
/**
* Symbol functions.
@@ -373,16 +367,13 @@ void jerry_free_source_info (jerry_source_info_t *source_info_p);
*/
bool jerry_value_is_arraybuffer (const jerry_value_t value);
jerry_value_t jerry_create_arraybuffer (const jerry_length_t size);
-jerry_value_t jerry_create_arraybuffer_external (const jerry_length_t size,
- uint8_t *buffer_p, void *buffer_user_p);
+jerry_value_t jerry_create_arraybuffer_external (const jerry_length_t size, uint8_t *buffer_p, void *buffer_user_p);
jerry_length_t jerry_arraybuffer_write (const jerry_value_t value,
jerry_length_t offset,
const uint8_t *buf_p,
jerry_length_t buf_size);
-jerry_length_t jerry_arraybuffer_read (const jerry_value_t value,
- jerry_length_t offset,
- uint8_t *buf_p,
- jerry_length_t buf_size);
+jerry_length_t
+jerry_arraybuffer_read (const jerry_value_t value, jerry_length_t offset, uint8_t *buf_p, jerry_length_t buf_size);
jerry_length_t jerry_get_arraybuffer_byte_length (const jerry_value_t value);
uint8_t *jerry_get_arraybuffer_pointer (const jerry_value_t value);
jerry_value_t jerry_is_arraybuffer_detachable (const jerry_value_t value);
@@ -399,24 +390,19 @@ void jerry_arraybuffer_set_allocator_callbacks (jerry_arraybuffer_allocate_t all
bool jerry_value_is_shared_arraybuffer (const jerry_value_t value);
jerry_value_t jerry_create_shared_arraybuffer (const jerry_length_t size);
-jerry_value_t jerry_create_shared_arraybuffer_external (const jerry_length_t size,
- uint8_t *buffer_p, void *buffer_user_p);
+jerry_value_t
+jerry_create_shared_arraybuffer_external (const jerry_length_t size, uint8_t *buffer_p, void *buffer_user_p);
/**
* DataView functions.
*/
jerry_value_t
-jerry_create_dataview (const jerry_value_t value,
- const jerry_length_t byte_offset,
- const jerry_length_t byte_length);
+jerry_create_dataview (const jerry_value_t value, const jerry_length_t byte_offset, const jerry_length_t byte_length);
-bool
-jerry_value_is_dataview (const jerry_value_t value);
+bool jerry_value_is_dataview (const jerry_value_t value);
jerry_value_t
-jerry_get_dataview_buffer (const jerry_value_t dataview,
- jerry_length_t *byte_offset,
- jerry_length_t *byte_length);
+jerry_get_dataview_buffer (const jerry_value_t dataview, jerry_length_t *byte_offset, jerry_length_t *byte_length);
/**
* TypedArray functions.
@@ -432,9 +418,8 @@ jerry_value_t jerry_create_typedarray_for_arraybuffer (jerry_typedarray_type_t t
const jerry_value_t arraybuffer);
jerry_typedarray_type_t jerry_get_typedarray_type (jerry_value_t value);
jerry_length_t jerry_get_typedarray_length (jerry_value_t value);
-jerry_value_t jerry_get_typedarray_buffer (jerry_value_t value,
- jerry_length_t *byte_offset,
- jerry_length_t *byte_length);
+jerry_value_t
+jerry_get_typedarray_buffer (jerry_value_t value, jerry_length_t *byte_offset, jerry_length_t *byte_length);
jerry_value_t jerry_json_parse (const jerry_char_t *string_p, jerry_size_t string_size);
jerry_value_t jerry_json_stringify (const jerry_value_t object_to_stringify);
jerry_value_t jerry_create_container (jerry_container_type_t container_type,
@@ -451,7 +436,6 @@ jerry_value_t jerry_container_operation (jerry_container_operation_t operation,
* @}
*/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYSCRIPT_CORE_H */
diff --git a/jerry-core/include/jerryscript-debugger-transport.h b/jerry-core/include/jerryscript-debugger-transport.h
index f6f9acaa..587fad81 100644
--- a/jerry-core/include/jerryscript-debugger-transport.h
+++ b/jerry-core/include/jerryscript-debugger-transport.h
@@ -20,10 +20,9 @@
#include <stddef.h>
#include <stdint.h>
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+#include "jerryscript-compiler.h"
+
+JERRY_C_API_BEGIN
/** \addtogroup jerry-debugger-transport Jerry engine debugger interface - transport control
* @{
@@ -61,7 +60,8 @@ typedef void (*jerry_debugger_transport_close_t) (struct jerry_debugger_transpor
* Send data callback.
*/
typedef bool (*jerry_debugger_transport_send_t) (struct jerry_debugger_transport_interface_t *header_p,
- uint8_t *message_p, size_t message_length);
+ uint8_t *message_p,
+ size_t message_length);
/**
* Receive data callback.
@@ -76,7 +76,7 @@ typedef struct jerry_debugger_transport_interface_t
{
/* The following fields must be filled before calling jerry_debugger_transport_add(). */
jerry_debugger_transport_close_t close; /**< close connection callback */
- jerry_debugger_transport_send_t send; /**< send data callback */
+ jerry_debugger_transport_send_t send; /**< send data callback */
jerry_debugger_transport_receive_t receive; /**< receive data callback */
/* The following fields are filled by jerry_debugger_transport_add(). */
@@ -84,8 +84,10 @@ typedef struct jerry_debugger_transport_interface_t
} jerry_debugger_transport_header_t;
void jerry_debugger_transport_add (jerry_debugger_transport_header_t *header_p,
- size_t send_message_header_size, size_t max_send_message_size,
- size_t receive_message_header_size, size_t max_receive_message_size);
+ size_t send_message_header_size,
+ size_t max_send_message_size,
+ size_t receive_message_header_size,
+ size_t max_receive_message_size);
void jerry_debugger_transport_start (void);
bool jerry_debugger_transport_is_connected (void);
@@ -101,7 +103,6 @@ void jerry_debugger_transport_sleep (void);
* @}
*/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYSCRIPT_DEBUGGER_TRANSPORT_H */
diff --git a/jerry-core/include/jerryscript-debugger.h b/jerry-core/include/jerryscript-debugger.h
index c876e83d..cf22f4cb 100644
--- a/jerry-core/include/jerryscript-debugger.h
+++ b/jerry-core/include/jerryscript-debugger.h
@@ -18,10 +18,7 @@
#include "jerryscript-port.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
/** \addtogroup jerry-debugger Jerry engine interface - Debugger feature
* @{
@@ -53,7 +50,8 @@ typedef enum
typedef jerry_value_t (*jerry_debugger_wait_for_source_callback_t) (const jerry_char_t *resource_name_p,
size_t resource_name_size,
const jerry_char_t *source_p,
- size_t source_size, void *user_p);
+ size_t source_size,
+ void *user_p);
/**
* Engine debugger functions.
@@ -64,7 +62,8 @@ void jerry_debugger_continue (void);
void jerry_debugger_stop_at_breakpoint (bool enable_stop_at_breakpoint);
jerry_debugger_wait_for_source_status_t
jerry_debugger_wait_for_client_source (jerry_debugger_wait_for_source_callback_t callback_p,
- void *user_p, jerry_value_t *return_value);
+ void *user_p,
+ jerry_value_t *return_value);
void jerry_debugger_send_output (const jerry_char_t *buffer, jerry_size_t str_size);
void jerry_debugger_send_log (jerry_log_level_t level, const jerry_char_t *buffer, jerry_size_t str_size);
@@ -72,7 +71,6 @@ void jerry_debugger_send_log (jerry_log_level_t level, const jerry_char_t *buffe
* @}
*/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYSCRIPT_DEBUGGER_H */
diff --git a/jerry-core/include/jerryscript-port.h b/jerry-core/include/jerryscript-port.h
index c219a610..91bb3fe3 100644
--- a/jerry-core/include/jerryscript-port.h
+++ b/jerry-core/include/jerryscript-port.h
@@ -22,10 +22,7 @@
#include "jerryscript-types.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
/** \addtogroup jerry_port Jerry engine port
* @{
@@ -77,10 +74,10 @@ void JERRY_ATTR_NORETURN jerry_port_fatal (jerry_fatal_code_t code);
*/
typedef enum
{
- JERRY_LOG_LEVEL_ERROR, /**< the engine will terminate after the message is printed */
- JERRY_LOG_LEVEL_WARNING, /**< a request is aborted, but the engine continues its operation */
- JERRY_LOG_LEVEL_DEBUG, /**< debug messages from the engine, low volume */
- JERRY_LOG_LEVEL_TRACE /**< detailed info about engine internals, potentially high volume */
+ JERRY_LOG_LEVEL_ERROR, /**< the engine will terminate after the message is printed */
+ JERRY_LOG_LEVEL_WARNING, /**< a request is aborted, but the engine continues its operation */
+ JERRY_LOG_LEVEL_DEBUG, /**< debug messages from the engine, low volume */
+ JERRY_LOG_LEVEL_TRACE /**< detailed info about engine internals, potentially high volume */
} jerry_log_level_t;
/**
@@ -228,10 +225,7 @@ void jerry_port_release_source (uint8_t *buffer_p);
*
* @return A module object if resolving is successful, an error otherwise.
*/
-jerry_value_t
-jerry_port_module_resolve (const jerry_value_t specifier,
- const jerry_value_t referrer,
- void *user_p);
+jerry_value_t jerry_port_module_resolve (const jerry_value_t specifier, const jerry_value_t referrer, void *user_p);
/**
* Release known modules.
@@ -249,7 +243,6 @@ void jerry_port_module_release (const jerry_value_t realm);
* @}
*/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYSCRIPT_PORT_H */
diff --git a/jerry-core/include/jerryscript-snapshot.h b/jerry-core/include/jerryscript-snapshot.h
index 8356e9b3..95e96b73 100644
--- a/jerry-core/include/jerryscript-snapshot.h
+++ b/jerry-core/include/jerryscript-snapshot.h
@@ -18,10 +18,7 @@
#include "jerryscript-types.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
/** \addtogroup jerry-snapshot Jerry engine interface - Snapshot feature
* @{
@@ -70,22 +67,32 @@ typedef struct
/**
* Snapshot functions.
*/
-jerry_value_t jerry_generate_snapshot (jerry_value_t compiled_code, uint32_t generate_snapshot_opts,
- uint32_t *buffer_p, size_t buffer_size);
+jerry_value_t jerry_generate_snapshot (jerry_value_t compiled_code,
+ uint32_t generate_snapshot_opts,
+ uint32_t *buffer_p,
+ size_t buffer_size);
-jerry_value_t jerry_exec_snapshot (const uint32_t *snapshot_p, size_t snapshot_size,
- size_t func_index, uint32_t exec_snapshot_opts,
+jerry_value_t jerry_exec_snapshot (const uint32_t *snapshot_p,
+ size_t snapshot_size,
+ size_t func_index,
+ uint32_t exec_snapshot_opts,
const jerry_exec_snapshot_option_values_t *options_values_p);
-size_t jerry_merge_snapshots (const uint32_t **inp_buffers_p, size_t *inp_buffer_sizes_p, size_t number_of_snapshots,
- uint32_t *out_buffer_p, size_t out_buffer_size, const char **error_p);
-size_t jerry_get_literals_from_snapshot (const uint32_t *snapshot_p, size_t snapshot_size,
- jerry_char_t *lit_buf_p, size_t lit_buf_size, bool is_c_format);
+size_t jerry_merge_snapshots (const uint32_t **inp_buffers_p,
+ size_t *inp_buffer_sizes_p,
+ size_t number_of_snapshots,
+ uint32_t *out_buffer_p,
+ size_t out_buffer_size,
+ const char **error_p);
+size_t jerry_get_literals_from_snapshot (const uint32_t *snapshot_p,
+ size_t snapshot_size,
+ jerry_char_t *lit_buf_p,
+ size_t lit_buf_size,
+ bool is_c_format);
/**
* @}
*/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYSCRIPT_SNAPSHOT_H */
diff --git a/jerry-core/include/jerryscript-types.h b/jerry-core/include/jerryscript-types.h
index 6b7e1e8e..9d131479 100644
--- a/jerry-core/include/jerryscript-types.h
+++ b/jerry-core/include/jerryscript-types.h
@@ -22,10 +22,7 @@
#include "jerryscript-compiler.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
/** \addtogroup jerry Jerry engine interface
* @{
@@ -51,12 +48,12 @@ extern "C"
*/
typedef enum
{
- JERRY_INIT_EMPTY = (0u), /**< empty flag set */
- JERRY_INIT_SHOW_OPCODES = (1u << 0), /**< dump byte-code to log after parse */
+ JERRY_INIT_EMPTY = (0u), /**< empty flag set */
+ JERRY_INIT_SHOW_OPCODES = (1u << 0), /**< dump byte-code to log after parse */
JERRY_INIT_SHOW_REGEXP_OPCODES = (1u << 1), /**< dump regexp byte-code to log after compilation */
- JERRY_INIT_MEM_STATS = (1u << 2), /**< dump memory statistics */
- JERRY_INIT_MEM_STATS_SEPARATE = (1u << 3), /**< deprecated, an unused placeholder now */
- JERRY_INIT_DEBUGGER = (1u << 4), /**< deprecated, an unused placeholder now */
+ JERRY_INIT_MEM_STATS = (1u << 2), /**< dump memory statistics */
+ JERRY_INIT_MEM_STATS_SEPARATE = (1u << 3), /**< deprecated, an unused placeholder now */
+ JERRY_INIT_DEBUGGER = (1u << 4), /**< deprecated, an unused placeholder now */
} jerry_init_flag_t;
/**
@@ -64,16 +61,16 @@ typedef enum
*/
typedef enum
{
- JERRY_ERROR_NONE = 0, /**< No Error */
+ JERRY_ERROR_NONE = 0, /**< No Error */
- JERRY_ERROR_COMMON, /**< Error */
- JERRY_ERROR_EVAL, /**< EvalError */
- JERRY_ERROR_RANGE, /**< RangeError */
+ JERRY_ERROR_COMMON, /**< Error */
+ JERRY_ERROR_EVAL, /**< EvalError */
+ JERRY_ERROR_RANGE, /**< RangeError */
JERRY_ERROR_REFERENCE, /**< ReferenceError */
- JERRY_ERROR_SYNTAX, /**< SyntaxError */
- JERRY_ERROR_TYPE, /**< TypeError */
- JERRY_ERROR_URI, /**< URIError */
- JERRY_ERROR_AGGREGATE /**< AggregateError */
+ JERRY_ERROR_SYNTAX, /**< SyntaxError */
+ JERRY_ERROR_TYPE, /**< TypeError */
+ JERRY_ERROR_URI, /**< URIError */
+ JERRY_ERROR_AGGREGATE /**< AggregateError */
} jerry_error_t;
/**
@@ -132,12 +129,12 @@ typedef enum
*/
typedef enum
{
- JERRY_REGEXP_FLAG_GLOBAL = (1u << 1), /**< Globally scan string */
+ JERRY_REGEXP_FLAG_GLOBAL = (1u << 1), /**< Globally scan string */
JERRY_REGEXP_FLAG_IGNORE_CASE = (1u << 2), /**< Ignore case */
- JERRY_REGEXP_FLAG_MULTILINE = (1u << 3), /**< Multiline string scan */
- JERRY_REGEXP_FLAG_STICKY = (1u << 4), /**< ECMAScript v11, 21.2.5.14 */
- JERRY_REGEXP_FLAG_UNICODE = (1u << 5), /**< ECMAScript v11, 21.2.5.17 */
- JERRY_REGEXP_FLAG_DOTALL = (1u << 6) /**< ECMAScript v11, 21.2.5.3 */
+ JERRY_REGEXP_FLAG_MULTILINE = (1u << 3), /**< Multiline string scan */
+ JERRY_REGEXP_FLAG_STICKY = (1u << 4), /**< ECMAScript v11, 21.2.5.14 */
+ JERRY_REGEXP_FLAG_UNICODE = (1u << 5), /**< ECMAScript v11, 21.2.5.17 */
+ JERRY_REGEXP_FLAG_DOTALL = (1u << 6) /**< ECMAScript v11, 21.2.5.3 */
} jerry_regexp_flags_t;
/**
@@ -229,23 +226,23 @@ typedef struct
*/
typedef enum
{
- JERRY_PROPERTY_FILTER_ALL = 0, /**< List all property keys independently
- * from key type or property value attributes
- * (equivalent to Reflect.ownKeys call) */
- JERRY_PROPERTY_FILTER_TRAVERSE_PROTOTYPE_CHAIN = (1 << 0), /**< Include keys from the objects's
- * prototype chain as well */
- JERRY_PROPERTY_FILTER_EXCLUDE_NON_CONFIGURABLE = (1 << 1), /**< Exclude property key if
- * the property is non-configurable */
- JERRY_PROPERTY_FILTER_EXCLUDE_NON_ENUMERABLE = (1 << 2), /**< Exclude property key if
- * the property is non-enumerable */
- JERRY_PROPERTY_FILTER_EXCLUDE_NON_WRITABLE = (1 << 3), /**< Exclude property key if
- * the property is non-writable */
- JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS = (1 << 4), /**< Exclude property key if it is a string */
- JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS = (1 << 5), /**< Exclude property key if it is a symbol */
- JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES = (1 << 6), /**< Exclude property key if it is an integer index */
- JERRY_PROPERTY_FILTER_INTEGER_INDICES_AS_NUMBER = (1 << 7), /**< By default integer index property keys are
- * converted to string. Enabling this flags keeps
- * integer index property keys as numbers. */
+ JERRY_PROPERTY_FILTER_ALL = 0, /**< List all property keys independently
+ * from key type or property value attributes
+ * (equivalent to Reflect.ownKeys call) */
+ JERRY_PROPERTY_FILTER_TRAVERSE_PROTOTYPE_CHAIN = (1 << 0), /**< Include keys from the objects's
+ * prototype chain as well */
+ JERRY_PROPERTY_FILTER_EXCLUDE_NON_CONFIGURABLE = (1 << 1), /**< Exclude property key if
+ * the property is non-configurable */
+ JERRY_PROPERTY_FILTER_EXCLUDE_NON_ENUMERABLE = (1 << 2), /**< Exclude property key if
+ * the property is non-enumerable */
+ JERRY_PROPERTY_FILTER_EXCLUDE_NON_WRITABLE = (1 << 3), /**< Exclude property key if
+ * the property is non-writable */
+ JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS = (1 << 4), /**< Exclude property key if it is a string */
+ JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS = (1 << 5), /**< Exclude property key if it is a symbol */
+ JERRY_PROPERTY_FILTER_EXCLUDE_INTEGER_INDICES = (1 << 6), /**< Exclude property key if it is an integer index */
+ JERRY_PROPERTY_FILTER_INTEGER_INDICES_AS_NUMBER = (1 << 7), /**< By default integer index property keys are
+ * converted to string. Enabling this flags keeps
+ * integer index property keys as numbers. */
} jerry_property_filter_t;
/**
@@ -296,8 +293,7 @@ typedef void (*jerry_object_native_free_callback_t) (void *native_p, struct jerr
/**
* Free callback for external strings.
*/
-typedef void (*jerry_external_string_free_callback_t) (jerry_char_t *string_p, jerry_size_t string_size,
- void *user_p);
+typedef void (*jerry_external_string_free_callback_t) (jerry_char_t *string_p, jerry_size_t string_size, void *user_p);
/**
* Decorator callback for Error objects. The decorator can create
@@ -337,8 +333,7 @@ typedef bool (*jerry_object_property_foreach_t) (const jerry_value_t property_na
/**
* Function type applied for each object in the engine.
*/
-typedef bool (*jerry_objects_foreach_t) (const jerry_value_t object,
- void *user_data_p);
+typedef bool (*jerry_objects_foreach_t) (const jerry_value_t object, void *user_data_p);
/**
* Function type applied for each matching object in the engine.
@@ -418,18 +413,18 @@ typedef struct jerry_context_t jerry_context_t;
*/
typedef enum
{
- JERRY_BIN_OP_EQUAL = 0u, /**< equal comparison (==) */
- JERRY_BIN_OP_STRICT_EQUAL, /**< strict equal comparison (===) */
- JERRY_BIN_OP_LESS, /**< less relation (<) */
- JERRY_BIN_OP_LESS_EQUAL, /**< less or equal relation (<=) */
- JERRY_BIN_OP_GREATER, /**< greater relation (>) */
+ JERRY_BIN_OP_EQUAL = 0u, /**< equal comparison (==) */
+ JERRY_BIN_OP_STRICT_EQUAL, /**< strict equal comparison (===) */
+ JERRY_BIN_OP_LESS, /**< less relation (<) */
+ JERRY_BIN_OP_LESS_EQUAL, /**< less or equal relation (<=) */
+ JERRY_BIN_OP_GREATER, /**< greater relation (>) */
JERRY_BIN_OP_GREATER_EQUAL, /**< greater or equal relation (>=)*/
- JERRY_BIN_OP_INSTANCEOF, /**< instanceof operation */
- JERRY_BIN_OP_ADD, /**< addition operator (+) */
- JERRY_BIN_OP_SUB, /**< subtraction operator (-) */
- JERRY_BIN_OP_MUL, /**< multiplication operator (*) */
- JERRY_BIN_OP_DIV, /**< division operator (/) */
- JERRY_BIN_OP_REM, /**< remainder operator (%) */
+ JERRY_BIN_OP_INSTANCEOF, /**< instanceof operation */
+ JERRY_BIN_OP_ADD, /**< addition operator (+) */
+ JERRY_BIN_OP_SUB, /**< subtraction operator (-) */
+ JERRY_BIN_OP_MUL, /**< multiplication operator (*) */
+ JERRY_BIN_OP_DIV, /**< division operator (/) */
+ JERRY_BIN_OP_REM, /**< remainder operator (%) */
} jerry_binary_operation_t;
/**
@@ -480,15 +475,15 @@ typedef enum
{
JERRY_TYPE_NONE = 0u, /**< no type information */
JERRY_TYPE_UNDEFINED, /**< undefined type */
- JERRY_TYPE_NULL, /**< null type */
- JERRY_TYPE_BOOLEAN, /**< boolean type */
- JERRY_TYPE_NUMBER, /**< number type */
- JERRY_TYPE_STRING, /**< string type */
- JERRY_TYPE_OBJECT, /**< object type */
- JERRY_TYPE_FUNCTION, /**< function type */
- JERRY_TYPE_ERROR, /**< error/abort type */
- JERRY_TYPE_SYMBOL, /**< symbol type */
- JERRY_TYPE_BIGINT, /**< bigint type */
+ JERRY_TYPE_NULL, /**< null type */
+ JERRY_TYPE_BOOLEAN, /**< boolean type */
+ JERRY_TYPE_NUMBER, /**< number type */
+ JERRY_TYPE_STRING, /**< string type */
+ JERRY_TYPE_OBJECT, /**< object type */
+ JERRY_TYPE_FUNCTION, /**< function type */
+ JERRY_TYPE_ERROR, /**< error/abort type */
+ JERRY_TYPE_SYMBOL, /**< symbol type */
+ JERRY_TYPE_BIGINT, /**< bigint type */
} jerry_type_t;
/**
@@ -496,33 +491,33 @@ typedef enum
*/
typedef enum
{
- JERRY_OBJECT_TYPE_NONE = 0u, /**< Non object type */
- JERRY_OBJECT_TYPE_GENERIC, /**< Generic JavaScript object without any internal property */
- JERRY_OBJECT_TYPE_MODULE_NAMESPACE, /**< Namespace object */
- JERRY_OBJECT_TYPE_ARRAY, /**< Array object */
- JERRY_OBJECT_TYPE_PROXY, /**< Proxy object */
- JERRY_OBJECT_TYPE_SCRIPT, /**< Script object (see jerry_parse) */
- JERRY_OBJECT_TYPE_MODULE, /**< Module object (see jerry_parse) */
- JERRY_OBJECT_TYPE_PROMISE, /**< Promise object */
- JERRY_OBJECT_TYPE_DATAVIEW, /**< Dataview object */
- JERRY_OBJECT_TYPE_FUNCTION, /**< Function object (see jerry_function_get_type) */
- JERRY_OBJECT_TYPE_TYPEDARRAY, /**< %TypedArray% object (see jerry_get_typedarray_type) */
- JERRY_OBJECT_TYPE_ITERATOR, /**< Iterator object (see jerry_iterator_get_type) */
- JERRY_OBJECT_TYPE_CONTAINER, /**< Container object (see jerry_container_get_type) */
- JERRY_OBJECT_TYPE_ERROR, /**< Error object */
- JERRY_OBJECT_TYPE_ARRAYBUFFER, /**< Array buffer object */
+ JERRY_OBJECT_TYPE_NONE = 0u, /**< Non object type */
+ JERRY_OBJECT_TYPE_GENERIC, /**< Generic JavaScript object without any internal property */
+ JERRY_OBJECT_TYPE_MODULE_NAMESPACE, /**< Namespace object */
+ JERRY_OBJECT_TYPE_ARRAY, /**< Array object */
+ JERRY_OBJECT_TYPE_PROXY, /**< Proxy object */
+ JERRY_OBJECT_TYPE_SCRIPT, /**< Script object (see jerry_parse) */
+ JERRY_OBJECT_TYPE_MODULE, /**< Module object (see jerry_parse) */
+ JERRY_OBJECT_TYPE_PROMISE, /**< Promise object */
+ JERRY_OBJECT_TYPE_DATAVIEW, /**< Dataview object */
+ JERRY_OBJECT_TYPE_FUNCTION, /**< Function object (see jerry_function_get_type) */
+ JERRY_OBJECT_TYPE_TYPEDARRAY, /**< %TypedArray% object (see jerry_get_typedarray_type) */
+ JERRY_OBJECT_TYPE_ITERATOR, /**< Iterator object (see jerry_iterator_get_type) */
+ JERRY_OBJECT_TYPE_CONTAINER, /**< Container object (see jerry_container_get_type) */
+ JERRY_OBJECT_TYPE_ERROR, /**< Error object */
+ JERRY_OBJECT_TYPE_ARRAYBUFFER, /**< Array buffer object */
JERRY_OBJECT_TYPE_SHARED_ARRAY_BUFFER, /**< Shared Array Buffer object */
- JERRY_OBJECT_TYPE_ARGUMENTS, /**< Arguments object */
- JERRY_OBJECT_TYPE_BOOLEAN, /**< Boolean object */
- JERRY_OBJECT_TYPE_DATE, /**< Date object */
- JERRY_OBJECT_TYPE_NUMBER, /**< Number object */
- JERRY_OBJECT_TYPE_REGEXP, /**< RegExp object */
- JERRY_OBJECT_TYPE_STRING, /**< String object */
- JERRY_OBJECT_TYPE_SYMBOL, /**< Symbol object */
- JERRY_OBJECT_TYPE_GENERATOR, /**< Generator object */
- JERRY_OBJECT_TYPE_BIGINT, /**< BigInt object */
- JERRY_OBJECT_TYPE_WEAKREF, /**< WeakRef object */
+ JERRY_OBJECT_TYPE_ARGUMENTS, /**< Arguments object */
+ JERRY_OBJECT_TYPE_BOOLEAN, /**< Boolean object */
+ JERRY_OBJECT_TYPE_DATE, /**< Date object */
+ JERRY_OBJECT_TYPE_NUMBER, /**< Number object */
+ JERRY_OBJECT_TYPE_REGEXP, /**< RegExp object */
+ JERRY_OBJECT_TYPE_STRING, /**< String object */
+ JERRY_OBJECT_TYPE_SYMBOL, /**< Symbol object */
+ JERRY_OBJECT_TYPE_GENERATOR, /**< Generator object */
+ JERRY_OBJECT_TYPE_BIGINT, /**< BigInt object */
+ JERRY_OBJECT_TYPE_WEAKREF, /**< WeakRef object */
} jerry_object_type_t;
/**
@@ -530,12 +525,12 @@ typedef enum
*/
typedef enum
{
- JERRY_FUNCTION_TYPE_NONE = 0u, /**< Non function type */
- JERRY_FUNCTION_TYPE_GENERIC, /**< Generic JavaScript function */
- JERRY_FUNCTION_TYPE_ACCESSOR, /**< Accessor function */
- JERRY_FUNCTION_TYPE_BOUND, /**< Bound function */
- JERRY_FUNCTION_TYPE_ARROW, /**< Arrow function */
- JERRY_FUNCTION_TYPE_GENERATOR, /**< Generator function */
+ JERRY_FUNCTION_TYPE_NONE = 0u, /**< Non function type */
+ JERRY_FUNCTION_TYPE_GENERIC, /**< Generic JavaScript function */
+ JERRY_FUNCTION_TYPE_ACCESSOR, /**< Accessor function */
+ JERRY_FUNCTION_TYPE_BOUND, /**< Bound function */
+ JERRY_FUNCTION_TYPE_ARROW, /**< Arrow function */
+ JERRY_FUNCTION_TYPE_GENERATOR, /**< Generator function */
} jerry_function_type_t;
/**
@@ -543,11 +538,11 @@ typedef enum
*/
typedef enum
{
- JERRY_ITERATOR_TYPE_NONE = 0u, /**< Non iterator type */
- JERRY_ITERATOR_TYPE_ARRAY, /**< Array iterator */
- JERRY_ITERATOR_TYPE_STRING, /**< String iterator */
- JERRY_ITERATOR_TYPE_MAP, /**< Map iterator */
- JERRY_ITERATOR_TYPE_SET, /**< Set iterator */
+ JERRY_ITERATOR_TYPE_NONE = 0u, /**< Non iterator type */
+ JERRY_ITERATOR_TYPE_ARRAY, /**< Array iterator */
+ JERRY_ITERATOR_TYPE_STRING, /**< String iterator */
+ JERRY_ITERATOR_TYPE_MAP, /**< Map iterator */
+ JERRY_ITERATOR_TYPE_SET, /**< Set iterator */
} jerry_iterator_type_t;
/**
@@ -559,7 +554,7 @@ typedef enum
*/
typedef enum
{
- JERRY_MODULE_STATE_INVALID = 0, /**< return value for jerry_module_get_state when its argument is not a module */
+ JERRY_MODULE_STATE_INVALID = 0, /**< return value for jerry_module_get_state when its argument is not a module */
JERRY_MODULE_STATE_UNLINKED = 1, /**< module is currently unlinked */
JERRY_MODULE_STATE_LINKING = 2, /**< module is currently being linked */
JERRY_MODULE_STATE_LINKED = 3, /**< module has been linked (its dependencies has been resolved) */
@@ -585,14 +580,17 @@ typedef jerry_value_t (*jerry_module_import_callback_t) (const jerry_value_t spe
/**
* Callback which is called after the module enters into linked, evaluated or error state.
*/
-typedef void (*jerry_module_state_changed_callback_t) (jerry_module_state_t new_state, const jerry_value_t module,
- const jerry_value_t value, void *user_p);
+typedef void (*jerry_module_state_changed_callback_t) (jerry_module_state_t new_state,
+ const jerry_value_t module,
+ const jerry_value_t value,
+ void *user_p);
/**
* Callback which is called when an import.meta expression of a module is evaluated the first time.
*/
typedef void (*jerry_module_import_meta_callback_t) (const jerry_value_t module,
- const jerry_value_t meta_object, void *user_p);
+ const jerry_value_t meta_object,
+ void *user_p);
/**
* Callback which is called by jerry_module_evaluate to evaluate the native module.
@@ -625,9 +623,9 @@ typedef enum
typedef enum
{
JERRY_PROMISE_STATE_NONE = 0u, /**< Invalid/Unknown state (possibly called on a non-promise object). */
- JERRY_PROMISE_STATE_PENDING, /**< Promise is in "Pending" state. */
+ JERRY_PROMISE_STATE_PENDING, /**< Promise is in "Pending" state. */
JERRY_PROMISE_STATE_FULFILLED, /**< Promise is in "Fulfilled" state. */
- JERRY_PROMISE_STATE_REJECTED, /**< Promise is in "Rejected" state. */
+ JERRY_PROMISE_STATE_REJECTED, /**< Promise is in "Rejected" state. */
} jerry_promise_state_t;
/**
@@ -649,8 +647,8 @@ typedef enum
* object: the Promise object
* value: value for resolving */
JERRY_PROMISE_EVENT_REJECT_FULFILLED, /**< called when a reject is called on a fulfilled Promise
- * object: the Promise object
- * value: value for rejecting */
+ * object: the Promise object
+ * value: value for rejecting */
JERRY_PROMISE_EVENT_REJECT_WITHOUT_HANDLER, /**< called when a Promise is rejected without a handler
* object: the Promise object
* value: value for rejecting */
@@ -715,7 +713,8 @@ typedef enum
* Notification callback for tracking Promise and async function operations.
*/
typedef void (*jerry_promise_callback_t) (jerry_promise_event_type_t event_type,
- const jerry_value_t object, const jerry_value_t value,
+ const jerry_value_t object,
+ const jerry_value_t value,
void *user_p);
/**
@@ -727,19 +726,19 @@ typedef void (*jerry_promise_callback_t) (jerry_promise_event_type_t event_type,
*/
typedef enum
{
- JERRY_SYMBOL_ASYNC_ITERATOR, /**< @@asyncIterator well-known symbol */
- JERRY_SYMBOL_HAS_INSTANCE, /**< @@hasInstance well-known symbol */
+ JERRY_SYMBOL_ASYNC_ITERATOR, /**< @@asyncIterator well-known symbol */
+ JERRY_SYMBOL_HAS_INSTANCE, /**< @@hasInstance well-known symbol */
JERRY_SYMBOL_IS_CONCAT_SPREADABLE, /**< @@isConcatSpreadable well-known symbol */
- JERRY_SYMBOL_ITERATOR, /**< @@iterator well-known symbol */
- JERRY_SYMBOL_MATCH, /**< @@match well-known symbol */
- JERRY_SYMBOL_REPLACE, /**< @@replace well-known symbol */
- JERRY_SYMBOL_SEARCH, /**< @@search well-known symbol */
- JERRY_SYMBOL_SPECIES, /**< @@species well-known symbol */
- JERRY_SYMBOL_SPLIT, /**< @@split well-known symbol */
- JERRY_SYMBOL_TO_PRIMITIVE, /**< @@toPrimitive well-known symbol */
- JERRY_SYMBOL_TO_STRING_TAG, /**< @@toStringTag well-known symbol */
- JERRY_SYMBOL_UNSCOPABLES, /**< @@unscopables well-known symbol */
- JERRY_SYMBOL_MATCH_ALL, /**< @@matchAll well-known symbol */
+ JERRY_SYMBOL_ITERATOR, /**< @@iterator well-known symbol */
+ JERRY_SYMBOL_MATCH, /**< @@match well-known symbol */
+ JERRY_SYMBOL_REPLACE, /**< @@replace well-known symbol */
+ JERRY_SYMBOL_SEARCH, /**< @@search well-known symbol */
+ JERRY_SYMBOL_SPECIES, /**< @@species well-known symbol */
+ JERRY_SYMBOL_SPLIT, /**< @@split well-known symbol */
+ JERRY_SYMBOL_TO_PRIMITIVE, /**< @@toPrimitive well-known symbol */
+ JERRY_SYMBOL_TO_STRING_TAG, /**< @@toStringTag well-known symbol */
+ JERRY_SYMBOL_UNSCOPABLES, /**< @@unscopables well-known symbol */
+ JERRY_SYMBOL_MATCH_ALL, /**< @@matchAll well-known symbol */
} jerry_well_known_symbol_t;
/**
@@ -834,20 +833,24 @@ typedef enum
/**
* Callback for allocating the backing store of array buffer or shared array buffer objects.
*/
-typedef uint8_t *(*jerry_arraybuffer_allocate_t) (jerry_arraybuffer_type_t buffer_type, uint32_t buffer_size,
- void **arraybuffer_user_p, void *user_p);
+typedef uint8_t *(*jerry_arraybuffer_allocate_t) (jerry_arraybuffer_type_t buffer_type,
+ uint32_t buffer_size,
+ void **arraybuffer_user_p,
+ void *user_p);
/**
* Callback for freeing the backing store of array buffer or shared array buffer objects.
*/
-typedef void (*jerry_arraybuffer_free_t) (jerry_arraybuffer_type_t buffer_type, uint8_t *buffer_p,
- uint32_t buffer_size, void *arraybuffer_user_p, void *user_p);
+typedef void (*jerry_arraybuffer_free_t) (jerry_arraybuffer_type_t buffer_type,
+ uint8_t *buffer_p,
+ uint32_t buffer_size,
+ void *arraybuffer_user_p,
+ void *user_p);
/**
* @}
*/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYSCRIPT_TYPES_H */
diff --git a/jerry-core/jcontext/jcontext.h b/jerry-core/jcontext/jcontext.h
index 627988e7..4af719ac 100644
--- a/jerry-core/jcontext/jcontext.h
+++ b/jerry-core/jcontext/jcontext.h
@@ -19,15 +19,17 @@
#ifndef JCONTEXT_H
#define JCONTEXT_H
-#include "debugger.h"
+#include "jerryscript-debugger-transport.h"
+
#include "ecma-builtins.h"
#include "ecma-helpers.h"
#include "ecma-jobqueue.h"
+
+#include "debugger.h"
#include "jmem.h"
+#include "js-parser-internal.h"
#include "re-bytecode.h"
#include "vm-defines.h"
-#include "jerryscript-debugger-transport.h"
-#include "js-parser-internal.h"
/** \addtogroup context Context
* @{
@@ -58,11 +60,11 @@
* to try and reduce clutter from unreachable objects. If the allocated memory can't be reduced below the limit,
* then the current limit will be incremented by CONFIG_MEM_HEAP_LIMIT.
*/
-#if defined (JERRY_GC_LIMIT) && (JERRY_GC_LIMIT != 0)
+#if defined(JERRY_GC_LIMIT) && (JERRY_GC_LIMIT != 0)
#define CONFIG_GC_LIMIT JERRY_GC_LIMIT
-#else
+#else /* !(defined(JERRY_GC_LIMIT) && (JERRY_GC_LIMIT != 0)) */
#define CONFIG_GC_LIMIT (JERRY_MIN (CONFIG_MEM_HEAP_SIZE / 32, CONFIG_MAX_GC_LIMIT))
-#endif
+#endif /* defined(JERRY_GC_LIMIT) && (JERRY_GC_LIMIT != 0) */
/**
* Amount of newly allocated objects since the last GC run, represented as a fraction of all allocated objects,
@@ -98,8 +100,7 @@ typedef struct jerry_context_data_header
const jerry_context_data_manager_t *manager_p; /**< manager responsible for deleting this item */
} jerry_context_data_header_t;
-#define JERRY_CONTEXT_DATA_HEADER_USER_DATA(item_p) \
- ((uint8_t *) (item_p + 1))
+#define JERRY_CONTEXT_DATA_HEADER_USER_DATA(item_p) ((uint8_t *) (item_p + 1))
/**
* First non-external member of the jerry context
@@ -132,7 +133,7 @@ struct jerry_context_t
#if JERRY_CPOINTER_32_BIT
jmem_pools_chunk_t *jmem_free_16_byte_chunk_p; /**< list of free sixteen byte pool chunks */
#endif /* JERRY_CPOINTER_32_BIT */
- const lit_utf8_byte_t * const *lit_magic_string_ex_array; /**< array of external magic strings */
+ const lit_utf8_byte_t *const *lit_magic_string_ex_array; /**< array of external magic strings */
const lit_utf8_size_t *lit_magic_string_ex_sizes; /**< external magic string lengths */
jmem_cpointer_t ecma_gc_objects_cp; /**< List of currently alive objects. */
jmem_cpointer_t string_list_first_cp; /**< first item of the literal string list */
@@ -199,11 +200,11 @@ struct jerry_context_t
#if JERRY_BUILTIN_TYPEDARRAY
uint32_t arraybuffer_compact_allocation_limit; /**< maximum size of compact allocation */
- jerry_arraybuffer_allocate_t arraybuffer_allocate_callback; /**< callback for allocating
- * arraybuffer memory */
+ jerry_arraybuffer_allocate_t arraybuffer_allocate_callback; /**< callback for allocating
+ * arraybuffer memory */
jerry_arraybuffer_free_t arraybuffer_free_callback; /**< callback for freeing arraybuffer memory */
- void *arraybuffer_allocate_callback_user_p; /**< user pointer passed to arraybuffer_allocate_callback
- * and arraybuffer_free_callback functions */
+ void *arraybuffer_allocate_callback_user_p; /**< user pointer passed to arraybuffer_allocate_callback
+ * and arraybuffer_free_callback functions */
#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_VM_EXEC_STOP
@@ -220,7 +221,7 @@ struct jerry_context_t
#endif /* JERRY_VM_THROW */
#if (JERRY_STACK_LIMIT != 0)
- uintptr_t stack_base; /**< stack base marker */
+ uintptr_t stack_base; /**< stack base marker */
#endif /* (JERRY_STACK_LIMIT != 0) */
#if JERRY_DEBUGGER
@@ -309,14 +310,14 @@ extern jerry_context_t jerry_global_context;
#if !JERRY_SYSTEM_ALLOCATOR
/**
-* Size of heap
-*/
-#define JMEM_HEAP_SIZE ((size_t) (CONFIG_MEM_HEAP_SIZE))
+ * Size of heap
+ */
+#define JMEM_HEAP_SIZE ((size_t) (CONFIG_MEM_HEAP_SIZE))
/**
* Calculate heap area size, leaving space for a pointer to the free list
*/
-#define JMEM_HEAP_AREA_SIZE (JMEM_HEAP_SIZE - JMEM_ALIGNMENT)
+#define JMEM_HEAP_AREA_SIZE (JMEM_HEAP_SIZE - JMEM_ALIGNMENT)
struct jmem_heap_t
{
@@ -338,26 +339,19 @@ extern jmem_heap_t jerry_global_heap;
#endif /* JERRY_EXTERNAL_CONTEXT */
-void
-jcontext_set_exception_flag (bool is_exception);
+void jcontext_set_exception_flag (bool is_exception);
-void
-jcontext_set_abort_flag (bool is_abort);
+void jcontext_set_abort_flag (bool is_abort);
-bool
-jcontext_has_pending_exception (void);
+bool jcontext_has_pending_exception (void);
-bool
-jcontext_has_pending_abort (void);
+bool jcontext_has_pending_abort (void);
-void
-jcontext_raise_exception (ecma_value_t error);
+void jcontext_raise_exception (ecma_value_t error);
-void
-jcontext_release_exception (void);
+void jcontext_release_exception (void);
-ecma_value_t
-jcontext_take_exception (void);
+ecma_value_t jcontext_take_exception (void);
/**
* @}
diff --git a/jerry-core/jmem/jmem-allocator-internal.h b/jerry-core/jmem/jmem-allocator-internal.h
index a3bc57ee..85e20fd0 100644
--- a/jerry-core/jmem/jmem-allocator-internal.h
+++ b/jerry-core/jmem/jmem-allocator-internal.h
@@ -17,7 +17,7 @@
#define JMEM_ALLOCATOR_INTERNAL_H
#ifndef JMEM_ALLOCATOR_INTERNAL
-# error "The header is for internal routines of memory allocator component. Please, don't use the routines directly."
+#error "The header is for internal routines of memory allocator component. Please, don't use the routines directly."
#endif /* !JMEM_ALLOCATOR_INTERNAL */
/** \addtogroup mem Memory allocation
@@ -29,21 +29,21 @@
* Valgrind-related options and headers
*/
#if JERRY_VALGRIND
-# include "memcheck.h"
+#include "memcheck.h"
-# define JMEM_VALGRIND_NOACCESS_SPACE(p, s) VALGRIND_MAKE_MEM_NOACCESS((p), (s))
-# define JMEM_VALGRIND_UNDEFINED_SPACE(p, s) VALGRIND_MAKE_MEM_UNDEFINED((p), (s))
-# define JMEM_VALGRIND_DEFINED_SPACE(p, s) VALGRIND_MAKE_MEM_DEFINED((p), (s))
-# define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s) VALGRIND_MALLOCLIKE_BLOCK((p), (s), 0, 0)
-# define JMEM_VALGRIND_RESIZE_SPACE(p, o, n) VALGRIND_RESIZEINPLACE_BLOCK((p), (o), (n), 0)
-# define JMEM_VALGRIND_FREELIKE_SPACE(p) VALGRIND_FREELIKE_BLOCK((p), 0)
+#define JMEM_VALGRIND_NOACCESS_SPACE(p, s) VALGRIND_MAKE_MEM_NOACCESS ((p), (s))
+#define JMEM_VALGRIND_UNDEFINED_SPACE(p, s) VALGRIND_MAKE_MEM_UNDEFINED ((p), (s))
+#define JMEM_VALGRIND_DEFINED_SPACE(p, s) VALGRIND_MAKE_MEM_DEFINED ((p), (s))
+#define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s) VALGRIND_MALLOCLIKE_BLOCK ((p), (s), 0, 0)
+#define JMEM_VALGRIND_RESIZE_SPACE(p, o, n) VALGRIND_RESIZEINPLACE_BLOCK ((p), (o), (n), 0)
+#define JMEM_VALGRIND_FREELIKE_SPACE(p) VALGRIND_FREELIKE_BLOCK ((p), 0)
#else /* !JERRY_VALGRIND */
-# define JMEM_VALGRIND_NOACCESS_SPACE(p, s)
-# define JMEM_VALGRIND_UNDEFINED_SPACE(p, s)
-# define JMEM_VALGRIND_DEFINED_SPACE(p, s)
-# define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s)
-# define JMEM_VALGRIND_RESIZE_SPACE(p, o, n)
-# define JMEM_VALGRIND_FREELIKE_SPACE(p)
+#define JMEM_VALGRIND_NOACCESS_SPACE(p, s)
+#define JMEM_VALGRIND_UNDEFINED_SPACE(p, s)
+#define JMEM_VALGRIND_DEFINED_SPACE(p, s)
+#define JMEM_VALGRIND_MALLOCLIKE_SPACE(p, s)
+#define JMEM_VALGRIND_RESIZE_SPACE(p, o, n)
+#define JMEM_VALGRIND_FREELIKE_SPACE(p)
#endif /* JERRY_VALGRIND */
/** @} */
@@ -74,13 +74,13 @@ void jmem_heap_stat_init (void);
void jmem_heap_stat_alloc (size_t num);
void jmem_heap_stat_free (size_t num);
-#define JMEM_HEAP_STAT_INIT() jmem_heap_stat_init ()
+#define JMEM_HEAP_STAT_INIT() jmem_heap_stat_init ()
#define JMEM_HEAP_STAT_ALLOC(v1) jmem_heap_stat_alloc (v1)
-#define JMEM_HEAP_STAT_FREE(v1) jmem_heap_stat_free (v1)
+#define JMEM_HEAP_STAT_FREE(v1) jmem_heap_stat_free (v1)
#else /* !JERRY_MEM_STATS */
#define JMEM_HEAP_STAT_INIT()
#define JMEM_HEAP_STAT_ALLOC(v1) JERRY_UNUSED (v1)
-#define JMEM_HEAP_STAT_FREE(v1) JERRY_UNUSED (v1)
+#define JMEM_HEAP_STAT_FREE(v1) JERRY_UNUSED (v1)
#endif /* JERRY_MEM_STATS */
/** @} */
diff --git a/jerry-core/jmem/jmem-allocator.c b/jerry-core/jmem/jmem-allocator.c
index 905e197a..3cd9dc06 100644
--- a/jerry-core/jmem/jmem-allocator.c
+++ b/jerry-core/jmem/jmem-allocator.c
@@ -17,6 +17,7 @@
* Allocator implementation
*/
#include "ecma-globals.h"
+
#include "jcontext.h"
#include "jmem.h"
#include "jrt-libc-includes.h"
@@ -185,7 +186,7 @@ jmem_compress_pointer (const void *pointer_p) /**< pointer to compress */
JERRY_ASSERT (uint_ptr % JMEM_ALIGNMENT == 0);
-#if defined (ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT
+#if defined(ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT
JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */
const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);
@@ -209,7 +210,7 @@ jmem_compress_pointer (const void *pointer_p) /**< pointer to compress */
*
* @return unpacked pointer
*/
-extern inline void * JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
+extern inline void *JERRY_ATTR_PURE JERRY_ATTR_ALWAYS_INLINE
jmem_decompress_pointer (uintptr_t compressed_pointer) /**< pointer to decompress */
{
JERRY_ASSERT (compressed_pointer != JMEM_CP_NULL);
@@ -218,7 +219,7 @@ jmem_decompress_pointer (uintptr_t compressed_pointer) /**< pointer to decompres
JERRY_ASSERT (((jmem_cpointer_t) uint_ptr) == uint_ptr);
-#if defined (ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT
+#if defined(ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT
JERRY_ASSERT (uint_ptr % JMEM_ALIGNMENT == 0);
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */
const uintptr_t heap_start = (uintptr_t) &JERRY_HEAP_CONTEXT (first);
diff --git a/jerry-core/jmem/jmem-heap.c b/jerry-core/jmem/jmem-heap.c
index cad427a5..152909a6 100644
--- a/jerry-core/jmem/jmem-heap.c
+++ b/jerry-core/jmem/jmem-heap.c
@@ -18,6 +18,7 @@
*/
#include "ecma-gc.h"
+
#include "jcontext.h"
#include "jmem.h"
#include "jrt-bit-fields.h"
@@ -47,7 +48,7 @@
#define JMEM_HEAP_GET_OFFSET_FROM_ADDR(p) ((uint32_t) (p))
#define JMEM_HEAP_GET_ADDR_FROM_OFFSET(u) ((jmem_heap_free_t *) (u))
#else /* !ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
-#define JMEM_HEAP_GET_OFFSET_FROM_ADDR(p) ((uint32_t) ((uint8_t *) (p) - JERRY_HEAP_CONTEXT (area)))
+#define JMEM_HEAP_GET_OFFSET_FROM_ADDR(p) ((uint32_t) ((uint8_t *) (p) -JERRY_HEAP_CONTEXT (area)))
#define JMEM_HEAP_GET_ADDR_FROM_OFFSET(u) ((jmem_heap_free_t *) (JERRY_HEAP_CONTEXT (area) + (u)))
#endif /* ECMA_VALUE_CAN_STORE_UINTPTR_VALUE_DIRECTLY */
/**
@@ -59,7 +60,7 @@
*
* @return pointer to the end of the region
*/
-static inline jmem_heap_free_t * JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_PURE
+static inline jmem_heap_free_t *JERRY_ATTR_ALWAYS_INLINE JERRY_ATTR_PURE
jmem_heap_get_region_end (jmem_heap_free_t *curr_p) /**< current region */
{
return (jmem_heap_free_t *) ((uint8_t *) curr_p + curr_p->size);
@@ -119,7 +120,7 @@ jmem_heap_finalize (void)
* @return pointer to allocated memory block - if allocation is successful,
* NULL - if there is not enough memory.
*/
-static void * JERRY_ATTR_HOT
+static void *JERRY_ATTR_HOT
jmem_heap_alloc (const size_t size) /**< size of requested block */
{
#if !JERRY_SYSTEM_ALLOCATOR
@@ -130,8 +131,7 @@ jmem_heap_alloc (const size_t size) /**< size of requested block */
JMEM_VALGRIND_DEFINED_SPACE (&JERRY_HEAP_CONTEXT (first), sizeof (jmem_heap_free_t));
/* Fast path for 8 byte chunks, first region is guaranteed to be sufficient. */
- if (required_size == JMEM_ALIGNMENT
- && JERRY_LIKELY (JERRY_HEAP_CONTEXT (first).next_offset != JMEM_HEAP_END_OF_LIST))
+ if (required_size == JMEM_ALIGNMENT && JERRY_LIKELY (JERRY_HEAP_CONTEXT (first).next_offset != JMEM_HEAP_END_OF_LIST))
{
data_space_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (JERRY_HEAP_CONTEXT (first).next_offset);
JERRY_ASSERT (jmem_is_heap_pointer (data_space_p));
@@ -303,7 +303,7 @@ jmem_heap_gc_and_alloc_block (const size_t size, /**< required memory size */
/**
* Internal method for allocating a memory block.
*/
-extern inline void * JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
+extern inline void *JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
jmem_heap_alloc_block_internal (const size_t size) /**< required memory size */
{
return jmem_heap_gc_and_alloc_block (size, JMEM_PRESSURE_FULL);
@@ -318,7 +318,7 @@ jmem_heap_alloc_block_internal (const size_t size) /**< required memory size */
* @return NULL, if the required memory is 0
* pointer to allocated memory block, otherwise
*/
-extern inline void * JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
+extern inline void *JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
jmem_heap_alloc_block (const size_t size) /**< required memory size */
{
void *block_p = jmem_heap_gc_and_alloc_block (size, JMEM_PRESSURE_FULL);
@@ -336,7 +336,7 @@ jmem_heap_alloc_block (const size_t size) /**< required memory size */
* also NULL, if the allocation has failed
* pointer to the allocated memory block, otherwise
*/
-extern inline void * JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
+extern inline void *JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
jmem_heap_alloc_block_null_on_error (const size_t size) /**< required memory size */
{
void *block_p = jmem_heap_gc_and_alloc_block (size, JMEM_PRESSURE_HIGH);
@@ -358,7 +358,7 @@ jmem_heap_alloc_block_null_on_error (const size_t size) /**< required memory siz
* @return pointer to the preceeding block
*/
static jmem_heap_free_t *
-jmem_heap_find_prev (const jmem_heap_free_t * const block_p) /**< which memory block's predecessor we're looking for */
+jmem_heap_find_prev (const jmem_heap_free_t *const block_p) /**< which memory block's predecessor we're looking for */
{
const jmem_heap_free_t *prev_p;
@@ -378,7 +378,7 @@ jmem_heap_find_prev (const jmem_heap_free_t * const block_p) /**< which memory b
/* Find position of region in the list. */
while (prev_p->next_offset < block_offset)
{
- const jmem_heap_free_t * const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);
+ const jmem_heap_free_t *const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);
JERRY_ASSERT (jmem_is_heap_pointer (next_p));
JMEM_VALGRIND_DEFINED_SPACE (next_p, sizeof (jmem_heap_free_t));
@@ -489,7 +489,7 @@ jmem_heap_free_block_internal (void *ptr, /**< pointer to beginning of data spac
*
* @return pointer to the reallocated region
*/
-void * JERRY_ATTR_HOT
+void *JERRY_ATTR_HOT
jmem_heap_realloc_block (void *ptr, /**< memory region to reallocate */
const size_t old_size, /**< current size of the region */
const size_t new_size) /**< desired new size */
@@ -500,7 +500,7 @@ jmem_heap_realloc_block (void *ptr, /**< memory region to reallocate */
JERRY_ASSERT (old_size != 0);
JERRY_ASSERT (new_size != 0);
- jmem_heap_free_t * const block_p = (jmem_heap_free_t *) ptr;
+ jmem_heap_free_t *const block_p = (jmem_heap_free_t *) ptr;
const size_t aligned_new_size = (new_size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT * JMEM_ALIGNMENT;
const size_t aligned_old_size = (old_size + JMEM_ALIGNMENT - 1) / JMEM_ALIGNMENT * JMEM_ALIGNMENT;
@@ -544,7 +544,7 @@ jmem_heap_realloc_block (void *ptr, /**< memory region to reallocate */
jmem_heap_free_t *prev_p = jmem_heap_find_prev (block_p);
JMEM_VALGRIND_DEFINED_SPACE (prev_p, sizeof (jmem_heap_free_t));
- jmem_heap_free_t * const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);
+ jmem_heap_free_t *const next_p = JMEM_HEAP_GET_ADDR_FROM_OFFSET (prev_p->next_offset);
/* Check if block can be extended at the end */
if (((jmem_heap_free_t *) ((uint8_t *) block_p + aligned_old_size)) == next_p)
@@ -738,8 +738,7 @@ jmem_heap_stats_print (void)
JERRY_DEBUG_MSG ("Heap stats:\n");
#if !JERRY_SYSTEM_ALLOCATOR
- JERRY_DEBUG_MSG (" Heap size = %zu bytes\n",
- heap_stats->size);
+ JERRY_DEBUG_MSG (" Heap size = %zu bytes\n", heap_stats->size);
#endif /* !JERRY_SYSTEM_ALLOCATOR */
JERRY_DEBUG_MSG (" Allocated = %zu bytes\n"
" Peak allocated = %zu bytes\n"
diff --git a/jerry-core/jmem/jmem-poolman.c b/jerry-core/jmem/jmem-poolman.c
index f688f95e..9fded49e 100644
--- a/jerry-core/jmem/jmem-poolman.c
+++ b/jerry-core/jmem/jmem-poolman.c
@@ -55,7 +55,7 @@ jmem_pools_finalize (void)
* @return pointer to allocated chunk, if allocation was successful,
* or NULL - if not enough memory.
*/
-extern inline void * JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
+extern inline void *JERRY_ATTR_HOT JERRY_ATTR_ALWAYS_INLINE
jmem_pools_alloc (size_t size) /**< size of the chunk */
{
#if JERRY_MEM_GC_BEFORE_EACH_ALLOC
@@ -66,7 +66,7 @@ jmem_pools_alloc (size_t size) /**< size of the chunk */
if (size <= 8)
{
#else /* !JERRY_CPOINTER_32_BIT */
- JERRY_ASSERT (size <= 8);
+ JERRY_ASSERT (size <= 8);
#endif /* JERRY_CPOINTER_32_BIT */
if (JERRY_CONTEXT (jmem_free_8_byte_chunk_p) != NULL)
@@ -130,7 +130,7 @@ jmem_pools_free (void *chunk_p, /**< pointer to the chunk */
if (size <= 8)
{
#else /* !JERRY_CPOINTER_32_BIT */
- JERRY_ASSERT (size <= 8);
+ JERRY_ASSERT (size <= 8);
#endif /* JERRY_CPOINTER_32_BIT */
chunk_to_free_p->next_p = JERRY_CONTEXT (jmem_free_8_byte_chunk_p);
diff --git a/jerry-core/jmem/jmem.h b/jerry-core/jmem/jmem.h
index ae298926..1fc1a719 100644
--- a/jerry-core/jmem/jmem.h
+++ b/jerry-core/jmem/jmem.h
@@ -28,7 +28,7 @@
/**
* Logarithm of required alignment for allocated units/blocks
*/
-#define JMEM_ALIGNMENT_LOG 3
+#define JMEM_ALIGNMENT_LOG 3
/**
* Representation of NULL value for compressed pointers
@@ -55,7 +55,7 @@
/**
* Shift for tag part in jmem_cpointer_tag_t
*/
-#if defined (JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT
+#if defined(JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY) && JERRY_CPOINTER_32_BIT
#define JMEM_TAG_SHIFT 0
#else /* !JMEM_CAN_STORE_POINTER_VALUE_DIRECTLY || !JERRY_CPOINTER_32_BIT */
#define JMEM_TAG_SHIFT 3
@@ -66,9 +66,9 @@
*/
enum
{
- JMEM_FIRST_TAG_BIT_MASK = (1u << 0), /**< first tag bit mask **/
- JMEM_SECOND_TAG_BIT_MASK = (1u << 1), /**< second tag bit mask **/
- JMEM_THIRD_TAG_BIT_MASK = (1u << 2), /**< third tag bit mask **/
+ JMEM_FIRST_TAG_BIT_MASK = (1u << 0), /**< first tag bit mask **/
+ JMEM_SECOND_TAG_BIT_MASK = (1u << 1), /**< second tag bit mask **/
+ JMEM_THIRD_TAG_BIT_MASK = (1u << 2), /**< third tag bit mask **/
};
/**
@@ -117,7 +117,7 @@ typedef uint32_t jmem_cpointer_tag_t;
typedef enum
{
JMEM_PRESSURE_NONE, /**< no memory pressure */
- JMEM_PRESSURE_LOW, /**< low memory pressure */
+ JMEM_PRESSURE_LOW, /**< low memory pressure */
JMEM_PRESSURE_HIGH, /**< high memory pressure */
JMEM_PRESSURE_FULL, /**< memory full */
} jmem_pressure_t;
@@ -189,7 +189,7 @@ void jmem_heap_stats_print (void);
#endif /* JERRY_MEM_STATS */
jmem_cpointer_t JERRY_ATTR_PURE jmem_compress_pointer (const void *pointer_p);
-void * JERRY_ATTR_PURE jmem_decompress_pointer (uintptr_t compressed_pointer);
+void *JERRY_ATTR_PURE jmem_decompress_pointer (uintptr_t compressed_pointer);
/**
* Define a local array variable and allocate memory for the array on the heap.
@@ -199,33 +199,32 @@ void * JERRY_ATTR_PURE jmem_decompress_pointer (uintptr_t compressed_pointer);
* Warning:
* if there is not enough memory on the heap, shutdown engine with ERR_OUT_OF_MEMORY.
*/
-#define JMEM_DEFINE_LOCAL_ARRAY(var_name, number, type) \
-{ \
- size_t var_name ## ___size = (size_t) (number) * sizeof (type); \
- type *var_name = (type *) (jmem_heap_alloc_block (var_name ## ___size));
+#define JMEM_DEFINE_LOCAL_ARRAY(var_name, number, type) \
+ { \
+ size_t var_name##___size = (size_t) (number) * sizeof (type); \
+ type *var_name = (type *) (jmem_heap_alloc_block (var_name##___size));
/**
* Free the previously defined local array variable, freeing corresponding block on the heap,
* if it was allocated (i.e. if the array's size was non-zero).
*/
-#define JMEM_FINALIZE_LOCAL_ARRAY(var_name) \
- if (var_name != NULL) \
- { \
- JERRY_ASSERT (var_name ## ___size != 0); \
- \
- jmem_heap_free_block (var_name, var_name ## ___size); \
- } \
- else \
- { \
- JERRY_ASSERT (var_name ## ___size == 0); \
- } \
-}
+#define JMEM_FINALIZE_LOCAL_ARRAY(var_name) \
+ if (var_name != NULL) \
+ { \
+ JERRY_ASSERT (var_name##___size != 0); \
+ \
+ jmem_heap_free_block (var_name, var_name##___size); \
+ } \
+ else \
+ { \
+ JERRY_ASSERT (var_name##___size == 0); \
+ } \
+ }
/**
* Get value of pointer from specified non-null compressed pointer value
*/
-#define JMEM_CP_GET_NON_NULL_POINTER(type, cp_value) \
- ((type *) (jmem_decompress_pointer (cp_value)))
+#define JMEM_CP_GET_NON_NULL_POINTER(type, cp_value) ((type *) (jmem_decompress_pointer (cp_value)))
/**
* Get value of pointer from specified compressed pointer value
@@ -245,29 +244,29 @@ void * JERRY_ATTR_PURE jmem_decompress_pointer (uintptr_t compressed_pointer);
* to specified non_compressed_pointer
*/
#define JMEM_CP_SET_POINTER(cp_value, non_compressed_pointer) \
- do \
- { \
- void *ptr_value = (void *) non_compressed_pointer; \
- \
- if (JERRY_UNLIKELY ((ptr_value) == NULL)) \
- { \
- (cp_value) = JMEM_CP_NULL; \
- } \
- else \
- { \
- JMEM_CP_SET_NON_NULL_POINTER (cp_value, ptr_value); \
- } \
+ do \
+ { \
+ void *ptr_value = (void *) non_compressed_pointer; \
+ \
+ if (JERRY_UNLIKELY ((ptr_value) == NULL)) \
+ { \
+ (cp_value) = JMEM_CP_NULL; \
+ } \
+ else \
+ { \
+ JMEM_CP_SET_NON_NULL_POINTER (cp_value, ptr_value); \
+ } \
} while (false);
/**
* Set value of pointer-tag value so that it will correspond
* to specified non_compressed_pointer along with tag
*/
-#define JMEM_CP_SET_NON_NULL_POINTER_TAG(cp_value, pointer, tag) \
- do \
- { \
- JERRY_ASSERT ((uintptr_t) tag < (uintptr_t) (JMEM_ALIGNMENT)); \
- jmem_cpointer_tag_t compressed_ptr = jmem_compress_pointer (pointer); \
+#define JMEM_CP_SET_NON_NULL_POINTER_TAG(cp_value, pointer, tag) \
+ do \
+ { \
+ JERRY_ASSERT ((uintptr_t) tag < (uintptr_t) (JMEM_ALIGNMENT)); \
+ jmem_cpointer_tag_t compressed_ptr = jmem_compress_pointer (pointer); \
(cp_value) = (jmem_cpointer_tag_t) ((compressed_ptr << JMEM_TAG_SHIFT) | tag); \
} while (false);
@@ -286,12 +285,14 @@ void * JERRY_ATTR_PURE jmem_decompress_pointer (uintptr_t compressed_pointer);
/**
* Get value of each tag from specified pointer-tag value
*/
-#define JMEM_CP_GET_FIRST_BIT_FROM_POINTER_TAG(cp_value) \
- (cp_value & JMEM_FIRST_TAG_BIT_MASK) /**< get first tag bit **/
+#define JMEM_CP_GET_FIRST_BIT_FROM_POINTER_TAG(cp_value) \
+ (cp_value & JMEM_FIRST_TAG_BIT_MASK) /**< get first tag bit \
+ **/
#define JMEM_CP_GET_SECOND_BIT_FROM_POINTER_TAG(cp_value) \
(cp_value & JMEM_SECOND_TAG_BIT_MASK) /**< get second tag bit **/
-#define JMEM_CP_GET_THIRD_BIT_FROM_POINTER_TAG(cp_value) \
- (cp_value & JMEM_THIRD_TAG_BIT_MASK) /**< get third tag bit **/
+#define JMEM_CP_GET_THIRD_BIT_FROM_POINTER_TAG(cp_value) \
+ (cp_value & JMEM_THIRD_TAG_BIT_MASK) /**< get third tag bit \
+ **/
/**
* Set value of each tag to specified pointer-tag value
diff --git a/jerry-core/jrt/jrt-bit-fields.h b/jerry-core/jrt/jrt-bit-fields.h
index c5aaf373..53ea31b2 100644
--- a/jerry-core/jrt/jrt-bit-fields.h
+++ b/jerry-core/jrt/jrt-bit-fields.h
@@ -25,8 +25,7 @@
* @param width width of the bit-field to be extracted
* @return bit-field's value
*/
-#define JRT_EXTRACT_BIT_FIELD(type, container, lsb, width) \
- (((container) >> lsb) & ((((type) 1) << (width)) - 1))
+#define JRT_EXTRACT_BIT_FIELD(type, container, lsb, width) (((container) >> lsb) & ((((type) 1) << (width)) - 1))
/**
* Set a bit-field.
diff --git a/jerry-core/jrt/jrt-fatals.c b/jerry-core/jrt/jrt-fatals.c
index 404cc5a0..36c02277 100644
--- a/jerry-core/jrt/jrt-fatals.c
+++ b/jerry-core/jrt/jrt-fatals.c
@@ -17,8 +17,8 @@
* Implementation of exit with specified status code.
*/
-#include "jrt.h"
#include "jrt-libc-includes.h"
+#include "jrt.h"
/*
* Exit with specified status code.
@@ -78,11 +78,7 @@ jerry_assert_fail (const char *assertion, /**< assertion condition string */
const char *function, /**< function name */
const uint32_t line) /**< line */
{
- JERRY_ERROR_MSG ("ICE: Assertion '%s' failed at %s(%s):%lu.\n",
- assertion,
- file,
- function,
- (unsigned long) line);
+ JERRY_ERROR_MSG ("ICE: Assertion '%s' failed at %s(%s):%lu.\n", assertion, file, function, (unsigned long) line);
jerry_fatal (ERR_FAILED_INTERNAL_ASSERTION);
} /* jerry_assert_fail */
@@ -95,10 +91,7 @@ jerry_unreachable (const char *file, /**< file name */
const char *function, /**< function name */
const uint32_t line) /**< line */
{
- JERRY_ERROR_MSG ("ICE: Unreachable control path at %s(%s):%lu was executed.\n",
- file,
- function,
- (unsigned long) line);
+ JERRY_ERROR_MSG ("ICE: Unreachable control path at %s(%s):%lu was executed.\n", file, function, (unsigned long) line);
jerry_fatal (ERR_FAILED_INTERNAL_ASSERTION);
} /* jerry_unreachable */
diff --git a/jerry-core/jrt/jrt.h b/jerry-core/jrt/jrt.h
index e9bed7a0..ffd4bde3 100644
--- a/jerry-core/jrt/jrt.h
+++ b/jerry-core/jrt/jrt.h
@@ -19,8 +19,9 @@
#include <stdio.h>
#include <string.h>
-#include "config.h"
#include "jerryscript-port.h"
+
+#include "config.h"
#include "jrt-types.h"
/*
@@ -33,21 +34,21 @@
*/
#define JERRY_UNUSED(x) ((void) (x))
-#define JERRY_UNUSED_1(_1) JERRY_UNUSED (_1)
-#define JERRY_UNUSED_2(_1, _2) JERRY_UNUSED (_1), JERRY_UNUSED_1 (_2)
-#define JERRY_UNUSED_3(_1, _2, _3) JERRY_UNUSED (_1), JERRY_UNUSED_2 (_2, _3)
-#define JERRY_UNUSED_4(_1, _2, _3, _4) JERRY_UNUSED (_1), JERRY_UNUSED_3 (_2, _3, _4)
-#define JERRY_UNUSED_5(_1, _2, _3, _4, _5) JERRY_UNUSED (_1), JERRY_UNUSED_4 (_2, _3, _4, _5)
-#define JERRY_UNUSED_6(_1, _2, _3, _4, _5, _6) JERRY_UNUSED (_1), JERRY_UNUSED_5 (_2, _3, _4, _5, _6)
-#define JERRY_UNUSED_7(_1, _2, _3, _4, _5, _6, _7) JERRY_UNUSED (_1), JERRY_UNUSED_6 (_2, _3, _4, _5, _6, _7)
-#define JERRY_UNUSED_8(_1, _2, _3, _4, _5, _6, _7, _8) JERRY_UNUSED (_1), JERRY_UNUSED_7 (_2, _3, _4, _5, _6, _7, _8)
+#define JERRY_UNUSED_1(_1) JERRY_UNUSED (_1)
+#define JERRY_UNUSED_2(_1, _2) JERRY_UNUSED (_1), JERRY_UNUSED_1 (_2)
+#define JERRY_UNUSED_3(_1, _2, _3) JERRY_UNUSED (_1), JERRY_UNUSED_2 (_2, _3)
+#define JERRY_UNUSED_4(_1, _2, _3, _4) JERRY_UNUSED (_1), JERRY_UNUSED_3 (_2, _3, _4)
+#define JERRY_UNUSED_5(_1, _2, _3, _4, _5) JERRY_UNUSED (_1), JERRY_UNUSED_4 (_2, _3, _4, _5)
+#define JERRY_UNUSED_6(_1, _2, _3, _4, _5, _6) JERRY_UNUSED (_1), JERRY_UNUSED_5 (_2, _3, _4, _5, _6)
+#define JERRY_UNUSED_7(_1, _2, _3, _4, _5, _6, _7) JERRY_UNUSED (_1), JERRY_UNUSED_6 (_2, _3, _4, _5, _6, _7)
+#define JERRY_UNUSED_8(_1, _2, _3, _4, _5, _6, _7, _8) JERRY_UNUSED (_1), JERRY_UNUSED_7 (_2, _3, _4, _5, _6, _7, _8)
#define JERRY_VA_ARGS_NUM_IMPL(_1, _2, _3, _4, _5, _6, _7, _8, N, ...) N
-#define JERRY_VA_ARGS_NUM(...) JERRY_VA_ARGS_NUM_IMPL (__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0)
+#define JERRY_VA_ARGS_NUM(...) JERRY_VA_ARGS_NUM_IMPL (__VA_ARGS__, 8, 7, 6, 5, 4, 3, 2, 1, 0)
-#define JERRY_UNUSED_ALL_IMPL_(nargs) JERRY_UNUSED_ ## nargs
-#define JERRY_UNUSED_ALL_IMPL(nargs) JERRY_UNUSED_ALL_IMPL_ (nargs)
-#define JERRY_UNUSED_ALL(...) JERRY_UNUSED_ALL_IMPL (JERRY_VA_ARGS_NUM (__VA_ARGS__)) (__VA_ARGS__)
+#define JERRY_UNUSED_ALL_IMPL_(nargs) JERRY_UNUSED_##nargs
+#define JERRY_UNUSED_ALL_IMPL(nargs) JERRY_UNUSED_ALL_IMPL_ (nargs)
+#define JERRY_UNUSED_ALL(...) JERRY_UNUSED_ALL_IMPL (JERRY_VA_ARGS_NUM (__VA_ARGS__)) (__VA_ARGS__)
/*
* Asserts
@@ -57,39 +58,43 @@
* __LINE__ may be the same for asserts in a header
* and in an implementation file.
*/
-#define JERRY_STATIC_ASSERT_GLUE_(a, b, c) a ## b ## _ ## c
-#define JERRY_STATIC_ASSERT_GLUE(a, b, c) JERRY_STATIC_ASSERT_GLUE_ (a, b, c)
-#define JERRY_STATIC_ASSERT(x, msg) \
- enum { JERRY_STATIC_ASSERT_GLUE (static_assertion_failed_, __LINE__, msg) = 1 / (!!(x)) }
+#define JERRY_STATIC_ASSERT_GLUE_(a, b, c) a##b##_##c
+#define JERRY_STATIC_ASSERT_GLUE(a, b, c) JERRY_STATIC_ASSERT_GLUE_ (a, b, c)
+#define JERRY_STATIC_ASSERT(x, msg) \
+ enum \
+ { \
+ JERRY_STATIC_ASSERT_GLUE (static_assertion_failed_, __LINE__, msg) = 1 / (!!(x)) \
+ }
#ifndef JERRY_NDEBUG
-void JERRY_ATTR_NORETURN
-jerry_assert_fail (const char *assertion, const char *file, const char *function, const uint32_t line);
-void JERRY_ATTR_NORETURN
-jerry_unreachable (const char *file, const char *function, const uint32_t line);
-
-#define JERRY_ASSERT(x) \
- do \
- { \
- if (JERRY_UNLIKELY (!(x))) \
- { \
+void JERRY_ATTR_NORETURN jerry_assert_fail (const char *assertion,
+ const char *file,
+ const char *function,
+ const uint32_t line);
+void JERRY_ATTR_NORETURN jerry_unreachable (const char *file, const char *function, const uint32_t line);
+
+#define JERRY_ASSERT(x) \
+ do \
+ { \
+ if (JERRY_UNLIKELY (!(x))) \
+ { \
jerry_assert_fail (#x, __FILE__, __func__, __LINE__); \
- } \
+ } \
} while (0)
-#define JERRY_UNREACHABLE() \
- do \
- { \
+#define JERRY_UNREACHABLE() \
+ do \
+ { \
jerry_unreachable (__FILE__, __func__, __LINE__); \
} while (0)
#else /* JERRY_NDEBUG */
#define JERRY_ASSERT(x) \
- do \
- { \
- if (false) \
- { \
+ do \
+ { \
+ if (false) \
+ { \
JERRY_UNUSED (x); \
- } \
+ } \
} while (0)
#ifdef __GNUC__
@@ -97,7 +102,7 @@ jerry_unreachable (const char *file, const char *function, const uint32_t line);
#endif /* __GNUC__ */
#ifdef _MSC_VER
-#define JERRY_UNREACHABLE() _assume (0)
+#define JERRY_UNREACHABLE() _assume (0)
#endif /* _MSC_VER */
#ifndef JERRY_UNREACHABLE
@@ -115,15 +120,43 @@ void JERRY_ATTR_NORETURN jerry_fatal (jerry_fatal_code_t code);
* Logging
*/
#if JERRY_LOGGING
-#define JERRY_ERROR_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_ERROR, __VA_ARGS__)
+#define JERRY_ERROR_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_ERROR, __VA_ARGS__)
#define JERRY_WARNING_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_WARNING, __VA_ARGS__)
-#define JERRY_DEBUG_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__)
-#define JERRY_TRACE_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_TRACE, __VA_ARGS__)
+#define JERRY_DEBUG_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__)
+#define JERRY_TRACE_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_TRACE, __VA_ARGS__)
#else /* !JERRY_LOGGING */
-#define JERRY_ERROR_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
-#define JERRY_WARNING_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
-#define JERRY_DEBUG_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
-#define JERRY_TRACE_MSG(...) do { if (false) { JERRY_UNUSED_ALL (__VA_ARGS__); } } while (0)
+#define JERRY_ERROR_MSG(...) \
+ do \
+ { \
+ if (false) \
+ { \
+ JERRY_UNUSED_ALL (__VA_ARGS__); \
+ } \
+ } while (0)
+#define JERRY_WARNING_MSG(...) \
+ do \
+ { \
+ if (false) \
+ { \
+ JERRY_UNUSED_ALL (__VA_ARGS__); \
+ } \
+ } while (0)
+#define JERRY_DEBUG_MSG(...) \
+ do \
+ { \
+ if (false) \
+ { \
+ JERRY_UNUSED_ALL (__VA_ARGS__); \
+ } \
+ } while (0)
+#define JERRY_TRACE_MSG(...) \
+ do \
+ { \
+ if (false) \
+ { \
+ JERRY_UNUSED_ALL (__VA_ARGS__); \
+ } \
+ } while (0)
#endif /* JERRY_LOGGING */
/**
@@ -136,7 +169,7 @@ void JERRY_ATTR_NORETURN jerry_fatal (jerry_fatal_code_t code);
*
* Returns minimum positive value, that divides @a alignment and is more than or equal to @a value
*/
-#define JERRY_ALIGNUP(value, alignment) (((value) + ((alignment) - 1)) & ~((alignment) - 1))
+#define JERRY_ALIGNUP(value, alignment) (((value) + ((alignment) -1)) & ~((alignment) -1))
/*
* min, max
@@ -151,7 +184,7 @@ void JERRY_ATTR_NORETURN jerry_fatal (jerry_fatal_code_t code);
#define JERRY__LOG2_2(n) (((n) >= 1 << 2) ? (2 + JERRY__LOG2_1 ((n) >> 2)) : JERRY__LOG2_1 (n))
#define JERRY__LOG2_4(n) (((n) >= 1 << 4) ? (4 + JERRY__LOG2_2 ((n) >> 4)) : JERRY__LOG2_2 (n))
#define JERRY__LOG2_8(n) (((n) >= 1 << 8) ? (8 + JERRY__LOG2_4 ((n) >> 8)) : JERRY__LOG2_4 (n))
-#define JERRY_LOG2(n) (((n) >= 1 << 16) ? (16 + JERRY__LOG2_8 ((n) >> 16)) : JERRY__LOG2_8 (n))
+#define JERRY_LOG2(n) (((n) >= 1 << 16) ? (16 + JERRY__LOG2_8 ((n) >> 16)) : JERRY__LOG2_8 (n))
/**
* JERRY_BLOCK_TAIL_CALL_OPTIMIZATION
@@ -173,17 +206,16 @@ void JERRY_ATTR_NORETURN jerry_fatal (jerry_fatal_code_t code);
* This macro is intentionally here as jerryscript-compiler.h is a public header and
* it does not make sense to expose this macro to the public.
*/
-#if defined (__clang__) || defined (__GNUC__)
+#if defined(__clang__) || defined(__GNUC__)
/* Clang/GCC will not tail call given inline volatile assembly. */
-#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__ ("")
+#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION() __asm__ __volatile__("")
#else /* !defined(__clang__) && !defined(__GNUC__) */
/* On GCC 10.x this version also works. */
-#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION() \
-do \
-{ \
- JERRY_CONTEXT (status_flags) |= ECMA_STATUS_API_AVAILABLE; \
-} \
-while (0)
+#define JERRY_BLOCK_TAIL_CALL_OPTIMIZATION() \
+ do \
+ { \
+ JERRY_CONTEXT (status_flags) |= ECMA_STATUS_API_AVAILABLE; \
+ } while (0)
#endif /* defined(__clang__) || defined (__GNUC__) */
#endif /* !JRT_H */
diff --git a/jerry-core/lit/lit-char-helpers.c b/jerry-core/lit/lit-char-helpers.c
index 8570729d..6eb6c5d9 100644
--- a/jerry-core/lit/lit-char-helpers.c
+++ b/jerry-core/lit/lit-char-helpers.c
@@ -13,9 +13,11 @@
* limitations under the License.
*/
-#include "config.h"
-#include "ecma-helpers.h"
#include "lit-char-helpers.h"
+
+#include "ecma-helpers.h"
+
+#include "config.h"
#include "lit-strings.h"
#include "lit-unicode-ranges.inc.h"
#if JERRY_ESNEXT
@@ -39,37 +41,36 @@
* @return true - if the character is in the given array
* false - otherwise
*/
-#define LIT_SEARCH_CHAR_IN_ARRAY_FN(function_name, char_type, array_type) \
-static bool \
-function_name (char_type c, /**< code unit */ \
- const array_type *array, /**< array */ \
- int size_of_array) /**< length of the array */\
-{ \
- int bottom = 0; \
- int top = size_of_array - 1; \
- \
- while (bottom <= top) \
- { \
- int middle = (bottom + top) / 2; \
- char_type current = array[middle]; \
- \
- if (current == c) \
- { \
- return true; \
- } \
- \
- if (c < current) \
- { \
- top = middle - 1; \
- } \
- else \
- { \
- bottom = middle + 1; \
- } \
- } \
- \
- return false; \
-} /* __function_name */
+#define LIT_SEARCH_CHAR_IN_ARRAY_FN(function_name, char_type, array_type) \
+ static bool function_name (char_type c, /**< code unit */ \
+ const array_type *array, /**< array */ \
+ int size_of_array) /**< length of the array */ \
+ { \
+ int bottom = 0; \
+ int top = size_of_array - 1; \
+ \
+ while (bottom <= top) \
+ { \
+ int middle = (bottom + top) / 2; \
+ char_type current = array[middle]; \
+ \
+ if (current == c) \
+ { \
+ return true; \
+ } \
+ \
+ if (c < current) \
+ { \
+ top = middle - 1; \
+ } \
+ else \
+ { \
+ bottom = middle + 1; \
+ } \
+ } \
+ \
+ return false; \
+ } /* __function_name */
LIT_SEARCH_CHAR_IN_ARRAY_FN (lit_search_char_in_array, ecma_char_t, uint16_t)
@@ -85,38 +86,37 @@ LIT_SEARCH_CHAR_IN_ARRAY_FN (lit_search_codepoint_in_array, lit_code_point_t, ui
* @return true - if the the character is included (inclusively) in one of the intervals in the given array
* false - otherwise
*/
-#define LIT_SEARCH_CHAR_IN_INTERVAL_ARRAY_FN(function_name, char_type, array_type, interval_type) \
-static bool \
-function_name (char_type c, /**< code unit */ \
- const array_type *array_sp, /**< array of interval starting points */ \
- const interval_type *lengths, /**< array of interval lengths */ \
- int size_of_array) /**< length of the array */ \
-{ \
- int bottom = 0; \
- int top = size_of_array - 1; \
- \
- while (bottom <= top) \
- { \
- int middle = (bottom + top) / 2; \
- char_type current_sp = array_sp[middle]; \
- \
- if (current_sp <= c && c <= current_sp + lengths[middle]) \
- { \
- return true; \
- } \
- \
- if (c > current_sp) \
- { \
- bottom = middle + 1; \
- } \
- else \
- { \
- top = middle - 1; \
- } \
- } \
- \
- return false; \
-} /* function_name */
+#define LIT_SEARCH_CHAR_IN_INTERVAL_ARRAY_FN(function_name, char_type, array_type, interval_type) \
+ static bool function_name (char_type c, /**< code unit */ \
+ const array_type *array_sp, /**< array of interval starting points */ \
+ const interval_type *lengths, /**< array of interval lengths */ \
+ int size_of_array) /**< length of the array */ \
+ { \
+ int bottom = 0; \
+ int top = size_of_array - 1; \
+ \
+ while (bottom <= top) \
+ { \
+ int middle = (bottom + top) / 2; \
+ char_type current_sp = array_sp[middle]; \
+ \
+ if (current_sp <= c && c <= current_sp + lengths[middle]) \
+ { \
+ return true; \
+ } \
+ \
+ if (c > current_sp) \
+ { \
+ bottom = middle + 1; \
+ } \
+ else \
+ { \
+ top = middle - 1; \
+ } \
+ } \
+ \
+ return false; \
+ } /* function_name */
LIT_SEARCH_CHAR_IN_INTERVAL_ARRAY_FN (lit_search_char_in_interval_array, ecma_char_t, uint16_t, uint8_t)
@@ -144,18 +144,17 @@ lit_char_is_white_space (lit_code_point_t c) /**< code point */
/* Mongolian Vowel Separator (u180e) used to be a whitespace character. */
|| c == LIT_CHAR_MVS
#endif /* !JERRY_ESNEXT */
- || c == LIT_CHAR_LS
- || c == LIT_CHAR_PS)
+ || c == LIT_CHAR_LS || c == LIT_CHAR_PS)
{
return true;
}
return (c <= LIT_UTF16_CODE_UNIT_MAX
&& ((c >= lit_unicode_white_space_interval_starts[0]
- && c <= lit_unicode_white_space_interval_starts[0] + lit_unicode_white_space_interval_lengths[0])
+ && c <= lit_unicode_white_space_interval_starts[0] + lit_unicode_white_space_interval_lengths[0])
|| lit_search_char_in_array ((ecma_char_t) c,
- lit_unicode_white_space_chars,
- NUM_OF_ELEMENTS (lit_unicode_white_space_chars))));
+ lit_unicode_white_space_chars,
+ NUM_OF_ELEMENTS (lit_unicode_white_space_chars))));
} /* lit_char_is_white_space */
/**
@@ -167,10 +166,7 @@ lit_char_is_white_space (lit_code_point_t c) /**< code point */
bool
lit_char_is_line_terminator (ecma_char_t c) /**< code unit */
{
- return (c == LIT_CHAR_LF
- || c == LIT_CHAR_CR
- || c == LIT_CHAR_LS
- || c == LIT_CHAR_PS);
+ return (c == LIT_CHAR_LF || c == LIT_CHAR_CR || c == LIT_CHAR_LS || c == LIT_CHAR_PS);
} /* lit_char_is_line_terminator */
/**
@@ -244,13 +240,12 @@ lit_char_is_unicode_id_continue (lit_code_point_t code_point) /**< code unit */
ecma_char_t c = (ecma_char_t) code_point;
- return (lit_search_char_in_interval_array (c,
- lit_unicode_id_continue_interval_starts,
- lit_unicode_id_continue_interval_lengths,
- NUM_OF_ELEMENTS (lit_unicode_id_continue_interval_starts))
- || lit_search_char_in_array (c,
- lit_unicode_id_continue_chars,
- NUM_OF_ELEMENTS (lit_unicode_id_continue_chars)));
+ return (
+ lit_search_char_in_interval_array (c,
+ lit_unicode_id_continue_interval_starts,
+ lit_unicode_id_continue_interval_lengths,
+ NUM_OF_ELEMENTS (lit_unicode_id_continue_interval_starts))
+ || lit_search_char_in_array (c, lit_unicode_id_continue_chars, NUM_OF_ELEMENTS (lit_unicode_id_continue_chars)));
} /* lit_char_is_unicode_id_continue */
/**
@@ -266,8 +261,7 @@ lit_code_point_is_identifier_start (lit_code_point_t code_point) /**< code point
{
return ((LEXER_TO_ASCII_LOWERCASE (code_point) >= LIT_CHAR_LOWERCASE_A
&& LEXER_TO_ASCII_LOWERCASE (code_point) <= LIT_CHAR_LOWERCASE_Z)
- || code_point == LIT_CHAR_DOLLAR_SIGN
- || code_point == LIT_CHAR_UNDERSCORE);
+ || code_point == LIT_CHAR_DOLLAR_SIGN || code_point == LIT_CHAR_UNDERSCORE);
}
return lit_char_is_unicode_id_start (code_point);
@@ -286,8 +280,7 @@ lit_code_point_is_identifier_part (lit_code_point_t code_point) /**< code point
{
return ((LEXER_TO_ASCII_LOWERCASE (code_point) >= LIT_CHAR_LOWERCASE_A
&& LEXER_TO_ASCII_LOWERCASE (code_point) <= LIT_CHAR_LOWERCASE_Z)
- || (code_point >= LIT_CHAR_0 && code_point <= LIT_CHAR_9)
- || code_point == LIT_CHAR_DOLLAR_SIGN
+ || (code_point >= LIT_CHAR_0 && code_point <= LIT_CHAR_9) || code_point == LIT_CHAR_DOLLAR_SIGN
|| code_point == LIT_CHAR_UNDERSCORE);
}
@@ -356,9 +349,9 @@ lit_char_unicode_escape (ecma_stringbuilder_t *builder_p, /**< stringbuilder to
for (int8_t i = 3; i >= 0; i--)
{
int32_t result_char = (c >> (i * 4)) & 0xF;
- ecma_stringbuilder_append_byte (builder_p, (lit_utf8_byte_t) (result_char + (result_char <= 9
- ? LIT_CHAR_0
- : (LIT_CHAR_LOWERCASE_A - 10))));
+ ecma_stringbuilder_append_byte (
+ builder_p,
+ (lit_utf8_byte_t) (result_char + (result_char <= 9 ? LIT_CHAR_0 : (LIT_CHAR_LOWERCASE_A - 10))));
}
} /* lit_char_unicode_escape */
@@ -561,8 +554,7 @@ lit_char_is_word_char (lit_code_point_t c) /**< code point */
{
return ((c >= LIT_CHAR_ASCII_LOWERCASE_LETTERS_BEGIN && c <= LIT_CHAR_ASCII_LOWERCASE_LETTERS_END)
|| (c >= LIT_CHAR_ASCII_UPPERCASE_LETTERS_BEGIN && c <= LIT_CHAR_ASCII_UPPERCASE_LETTERS_END)
- || (c >= LIT_CHAR_ASCII_DIGITS_BEGIN && c <= LIT_CHAR_ASCII_DIGITS_END)
- || c == LIT_CHAR_UNDERSCORE);
+ || (c >= LIT_CHAR_ASCII_DIGITS_BEGIN && c <= LIT_CHAR_ASCII_DIGITS_END) || c == LIT_CHAR_UNDERSCORE);
} /* lit_char_is_word_char */
#if JERRY_UNICODE_CASE_CONVERSION
@@ -574,8 +566,8 @@ lit_char_is_word_char (lit_code_point_t c) /**< code point */
* LIT_INVALID_CP - otherwise.
*/
static lit_code_point_t
-lit_search_in_bidirectional_conversion_tables (lit_code_point_t cp, /**< code point */
- bool is_lowercase) /**< is lowercase conversion */
+lit_search_in_bidirectional_conversion_tables (lit_code_point_t cp, /**< code point */
+ bool is_lowercase) /**< is lowercase conversion */
{
/* 1, Check if the specified character is part of the lit_unicode_character_case_ranges_{sup} table. */
int number_of_case_ranges;
@@ -723,10 +715,10 @@ lit_search_in_bidirectional_conversion_tables (lit_code_point_t cp, /**< code
* converted code point - otherwise
*/
static lit_code_point_t
-lit_search_in_conversion_table (ecma_char_t character, /**< code unit */
- ecma_stringbuilder_t *builder_p, /**< string builder */
- const ecma_char_t *array, /**< array */
- const uint8_t *counters) /**< case_values counter */
+lit_search_in_conversion_table (ecma_char_t character, /**< code unit */
+ ecma_stringbuilder_t *builder_p, /**< string builder */
+ const ecma_char_t *array, /**< array */
+ const uint8_t *counters) /**< case_values counter */
{
int end_point = 0;
@@ -763,7 +755,7 @@ lit_search_in_conversion_table (ecma_char_t character, /**< code unit
}
}
- return size_of_case_value == 1 ? array[middle + 1]: LIT_MULTIPLE_CU;
+ return size_of_case_value == 1 ? array[middle + 1] : LIT_MULTIPLE_CU;
}
if (character < current)
@@ -943,8 +935,7 @@ bool
lit_char_fold_to_lower (lit_code_point_t cp) /**< code point */
{
#if JERRY_UNICODE_CASE_CONVERSION
- return (cp <= LIT_UTF8_1_BYTE_CODE_POINT_MAX
- || cp > LIT_UTF16_CODE_UNIT_MAX
+ return (cp <= LIT_UTF8_1_BYTE_CODE_POINT_MAX || cp > LIT_UTF16_CODE_UNIT_MAX
|| (!lit_search_char_in_interval_array ((ecma_char_t) cp,
lit_unicode_folding_skip_to_lower_interval_starts,
lit_unicode_folding_skip_to_lower_interval_lengths,
@@ -967,12 +958,11 @@ bool
lit_char_fold_to_upper (lit_code_point_t cp) /**< code point */
{
#if JERRY_UNICODE_CASE_CONVERSION
- return (cp > LIT_UTF8_1_BYTE_CODE_POINT_MAX
- && cp <= LIT_UTF16_CODE_UNIT_MAX
+ return (cp > LIT_UTF8_1_BYTE_CODE_POINT_MAX && cp <= LIT_UTF16_CODE_UNIT_MAX
&& (lit_search_char_in_interval_array ((ecma_char_t) cp,
- lit_unicode_folding_to_upper_interval_starts,
- lit_unicode_folding_to_upper_interval_lengths,
- NUM_OF_ELEMENTS (lit_unicode_folding_to_upper_interval_starts))
+ lit_unicode_folding_to_upper_interval_starts,
+ lit_unicode_folding_to_upper_interval_lengths,
+ NUM_OF_ELEMENTS (lit_unicode_folding_to_upper_interval_starts))
|| lit_search_char_in_array ((ecma_char_t) cp,
lit_unicode_folding_to_upper_chars,
NUM_OF_ELEMENTS (lit_unicode_folding_to_upper_chars))));
diff --git a/jerry-core/lit/lit-char-helpers.h b/jerry-core/lit/lit-char-helpers.h
index 7e970aa6..16370cd3 100644
--- a/jerry-core/lit/lit-char-helpers.h
+++ b/jerry-core/lit/lit-char-helpers.h
@@ -16,6 +16,8 @@
#ifndef LIT_CHAR_HELPERS_H
#define LIT_CHAR_HELPERS_H
+#include "ecma-globals.h"
+
#include "lit-globals.h"
/**
@@ -61,7 +63,7 @@ bool lit_char_is_line_terminator (ecma_char_t c);
/*
* String Single Character Escape Sequences (ECMA-262 v5, Table 4)
*/
-#define LIT_CHAR_BS ((ecma_char_t) 0x0008) /* backspace */
+#define LIT_CHAR_BS ((ecma_char_t) 0x0008) /* backspace */
/* LIT_CHAR_TAB is defined above */
/* LIT_CHAR_LF is defined above */
/* LIT_CHAR_VTAB is defined above */
@@ -80,8 +82,8 @@ bool lit_char_is_line_terminator (ecma_char_t c);
/*
* Identifier name characters (ECMA-262 v5, 7.6)
*/
-#define LIT_CHAR_DOLLAR_SIGN ((ecma_char_t) '$') /* dollar sign */
-#define LIT_CHAR_UNDERSCORE ((ecma_char_t) '_') /* low line (underscore) */
+#define LIT_CHAR_DOLLAR_SIGN ((ecma_char_t) '$') /* dollar sign */
+#define LIT_CHAR_UNDERSCORE ((ecma_char_t) '_') /* low line (underscore) */
/* LIT_CHAR_BACKSLASH defined above */
bool lit_code_point_is_identifier_start (lit_code_point_t code_point);
@@ -105,14 +107,14 @@ bool lit_code_point_is_identifier_part (lit_code_point_t code_point);
#define LIT_CHAR_PLUS ((ecma_char_t) '+') /* plus sign */
#define LIT_CHAR_MINUS ((ecma_char_t) '-') /* hyphen-minus */
/* LIT_CHAR_ASTERISK is defined above */
-#define LIT_CHAR_PERCENT ((ecma_char_t) '%') /* percent sign */
-#define LIT_CHAR_AMPERSAND ((ecma_char_t) '&') /* ampersand */
-#define LIT_CHAR_VLINE ((ecma_char_t) '|') /* vertical line */
-#define LIT_CHAR_CIRCUMFLEX ((ecma_char_t) '^') /* circumflex accent */
-#define LIT_CHAR_EXCLAMATION ((ecma_char_t) '!') /* exclamation mark */
-#define LIT_CHAR_TILDE ((ecma_char_t) '~') /* tilde */
-#define LIT_CHAR_QUESTION ((ecma_char_t) '?') /* question mark */
-#define LIT_CHAR_COLON ((ecma_char_t) ':') /* colon */
+#define LIT_CHAR_PERCENT ((ecma_char_t) '%') /* percent sign */
+#define LIT_CHAR_AMPERSAND ((ecma_char_t) '&') /* ampersand */
+#define LIT_CHAR_VLINE ((ecma_char_t) '|') /* vertical line */
+#define LIT_CHAR_CIRCUMFLEX ((ecma_char_t) '^') /* circumflex accent */
+#define LIT_CHAR_EXCLAMATION ((ecma_char_t) '!') /* exclamation mark */
+#define LIT_CHAR_TILDE ((ecma_char_t) '~') /* tilde */
+#define LIT_CHAR_QUESTION ((ecma_char_t) '?') /* question mark */
+#define LIT_CHAR_COLON ((ecma_char_t) ':') /* colon */
/*
* Special characters for String.prototype.replace.
@@ -182,39 +184,41 @@ bool lit_code_point_is_identifier_part (lit_code_point_t code_point);
/**
* ASCII decimal digits
*/
-#define LIT_CHAR_0 ((ecma_char_t) '0')
-#define LIT_CHAR_1 ((ecma_char_t) '1')
-#define LIT_CHAR_2 ((ecma_char_t) '2')
-#define LIT_CHAR_3 ((ecma_char_t) '3')
-#define LIT_CHAR_4 ((ecma_char_t) '4')
-#define LIT_CHAR_5 ((ecma_char_t) '5')
-#define LIT_CHAR_6 ((ecma_char_t) '6')
-#define LIT_CHAR_7 ((ecma_char_t) '7')
-#define LIT_CHAR_8 ((ecma_char_t) '8')
-#define LIT_CHAR_9 ((ecma_char_t) '9')
+#define LIT_CHAR_0 ((ecma_char_t) '0')
+#define LIT_CHAR_1 ((ecma_char_t) '1')
+#define LIT_CHAR_2 ((ecma_char_t) '2')
+#define LIT_CHAR_3 ((ecma_char_t) '3')
+#define LIT_CHAR_4 ((ecma_char_t) '4')
+#define LIT_CHAR_5 ((ecma_char_t) '5')
+#define LIT_CHAR_6 ((ecma_char_t) '6')
+#define LIT_CHAR_7 ((ecma_char_t) '7')
+#define LIT_CHAR_8 ((ecma_char_t) '8')
+#define LIT_CHAR_9 ((ecma_char_t) '9')
/**
* ASCII character ranges
*/
-#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_BEGIN LIT_CHAR_UPPERCASE_A /* uppercase letters range */
-#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_END LIT_CHAR_UPPERCASE_Z
+#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_BEGIN LIT_CHAR_UPPERCASE_A /* uppercase letters range */
+#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_END LIT_CHAR_UPPERCASE_Z
-#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_BEGIN LIT_CHAR_LOWERCASE_A /* lowercase letters range */
-#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_END LIT_CHAR_LOWERCASE_Z
+#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_BEGIN LIT_CHAR_LOWERCASE_A /* lowercase letters range */
+#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_END LIT_CHAR_LOWERCASE_Z
-#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_HEX_BEGIN LIT_CHAR_UPPERCASE_A /* uppercase letters for
- * hexadecimal digits range */
-#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_HEX_END LIT_CHAR_UPPERCASE_F
+#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_HEX_BEGIN \
+ LIT_CHAR_UPPERCASE_A /* uppercase letters for \
+ * hexadecimal digits range */
+#define LIT_CHAR_ASCII_UPPERCASE_LETTERS_HEX_END LIT_CHAR_UPPERCASE_F
-#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_BEGIN LIT_CHAR_LOWERCASE_A /* lowercase letters for
- * hexadecimal digits range */
-#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_END LIT_CHAR_LOWERCASE_F
+#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_BEGIN \
+ LIT_CHAR_LOWERCASE_A /* lowercase letters for \
+ * hexadecimal digits range */
+#define LIT_CHAR_ASCII_LOWERCASE_LETTERS_HEX_END LIT_CHAR_LOWERCASE_F
-#define LIT_CHAR_ASCII_OCTAL_DIGITS_BEGIN LIT_CHAR_0 /* octal digits range */
-#define LIT_CHAR_ASCII_OCTAL_DIGITS_END LIT_CHAR_7
+#define LIT_CHAR_ASCII_OCTAL_DIGITS_BEGIN LIT_CHAR_0 /* octal digits range */
+#define LIT_CHAR_ASCII_OCTAL_DIGITS_END LIT_CHAR_7
-#define LIT_CHAR_ASCII_DIGITS_BEGIN LIT_CHAR_0 /* decimal digits range */
-#define LIT_CHAR_ASCII_DIGITS_END LIT_CHAR_9
+#define LIT_CHAR_ASCII_DIGITS_BEGIN LIT_CHAR_0 /* decimal digits range */
+#define LIT_CHAR_ASCII_DIGITS_END LIT_CHAR_9
#define LEXER_TO_ASCII_LOWERCASE(character) ((character) | LIT_CHAR_SP)
@@ -236,7 +240,7 @@ bool lit_find_char_in_string (ecma_string_t *str_p, lit_utf8_byte_t c);
/**
* Null character
*/
-#define LIT_CHAR_NULL ((ecma_char_t) '\0')
+#define LIT_CHAR_NULL ((ecma_char_t) '\0')
/*
* Part of IsWordChar abstract operation (ECMA-262 v5, 15.10.2.6, step 3)
diff --git a/jerry-core/lit/lit-magic-strings.c b/jerry-core/lit/lit-magic-strings.c
index f72f3895..560497ef 100644
--- a/jerry-core/lit/lit-magic-strings.c
+++ b/jerry-core/lit/lit-magic-strings.c
@@ -13,8 +13,9 @@
* limitations under the License.
*/
-#include "jcontext.h"
#include "lit-magic-strings.h"
+
+#include "jcontext.h"
#include "lit-strings.h"
/**
@@ -42,16 +43,14 @@ lit_get_magic_string_ex_count (void)
const lit_utf8_byte_t *
lit_get_magic_string_utf8 (uint32_t id) /**< magic string id */
{
- static const lit_utf8_byte_t * const lit_magic_strings[] JERRY_ATTR_CONST_DATA =
- {
+ static const lit_utf8_byte_t *const lit_magic_strings[] JERRY_ATTR_CONST_DATA = {
/** @cond doxygen_suppress */
#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id)
-#define LIT_MAGIC_STRING_DEF(id, utf8_string) \
- (const lit_utf8_byte_t *) utf8_string,
+#define LIT_MAGIC_STRING_DEF(id, utf8_string) (const lit_utf8_byte_t *) utf8_string,
#include "lit-magic-strings.inc.h"
#undef LIT_MAGIC_STRING_DEF
#undef LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE
-/** @endcond */
+ /** @endcond */
};
JERRY_ASSERT (id < LIT_NON_INTERNAL_MAGIC_STRING__COUNT);
@@ -67,16 +66,14 @@ lit_get_magic_string_utf8 (uint32_t id) /**< magic string id */
lit_utf8_size_t
lit_get_magic_string_size (uint32_t id) /**< magic string id */
{
- static const lit_magic_size_t lit_magic_string_sizes[] JERRY_ATTR_CONST_DATA =
- {
+ static const lit_magic_size_t lit_magic_string_sizes[] JERRY_ATTR_CONST_DATA = {
/** @cond doxygen_suppress */
#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id)
-#define LIT_MAGIC_STRING_DEF(id, utf8_string) \
- sizeof(utf8_string) - 1,
+#define LIT_MAGIC_STRING_DEF(id, utf8_string) sizeof (utf8_string) - 1,
#include "lit-magic-strings.inc.h"
#undef LIT_MAGIC_STRING_DEF
#undef LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE
-/** @endcond */
+ /** @endcond */
};
JERRY_ASSERT (id < LIT_NON_INTERNAL_MAGIC_STRING__COUNT);
@@ -93,17 +90,15 @@ lit_get_magic_string_size (uint32_t id) /**< magic string id */
static lit_magic_string_id_t
lit_get_magic_string_size_block_start (lit_utf8_size_t size) /**< magic string size */
{
- static const lit_magic_string_id_t lit_magic_string_size_block_starts[] JERRY_ATTR_CONST_DATA =
- {
+ static const lit_magic_string_id_t lit_magic_string_size_block_starts[] JERRY_ATTR_CONST_DATA = {
/** @cond doxygen_suppress */
#define LIT_MAGIC_STRING_DEF(id, utf8_string)
-#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id) \
- id,
+#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id) id,
#include "lit-magic-strings.inc.h"
LIT_NON_INTERNAL_MAGIC_STRING__COUNT
#undef LIT_MAGIC_STRING_DEF
#undef LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE
-/** @endcond */
+ /** @endcond */
};
JERRY_ASSERT (size <= (sizeof (lit_magic_string_size_block_starts) / sizeof (lit_magic_string_id_t)));
@@ -139,10 +134,10 @@ lit_get_magic_string_ex_size (uint32_t id) /**< external magic string id */
* Register external magic strings
*/
void
-lit_magic_strings_ex_set (const lit_utf8_byte_t * const *ex_str_items, /**< character arrays, representing
- * external magic strings' contents */
- uint32_t count, /**< number of the strings */
- const lit_utf8_size_t *ex_str_sizes) /**< sizes of the strings */
+lit_magic_strings_ex_set (const lit_utf8_byte_t *const *ex_str_items, /**< character arrays, representing
+ * external magic strings' contents */
+ uint32_t count, /**< number of the strings */
+ const lit_utf8_size_t *ex_str_sizes) /**< sizes of the strings */
{
JERRY_ASSERT (ex_str_items != NULL);
JERRY_ASSERT (count > 0);
@@ -164,8 +159,7 @@ lit_magic_strings_ex_set (const lit_utf8_byte_t * const *ex_str_items, /**< char
JERRY_CONTEXT (lit_magic_string_ex_sizes) = ex_str_sizes;
#ifndef JERRY_NDEBUG
- for (lit_magic_string_ex_id_t id = (lit_magic_string_ex_id_t) 0;
- id < JERRY_CONTEXT (lit_magic_string_ex_count);
+ for (lit_magic_string_ex_id_t id = (lit_magic_string_ex_id_t) 0; id < JERRY_CONTEXT (lit_magic_string_ex_count);
id = (lit_magic_string_ex_id_t) (id + 1))
{
lit_utf8_size_t string_size = JERRY_CONTEXT (lit_magic_string_ex_sizes)[id];
@@ -178,8 +172,7 @@ lit_magic_strings_ex_set (const lit_utf8_byte_t * const *ex_str_items, /**< char
{
const lit_magic_string_ex_id_t prev_id = id - 1;
const lit_utf8_size_t prev_string_size = lit_get_magic_string_ex_size (prev_id);
- JERRY_ASSERT (lit_is_valid_cesu8_string (lit_get_magic_string_ex_utf8 (id),
- string_size));
+ JERRY_ASSERT (lit_is_valid_cesu8_string (lit_get_magic_string_ex_utf8 (id), string_size));
JERRY_ASSERT (prev_string_size <= string_size);
if (prev_string_size == string_size)
@@ -298,8 +291,7 @@ lit_is_ex_utf8_string_magic (const lit_utf8_byte_t *string_p, /**< utf-8 string
{
const uint32_t magic_string_ex_count = lit_get_magic_string_ex_count ();
- if (magic_string_ex_count == 0
- || string_size > lit_get_magic_string_ex_size (magic_string_ex_count - 1))
+ if (magic_string_ex_count == 0 || string_size > lit_get_magic_string_ex_size (magic_string_ex_count - 1))
{
return (lit_magic_string_ex_id_t) magic_string_ex_count;
}
@@ -358,8 +350,7 @@ lit_is_ex_utf8_string_pair_magic (const lit_utf8_byte_t *string1_p, /**< first u
const uint32_t magic_string_ex_count = lit_get_magic_string_ex_count ();
const lit_utf8_size_t total_string_size = string1_size + string2_size;
- if (magic_string_ex_count == 0
- || total_string_size > lit_get_magic_string_ex_size (magic_string_ex_count - 1))
+ if (magic_string_ex_count == 0 || total_string_size > lit_get_magic_string_ex_size (magic_string_ex_count - 1))
{
return (lit_magic_string_ex_id_t) magic_string_ex_count;
}
@@ -430,7 +421,7 @@ lit_copy_magic_string_to_buffer (lit_magic_string_id_t id, /**< magic string id
while (magic_string_bytes_count--)
{
- bytes_copied ++;
+ bytes_copied++;
JERRY_ASSERT (bytes_copied <= buffer_size);
*buf_iter_p++ = *str_iter_p++;
diff --git a/jerry-core/lit/lit-magic-strings.h b/jerry-core/lit/lit-magic-strings.h
index c0695f73..7f556f43 100644
--- a/jerry-core/lit/lit-magic-strings.h
+++ b/jerry-core/lit/lit-magic-strings.h
@@ -25,12 +25,11 @@ typedef enum
{
/** @cond doxygen_suppress */
#define LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE(size, id)
-#define LIT_MAGIC_STRING_DEF(id, ascii_zt_string) \
- id,
+#define LIT_MAGIC_STRING_DEF(id, ascii_zt_string) id,
#include "lit-magic-strings.inc.h"
#undef LIT_MAGIC_STRING_DEF
#undef LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE
-/** @endcond */
+ /** @endcond */
LIT_NON_INTERNAL_MAGIC_STRING__COUNT, /**< number of non-internal magic strings */
LIT_INTERNAL_MAGIC_API_INTERNAL = LIT_NON_INTERNAL_MAGIC_STRING__COUNT, /**< Used to add non-visible JS properties
* from the public API */
@@ -90,13 +89,15 @@ lit_utf8_size_t lit_get_magic_string_size (uint32_t id);
const lit_utf8_byte_t *lit_get_magic_string_ex_utf8 (uint32_t id);
lit_utf8_size_t lit_get_magic_string_ex_size (uint32_t id);
-void lit_magic_strings_ex_set (const lit_utf8_byte_t * const *ex_str_items,
+void lit_magic_strings_ex_set (const lit_utf8_byte_t *const *ex_str_items,
uint32_t count,
const lit_utf8_size_t *ex_str_sizes);
lit_magic_string_id_t lit_is_utf8_string_magic (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);
-lit_magic_string_id_t lit_is_utf8_string_pair_magic (const lit_utf8_byte_t *string1_p, lit_utf8_size_t string1_size,
- const lit_utf8_byte_t *string2_p, lit_utf8_size_t string2_size);
+lit_magic_string_id_t lit_is_utf8_string_pair_magic (const lit_utf8_byte_t *string1_p,
+ lit_utf8_size_t string1_size,
+ const lit_utf8_byte_t *string2_p,
+ lit_utf8_size_t string2_size);
lit_magic_string_ex_id_t lit_is_ex_utf8_string_magic (const lit_utf8_byte_t *string_p, lit_utf8_size_t string_size);
lit_magic_string_ex_id_t lit_is_ex_utf8_string_pair_magic (const lit_utf8_byte_t *string1_p,
@@ -104,7 +105,7 @@ lit_magic_string_ex_id_t lit_is_ex_utf8_string_pair_magic (const lit_utf8_byte_t
const lit_utf8_byte_t *string2_p,
lit_utf8_size_t string2_size);
-lit_utf8_byte_t *lit_copy_magic_string_to_buffer (lit_magic_string_id_t id, lit_utf8_byte_t *buffer_p,
- lit_utf8_size_t buffer_size);
+lit_utf8_byte_t *
+lit_copy_magic_string_to_buffer (lit_magic_string_id_t id, lit_utf8_byte_t *buffer_p, lit_utf8_size_t buffer_size);
#endif /* !LIT_MAGIC_STRINGS_H */
diff --git a/jerry-core/lit/lit-magic-strings.inc.h b/jerry-core/lit/lit-magic-strings.inc.h
index 0cc6c769..4b7c21d7 100644
--- a/jerry-core/lit/lit-magic-strings.inc.h
+++ b/jerry-core/lit/lit-magic-strings.inc.h
@@ -19,1048 +19,1050 @@
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING__EMPTY, "")
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPACE_CHAR, " ")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASTERIX_CHAR, "*")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_MODULE_SYSTEM */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COMMA_CHAR, ",")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_E_U, "E")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LEFT_SQUARE_CHAR, "[")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RIGHT_SQUARE_CHAR, "]")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PI_U, "PI")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_STRING \
-|| JERRY_BUILTIN_TYPEDARRAY \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_MATH */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_STRING || JERRY_BUILTIN_TYPEDARRAY || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_AT, "at")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_STRING \
+|| JERRY_BUILTIN_TYPEDARRAY \
+|| JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS, "is")
-#endif
-#if JERRY_BUILTIN_ARRAY && JERRY_ESNEXT \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_ESNEXT */
+#if JERRY_BUILTIN_ARRAY && JERRY_ESNEXT || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OF, "of")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY && JERRY_ESNEXT \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_OR, "or")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LN2_U, "LN2")
-#endif
-#if JERRY_BUILTIN_CONTAINER \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_MATH */
+#if JERRY_BUILTIN_CONTAINER || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAP_UL, "Map")
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NAN, "NaN")
-#if JERRY_BUILTIN_CONTAINER \
-|| JERRY_ESNEXT
+#if JERRY_BUILTIN_CONTAINER || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UL, "Set")
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UTC_U, "UTC")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ABS, "abs")
-#endif
-#if JERRY_BUILTIN_ATOMICS \
-|| JERRY_BUILTIN_CONTAINER
+#endif /* JERRY_BUILTIN_MATH */
+#if JERRY_BUILTIN_ATOMICS || JERRY_BUILTIN_CONTAINER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ADD, "add")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS \
+|| JERRY_BUILTIN_CONTAINER */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ALL, "all")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_AND, "and")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ANY, "any")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COS, "cos")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EXP, "exp")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FOR, "for")
-#endif
+#endif /* JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET, "get")
-#if JERRY_BUILTIN_CONTAINER \
-|| JERRY_BUILTIN_PROXY \
-|| JERRY_BUILTIN_REFLECT
+#if JERRY_BUILTIN_CONTAINER || JERRY_BUILTIN_PROXY || JERRY_BUILTIN_REFLECT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HAS, "has")
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER \
+|| JERRY_BUILTIN_PROXY \
+|| JERRY_BUILTIN_REFLECT */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG, "log")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_BUILTIN_MATH */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAP, "map")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAX, "max")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MIN, "min")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NOW, "now")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_ARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_POP, "pop")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_POW, "pow")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RAW, "raw")
-#endif
+#endif /* JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET, "set")
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SIN, "sin")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_SUB, "sub")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TAN, "tan")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_XOR, "xor")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
#if JERRY_BUILTIN_REGEXP
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP, "(?:)")
-#endif
-#if JERRY_BUILTIN_DATE \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_REGEXP */
+#if JERRY_BUILTIN_DATE || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DATE_UL, "Date")
-#endif
+#endif /* JERRY_BUILTIN_DATE \
+|| JERRY_ESNEXT */
#if JERRY_BUILTIN_JSON
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_JSON_U, "JSON")
-#endif
+#endif /* JERRY_BUILTIN_JSON */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LN10_U, "LN10")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MATH_UL, "Math")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NULL_UL, "Null")
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ACOS, "acos")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASIN, "asin")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATAN, "atan")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BIND, "bind")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CALL, "call")
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CBRT, "cbrt")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CEIL, "ceil")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COSH, "cosh")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DONE, "done")
-#endif
+#endif /* JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EVAL, "eval")
#if JERRY_BUILTIN_REGEXP
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EXEC, "exec")
-#endif
-#if JERRY_BUILTIN_TYPEDARRAY \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_REGEXP */
+#if JERRY_BUILTIN_TYPEDARRAY || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FILL, "fill")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FIND, "find")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY \
+|| JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLAT, "flat")
-#endif
-#if JERRY_BUILTIN_ARRAY && JERRY_ESNEXT \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_ESNEXT */
+#if JERRY_BUILTIN_ARRAY && JERRY_ESNEXT || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FROM, "from")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY && JERRY_ESNEXT \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IMUL, "imul")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_JOIN, "join")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_KEYS, "keys")
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_LOAD, "load")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG2, "log2")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NAME, "name")
-#if JERRY_BUILTIN_CONTAINER \
-|| JERRY_ESNEXT
+#if JERRY_BUILTIN_CONTAINER || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NEXT, "next")
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NULL, "null")
#if JERRY_BUILTIN_ARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PUSH, "push")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RACE, "race")
-#endif
+#endif /* JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SEAL, "seal")
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SIGN, "sign")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SINH, "sinh")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
#if JERRY_BUILTIN_CONTAINER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SIZE, "size")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_BUILTIN_CONTAINER */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SOME, "some")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SORT, "sort")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SQRT, "sqrt")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TANH, "tanh")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
#if JERRY_BUILTIN_REGEXP
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TEST, "test")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_THEN, "then")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRIM, "trim")
-#endif
+#endif /* JERRY_BUILTIN_STRING */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRUE, "true")
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_WAIT, "wait")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARRAY_UL, "Array")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ERROR_UL, "Error")
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG2E_U, "LOG2E")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_PROXY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROXY_UL, "Proxy")
-#endif
+#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SQRT2_U, "SQRT2")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ACOSH, "acosh")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_APPLY, "apply")
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASINH, "asinh")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATAN2, "atan2")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATANH, "atanh")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CATCH, "catch")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_CONTAINER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CLEAR, "clear")
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CLZ32, "clz32")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
#if JERRY_BUILTIN_WEAKREF
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEREF, "deref")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_BUILTIN_WEAKREF */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EVERY, "every")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EXPM1, "expm1")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FALSE, "false")
#if JERRY_BUILTIN_REGEXP && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLAGS, "flags")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP && JERRY_ESNEXT */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLOOR, "floor")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HYPOT, "hypot")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
#if JERRY_BUILTIN_REGEXP
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INDEX, "index")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INPUT, "input")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_NAN, "isNaN")
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG10, "log10")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG1P, "log1p")
-#endif
-#if JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
+#if JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MATCH, "match")
-#endif
-#if JERRY_BUILTIN_DATE \
-|| JERRY_BUILTIN_JSON
+#endif /* JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING \
+|| JERRY_ESNEXT */
+#if JERRY_BUILTIN_DATE || JERRY_BUILTIN_JSON
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PARSE, "parse")
-#endif
+#endif /* JERRY_BUILTIN_DATE \
+|| JERRY_BUILTIN_JSON */
#if JERRY_BUILTIN_PROXY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROXY, "proxy")
-#endif
+#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ROUND, "round")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_BUILTIN_ARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SHIFT, "shift")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_SHAREDARRAYBUFFER \
-|| JERRY_BUILTIN_STRING \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_BUILTIN_ARRAY */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_SHAREDARRAYBUFFER || JERRY_BUILTIN_STRING || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SLICE, "slice")
-#endif
-#if JERRY_BUILTIN_STRING \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_SHAREDARRAYBUFFER \
+|| JERRY_BUILTIN_STRING \
+|| JERRY_BUILTIN_TYPEDARRAY */
+#if JERRY_BUILTIN_STRING || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPLIT, "split")
-#endif
+#endif /* JERRY_BUILTIN_STRING \
+|| JERRY_ESNEXT */
#if JERRY_LINE_INFO
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STACK, "stack")
-#endif
+#endif /* JERRY_LINE_INFO */
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_STORE, "store")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_THROW, "throw")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRUNC, "trunc")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_VALUE, "value")
#if JERRY_PARSER && JERRY_RESOURCE_NAME
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RESOURCE_EVAL, "<eval>")
-#endif
+#endif /* JERRY_PARSER && JERRY_RESOURCE_NAME */
#if JERRY_BUILTIN_BIGINT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BIGINT_UL, "BigInt")
-#endif
+#endif /* JERRY_BUILTIN_BIGINT */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOG10E_U, "LOG10E")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_MODULE_SYSTEM
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MODULE_UL, "Module")
-#endif
+#endif /* JERRY_MODULE_SYSTEM */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NUMBER_UL, "Number")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OBJECT_UL, "Object")
-#if JERRY_BUILTIN_REGEXP \
-|| JERRY_ESNEXT
+#if JERRY_BUILTIN_REGEXP || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REGEXP_UL, "RegExp")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP \
+|| JERRY_ESNEXT */
#if JERRY_PARSER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SCRIPT_UL, "Script")
-#endif
+#endif /* JERRY_PARSER */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRING_UL, "String")
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL_UL, "Symbol")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASSIGN, "assign")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_BIGINT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BIGINT, "bigint")
-#endif
-#if JERRY_BUILTIN_DATAVIEW \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_BUILTIN_BIGINT */
+#if JERRY_BUILTIN_DATAVIEW || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BUFFER, "buffer")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW \
+|| JERRY_BUILTIN_TYPEDARRAY */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CALLEE, "callee")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CALLER, "caller")
#if JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CHAR_AT_UL, "charAt")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_STRING
+#endif /* JERRY_BUILTIN_STRING */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CONCAT, "concat")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_STRING */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CREATE, "create")
#if JERRY_BUILTIN_CONTAINER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DELETE, "delete")
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_REGEXP && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DOTALL, "dotAll")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP && JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ERRORS_UL, "errors")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_ANNEXB
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ESCAPE, "escape")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_BUILTIN_ANNEXB */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FILTER, "filter")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_TYPEDARRAY */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FREEZE, "freeze")
#if JERRY_BUILTIN_MATH && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FROUND, "fround")
-#endif
+#endif /* JERRY_BUILTIN_MATH && JERRY_ESNEXT */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_DAY_UL, "getDay")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_REGEXP
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GLOBAL, "global")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_VIEW_UL, "isView")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_KEY_FOR, "keyFor")
-#endif
+#endif /* JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LENGTH, "length")
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_NOTIFY, "notify")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NUMBER, "number")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OBJECT, "object")
#if JERRY_BUILTIN_STRING && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PAD_END, "padEnd")
-#endif
+#endif /* JERRY_BUILTIN_STRING && JERRY_ESNEXT */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RANDOM, "random")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REASON, "reason")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_ESNEXT */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REDUCE, "reduce")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REJECT, "reject")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_STRING && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REPEAT, "repeat")
-#endif
+#endif /* JERRY_BUILTIN_STRING && JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RETURN, "return")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_PROXY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REVOKE, "revoke")
-#endif
-#if JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_PROXY */
+#if JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SEARCH, "search")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING \
+|| JERRY_ESNEXT */
#if JERRY_BUILTIN_REGEXP
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SOURCE, "source")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_ARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPLICE, "splice")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STATUS, "status")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_REGEXP && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STICKY, "sticky")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP && JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRING, "string")
#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SUBSTR, "substr")
-#endif
+#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_STRING */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL, "symbol")
-#endif
-#if JERRY_BUILTIN_DATE \
-|| JERRY_BUILTIN_JSON
+#endif /* JERRY_ESNEXT */
+#if JERRY_BUILTIN_DATE || JERRY_BUILTIN_JSON
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_JSON_UL, "toJSON")
-#endif
-#if JERRY_BUILTIN_CONTAINER \
-|| JERRY_BUILTIN_TYPEDARRAY \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_DATE \
+|| JERRY_BUILTIN_JSON */
+#if JERRY_BUILTIN_CONTAINER || JERRY_BUILTIN_TYPEDARRAY || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_VALUES, "values")
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER \
+|| JERRY_BUILTIN_TYPEDARRAY \
+|| JERRY_ESNEXT */
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_U, "Atomics")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BOOLEAN_UL, "Boolean")
#if JERRY_BUILTIN_NUMBER && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EPSILON_U, "EPSILON")
-#endif
+#endif /* JERRY_BUILTIN_NUMBER && JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROMISE_UL, "Promise")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_REFLECT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REFLECT_UL, "Reflect")
-#endif
+#endif /* JERRY_BUILTIN_REFLECT */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SQRT1_2_U, "SQRT1_2")
-#endif
+#endif /* JERRY_BUILTIN_MATH */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYMBOL_DOT_UL, "Symbol.")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_CONTAINER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WEAKMAP_UL, "WeakMap")
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER */
#if JERRY_BUILTIN_WEAKREF
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WEAKREF_UL, "WeakRef")
-#endif
+#endif /* JERRY_BUILTIN_WEAKREF */
#if JERRY_BUILTIN_CONTAINER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WEAKSET_UL, "WeakSet")
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BOOLEAN, "boolean")
#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_REGEXP
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COMPILE, "compile")
-#endif
-#if JERRY_ESNEXT \
-|| JERRY_MODULE_SYSTEM
+#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_REGEXP */
+#if JERRY_ESNEXT || JERRY_MODULE_SYSTEM
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFAULT, "default")
-#endif
-#if JERRY_BUILTIN_CONTAINER \
-|| JERRY_BUILTIN_TYPEDARRAY \
-|| JERRY_ESNEXT
+#endif /* JERRY_ESNEXT \
+|| JERRY_MODULE_SYSTEM */
+#if JERRY_BUILTIN_CONTAINER || JERRY_BUILTIN_TYPEDARRAY || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENTRIES, "entries")
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER \
+|| JERRY_BUILTIN_TYPEDARRAY \
+|| JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FINALLY, "finally")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLATMAP, "flatMap")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_CONTAINER \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_ESNEXT */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_CONTAINER || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FOR_EACH_UL, "forEach")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_CONTAINER \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_DATE_UL, "getDate")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_INT8_UL, "getInt8")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_TIME_UL, "getTime")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_YEAR_UL, "getYear")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_STRING \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_STRING || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INDEX_OF_UL, "indexOf")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_STRING \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_ARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_ARRAY_UL, "isArray")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MESSAGE, "message")
-#if JERRY_BUILTIN_PROXY \
-|| JERRY_BUILTIN_REFLECT
+#if JERRY_BUILTIN_PROXY || JERRY_BUILTIN_REFLECT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OWN_KEYS_UL, "ownKeys")
-#endif
-#if JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_PROXY \
+|| JERRY_BUILTIN_REFLECT */
+#if JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REPLACE, "replace")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING \
+|| JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RESOLVE, "resolve")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_ESNEXT */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REVERSE, "reverse")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_DATE_UL, "setDate")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_INT8_UL, "setInt8")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_TIME_UL, "setTime")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_YEAR_UL, "setYear")
-#endif
+#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SPECIES, "species")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_NUMBER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_FIXED_UL, "toFixed")
-#endif
+#endif /* JERRY_BUILTIN_NUMBER */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRIM_END, "trimEnd")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_REGEXP && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNICODE, "unicode")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP && JERRY_ESNEXT */
#if JERRY_BUILTIN_ARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNSHIFT, "unshift")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_VALUE_OF_UL, "valueOf")
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DATAVIEW_UL, "DataView")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_UL, "Function")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INFINITY_UL, "Infinity")
#if JERRY_BUILTIN_ERRORS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_URI_ERROR_UL, "URIError")
-#endif
+#endif /* JERRY_BUILTIN_ERRORS */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OBJECT_TO_STRING_UL, "[object ")
#if JERRY_BUILTIN_STRING && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENDS_WITH, "endsWith")
-#endif
+#endif /* JERRY_BUILTIN_STRING && JERRY_ESNEXT */
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_EXCHANGE, "exchange")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION, "function")
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_HOURS_UL, "getHours")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_INT16_UL, "getInt16")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_INT32_UL, "getInt32")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_MONTH_UL, "getMonth")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UINT8_UL, "getUint8")
-#endif
-#if JERRY_BUILTIN_TYPEDARRAY \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_DATAVIEW */
+#if JERRY_BUILTIN_TYPEDARRAY || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INCLUDES, "includes")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY \
+|| JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_FINITE, "isFinite")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_FROZEN_UL, "isFrozen")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_SEALED_UL, "isSealed")
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ITERATOR, "iterator")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MATCH_ALL, "matchAll")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_STRING && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PAD_START, "padStart")
-#endif
+#endif /* JERRY_BUILTIN_STRING && JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PARSE_INT, "parseInt")
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REJECTED, "rejected")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_HOURS_UL, "setHours")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_INT16_UL, "setInt16")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_INT32_UL, "setInt32")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_MONTH_UL, "setMonth")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UINT8_UL, "setUint8")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SUBARRAY, "subarray")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_STRING_UL, "toString")
#if JERRY_BUILTIN_STRING && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRIM_LEFT, "trimLeft")
-#endif
+#endif /* JERRY_BUILTIN_STRING && JERRY_ESNEXT */
#if JERRY_BUILTIN_ANNEXB
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNESCAPE, "unescape")
-#endif
+#endif /* JERRY_BUILTIN_ANNEXB */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_WRITABLE, "writable")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NEGATIVE_INFINITY_UL, "-Infinity")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARGUMENTS_UL, "Arguments")
#if JERRY_BUILTIN_ERRORS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_EVAL_ERROR_UL, "EvalError")
-#endif
+#endif /* JERRY_BUILTIN_ERRORS */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GENERATOR_UL, "Generator")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INT8_ARRAY_UL, "Int8Array")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_NUMBER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAX_VALUE_U, "MAX_VALUE")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MIN_VALUE_U, "MIN_VALUE")
-#endif
+#endif /* JERRY_BUILTIN_NUMBER */
#if JERRY_BUILTIN_ERRORS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TYPE_ERROR_UL, "TypeError")
-#endif
+#endif /* JERRY_BUILTIN_ERRORS */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNDEFINED_UL, "Undefined")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING__PROTO__, "__proto__")
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ANONYMOUS, "anonymous")
-#endif
+#endif /* JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARGUMENTS, "arguments")
-#if JERRY_BUILTIN_PROXY \
-|| JERRY_BUILTIN_REFLECT
+#if JERRY_BUILTIN_PROXY || JERRY_BUILTIN_REFLECT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CONSTRUCT, "construct")
-#endif
+#endif /* JERRY_BUILTIN_PROXY \
+|| JERRY_BUILTIN_REFLECT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DECODE_URI, "decodeURI")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENCODE_URI, "encodeURI")
-#if JERRY_BUILTIN_TYPEDARRAY \
-|| JERRY_ESNEXT
+#if JERRY_BUILTIN_TYPEDARRAY || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FIND_INDEX, "findIndex")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY \
+|| JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FULFILLED, "fulfilled")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_DAY_UL, "getUTCDay")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UINT16_UL, "getUint16")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UINT32_UL, "getUint32")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_INTEGER, "isInteger")
-#endif
+#endif /* JERRY_ESNEXT */
+#if JERRY_BUILTIN_REGEXP || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LASTINDEX_UL, "lastIndex")
+#endif /* JERRY_BUILTIN_REGEXP \
+|| JERRY_ESNEXT */
#if JERRY_BUILTIN_REGEXP
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MULTILINE, "multiline")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROTOTYPE, "prototype")
#if JERRY_BUILTIN_PROXY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REVOCABLE, "revocable")
-#endif
+#endif /* JERRY_BUILTIN_PROXY */
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UINT16_UL, "setUint16")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UINT32_UL, "setUint32")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_JSON
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRINGIFY, "stringify")
-#endif
+#endif /* JERRY_BUILTIN_JSON */
#if JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SUBSTRING, "substring")
-#endif
+#endif /* JERRY_BUILTIN_STRING */
#if JERRY_BUILTIN_STRING && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRIM_RIGHT, "trimRight")
-#endif
+#endif /* JERRY_BUILTIN_STRING && JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TRIM_START, "trimStart")
-#endif
+#endif /* JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNDEFINED, "undefined")
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INT16_ARRAY_UL, "Int16Array")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INT32_ARRAY_UL, "Int32Array")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_ERRORS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RANGE_ERROR_UL, "RangeError")
-#endif
+#endif /* JERRY_BUILTIN_ERRORS */
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TYPED_ARRAY_UL, "TypedArray")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UINT8_ARRAY_UL, "Uint8Array")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ALLSETTLED, "allSettled")
-#endif
-#if JERRY_BUILTIN_DATAVIEW \
-|| JERRY_BUILTIN_SHAREDARRAYBUFFER \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_ESNEXT */
+#if JERRY_BUILTIN_DATAVIEW || JERRY_BUILTIN_SHAREDARRAYBUFFER || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BYTE_LENGTH_UL, "byteLength")
-#endif
-#if JERRY_BUILTIN_DATAVIEW \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_BUILTIN_DATAVIEW \
+|| JERRY_BUILTIN_SHAREDARRAYBUFFER \
+|| JERRY_BUILTIN_TYPEDARRAY */
+#if JERRY_BUILTIN_DATAVIEW || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BYTE_OFFSET_UL, "byteOffset")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CHAR_CODE_AT_UL, "charCodeAt")
-#endif
-#if JERRY_BUILTIN_TYPEDARRAY \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_STRING */
+#if JERRY_BUILTIN_TYPEDARRAY || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_COPY_WITHIN, "copyWithin")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY \
+|| JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENUMERABLE, "enumerable")
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_FLOAT_32_UL, "getFloat32")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_DATAVIEW && JERRY_NUMBER_TYPE_FLOAT64
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_FLOAT_64_UL, "getFloat64")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW && JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_MINUTES_UL, "getMinutes")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_SECONDS_UL, "getSeconds")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_DATE_UL, "getUTCDate")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_GLOBAL_THIS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GLOBAL_THIS_UL, "globalThis")
-#endif
+#endif /* JERRY_BUILTIN_GLOBAL_THIS */
#if JERRY_BUILTIN_REGEXP
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IGNORECASE_UL, "ignoreCase")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP */
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_ISLOCKFREE, "isLockFree")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PARSE_FLOAT, "parseFloat")
#if JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REPLACE_ALL, "replaceAll")
-#endif
+#endif /* JERRY_BUILTIN_REGEXP && JERRY_BUILTIN_STRING && JERRY_ESNEXT */
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_FLOAT_32_UL, "setFloat32")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_DATAVIEW && JERRY_NUMBER_TYPE_FLOAT64
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_FLOAT_64_UL, "setFloat64")
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW && JERRY_NUMBER_TYPE_FLOAT64 */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_MINUTES_UL, "setMinutes")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_SECONDS_UL, "setSeconds")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_DATE_UL, "setUTCDate")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_STRING && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STARTS_WITH, "startsWith")
-#endif
+#endif /* JERRY_BUILTIN_STRING && JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_RESOURCE_ANON, "<anonymous>")
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARRAY_BUFFER_UL, "ArrayBuffer")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_ERRORS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SYNTAX_ERROR_UL, "SyntaxError")
-#endif
+#endif /* JERRY_BUILTIN_ERRORS */
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UINT16_ARRAY_UL, "Uint16Array")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UINT32_ARRAY_UL, "Uint32Array")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_STRING && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CODE_POINT_AT, "codePointAt")
-#endif
+#endif /* JERRY_BUILTIN_STRING && JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CONSTRUCTOR, "constructor")
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DESCRIPTION, "description")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_OBJECT_FROM_ENTRIES, "fromEntries")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_BIGINT64, "getBigInt64")
-#endif
+#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_FULL_YEAR_UL, "getFullYear")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_HOURS_UL, "getUTCHours")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_MONTH_UL, "getUTCMonth")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HAS_INSTANCE, "hasInstance")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_STRING \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_ESNEXT */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_STRING || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LAST_INDEX_OF_UL, "lastIndexOf")
-#endif
-#if JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_TYPEDARRAY
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_STRING \
+|| JERRY_BUILTIN_TYPEDARRAY */
+#if JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REDUCE_RIGHT_UL, "reduceRight")
-#endif
+#endif /* JERRY_BUILTIN_ARRAY \
+|| JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_BIGINT64, "setBigInt64")
-#endif
+#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_FULL_YEAR_UL, "setFullYear")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_HOURS_UL, "setUTCHours")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_MONTH_UL, "setUTCMonth")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_GMT_STRING_UL, "toGMTString")
-#endif
+#endif /* JERRY_BUILTIN_ANNEXB && JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_ISO_STRING_UL, "toISOString")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOWER_CASE_UL, "toLowerCase")
-#endif
+#endif /* JERRY_BUILTIN_STRING */
#if JERRY_BUILTIN_NUMBER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_PRECISION_UL, "toPrecision")
-#endif
+#endif /* JERRY_BUILTIN_NUMBER */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_PRIMITIVE, "toPrimitive")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_STRING_TAG, "toStringTag")
-#endif
-#if JERRY_BUILTIN_DATE \
-|| JERRY_ESNEXT
+#endif /* JERRY_ESNEXT */
+#if JERRY_BUILTIN_DATE || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_UTC_STRING_UL, "toUTCString")
-#endif
+#endif /* JERRY_BUILTIN_DATE \
+|| JERRY_ESNEXT */
#if JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_UPPER_CASE_UL, "toUpperCase")
-#endif
+#endif /* JERRY_BUILTIN_STRING */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UNSCOPABLES, "unscopables")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLOAT32_ARRAY_UL, "Float32Array")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_TYPEDARRAY && JERRY_NUMBER_TYPE_FLOAT64
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FLOAT64_ARRAY_UL, "Float64Array")
-#endif
-#if JERRY_BUILTIN_DATE \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_TYPEDARRAY && JERRY_NUMBER_TYPE_FLOAT64 */
+#if JERRY_BUILTIN_DATE || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_INVALID_DATE_UL, "Invalid Date")
-#endif
-#if JERRY_BUILTIN_CONTAINER \
-|| JERRY_ESNEXT
+#endif /* JERRY_BUILTIN_DATE \
+|| JERRY_ESNEXT */
+#if JERRY_BUILTIN_CONTAINER || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAP_ITERATOR_UL, "Map Iterator")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_ITERATOR_UL, "Set Iterator")
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_CONFIGURABLE, "configurable")
#if JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FROM_CHAR_CODE_UL, "fromCharCode")
-#endif
+#endif /* JERRY_BUILTIN_STRING */
#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_BIGUINT64, "getBigUint64")
-#endif
+#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_EXTENSIBLE, "isExtensible")
#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_BIGUINT64, "setBigUint64")
-#endif
+#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_DATAVIEW */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_DATE_STRING_UL, "toDateString")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_TIME_STRING_UL, "toTimeString")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASYNC_FUNCTION_UL, "AsyncFunction")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BIGINT64_ARRAY_UL, "BigInt64Array")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASYNC_ITERATOR, "asyncIterator")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_STRING && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FROM_CODE_POINT_UL, "fromCodePoint")
-#endif
+#endif /* JERRY_BUILTIN_STRING && JERRY_ESNEXT */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_MINUTES_UL, "getUTCMinutes")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_SECONDS_UL, "getUTCSeconds")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_PROTOTYPE_OF_UL, "isPrototypeOf")
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_SAFE_INTEGER, "isSafeInteger")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOCALE_COMPARE_UL, "localeCompare")
-#endif
+#endif /* JERRY_BUILTIN_STRING */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_MINUTES_UL, "setUTCMinutes")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_SECONDS_UL, "setUTCSeconds")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_NUMBER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_EXPONENTIAL_UL, "toExponential")
-#endif
+#endif /* JERRY_BUILTIN_NUMBER */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_AGGREGATE_ERROR_UL, "AggregateError")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ARRAY_ITERATOR_UL, "Array Iterator")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASYNC_GENERATOR_UL, "AsyncGenerator")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL, "BigUint64Array")
-#endif
+#endif /* JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_ERRORS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REFERENCE_ERROR_UL, "ReferenceError")
-#endif
+#endif /* JERRY_BUILTIN_ERRORS */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFINE_PROPERTY_UL, "defineProperty")
-#if JERRY_BUILTIN_PROXY \
-|| JERRY_BUILTIN_REFLECT
+#if JERRY_BUILTIN_PROXY || JERRY_BUILTIN_REFLECT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DELETE_PROPERTY_UL, "deleteProperty")
-#endif
+#endif /* JERRY_BUILTIN_PROXY \
+|| JERRY_BUILTIN_REFLECT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_PROTOTYPE_OF_UL, "getPrototypeOf")
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_FULL_YEAR_UL, "getUTCFullYear")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_HAS_OWN_PROPERTY_UL, "hasOwnProperty")
-#if JERRY_BUILTIN_PROXY \
-|| JERRY_BUILTIN_REFLECT \
-|| JERRY_ESNEXT
+#if JERRY_BUILTIN_PROXY || JERRY_BUILTIN_REFLECT || JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_PROTOTYPE_OF_UL, "setPrototypeOf")
-#endif
+#endif /* JERRY_BUILTIN_PROXY \
+|| JERRY_BUILTIN_REFLECT \
+|| JERRY_ESNEXT */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_FULL_YEAR_UL, "setUTCFullYear")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_STRING_UL, "toLocaleString")
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_STRING_ITERATOR_UL, "String Iterator")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ATOMICS_COMPAREEXCHANGE, "compareExchange")
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_MILLISECONDS_UL, "getMilliseconds")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_MILLISECONDS_UL, "setMilliseconds")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_BUILTIN_NUMBER && JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U, "MAX_SAFE_INTEGER")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_MIN_SAFE_INTEGER_U, "MIN_SAFE_INTEGER")
-#endif
+#endif /* JERRY_BUILTIN_NUMBER && JERRY_ESNEXT */
#if JERRY_ESNEXT && JERRY_BUILTIN_ANNEXB
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFINE_GETTER, "__defineGetter__")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFINE_SETTER, "__defineSetter__")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOOKUP_GETTER, "__lookupGetter__")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_LOOKUP_SETTER, "__lookupSetter__")
-#endif
+#endif /* JERRY_ESNEXT && JERRY_BUILTIN_ANNEXB */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DEFINE_PROPERTIES_UL, "defineProperties")
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U, "BYTES_PER_ELEMENT")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GENERATOR_FUNCTION_UL, "GeneratorFunction")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_NUMBER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_NEGATIVE_INFINITY_U, "NEGATIVE_INFINITY")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_POSITIVE_INFINITY_U, "POSITIVE_INFINITY")
-#endif
+#endif /* JERRY_BUILTIN_NUMBER */
#if JERRY_BUILTIN_SHAREDARRAYBUFFER
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SHARED_ARRAY_BUFFER_UL, "SharedArrayBuffer")
-#endif
+#endif /* JERRY_BUILTIN_SHAREDARRAYBUFFER */
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL, "Uint8ClampedArray")
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_TIMEZONE_OFFSET_UL, "getTimezoneOffset")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PREVENT_EXTENSIONS_UL, "preventExtensions")
#if JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_LOWER_CASE_UL, "toLocaleLowerCase")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_UPPER_CASE_UL, "toLocaleUpperCase")
-#endif
+#endif /* JERRY_BUILTIN_STRING */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_DECODE_URI_COMPONENT, "decodeURIComponent")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ENCODE_URI_COMPONENT, "encodeURIComponent")
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_UTC_MILLISECONDS_UL, "getUTCMilliseconds")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_IS_CONCAT_SPREADABLE, "isConcatSpreadable")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_SET_UTC_MILLISECONDS_UL, "setUTCMilliseconds")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_DATE_STRING_UL, "toLocaleDateString")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_TO_LOCALE_TIME_STRING_UL, "toLocaleTimeString")
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_FUNCTION_TO_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON, "function anonymous(")
-#endif
+#endif /* JERRY_FUNCTION_TO_STRING */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL, "getOwnPropertyNames")
#if JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_GENERATOR, "function* anonymous(")
-#endif
+#endif /* JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL, "propertyIsEnumerable")
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL, "getOwnPropertySymbols")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL, "AsyncGeneratorFunction")
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_REGEXP_STRING_ITERATOR_UL, "RegExp String Iterator")
-#endif
+#endif /* JERRY_ESNEXT */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL, "getOwnPropertyDescriptor")
#if JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC, "async function anonymous(")
-#endif
+#endif /* JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTORS_UL, "getOwnPropertyDescriptors")
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC_GENERATOR, "async function* anonymous(")
-#endif
+#endif /* JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING */
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE, "function () { [native code] }")
-#if JERRY_SNAPSHOT_EXEC \
-|| !(JERRY_FUNCTION_TO_STRING)
+#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)
LIT_MAGIC_STRING_DEF (LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA, "function () { /* ecmascript */ }")
-#endif
+#endif /* JERRY_SNAPSHOT_EXEC \
+|| !(JERRY_FUNCTION_TO_STRING) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (0, LIT_MAGIC_STRING__EMPTY)
#if JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_SPACE_CHAR)
#elif JERRY_MODULE_SYSTEM
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_ASTERIX_CHAR)
-#elif JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_TYPEDARRAY
+#elif JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_COMMA_CHAR)
#elif JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_E_U)
@@ -1068,68 +1070,62 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_E_U)
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_LEFT_SQUARE_CHAR)
#elif JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_PI_U)
-#elif JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_STRING \
-|| JERRY_BUILTIN_TYPEDARRAY \
-|| JERRY_ESNEXT
+#elif JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_STRING || JERRY_BUILTIN_TYPEDARRAY || JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_AT)
#elif JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_IS)
-#elif JERRY_BUILTIN_ARRAY && JERRY_ESNEXT \
-|| JERRY_BUILTIN_TYPEDARRAY
+#elif JERRY_BUILTIN_ARRAY && JERRY_ESNEXT || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_OF)
#elif JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_ATOMICS_OR)
#elif JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_LN2_U)
-#elif JERRY_BUILTIN_CONTAINER \
-|| JERRY_ESNEXT
+#elif JERRY_BUILTIN_CONTAINER || JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_MAP_UL)
-#else
+#else /* !(JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (1, LIT_MAGIC_STRING_NAN)
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_PI_U)
-#elif JERRY_BUILTIN_ARRAY \
-|| JERRY_BUILTIN_STRING \
-|| JERRY_BUILTIN_TYPEDARRAY \
-|| JERRY_ESNEXT
+#elif JERRY_BUILTIN_ARRAY || JERRY_BUILTIN_STRING || JERRY_BUILTIN_TYPEDARRAY || JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_AT)
#elif JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_IS)
-#elif JERRY_BUILTIN_ARRAY && JERRY_ESNEXT \
-|| JERRY_BUILTIN_TYPEDARRAY
+#elif JERRY_BUILTIN_ARRAY && JERRY_ESNEXT || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_OF)
#elif JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_ATOMICS_OR)
#elif JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_LN2_U)
-#elif JERRY_BUILTIN_CONTAINER \
-|| JERRY_ESNEXT
+#elif JERRY_BUILTIN_CONTAINER || JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_MAP_UL)
-#else
+#else /* !(JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (2, LIT_MAGIC_STRING_NAN)
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT */
#if JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (3, LIT_MAGIC_STRING_LN2_U)
-#elif JERRY_BUILTIN_CONTAINER \
-|| JERRY_ESNEXT
+#elif JERRY_BUILTIN_CONTAINER || JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (3, LIT_MAGIC_STRING_MAP_UL)
-#else
+#else /* !(JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (3, LIT_MAGIC_STRING_NAN)
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT */
#if JERRY_BUILTIN_REGEXP
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_EMPTY_NON_CAPTURE_GROUP)
-#elif JERRY_BUILTIN_DATE \
-|| JERRY_ESNEXT
+#elif JERRY_BUILTIN_DATE || JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_DATE_UL)
#elif JERRY_BUILTIN_JSON
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_JSON_U)
#elif JERRY_BUILTIN_MATH
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_LN10_U)
-#else
+#else /* !(JERRY_BUILTIN_MATH) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (4, LIT_MAGIC_STRING_NULL_UL)
-#endif
+#endif /* JERRY_BUILTIN_MATH */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (5, LIT_MAGIC_STRING_ARRAY_UL)
#if JERRY_PARSER && JERRY_RESOURCE_NAME
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (6, LIT_MAGIC_STRING_RESOURCE_EVAL)
@@ -1139,19 +1135,19 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (6, LIT_MAGIC_STRING_BIGINT_UL)
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (6, LIT_MAGIC_STRING_LOG10E_U)
#elif JERRY_MODULE_SYSTEM
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (6, LIT_MAGIC_STRING_MODULE_UL)
-#else
+#else /* !(JERRY_MODULE_SYSTEM) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (6, LIT_MAGIC_STRING_NUMBER_UL)
-#endif
+#endif /* JERRY_MODULE_SYSTEM */
#if JERRY_BUILTIN_ATOMICS
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (7, LIT_MAGIC_STRING_ATOMICS_U)
-#else
+#else /* !(JERRY_BUILTIN_ATOMICS) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (7, LIT_MAGIC_STRING_BOOLEAN_UL)
-#endif
+#endif /* JERRY_BUILTIN_ATOMICS */
#if JERRY_BUILTIN_DATAVIEW
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (8, LIT_MAGIC_STRING_DATAVIEW_UL)
-#else
+#else /* !(JERRY_BUILTIN_DATAVIEW) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (8, LIT_MAGIC_STRING_FUNCTION_UL)
-#endif
+#endif /* JERRY_BUILTIN_DATAVIEW */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (9, LIT_MAGIC_STRING_NEGATIVE_INFINITY_UL)
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_INT16_ARRAY_UL)
@@ -1161,35 +1157,33 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_RANGE_ERROR_UL)
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_TYPED_ARRAY_UL)
#elif JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_ALLSETTLED)
-#elif JERRY_BUILTIN_DATAVIEW \
-|| JERRY_BUILTIN_SHAREDARRAYBUFFER \
-|| JERRY_BUILTIN_TYPEDARRAY
+#elif JERRY_BUILTIN_DATAVIEW || JERRY_BUILTIN_SHAREDARRAYBUFFER || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_BYTE_LENGTH_UL)
-#elif JERRY_BUILTIN_DATAVIEW \
-|| JERRY_BUILTIN_TYPEDARRAY
+#elif JERRY_BUILTIN_DATAVIEW || JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_BYTE_OFFSET_UL)
#elif JERRY_BUILTIN_STRING
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_CHAR_CODE_AT_UL)
-#elif JERRY_BUILTIN_TYPEDARRAY \
-|| JERRY_ESNEXT
+#elif JERRY_BUILTIN_TYPEDARRAY || JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_COPY_WITHIN)
-#else
+#else /* !(JERRY_BUILTIN_TYPEDARRAY \
+|| JERRY_ESNEXT) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (10, LIT_MAGIC_STRING_ENUMERABLE)
-#endif
+#endif /* JERRY_BUILTIN_TYPEDARRAY \
+|| JERRY_ESNEXT */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (11, LIT_MAGIC_STRING_RESOURCE_ANON)
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_FLOAT32_ARRAY_UL)
#elif JERRY_BUILTIN_TYPEDARRAY && JERRY_NUMBER_TYPE_FLOAT64
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_FLOAT64_ARRAY_UL)
-#elif JERRY_BUILTIN_DATE \
-|| JERRY_ESNEXT
+#elif JERRY_BUILTIN_DATE || JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_INVALID_DATE_UL)
-#elif JERRY_BUILTIN_CONTAINER \
-|| JERRY_ESNEXT
+#elif JERRY_BUILTIN_CONTAINER || JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_MAP_ITERATOR_UL)
-#else
+#else /* !(JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (12, LIT_MAGIC_STRING_CONFIGURABLE)
-#endif
+#endif /* JERRY_BUILTIN_CONTAINER \
+|| JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (13, LIT_MAGIC_STRING_ASYNC_FUNCTION_UL)
#elif JERRY_BUILTIN_TYPEDARRAY
@@ -1200,18 +1194,18 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (13, LIT_MAGIC_STRING_ASYNC_ITERATOR)
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (13, LIT_MAGIC_STRING_FROM_CODE_POINT_UL)
#elif JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (13, LIT_MAGIC_STRING_GET_UTC_MINUTES_UL)
-#else
+#else /* !(JERRY_BUILTIN_DATE) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (13, LIT_MAGIC_STRING_IS_PROTOTYPE_OF_UL)
-#endif
+#endif /* JERRY_BUILTIN_DATE */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (14, LIT_MAGIC_STRING_AGGREGATE_ERROR_UL)
#elif JERRY_BUILTIN_BIGINT && JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (14, LIT_MAGIC_STRING_BIGUINT64_ARRAY_UL)
#elif JERRY_BUILTIN_ERRORS
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (14, LIT_MAGIC_STRING_REFERENCE_ERROR_UL)
-#else
+#else /* !(JERRY_BUILTIN_ERRORS) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (14, LIT_MAGIC_STRING_DEFINE_PROPERTY_UL)
-#endif
+#endif /* JERRY_BUILTIN_ERRORS */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (15, LIT_MAGIC_STRING_STRING_ITERATOR_UL)
#elif JERRY_BUILTIN_ATOMICS
@@ -1222,16 +1216,16 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (15, LIT_MAGIC_STRING_GET_MILLISECONDS_U
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (15, LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U)
#elif JERRY_ESNEXT && JERRY_BUILTIN_ANNEXB
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (15, LIT_MAGIC_STRING_DEFINE_GETTER)
-#else
+#else /* !(JERRY_ESNEXT && JERRY_BUILTIN_ANNEXB) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (15, LIT_MAGIC_STRING_DEFINE_PROPERTIES_UL)
-#endif
+#endif /* JERRY_ESNEXT && JERRY_BUILTIN_ANNEXB */
#if JERRY_BUILTIN_NUMBER && JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (16, LIT_MAGIC_STRING_MAX_SAFE_INTEGER_U)
#elif JERRY_ESNEXT && JERRY_BUILTIN_ANNEXB
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (16, LIT_MAGIC_STRING_DEFINE_GETTER)
-#else
+#else /* !(JERRY_ESNEXT && JERRY_BUILTIN_ANNEXB) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (16, LIT_MAGIC_STRING_DEFINE_PROPERTIES_UL)
-#endif
+#endif /* JERRY_ESNEXT && JERRY_BUILTIN_ANNEXB */
#if JERRY_BUILTIN_TYPEDARRAY
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_BYTES_PER_ELEMENT_U)
#elif JERRY_ESNEXT
@@ -1244,30 +1238,30 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_SHARED_ARRAY_BUFFE
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_UINT8_CLAMPED_ARRAY_UL)
#elif JERRY_BUILTIN_DATE
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_GET_TIMEZONE_OFFSET_UL)
-#else
+#else /* !(JERRY_BUILTIN_DATE) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (17, LIT_MAGIC_STRING_PREVENT_EXTENSIONS_UL)
-#endif
+#endif /* JERRY_BUILTIN_DATE */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (18, LIT_MAGIC_STRING_DECODE_URI_COMPONENT)
#if JERRY_FUNCTION_TO_STRING
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (19, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON)
-#else
+#else /* !(JERRY_FUNCTION_TO_STRING) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (19, LIT_MAGIC_STRING_GET_OWN_PROPERTY_NAMES_UL)
-#endif
+#endif /* JERRY_FUNCTION_TO_STRING */
#if JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (20, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_GENERATOR)
-#else
+#else /* !(JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (20, LIT_MAGIC_STRING_PROPERTY_IS_ENUMERABLE_UL)
-#endif
+#endif /* JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (21, LIT_MAGIC_STRING_GET_OWN_PROPERTY_SYMBOLS_UL)
-#else
+#else /* !(JERRY_ESNEXT) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (21, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL)
-#endif
+#endif /* JERRY_ESNEXT */
#if JERRY_ESNEXT
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (22, LIT_MAGIC_STRING_ASYNC_GENERATOR_FUNCTION_UL)
-#else
+#else /* !(JERRY_ESNEXT) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (22, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL)
-#endif
+#endif /* JERRY_ESNEXT */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (23, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL)
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (24, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTOR_UL)
#if JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING
@@ -1276,26 +1270,26 @@ LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (25, LIT_MAGIC_STRING_FUNCTION_TO_STRING
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (25, LIT_MAGIC_STRING_GET_OWN_PROPERTY_DESCRIPTORS_UL)
#elif JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (25, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC_GENERATOR)
-#else
+#else /* !(JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (25, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
-#endif
+#endif /* JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING */
#if JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (26, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ANON_ASYNC_GENERATOR)
-#else
+#else /* !(JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING) */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (26, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
-#endif
+#endif /* JERRY_ESNEXT && JERRY_FUNCTION_TO_STRING */
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (27, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (28, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (29, LIT_MAGIC_STRING_FUNCTION_TO_STRING_NATIVE)
-#if JERRY_SNAPSHOT_EXEC \
-|| !(JERRY_FUNCTION_TO_STRING)
+#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (30, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)
-#endif
-#if JERRY_SNAPSHOT_EXEC \
-|| !(JERRY_FUNCTION_TO_STRING)
+#endif /* JERRY_SNAPSHOT_EXEC \
+|| !(JERRY_FUNCTION_TO_STRING) */
+#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (31, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)
-#endif
-#if JERRY_SNAPSHOT_EXEC \
-|| !(JERRY_FUNCTION_TO_STRING)
+#endif /* JERRY_SNAPSHOT_EXEC \
+|| !(JERRY_FUNCTION_TO_STRING) */
+#if JERRY_SNAPSHOT_EXEC || !(JERRY_FUNCTION_TO_STRING)
LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE (32, LIT_MAGIC_STRING_FUNCTION_TO_STRING_ECMA)
-#endif
+#endif /* JERRY_SNAPSHOT_EXEC \
+|| !(JERRY_FUNCTION_TO_STRING) */
diff --git a/jerry-core/lit/lit-strings.c b/jerry-core/lit/lit-strings.c
index b432a9e6..2ccb4144 100644
--- a/jerry-core/lit/lit-strings.c
+++ b/jerry-core/lit/lit-strings.c
@@ -17,13 +17,13 @@
#include "jrt-libc-includes.h"
-#define LIT_UTF8_SURROGATE_MARKER 0xed /**< utf8 surrogate marker */
-#define LIT_UTF8_HIGH_SURROGATE_MIN 0xa0 /**< utf8 high surrogate minimum */
-#define LIT_UTF8_HIGH_SURROGATE_MAX 0xaf /**< utf8 high surrogate maximum */
-#define LIT_UTF8_LOW_SURROGATE_MIN 0xb0 /**< utf8 low surrogate minimum */
-#define LIT_UTF8_LOW_SURROGATE_MAX 0xbf /**< utf8 low surrogate maximum */
-#define LIT_UTF8_1_BYTE_MAX 0xf4 /**< utf8 one byte max */
-#define LIT_UTF8_2_BYTE_MAX 0x8f /**< utf8 two byte max */
+#define LIT_UTF8_SURROGATE_MARKER 0xed /**< utf8 surrogate marker */
+#define LIT_UTF8_HIGH_SURROGATE_MIN 0xa0 /**< utf8 high surrogate minimum */
+#define LIT_UTF8_HIGH_SURROGATE_MAX 0xaf /**< utf8 high surrogate maximum */
+#define LIT_UTF8_LOW_SURROGATE_MIN 0xb0 /**< utf8 low surrogate minimum */
+#define LIT_UTF8_LOW_SURROGATE_MAX 0xbf /**< utf8 low surrogate maximum */
+#define LIT_UTF8_1_BYTE_MAX 0xf4 /**< utf8 one byte max */
+#define LIT_UTF8_2_BYTE_MAX 0x8f /**< utf8 two byte max */
#define LIT_UTF8_VALID_TWO_BYTE_START 0xc2 /**< utf8 two byte start */
/**
@@ -82,22 +82,16 @@ lit_is_valid_utf8_string (const lit_utf8_byte_t *utf8_buf_p, /**< utf-8 string *
return false;
}
- if (is_strict
- && first_byte == LIT_UTF8_SURROGATE_MARKER
- && second_byte >= LIT_UTF8_HIGH_SURROGATE_MIN
- && second_byte <= LIT_UTF8_HIGH_SURROGATE_MAX
- && idx + 3 <= end
- && idx[0] == LIT_UTF8_SURROGATE_MARKER
- && idx[1] >= LIT_UTF8_LOW_SURROGATE_MIN
- && idx[1] <= LIT_UTF8_LOW_SURROGATE_MAX)
+ if (is_strict && first_byte == LIT_UTF8_SURROGATE_MARKER && second_byte >= LIT_UTF8_HIGH_SURROGATE_MIN
+ && second_byte <= LIT_UTF8_HIGH_SURROGATE_MAX && idx + 3 <= end && idx[0] == LIT_UTF8_SURROGATE_MARKER
+ && idx[1] >= LIT_UTF8_LOW_SURROGATE_MIN && idx[1] <= LIT_UTF8_LOW_SURROGATE_MAX)
{
return false;
}
continue;
}
- if (idx >= end
- || first_byte > LIT_UTF8_1_BYTE_MAX
+ if (idx >= end || first_byte > LIT_UTF8_1_BYTE_MAX
|| (first_byte == LIT_UTF8_4_BYTE_MARKER && second_byte <= LIT_UTF8_EXTRA_BYTE_MARKER)
|| (first_byte == LIT_UTF8_1_BYTE_MAX && second_byte > LIT_UTF8_2_BYTE_MAX)
|| (*idx++ & LIT_UTF8_EXTRA_BYTE_MASK) != LIT_UTF8_EXTRA_BYTE_MARKER)
@@ -593,8 +587,7 @@ lit_utf8_decr (const lit_utf8_byte_t **buf_p) /**< [in,out] buffer with characte
do
{
current_p--;
- }
- while ((*(current_p) & LIT_UTF8_EXTRA_BYTE_MASK) == LIT_UTF8_EXTRA_BYTE_MARKER);
+ } while ((*(current_p) &LIT_UTF8_EXTRA_BYTE_MASK) == LIT_UTF8_EXTRA_BYTE_MARKER);
*buf_p = current_p;
} /* lit_utf8_decr */
@@ -662,8 +655,7 @@ lit_utf8_string_code_unit_at (const lit_utf8_byte_t *utf8_buf_p, /**< utf-8 stri
{
JERRY_ASSERT (current_p < utf8_buf_p + utf8_buf_size);
current_p += lit_read_code_unit_from_cesu8 (current_p, &code_unit);
- }
- while (code_unit_offset--);
+ } while (code_unit_offset--);
return code_unit;
} /* lit_utf8_string_code_unit_at */
@@ -768,7 +760,7 @@ lit_code_point_to_cesu8 (lit_code_point_t code_point, /**< code point */
lit_utf8_size_t
lit_code_point_to_utf8 (lit_code_point_t code_point, /**< code point */
lit_utf8_byte_t *buf) /**< buffer where to store the result,
- * its size should be at least 4 bytes */
+ * its size should be at least 4 bytes */
{
if (code_point <= LIT_UTF8_1_BYTE_CODE_POINT_MAX)
{
@@ -917,10 +909,11 @@ lit_convert_surrogate_pair_to_code_point (ecma_char_t high_surrogate, /**< high
* @return true - if first string is less than second string,
* false - otherwise
*/
-bool lit_compare_utf8_strings_relational (const lit_utf8_byte_t *string1_p, /**< utf-8 string */
- lit_utf8_size_t string1_size, /**< string size */
- const lit_utf8_byte_t *string2_p, /**< utf-8 string */
- lit_utf8_size_t string2_size) /**< string size */
+bool
+lit_compare_utf8_strings_relational (const lit_utf8_byte_t *string1_p, /**< utf-8 string */
+ lit_utf8_size_t string1_size, /**< string size */
+ const lit_utf8_byte_t *string2_p, /**< utf-8 string */
+ lit_utf8_size_t string2_size) /**< string size */
{
lit_utf8_byte_t *string1_pos = (lit_utf8_byte_t *) string1_p;
lit_utf8_byte_t *string2_pos = (lit_utf8_byte_t *) string2_p;
diff --git a/jerry-core/lit/lit-strings.h b/jerry-core/lit/lit-strings.h
index 0c18da4c..2905de5b 100644
--- a/jerry-core/lit/lit-strings.h
+++ b/jerry-core/lit/lit-strings.h
@@ -29,29 +29,29 @@
* Unicode Standard (http://www.unicode.org/versions/Unicode3.0.0/ch03.pdf#G7404).
*/
#define LIT_UNICODE_CODE_POINT_NULL (0x0)
-#define LIT_UNICODE_CODE_POINT_MAX (0x10FFFF)
+#define LIT_UNICODE_CODE_POINT_MAX (0x10FFFF)
-#define LIT_UTF16_CODE_UNIT_MAX (0xFFFF)
+#define LIT_UTF16_CODE_UNIT_MAX (0xFFFF)
#define LIT_UTF16_FIRST_SURROGATE_CODE_POINT (0x10000)
-#define LIT_UTF16_LOW_SURROGATE_MARKER (0xDC00)
-#define LIT_UTF16_HIGH_SURROGATE_MARKER (0xD800)
-#define LIT_UTF16_HIGH_SURROGATE_MIN (0xD800)
-#define LIT_UTF16_HIGH_SURROGATE_MAX (0xDBFF)
-#define LIT_UTF16_LOW_SURROGATE_MIN (0xDC00)
-#define LIT_UTF16_LOW_SURROGATE_MAX (0xDFFF)
-#define LIT_UTF16_BITS_IN_SURROGATE (10)
-#define LIT_UTF16_LAST_10_BITS_MASK (0x3FF)
-
-#define LIT_UTF8_1_BYTE_MARKER (0x00)
-#define LIT_UTF8_2_BYTE_MARKER (0xC0)
-#define LIT_UTF8_3_BYTE_MARKER (0xE0)
-#define LIT_UTF8_4_BYTE_MARKER (0xF0)
+#define LIT_UTF16_LOW_SURROGATE_MARKER (0xDC00)
+#define LIT_UTF16_HIGH_SURROGATE_MARKER (0xD800)
+#define LIT_UTF16_HIGH_SURROGATE_MIN (0xD800)
+#define LIT_UTF16_HIGH_SURROGATE_MAX (0xDBFF)
+#define LIT_UTF16_LOW_SURROGATE_MIN (0xDC00)
+#define LIT_UTF16_LOW_SURROGATE_MAX (0xDFFF)
+#define LIT_UTF16_BITS_IN_SURROGATE (10)
+#define LIT_UTF16_LAST_10_BITS_MASK (0x3FF)
+
+#define LIT_UTF8_1_BYTE_MARKER (0x00)
+#define LIT_UTF8_2_BYTE_MARKER (0xC0)
+#define LIT_UTF8_3_BYTE_MARKER (0xE0)
+#define LIT_UTF8_4_BYTE_MARKER (0xF0)
#define LIT_UTF8_EXTRA_BYTE_MARKER (0x80)
-#define LIT_UTF8_1_BYTE_MASK (0x80)
-#define LIT_UTF8_2_BYTE_MASK (0xE0)
-#define LIT_UTF8_3_BYTE_MASK (0xF0)
-#define LIT_UTF8_4_BYTE_MASK (0xF8)
+#define LIT_UTF8_1_BYTE_MASK (0x80)
+#define LIT_UTF8_2_BYTE_MASK (0xE0)
+#define LIT_UTF8_3_BYTE_MASK (0xF0)
+#define LIT_UTF8_4_BYTE_MASK (0xF8)
#define LIT_UTF8_EXTRA_BYTE_MASK (0xC0)
#define LIT_UTF8_LAST_7_BITS_MASK (0x7F)
@@ -102,11 +102,13 @@ lit_utf8_size_t lit_get_utf8_length_of_cesu8_string (const lit_utf8_byte_t *cesu
/* hash */
lit_string_hash_t lit_utf8_string_calc_hash (const lit_utf8_byte_t *utf8_buf_p, lit_utf8_size_t utf8_buf_size);
-lit_string_hash_t lit_utf8_string_hash_combine (lit_string_hash_t hash_basis, const lit_utf8_byte_t *utf8_buf_p,
+lit_string_hash_t lit_utf8_string_hash_combine (lit_string_hash_t hash_basis,
+ const lit_utf8_byte_t *utf8_buf_p,
lit_utf8_size_t utf8_buf_size);
/* code unit access */
-ecma_char_t lit_utf8_string_code_unit_at (const lit_utf8_byte_t *utf8_buf_p, lit_utf8_size_t utf8_buf_size,
+ecma_char_t lit_utf8_string_code_unit_at (const lit_utf8_byte_t *utf8_buf_p,
+ lit_utf8_size_t utf8_buf_size,
lit_utf8_size_t code_unit_offset);
lit_utf8_size_t lit_get_unicode_char_size_by_utf8_first_byte (const lit_utf8_byte_t first_byte);
@@ -120,22 +122,23 @@ lit_utf8_size_t lit_convert_cesu8_string_to_utf8_string (const lit_utf8_byte_t *
lit_utf8_size_t utf8_size);
lit_code_point_t lit_convert_surrogate_pair_to_code_point (ecma_char_t high_surrogate, ecma_char_t low_surrogate);
-bool lit_compare_utf8_strings_relational (const lit_utf8_byte_t *string1_p, lit_utf8_size_t string1_size,
- const lit_utf8_byte_t *string2_p, lit_utf8_size_t string2_size);
+bool lit_compare_utf8_strings_relational (const lit_utf8_byte_t *string1_p,
+ lit_utf8_size_t string1_size,
+ const lit_utf8_byte_t *string2_p,
+ lit_utf8_size_t string2_size);
uint8_t lit_utf16_encode_code_point (lit_code_point_t cp, ecma_char_t *cu_p);
/* read code point from buffer */
-lit_utf8_size_t lit_read_code_point_from_utf8 (const lit_utf8_byte_t *buf_p, lit_utf8_size_t buf_size,
- lit_code_point_t *code_point);
+lit_utf8_size_t
+lit_read_code_point_from_utf8 (const lit_utf8_byte_t *buf_p, lit_utf8_size_t buf_size, lit_code_point_t *code_point);
-lit_utf8_size_t lit_read_code_unit_from_cesu8 (const lit_utf8_byte_t *buf_p,
- ecma_char_t *code_unit);
-lit_utf8_size_t lit_read_code_point_from_cesu8 (const lit_utf8_byte_t *buf_p, const lit_utf8_byte_t *buf_end_p,
+lit_utf8_size_t lit_read_code_unit_from_cesu8 (const lit_utf8_byte_t *buf_p, ecma_char_t *code_unit);
+lit_utf8_size_t lit_read_code_point_from_cesu8 (const lit_utf8_byte_t *buf_p,
+ const lit_utf8_byte_t *buf_end_p,
lit_code_point_t *code_point);
-lit_utf8_size_t lit_read_prev_code_unit_from_utf8 (const lit_utf8_byte_t *buf_p,
- ecma_char_t *code_point);
+lit_utf8_size_t lit_read_prev_code_unit_from_utf8 (const lit_utf8_byte_t *buf_p, ecma_char_t *code_point);
ecma_char_t lit_cesu8_read_next (const lit_utf8_byte_t **buf_p);
ecma_char_t lit_cesu8_read_prev (const lit_utf8_byte_t **buf_p);
diff --git a/jerry-core/lit/lit-unicode-conversions-sup.inc.h b/jerry-core/lit/lit-unicode-conversions-sup.inc.h
index 65f597d1..5a12a334 100644
--- a/jerry-core/lit/lit-unicode-conversions-sup.inc.h
+++ b/jerry-core/lit/lit-unicode-conversions-sup.inc.h
@@ -17,14 +17,11 @@
* from UnicodeData.txt and SpecialCasing.txt files. Do not edit! */
/* Contains start points of character case ranges (these are bidirectional conversions). */
-static const uint32_t lit_unicode_character_case_ranges_sup[] JERRY_ATTR_CONST_DATA =
-{
- 0x010400, 0x010428, 0x0104b0, 0x0104d8, 0x010c80, 0x010cc0, 0x0118a0, 0x0118c0, 0x016e40, 0x016e60,
- 0x01e900, 0x01e922
+static const uint32_t lit_unicode_character_case_ranges_sup[] JERRY_ATTR_CONST_DATA = {
+ 0x010400, 0x010428, 0x0104b0, 0x0104d8, 0x010c80, 0x010cc0, 0x0118a0, 0x0118c0, 0x016e40, 0x016e60, 0x01e900, 0x01e922
};
/* Interval lengths of start points in `character_case_ranges` table. */
-static const uint16_t lit_unicode_character_case_range_lengths_sup[] JERRY_ATTR_CONST_DATA =
-{
- 0x000028, 0x000024, 0x000033, 0x000020, 0x000020, 0x000022
-};
+static const uint16_t lit_unicode_character_case_range_lengths_sup[] JERRY_ATTR_CONST_DATA = { 0x000028, 0x000024,
+ 0x000033, 0x000020,
+ 0x000020, 0x000022 };
diff --git a/jerry-core/lit/lit-unicode-conversions.inc.h b/jerry-core/lit/lit-unicode-conversions.inc.h
index b100576a..7c6279b2 100644
--- a/jerry-core/lit/lit-unicode-conversions.inc.h
+++ b/jerry-core/lit/lit-unicode-conversions.inc.h
@@ -17,140 +17,103 @@
* from UnicodeData.txt and SpecialCasing.txt files. Do not edit! */
/* Contains start points of character case ranges (these are bidirectional conversions). */
-static const uint16_t lit_unicode_character_case_ranges[] JERRY_ATTR_CONST_DATA =
-{
- 0x00c0, 0x00e0, 0x00d8, 0x00f8, 0x0189, 0x0256, 0x01b1, 0x028a, 0x0388, 0x03ad,
- 0x038e, 0x03cd, 0x0391, 0x03b1, 0x03a3, 0x03c3, 0x03fd, 0x037b, 0x0400, 0x0450,
- 0x0410, 0x0430, 0x0531, 0x0561, 0x10a0, 0x2d00, 0x13a0, 0xab70, 0x13f0, 0x13f8,
- 0x1c90, 0x10d0, 0x1cbd, 0x10fd, 0x1f08, 0x1f00, 0x1f18, 0x1f10, 0x1f28, 0x1f20,
- 0x1f38, 0x1f30, 0x1f48, 0x1f40, 0x1f68, 0x1f60, 0x1fb8, 0x1fb0, 0x1fba, 0x1f70,
- 0x1fc8, 0x1f72, 0x1fd8, 0x1fd0, 0x1fda, 0x1f76, 0x1fe8, 0x1fe0, 0x1fea, 0x1f7a,
- 0x1ff8, 0x1f78, 0x1ffa, 0x1f7c, 0x2160, 0x2170, 0x24b6, 0x24d0, 0x2c00, 0x2c30,
- 0x2c7e, 0x023f, 0xff21, 0xff41
+static const uint16_t lit_unicode_character_case_ranges[] JERRY_ATTR_CONST_DATA = {
+ 0x00c0, 0x00e0, 0x00d8, 0x00f8, 0x0189, 0x0256, 0x01b1, 0x028a, 0x0388, 0x03ad, 0x038e, 0x03cd, 0x0391,
+ 0x03b1, 0x03a3, 0x03c3, 0x03fd, 0x037b, 0x0400, 0x0450, 0x0410, 0x0430, 0x0531, 0x0561, 0x10a0, 0x2d00,
+ 0x13a0, 0xab70, 0x13f0, 0x13f8, 0x1c90, 0x10d0, 0x1cbd, 0x10fd, 0x1f08, 0x1f00, 0x1f18, 0x1f10, 0x1f28,
+ 0x1f20, 0x1f38, 0x1f30, 0x1f48, 0x1f40, 0x1f68, 0x1f60, 0x1fb8, 0x1fb0, 0x1fba, 0x1f70, 0x1fc8, 0x1f72,
+ 0x1fd8, 0x1fd0, 0x1fda, 0x1f76, 0x1fe8, 0x1fe0, 0x1fea, 0x1f7a, 0x1ff8, 0x1f78, 0x1ffa, 0x1f7c, 0x2160,
+ 0x2170, 0x24b6, 0x24d0, 0x2c00, 0x2c30, 0x2c7e, 0x023f, 0xff21, 0xff41
};
/* Interval lengths of start points in `character_case_ranges` table. */
-static const uint8_t lit_unicode_character_case_range_lengths[] JERRY_ATTR_CONST_DATA =
-{
- 0x0017, 0x0007, 0x0002, 0x0002, 0x0003, 0x0002, 0x0011, 0x0009, 0x0003, 0x0010,
- 0x0020, 0x0026, 0x0026, 0x0050, 0x0006, 0x002b, 0x0003, 0x0008, 0x0006, 0x0008,
- 0x0008, 0x0006, 0x0008, 0x0002, 0x0002, 0x0004, 0x0002, 0x0002, 0x0002, 0x0002,
- 0x0002, 0x0002, 0x0010, 0x001a, 0x002f, 0x0002, 0x001a
+static const uint8_t lit_unicode_character_case_range_lengths[] JERRY_ATTR_CONST_DATA = {
+ 0x0017, 0x0007, 0x0002, 0x0002, 0x0003, 0x0002, 0x0011, 0x0009, 0x0003, 0x0010, 0x0020, 0x0026, 0x0026,
+ 0x0050, 0x0006, 0x002b, 0x0003, 0x0008, 0x0006, 0x0008, 0x0008, 0x0006, 0x0008, 0x0002, 0x0002, 0x0004,
+ 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0002, 0x0010, 0x001a, 0x002f, 0x0002, 0x001a
};
/* Contains the start points of bidirectional conversion ranges. */
-static const uint16_t lit_unicode_character_pair_ranges[] JERRY_ATTR_CONST_DATA =
-{
- 0x0100, 0x0132, 0x0139, 0x014a, 0x0179, 0x0182, 0x0187, 0x018b, 0x0191, 0x0198,
- 0x01a0, 0x01a7, 0x01ac, 0x01af, 0x01b3, 0x01b8, 0x01bc, 0x01cd, 0x01de, 0x01f4,
- 0x01f8, 0x0222, 0x023b, 0x0241, 0x0246, 0x0370, 0x0376, 0x03d8, 0x03f7, 0x03fa,
- 0x0460, 0x048a, 0x04c1, 0x04d0, 0x1e00, 0x1ea0, 0x2183, 0x2c60, 0x2c67, 0x2c72,
- 0x2c75, 0x2c80, 0x2ceb, 0x2cf2, 0xa640, 0xa680, 0xa722, 0xa732, 0xa779, 0xa77e,
- 0xa78b, 0xa790, 0xa796, 0xa7b4, 0xa7c2, 0xa7c7, 0xa7f5
+static const uint16_t lit_unicode_character_pair_ranges[] JERRY_ATTR_CONST_DATA = {
+ 0x0100, 0x0132, 0x0139, 0x014a, 0x0179, 0x0182, 0x0187, 0x018b, 0x0191, 0x0198, 0x01a0, 0x01a7,
+ 0x01ac, 0x01af, 0x01b3, 0x01b8, 0x01bc, 0x01cd, 0x01de, 0x01f4, 0x01f8, 0x0222, 0x023b, 0x0241,
+ 0x0246, 0x0370, 0x0376, 0x03d8, 0x03f7, 0x03fa, 0x0460, 0x048a, 0x04c1, 0x04d0, 0x1e00, 0x1ea0,
+ 0x2183, 0x2c60, 0x2c67, 0x2c72, 0x2c75, 0x2c80, 0x2ceb, 0x2cf2, 0xa640, 0xa680, 0xa722, 0xa732,
+ 0xa779, 0xa77e, 0xa78b, 0xa790, 0xa796, 0xa7b4, 0xa7c2, 0xa7c7, 0xa7f5
};
/* Interval lengths of start points in `character_pair_ranges` table. */
-static const uint8_t lit_unicode_character_pair_range_lengths[] JERRY_ATTR_CONST_DATA =
-{
- 0x0030, 0x0006, 0x0010, 0x002e, 0x0006, 0x0004, 0x0002, 0x0002, 0x0002, 0x0002,
- 0x0006, 0x0002, 0x0002, 0x0002, 0x0004, 0x0002, 0x0002, 0x0010, 0x0012, 0x0002,
- 0x0028, 0x0012, 0x0002, 0x0002, 0x000a, 0x0004, 0x0002, 0x0018, 0x0002, 0x0002,
- 0x0022, 0x0036, 0x000e, 0x0060, 0x0096, 0x0060, 0x0002, 0x0002, 0x0006, 0x0002,
- 0x0002, 0x0064, 0x0004, 0x0002, 0x002e, 0x001c, 0x000e, 0x003e, 0x0004, 0x000a,
- 0x0002, 0x0004, 0x0014, 0x000c, 0x0002, 0x0004, 0x0002
+static const uint8_t lit_unicode_character_pair_range_lengths[] JERRY_ATTR_CONST_DATA = {
+ 0x0030, 0x0006, 0x0010, 0x002e, 0x0006, 0x0004, 0x0002, 0x0002, 0x0002, 0x0002, 0x0006, 0x0002,
+ 0x0002, 0x0002, 0x0004, 0x0002, 0x0002, 0x0010, 0x0012, 0x0002, 0x0028, 0x0012, 0x0002, 0x0002,
+ 0x000a, 0x0004, 0x0002, 0x0018, 0x0002, 0x0002, 0x0022, 0x0036, 0x000e, 0x0060, 0x0096, 0x0060,
+ 0x0002, 0x0002, 0x0006, 0x0002, 0x0002, 0x0064, 0x0004, 0x0002, 0x002e, 0x001c, 0x000e, 0x003e,
+ 0x0004, 0x000a, 0x0002, 0x0004, 0x0014, 0x000c, 0x0002, 0x0004, 0x0002
};
/* Contains lower/upper case bidirectional conversion pairs. */
-static const uint16_t lit_unicode_character_pairs[] JERRY_ATTR_CONST_DATA =
-{
- 0x0178, 0x00ff, 0x0181, 0x0253, 0x0186, 0x0254, 0x018e, 0x01dd, 0x018f, 0x0259,
- 0x0190, 0x025b, 0x0193, 0x0260, 0x0194, 0x0263, 0x0196, 0x0269, 0x0197, 0x0268,
- 0x019c, 0x026f, 0x019d, 0x0272, 0x019f, 0x0275, 0x01a6, 0x0280, 0x01a9, 0x0283,
- 0x01ae, 0x0288, 0x01b7, 0x0292, 0x01c4, 0x01c6, 0x01c7, 0x01c9, 0x01ca, 0x01cc,
- 0x01f1, 0x01f3, 0x01f6, 0x0195, 0x01f7, 0x01bf, 0x0220, 0x019e, 0x023a, 0x2c65,
- 0x023d, 0x019a, 0x023e, 0x2c66, 0x0243, 0x0180, 0x0244, 0x0289, 0x0245, 0x028c,
- 0x037f, 0x03f3, 0x0386, 0x03ac, 0x038c, 0x03cc, 0x03cf, 0x03d7, 0x03f9, 0x03f2,
- 0x04c0, 0x04cf, 0x10c7, 0x2d27, 0x10cd, 0x2d2d, 0x1f59, 0x1f51, 0x1f5b, 0x1f53,
- 0x1f5d, 0x1f55, 0x1f5f, 0x1f57, 0x1fec, 0x1fe5, 0x2132, 0x214e, 0x2c62, 0x026b,
- 0x2c63, 0x1d7d, 0x2c64, 0x027d, 0x2c6d, 0x0251, 0x2c6e, 0x0271, 0x2c6f, 0x0250,
- 0x2c70, 0x0252, 0xa77d, 0x1d79, 0xa78d, 0x0265, 0xa7aa, 0x0266, 0xa7ab, 0x025c,
- 0xa7ac, 0x0261, 0xa7ad, 0x026c, 0xa7ae, 0x026a, 0xa7b0, 0x029e, 0xa7b1, 0x0287,
- 0xa7b2, 0x029d, 0xa7b3, 0xab53, 0xa7c4, 0xa794, 0xa7c5, 0x0282, 0xa7c6, 0x1d8e
+static const uint16_t lit_unicode_character_pairs[] JERRY_ATTR_CONST_DATA = {
+ 0x0178, 0x00ff, 0x0181, 0x0253, 0x0186, 0x0254, 0x018e, 0x01dd, 0x018f, 0x0259, 0x0190, 0x025b, 0x0193,
+ 0x0260, 0x0194, 0x0263, 0x0196, 0x0269, 0x0197, 0x0268, 0x019c, 0x026f, 0x019d, 0x0272, 0x019f, 0x0275,
+ 0x01a6, 0x0280, 0x01a9, 0x0283, 0x01ae, 0x0288, 0x01b7, 0x0292, 0x01c4, 0x01c6, 0x01c7, 0x01c9, 0x01ca,
+ 0x01cc, 0x01f1, 0x01f3, 0x01f6, 0x0195, 0x01f7, 0x01bf, 0x0220, 0x019e, 0x023a, 0x2c65, 0x023d, 0x019a,
+ 0x023e, 0x2c66, 0x0243, 0x0180, 0x0244, 0x0289, 0x0245, 0x028c, 0x037f, 0x03f3, 0x0386, 0x03ac, 0x038c,
+ 0x03cc, 0x03cf, 0x03d7, 0x03f9, 0x03f2, 0x04c0, 0x04cf, 0x10c7, 0x2d27, 0x10cd, 0x2d2d, 0x1f59, 0x1f51,
+ 0x1f5b, 0x1f53, 0x1f5d, 0x1f55, 0x1f5f, 0x1f57, 0x1fec, 0x1fe5, 0x2132, 0x214e, 0x2c62, 0x026b, 0x2c63,
+ 0x1d7d, 0x2c64, 0x027d, 0x2c6d, 0x0251, 0x2c6e, 0x0271, 0x2c6f, 0x0250, 0x2c70, 0x0252, 0xa77d, 0x1d79,
+ 0xa78d, 0x0265, 0xa7aa, 0x0266, 0xa7ab, 0x025c, 0xa7ac, 0x0261, 0xa7ad, 0x026c, 0xa7ae, 0x026a, 0xa7b0,
+ 0x029e, 0xa7b1, 0x0287, 0xa7b2, 0x029d, 0xa7b3, 0xab53, 0xa7c4, 0xa794, 0xa7c5, 0x0282, 0xa7c6, 0x1d8e
};
/* Contains start points of one-to-two uppercase ranges where the second character
* is always the same.
*/
-static const uint16_t lit_unicode_upper_case_special_ranges[] JERRY_ATTR_CONST_DATA =
-{
- 0x1f80, 0x1f08, 0x0399, 0x1f88, 0x1f08, 0x0399, 0x1f90, 0x1f28, 0x0399, 0x1f98,
- 0x1f28, 0x0399, 0x1fa0, 0x1f68, 0x0399, 0x1fa8, 0x1f68, 0x0399
+static const uint16_t lit_unicode_upper_case_special_ranges[] JERRY_ATTR_CONST_DATA = {
+ 0x1f80, 0x1f08, 0x0399, 0x1f88, 0x1f08, 0x0399, 0x1f90, 0x1f28, 0x0399,
+ 0x1f98, 0x1f28, 0x0399, 0x1fa0, 0x1f68, 0x0399, 0x1fa8, 0x1f68, 0x0399
};
/* Interval lengths for start points in `upper_case_special_ranges` table. */
-static const uint8_t lit_unicode_upper_case_special_range_lengths[] JERRY_ATTR_CONST_DATA =
-{
- 0x0007, 0x0007, 0x0007, 0x0007, 0x0007, 0x0007
-};
+static const uint8_t lit_unicode_upper_case_special_range_lengths[] JERRY_ATTR_CONST_DATA = { 0x0007, 0x0007, 0x0007,
+ 0x0007, 0x0007, 0x0007 };
/* Contains start points of lowercase ranges. */
-static const uint16_t lit_unicode_lower_case_ranges[] JERRY_ATTR_CONST_DATA =
-{
- 0x1f88, 0x1f80, 0x1f98, 0x1f90, 0x1fa8, 0x1fa0
-};
+static const uint16_t lit_unicode_lower_case_ranges[] JERRY_ATTR_CONST_DATA = { 0x1f88, 0x1f80, 0x1f98,
+ 0x1f90, 0x1fa8, 0x1fa0 };
/* Interval lengths for start points in `lower_case_ranges` table. */
-static const uint8_t lit_unicode_lower_case_range_lengths[] JERRY_ATTR_CONST_DATA =
-{
- 0x0008, 0x0008, 0x0008
-};
+static const uint8_t lit_unicode_lower_case_range_lengths[] JERRY_ATTR_CONST_DATA = { 0x0008, 0x0008, 0x0008 };
/* The remaining lowercase conversions. The lowercase variant can be one-to-three character long. */
-static const uint16_t lit_unicode_lower_case_conversions[] JERRY_ATTR_CONST_DATA =
-{
- 0x01c5, 0x01c6, 0x01c8, 0x01c9, 0x01cb, 0x01cc, 0x01f2, 0x01f3, 0x03f4, 0x03b8,
- 0x1e9e, 0x00df, 0x1fbc, 0x1fb3, 0x1fcc, 0x1fc3, 0x1ffc, 0x1ff3, 0x2126, 0x03c9,
- 0x212a, 0x006b, 0x212b, 0x00e5, 0x0130, 0x0069, 0x0307
+static const uint16_t lit_unicode_lower_case_conversions[] JERRY_ATTR_CONST_DATA = {
+ 0x01c5, 0x01c6, 0x01c8, 0x01c9, 0x01cb, 0x01cc, 0x01f2, 0x01f3, 0x03f4, 0x03b8, 0x1e9e, 0x00df, 0x1fbc, 0x1fb3,
+ 0x1fcc, 0x1fc3, 0x1ffc, 0x1ff3, 0x2126, 0x03c9, 0x212a, 0x006b, 0x212b, 0x00e5, 0x0130, 0x0069, 0x0307
};
/* Number of one-to-one, one-to-two, and one-to-three lowercase conversions. */
-static const uint8_t lit_unicode_lower_case_conversion_counters[] JERRY_ATTR_CONST_DATA =
-{
- 0x000c, 0x0001, 0x0000
-};
+static const uint8_t lit_unicode_lower_case_conversion_counters[] JERRY_ATTR_CONST_DATA = { 0x000c, 0x0001, 0x0000 };
/* The remaining uppercase conversions. The uppercase variant can be one-to-three character long. */
-static const uint16_t lit_unicode_upper_case_conversions[] JERRY_ATTR_CONST_DATA =
-{
- 0x00b5, 0x039c, 0x0131, 0x0049, 0x017f, 0x0053, 0x01c5, 0x01c4, 0x01c8, 0x01c7,
- 0x01cb, 0x01ca, 0x01f2, 0x01f1, 0x0345, 0x0399, 0x03c2, 0x03a3, 0x03d0, 0x0392,
- 0x03d1, 0x0398, 0x03d5, 0x03a6, 0x03d6, 0x03a0, 0x03f0, 0x039a, 0x03f1, 0x03a1,
- 0x03f5, 0x0395, 0x1c80, 0x0412, 0x1c81, 0x0414, 0x1c82, 0x041e, 0x1c83, 0x0421,
- 0x1c84, 0x0422, 0x1c85, 0x0422, 0x1c86, 0x042a, 0x1c87, 0x0462, 0x1c88, 0xa64a,
- 0x1e9b, 0x1e60, 0x1fbe, 0x0399, 0x00df, 0x0053, 0x0053, 0x0149, 0x02bc, 0x004e,
- 0x01f0, 0x004a, 0x030c, 0x0587, 0x0535, 0x0552, 0x1e96, 0x0048, 0x0331, 0x1e97,
- 0x0054, 0x0308, 0x1e98, 0x0057, 0x030a, 0x1e99, 0x0059, 0x030a, 0x1e9a, 0x0041,
- 0x02be, 0x1f50, 0x03a5, 0x0313, 0x1f87, 0x1f0f, 0x0399, 0x1f8f, 0x1f0f, 0x0399,
- 0x1f97, 0x1f2f, 0x0399, 0x1f9f, 0x1f2f, 0x0399, 0x1fa7, 0x1f6f, 0x0399, 0x1faf,
- 0x1f6f, 0x0399, 0x1fb2, 0x1fba, 0x0399, 0x1fb3, 0x0391, 0x0399, 0x1fb4, 0x0386,
- 0x0399, 0x1fb6, 0x0391, 0x0342, 0x1fbc, 0x0391, 0x0399, 0x1fc2, 0x1fca, 0x0399,
- 0x1fc3, 0x0397, 0x0399, 0x1fc4, 0x0389, 0x0399, 0x1fc6, 0x0397, 0x0342, 0x1fcc,
- 0x0397, 0x0399, 0x1fd6, 0x0399, 0x0342, 0x1fe4, 0x03a1, 0x0313, 0x1fe6, 0x03a5,
- 0x0342, 0x1ff2, 0x1ffa, 0x0399, 0x1ff3, 0x03a9, 0x0399, 0x1ff4, 0x038f, 0x0399,
- 0x1ff6, 0x03a9, 0x0342, 0x1ffc, 0x03a9, 0x0399, 0xfb00, 0x0046, 0x0046, 0xfb01,
- 0x0046, 0x0049, 0xfb02, 0x0046, 0x004c, 0xfb05, 0x0053, 0x0054, 0xfb06, 0x0053,
- 0x0054, 0xfb13, 0x0544, 0x0546, 0xfb14, 0x0544, 0x0535, 0xfb15, 0x0544, 0x053b,
- 0xfb16, 0x054e, 0x0546, 0xfb17, 0x0544, 0x053d, 0x0390, 0x0399, 0x0308, 0x0301,
- 0x03b0, 0x03a5, 0x0308, 0x0301, 0x1f52, 0x03a5, 0x0313, 0x0300, 0x1f54, 0x03a5,
- 0x0313, 0x0301, 0x1f56, 0x03a5, 0x0313, 0x0342, 0x1fb7, 0x0391, 0x0342, 0x0399,
- 0x1fc7, 0x0397, 0x0342, 0x0399, 0x1fd2, 0x0399, 0x0308, 0x0300, 0x1fd3, 0x0399,
- 0x0308, 0x0301, 0x1fd7, 0x0399, 0x0308, 0x0342, 0x1fe2, 0x03a5, 0x0308, 0x0300,
- 0x1fe3, 0x03a5, 0x0308, 0x0301, 0x1fe7, 0x03a5, 0x0308, 0x0342, 0x1ff7, 0x03a9,
- 0x0342, 0x0399, 0xfb03, 0x0046, 0x0046, 0x0049, 0xfb04, 0x0046, 0x0046, 0x004c
+static const uint16_t lit_unicode_upper_case_conversions[] JERRY_ATTR_CONST_DATA = {
+ 0x00b5, 0x039c, 0x0131, 0x0049, 0x017f, 0x0053, 0x01c5, 0x01c4, 0x01c8, 0x01c7, 0x01cb, 0x01ca, 0x01f2, 0x01f1,
+ 0x0345, 0x0399, 0x03c2, 0x03a3, 0x03d0, 0x0392, 0x03d1, 0x0398, 0x03d5, 0x03a6, 0x03d6, 0x03a0, 0x03f0, 0x039a,
+ 0x03f1, 0x03a1, 0x03f5, 0x0395, 0x1c80, 0x0412, 0x1c81, 0x0414, 0x1c82, 0x041e, 0x1c83, 0x0421, 0x1c84, 0x0422,
+ 0x1c85, 0x0422, 0x1c86, 0x042a, 0x1c87, 0x0462, 0x1c88, 0xa64a, 0x1e9b, 0x1e60, 0x1fbe, 0x0399, 0x00df, 0x0053,
+ 0x0053, 0x0149, 0x02bc, 0x004e, 0x01f0, 0x004a, 0x030c, 0x0587, 0x0535, 0x0552, 0x1e96, 0x0048, 0x0331, 0x1e97,
+ 0x0054, 0x0308, 0x1e98, 0x0057, 0x030a, 0x1e99, 0x0059, 0x030a, 0x1e9a, 0x0041, 0x02be, 0x1f50, 0x03a5, 0x0313,
+ 0x1f87, 0x1f0f, 0x0399, 0x1f8f, 0x1f0f, 0x0399, 0x1f97, 0x1f2f, 0x0399, 0x1f9f, 0x1f2f, 0x0399, 0x1fa7, 0x1f6f,
+ 0x0399, 0x1faf, 0x1f6f, 0x0399, 0x1fb2, 0x1fba, 0x0399, 0x1fb3, 0x0391, 0x0399, 0x1fb4, 0x0386, 0x0399, 0x1fb6,
+ 0x0391, 0x0342, 0x1fbc, 0x0391, 0x0399, 0x1fc2, 0x1fca, 0x0399, 0x1fc3, 0x0397, 0x0399, 0x1fc4, 0x0389, 0x0399,
+ 0x1fc6, 0x0397, 0x0342, 0x1fcc, 0x0397, 0x0399, 0x1fd6, 0x0399, 0x0342, 0x1fe4, 0x03a1, 0x0313, 0x1fe6, 0x03a5,
+ 0x0342, 0x1ff2, 0x1ffa, 0x0399, 0x1ff3, 0x03a9, 0x0399, 0x1ff4, 0x038f, 0x0399, 0x1ff6, 0x03a9, 0x0342, 0x1ffc,
+ 0x03a9, 0x0399, 0xfb00, 0x0046, 0x0046, 0xfb01, 0x0046, 0x0049, 0xfb02, 0x0046, 0x004c, 0xfb05, 0x0053, 0x0054,
+ 0xfb06, 0x0053, 0x0054, 0xfb13, 0x0544, 0x0546, 0xfb14, 0x0544, 0x0535, 0xfb15, 0x0544, 0x053b, 0xfb16, 0x054e,
+ 0x0546, 0xfb17, 0x0544, 0x053d, 0x0390, 0x0399, 0x0308, 0x0301, 0x03b0, 0x03a5, 0x0308, 0x0301, 0x1f52, 0x03a5,
+ 0x0313, 0x0300, 0x1f54, 0x03a5, 0x0313, 0x0301, 0x1f56, 0x03a5, 0x0313, 0x0342, 0x1fb7, 0x0391, 0x0342, 0x0399,
+ 0x1fc7, 0x0397, 0x0342, 0x0399, 0x1fd2, 0x0399, 0x0308, 0x0300, 0x1fd3, 0x0399, 0x0308, 0x0301, 0x1fd7, 0x0399,
+ 0x0308, 0x0342, 0x1fe2, 0x03a5, 0x0308, 0x0300, 0x1fe3, 0x03a5, 0x0308, 0x0301, 0x1fe7, 0x03a5, 0x0308, 0x0342,
+ 0x1ff7, 0x03a9, 0x0342, 0x0399, 0xfb03, 0x0046, 0x0046, 0x0049, 0xfb04, 0x0046, 0x0046, 0x004c
};
/* Number of one-to-one, one-to-two, and one-to-three uppercase conversions. */
-static const uint8_t lit_unicode_upper_case_conversion_counters[] JERRY_ATTR_CONST_DATA =
-{
- 0x001b, 0x002c, 0x0010
-};
+static const uint8_t lit_unicode_upper_case_conversion_counters[] JERRY_ATTR_CONST_DATA = { 0x001b, 0x002c, 0x0010 };
diff --git a/jerry-core/lit/lit-unicode-folding.inc.h b/jerry-core/lit/lit-unicode-folding.inc.h
index 5c4965b0..d9cd46f1 100644
--- a/jerry-core/lit/lit-unicode-folding.inc.h
+++ b/jerry-core/lit/lit-unicode-folding.inc.h
@@ -19,47 +19,36 @@
/**
* Character interval starting points for folding_skip_to_lower.
*/
-static const uint16_t lit_unicode_folding_skip_to_lower_interval_starts[] JERRY_ATTR_CONST_DATA =
-{
- 0x13a0, 0x13f8, 0xab70
-};
+static const uint16_t lit_unicode_folding_skip_to_lower_interval_starts[] JERRY_ATTR_CONST_DATA = { 0x13a0,
+ 0x13f8,
+ 0xab70 };
/**
* Character interval lengths for folding_skip_to_lower.
*/
-static const uint8_t lit_unicode_folding_skip_to_lower_interval_lengths[] JERRY_ATTR_CONST_DATA =
-{
- 0x0055, 0x0005, 0x004f
-};
+static const uint8_t lit_unicode_folding_skip_to_lower_interval_lengths[] JERRY_ATTR_CONST_DATA = { 0x0055,
+ 0x0005,
+ 0x004f };
/**
* Non-interval characters for folding_skip_to_lower.
*/
-static const uint16_t lit_unicode_folding_skip_to_lower_chars[] JERRY_ATTR_CONST_DATA =
-{
- 0x0130
-};
+static const uint16_t lit_unicode_folding_skip_to_lower_chars[] JERRY_ATTR_CONST_DATA = { 0x0130 };
/**
* Character interval starting points for folding_to_upper.
*/
-static const uint16_t lit_unicode_folding_to_upper_interval_starts[] JERRY_ATTR_CONST_DATA =
-{
- 0x03d0, 0x03d5, 0x03f0, 0x13f8, 0x1c80, 0xab70
-};
+static const uint16_t lit_unicode_folding_to_upper_interval_starts[] JERRY_ATTR_CONST_DATA = { 0x03d0, 0x03d5, 0x03f0,
+ 0x13f8, 0x1c80, 0xab70 };
/**
* Character interval lengths for folding_to_upper.
*/
-static const uint8_t lit_unicode_folding_to_upper_interval_lengths[] JERRY_ATTR_CONST_DATA =
-{
- 0x0001, 0x0001, 0x0001, 0x0005, 0x0008, 0x004f
-};
+static const uint8_t lit_unicode_folding_to_upper_interval_lengths[] JERRY_ATTR_CONST_DATA = { 0x0001, 0x0001, 0x0001,
+ 0x0005, 0x0008, 0x004f };
/**
* Non-interval characters for folding_to_upper.
*/
-static const uint16_t lit_unicode_folding_to_upper_chars[] JERRY_ATTR_CONST_DATA =
-{
- 0x00b5, 0x017f, 0x0345, 0x03c2, 0x03f5, 0x1e9b, 0x1fbe
-};
+static const uint16_t lit_unicode_folding_to_upper_chars[] JERRY_ATTR_CONST_DATA = { 0x00b5, 0x017f, 0x0345, 0x03c2,
+ 0x03f5, 0x1e9b, 0x1fbe };
diff --git a/jerry-core/lit/lit-unicode-ranges-sup.inc.h b/jerry-core/lit/lit-unicode-ranges-sup.inc.h
index 6b856948..2e034faa 100644
--- a/jerry-core/lit/lit-unicode-ranges-sup.inc.h
+++ b/jerry-core/lit/lit-unicode-ranges-sup.inc.h
@@ -19,111 +19,98 @@
/**
* Character interval starting points for ID_Start.
*/
-static const uint32_t lit_unicode_id_start_interval_starts_sup[] JERRY_ATTR_CONST_DATA =
-{
- 0x010000, 0x01000d, 0x010028, 0x01003c, 0x01003f, 0x010050, 0x010080, 0x010140, 0x010280, 0x0102a0,
- 0x010300, 0x01032d, 0x010350, 0x010380, 0x0103a0, 0x0103c8, 0x0103d1, 0x010400, 0x0104b0, 0x0104d8,
- 0x010500, 0x010530, 0x010600, 0x010740, 0x010760, 0x010800, 0x01080a, 0x010837, 0x01083f, 0x010860,
- 0x010880, 0x0108e0, 0x0108f4, 0x010900, 0x010920, 0x010980, 0x0109be, 0x010a10, 0x010a15, 0x010a19,
- 0x010a60, 0x010a80, 0x010ac0, 0x010ac9, 0x010b00, 0x010b40, 0x010b60, 0x010b80, 0x010c00, 0x010c80,
- 0x010cc0, 0x010d00, 0x010e80, 0x010eb0, 0x010f00, 0x010f30, 0x010fb0, 0x010fe0, 0x011003, 0x011083,
- 0x0110d0, 0x011103, 0x011150, 0x011183, 0x0111c1, 0x011200, 0x011213, 0x011280, 0x01128a, 0x01128f,
- 0x01129f, 0x0112b0, 0x011305, 0x01130f, 0x011313, 0x01132a, 0x011332, 0x011335, 0x01135d, 0x011400,
- 0x011447, 0x01145f, 0x011480, 0x0114c4, 0x011580, 0x0115d8, 0x011600, 0x011680, 0x011700, 0x011800,
- 0x0118a0, 0x0118ff, 0x01190c, 0x011915, 0x011918, 0x0119a0, 0x0119aa, 0x011a0b, 0x011a5c, 0x011ac0,
- 0x011c00, 0x011c0a, 0x011c72, 0x011d00, 0x011d08, 0x011d0b, 0x011d60, 0x011d67, 0x011d6a, 0x011ee0,
- 0x012000, 0x012400, 0x012480, 0x013000, 0x014400, 0x016800, 0x016a40, 0x016ad0, 0x016b00, 0x016b40,
- 0x016b63, 0x016b7d, 0x016e40, 0x016f00, 0x016f93, 0x016fe0, 0x017000, 0x018800, 0x018d00, 0x01b000,
- 0x01b150, 0x01b164, 0x01b170, 0x01bc00, 0x01bc70, 0x01bc80, 0x01bc90, 0x01d400, 0x01d456, 0x01d49e,
- 0x01d4a5, 0x01d4a9, 0x01d4ae, 0x01d4bd, 0x01d4c5, 0x01d507, 0x01d50d, 0x01d516, 0x01d51e, 0x01d53b,
- 0x01d540, 0x01d54a, 0x01d552, 0x01d6a8, 0x01d6c2, 0x01d6dc, 0x01d6fc, 0x01d716, 0x01d736, 0x01d750,
- 0x01d770, 0x01d78a, 0x01d7aa, 0x01d7c4, 0x01e100, 0x01e137, 0x01e2c0, 0x01e800, 0x01e900, 0x01ee00,
- 0x01ee05, 0x01ee21, 0x01ee29, 0x01ee34, 0x01ee4d, 0x01ee51, 0x01ee61, 0x01ee67, 0x01ee6c, 0x01ee74,
- 0x01ee79, 0x01ee80, 0x01ee8b, 0x01eea1, 0x01eea5, 0x01eeab, 0x020000, 0x02a700, 0x02b740, 0x02b820,
- 0x02ceb0, 0x02f800, 0x030000
+static const uint32_t lit_unicode_id_start_interval_starts_sup[] JERRY_ATTR_CONST_DATA = {
+ 0x010000, 0x01000d, 0x010028, 0x01003c, 0x01003f, 0x010050, 0x010080, 0x010140, 0x010280, 0x0102a0, 0x010300,
+ 0x01032d, 0x010350, 0x010380, 0x0103a0, 0x0103c8, 0x0103d1, 0x010400, 0x0104b0, 0x0104d8, 0x010500, 0x010530,
+ 0x010600, 0x010740, 0x010760, 0x010800, 0x01080a, 0x010837, 0x01083f, 0x010860, 0x010880, 0x0108e0, 0x0108f4,
+ 0x010900, 0x010920, 0x010980, 0x0109be, 0x010a10, 0x010a15, 0x010a19, 0x010a60, 0x010a80, 0x010ac0, 0x010ac9,
+ 0x010b00, 0x010b40, 0x010b60, 0x010b80, 0x010c00, 0x010c80, 0x010cc0, 0x010d00, 0x010e80, 0x010eb0, 0x010f00,
+ 0x010f30, 0x010fb0, 0x010fe0, 0x011003, 0x011083, 0x0110d0, 0x011103, 0x011150, 0x011183, 0x0111c1, 0x011200,
+ 0x011213, 0x011280, 0x01128a, 0x01128f, 0x01129f, 0x0112b0, 0x011305, 0x01130f, 0x011313, 0x01132a, 0x011332,
+ 0x011335, 0x01135d, 0x011400, 0x011447, 0x01145f, 0x011480, 0x0114c4, 0x011580, 0x0115d8, 0x011600, 0x011680,
+ 0x011700, 0x011800, 0x0118a0, 0x0118ff, 0x01190c, 0x011915, 0x011918, 0x0119a0, 0x0119aa, 0x011a0b, 0x011a5c,
+ 0x011ac0, 0x011c00, 0x011c0a, 0x011c72, 0x011d00, 0x011d08, 0x011d0b, 0x011d60, 0x011d67, 0x011d6a, 0x011ee0,
+ 0x012000, 0x012400, 0x012480, 0x013000, 0x014400, 0x016800, 0x016a40, 0x016ad0, 0x016b00, 0x016b40, 0x016b63,
+ 0x016b7d, 0x016e40, 0x016f00, 0x016f93, 0x016fe0, 0x017000, 0x018800, 0x018d00, 0x01b000, 0x01b150, 0x01b164,
+ 0x01b170, 0x01bc00, 0x01bc70, 0x01bc80, 0x01bc90, 0x01d400, 0x01d456, 0x01d49e, 0x01d4a5, 0x01d4a9, 0x01d4ae,
+ 0x01d4bd, 0x01d4c5, 0x01d507, 0x01d50d, 0x01d516, 0x01d51e, 0x01d53b, 0x01d540, 0x01d54a, 0x01d552, 0x01d6a8,
+ 0x01d6c2, 0x01d6dc, 0x01d6fc, 0x01d716, 0x01d736, 0x01d750, 0x01d770, 0x01d78a, 0x01d7aa, 0x01d7c4, 0x01e100,
+ 0x01e137, 0x01e2c0, 0x01e800, 0x01e900, 0x01ee00, 0x01ee05, 0x01ee21, 0x01ee29, 0x01ee34, 0x01ee4d, 0x01ee51,
+ 0x01ee61, 0x01ee67, 0x01ee6c, 0x01ee74, 0x01ee79, 0x01ee80, 0x01ee8b, 0x01eea1, 0x01eea5, 0x01eeab, 0x020000,
+ 0x02a700, 0x02b740, 0x02b820, 0x02ceb0, 0x02f800, 0x030000
};
/**
* Character interval lengths for ID_Start.
*/
-static const uint16_t lit_unicode_id_start_interval_lengths_sup[] JERRY_ATTR_CONST_DATA =
-{
- 0x00000b, 0x000019, 0x000012, 0x000001, 0x00000e, 0x00000d, 0x00007a, 0x000034, 0x00001c, 0x000030,
- 0x00001f, 0x00001d, 0x000025, 0x00001d, 0x000023, 0x000007, 0x000004, 0x00009d, 0x000023, 0x000023,
- 0x000027, 0x000033, 0x000136, 0x000015, 0x000007, 0x000005, 0x00002b, 0x000001, 0x000016, 0x000016,
- 0x00001e, 0x000012, 0x000001, 0x000015, 0x000019, 0x000037, 0x000001, 0x000003, 0x000002, 0x00001c,
- 0x00001c, 0x00001c, 0x000007, 0x00001b, 0x000035, 0x000015, 0x000012, 0x000011, 0x000048, 0x000032,
- 0x000032, 0x000023, 0x000029, 0x000001, 0x00001c, 0x000015, 0x000014, 0x000016, 0x000034, 0x00002c,
- 0x000018, 0x000023, 0x000022, 0x00002f, 0x000003, 0x000011, 0x000018, 0x000006, 0x000003, 0x00000e,
- 0x000009, 0x00002e, 0x000007, 0x000001, 0x000015, 0x000006, 0x000001, 0x000004, 0x000004, 0x000034,
- 0x000003, 0x000002, 0x00002f, 0x000001, 0x00002e, 0x000003, 0x00002f, 0x00002a, 0x00001a, 0x00002b,
- 0x00003f, 0x000007, 0x000007, 0x000001, 0x000017, 0x000007, 0x000026, 0x000027, 0x00002d, 0x000038,
- 0x000008, 0x000024, 0x00001d, 0x000006, 0x000001, 0x000025, 0x000005, 0x000001, 0x00001f, 0x000012,
- 0x000399, 0x00006e, 0x0000c3, 0x00042e, 0x000246, 0x000238, 0x00001e, 0x00001d, 0x00002f, 0x000003,
- 0x000014, 0x000012, 0x00003f, 0x00004a, 0x00000c, 0x000001, 0x0017f7, 0x0004d5, 0x000008, 0x00011e,
- 0x000002, 0x000003, 0x00018b, 0x00006a, 0x00000c, 0x000008, 0x000009, 0x000054, 0x000046, 0x000001,
- 0x000001, 0x000003, 0x00000b, 0x000006, 0x000040, 0x000003, 0x000007, 0x000006, 0x00001b, 0x000003,
- 0x000004, 0x000006, 0x000153, 0x000018, 0x000018, 0x00001e, 0x000018, 0x00001e, 0x000018, 0x00001e,
- 0x000018, 0x00001e, 0x000018, 0x000007, 0x00002c, 0x000006, 0x00002b, 0x0000c4, 0x000043, 0x000003,
- 0x00001a, 0x000001, 0x000009, 0x000003, 0x000002, 0x000001, 0x000001, 0x000003, 0x000006, 0x000003,
- 0x000003, 0x000009, 0x000010, 0x000002, 0x000004, 0x000010, 0x00a6dd, 0x001034, 0x0000dd, 0x001681,
- 0x001d30, 0x00021d, 0x00134a
+static const uint16_t lit_unicode_id_start_interval_lengths_sup[] JERRY_ATTR_CONST_DATA = {
+ 0x00000b, 0x000019, 0x000012, 0x000001, 0x00000e, 0x00000d, 0x00007a, 0x000034, 0x00001c, 0x000030, 0x00001f,
+ 0x00001d, 0x000025, 0x00001d, 0x000023, 0x000007, 0x000004, 0x00009d, 0x000023, 0x000023, 0x000027, 0x000033,
+ 0x000136, 0x000015, 0x000007, 0x000005, 0x00002b, 0x000001, 0x000016, 0x000016, 0x00001e, 0x000012, 0x000001,
+ 0x000015, 0x000019, 0x000037, 0x000001, 0x000003, 0x000002, 0x00001c, 0x00001c, 0x00001c, 0x000007, 0x00001b,
+ 0x000035, 0x000015, 0x000012, 0x000011, 0x000048, 0x000032, 0x000032, 0x000023, 0x000029, 0x000001, 0x00001c,
+ 0x000015, 0x000014, 0x000016, 0x000034, 0x00002c, 0x000018, 0x000023, 0x000022, 0x00002f, 0x000003, 0x000011,
+ 0x000018, 0x000006, 0x000003, 0x00000e, 0x000009, 0x00002e, 0x000007, 0x000001, 0x000015, 0x000006, 0x000001,
+ 0x000004, 0x000004, 0x000034, 0x000003, 0x000002, 0x00002f, 0x000001, 0x00002e, 0x000003, 0x00002f, 0x00002a,
+ 0x00001a, 0x00002b, 0x00003f, 0x000007, 0x000007, 0x000001, 0x000017, 0x000007, 0x000026, 0x000027, 0x00002d,
+ 0x000038, 0x000008, 0x000024, 0x00001d, 0x000006, 0x000001, 0x000025, 0x000005, 0x000001, 0x00001f, 0x000012,
+ 0x000399, 0x00006e, 0x0000c3, 0x00042e, 0x000246, 0x000238, 0x00001e, 0x00001d, 0x00002f, 0x000003, 0x000014,
+ 0x000012, 0x00003f, 0x00004a, 0x00000c, 0x000001, 0x0017f7, 0x0004d5, 0x000008, 0x00011e, 0x000002, 0x000003,
+ 0x00018b, 0x00006a, 0x00000c, 0x000008, 0x000009, 0x000054, 0x000046, 0x000001, 0x000001, 0x000003, 0x00000b,
+ 0x000006, 0x000040, 0x000003, 0x000007, 0x000006, 0x00001b, 0x000003, 0x000004, 0x000006, 0x000153, 0x000018,
+ 0x000018, 0x00001e, 0x000018, 0x00001e, 0x000018, 0x00001e, 0x000018, 0x00001e, 0x000018, 0x000007, 0x00002c,
+ 0x000006, 0x00002b, 0x0000c4, 0x000043, 0x000003, 0x00001a, 0x000001, 0x000009, 0x000003, 0x000002, 0x000001,
+ 0x000001, 0x000003, 0x000006, 0x000003, 0x000003, 0x000009, 0x000010, 0x000002, 0x000004, 0x000010, 0x00a6dd,
+ 0x001034, 0x0000dd, 0x001681, 0x001d30, 0x00021d, 0x00134a
};
/**
* Non-interval characters for ID_Start.
*/
-static const uint32_t lit_unicode_id_start_chars_sup[] JERRY_ATTR_CONST_DATA =
-{
- 0x010808, 0x01083c, 0x010a00, 0x010f27, 0x011144, 0x011147, 0x011176, 0x0111da, 0x0111dc, 0x011288,
- 0x01133d, 0x011350, 0x0114c7, 0x011644, 0x0116b8, 0x011909, 0x01193f, 0x011941, 0x0119e1, 0x0119e3,
- 0x011a00, 0x011a3a, 0x011a50, 0x011a9d, 0x011c40, 0x011d46, 0x011d98, 0x011fb0, 0x016f50, 0x016fe3,
- 0x01d4a2, 0x01d4bb, 0x01d546, 0x01e14e, 0x01e94b, 0x01ee24, 0x01ee27, 0x01ee39, 0x01ee3b, 0x01ee42,
- 0x01ee47, 0x01ee49, 0x01ee4b, 0x01ee54, 0x01ee57, 0x01ee59, 0x01ee5b, 0x01ee5d, 0x01ee5f, 0x01ee64,
- 0x01ee7e
+static const uint32_t lit_unicode_id_start_chars_sup[] JERRY_ATTR_CONST_DATA = {
+ 0x010808, 0x01083c, 0x010a00, 0x010f27, 0x011144, 0x011147, 0x011176, 0x0111da, 0x0111dc, 0x011288, 0x01133d,
+ 0x011350, 0x0114c7, 0x011644, 0x0116b8, 0x011909, 0x01193f, 0x011941, 0x0119e1, 0x0119e3, 0x011a00, 0x011a3a,
+ 0x011a50, 0x011a9d, 0x011c40, 0x011d46, 0x011d98, 0x011fb0, 0x016f50, 0x016fe3, 0x01d4a2, 0x01d4bb, 0x01d546,
+ 0x01e14e, 0x01e94b, 0x01ee24, 0x01ee27, 0x01ee39, 0x01ee3b, 0x01ee42, 0x01ee47, 0x01ee49, 0x01ee4b, 0x01ee54,
+ 0x01ee57, 0x01ee59, 0x01ee5b, 0x01ee5d, 0x01ee5f, 0x01ee64, 0x01ee7e
};
/**
* Character interval starting points for ID_Continue.
*/
-static const uint32_t lit_unicode_id_continue_interval_starts_sup[] JERRY_ATTR_CONST_DATA =
-{
- 0x010376, 0x0104a0, 0x010a01, 0x010a05, 0x010a0c, 0x010a38, 0x010ae5, 0x010d24, 0x010d30, 0x010eab,
- 0x010f46, 0x011000, 0x011038, 0x011066, 0x01107f, 0x0110b0, 0x0110f0, 0x011100, 0x011127, 0x011136,
- 0x011145, 0x011180, 0x0111b3, 0x0111c9, 0x0111ce, 0x01122c, 0x0112df, 0x0112f0, 0x011300, 0x01133b,
- 0x01133e, 0x011347, 0x01134b, 0x011362, 0x011366, 0x011370, 0x011435, 0x011450, 0x0114b0, 0x0114d0,
- 0x0115af, 0x0115b8, 0x0115dc, 0x011630, 0x011650, 0x0116ab, 0x0116c0, 0x01171d, 0x011730, 0x01182c,
- 0x0118e0, 0x011930, 0x011937, 0x01193b, 0x011942, 0x011950, 0x0119d1, 0x0119da, 0x011a01, 0x011a33,
- 0x011a3b, 0x011a51, 0x011a8a, 0x011c2f, 0x011c38, 0x011c50, 0x011c92, 0x011ca9, 0x011d31, 0x011d3c,
- 0x011d3f, 0x011d50, 0x011d8a, 0x011d90, 0x011d93, 0x011da0, 0x011ef3, 0x016a60, 0x016af0, 0x016b30,
- 0x016b50, 0x016f51, 0x016f8f, 0x016ff0, 0x01bc9d, 0x01d165, 0x01d16d, 0x01d17b, 0x01d185, 0x01d1aa,
- 0x01d242, 0x01d7ce, 0x01da00, 0x01da3b, 0x01da9b, 0x01daa1, 0x01e000, 0x01e008, 0x01e01b, 0x01e023,
- 0x01e026, 0x01e130, 0x01e140, 0x01e2ec, 0x01e8d0, 0x01e944, 0x01e950, 0x01fbf0, 0x0e0100
+static const uint32_t lit_unicode_id_continue_interval_starts_sup[] JERRY_ATTR_CONST_DATA = {
+ 0x010376, 0x0104a0, 0x010a01, 0x010a05, 0x010a0c, 0x010a38, 0x010ae5, 0x010d24, 0x010d30, 0x010eab, 0x010f46,
+ 0x011000, 0x011038, 0x011066, 0x01107f, 0x0110b0, 0x0110f0, 0x011100, 0x011127, 0x011136, 0x011145, 0x011180,
+ 0x0111b3, 0x0111c9, 0x0111ce, 0x01122c, 0x0112df, 0x0112f0, 0x011300, 0x01133b, 0x01133e, 0x011347, 0x01134b,
+ 0x011362, 0x011366, 0x011370, 0x011435, 0x011450, 0x0114b0, 0x0114d0, 0x0115af, 0x0115b8, 0x0115dc, 0x011630,
+ 0x011650, 0x0116ab, 0x0116c0, 0x01171d, 0x011730, 0x01182c, 0x0118e0, 0x011930, 0x011937, 0x01193b, 0x011942,
+ 0x011950, 0x0119d1, 0x0119da, 0x011a01, 0x011a33, 0x011a3b, 0x011a51, 0x011a8a, 0x011c2f, 0x011c38, 0x011c50,
+ 0x011c92, 0x011ca9, 0x011d31, 0x011d3c, 0x011d3f, 0x011d50, 0x011d8a, 0x011d90, 0x011d93, 0x011da0, 0x011ef3,
+ 0x016a60, 0x016af0, 0x016b30, 0x016b50, 0x016f51, 0x016f8f, 0x016ff0, 0x01bc9d, 0x01d165, 0x01d16d, 0x01d17b,
+ 0x01d185, 0x01d1aa, 0x01d242, 0x01d7ce, 0x01da00, 0x01da3b, 0x01da9b, 0x01daa1, 0x01e000, 0x01e008, 0x01e01b,
+ 0x01e023, 0x01e026, 0x01e130, 0x01e140, 0x01e2ec, 0x01e8d0, 0x01e944, 0x01e950, 0x01fbf0, 0x0e0100
};
/**
* Character interval lengths for ID_Continue.
*/
-static const uint16_t lit_unicode_id_continue_interval_lengths_sup[] JERRY_ATTR_CONST_DATA =
-{
- 0x000004, 0x000009, 0x000002, 0x000001, 0x000003, 0x000002, 0x000001, 0x000003, 0x000009, 0x000001,
- 0x00000a, 0x000002, 0x00000e, 0x000009, 0x000003, 0x00000a, 0x000009, 0x000002, 0x00000d, 0x000009,
- 0x000001, 0x000002, 0x00000d, 0x000003, 0x00000b, 0x00000b, 0x00000b, 0x000009, 0x000003, 0x000001,
- 0x000006, 0x000001, 0x000002, 0x000001, 0x000006, 0x000004, 0x000011, 0x000009, 0x000013, 0x000009,
- 0x000006, 0x000008, 0x000001, 0x000010, 0x000009, 0x00000c, 0x000009, 0x00000e, 0x000009, 0x00000e,
- 0x000009, 0x000005, 0x000001, 0x000003, 0x000001, 0x000009, 0x000006, 0x000006, 0x000009, 0x000006,
- 0x000003, 0x00000a, 0x00000f, 0x000007, 0x000007, 0x000009, 0x000015, 0x00000d, 0x000005, 0x000001,
- 0x000006, 0x000009, 0x000004, 0x000001, 0x000004, 0x000009, 0x000003, 0x000009, 0x000004, 0x000006,
- 0x000009, 0x000036, 0x000003, 0x000001, 0x000001, 0x000004, 0x000005, 0x000007, 0x000006, 0x000003,
- 0x000002, 0x000031, 0x000036, 0x000031, 0x000004, 0x00000e, 0x000006, 0x000010, 0x000006, 0x000001,
- 0x000004, 0x000006, 0x000009, 0x00000d, 0x000006, 0x000006, 0x000009, 0x000009, 0x0000ef
+static const uint16_t lit_unicode_id_continue_interval_lengths_sup[] JERRY_ATTR_CONST_DATA = {
+ 0x000004, 0x000009, 0x000002, 0x000001, 0x000003, 0x000002, 0x000001, 0x000003, 0x000009, 0x000001, 0x00000a,
+ 0x000002, 0x00000e, 0x000009, 0x000003, 0x00000a, 0x000009, 0x000002, 0x00000d, 0x000009, 0x000001, 0x000002,
+ 0x00000d, 0x000003, 0x00000b, 0x00000b, 0x00000b, 0x000009, 0x000003, 0x000001, 0x000006, 0x000001, 0x000002,
+ 0x000001, 0x000006, 0x000004, 0x000011, 0x000009, 0x000013, 0x000009, 0x000006, 0x000008, 0x000001, 0x000010,
+ 0x000009, 0x00000c, 0x000009, 0x00000e, 0x000009, 0x00000e, 0x000009, 0x000005, 0x000001, 0x000003, 0x000001,
+ 0x000009, 0x000006, 0x000006, 0x000009, 0x000006, 0x000003, 0x00000a, 0x00000f, 0x000007, 0x000007, 0x000009,
+ 0x000015, 0x00000d, 0x000005, 0x000001, 0x000006, 0x000009, 0x000004, 0x000001, 0x000004, 0x000009, 0x000003,
+ 0x000009, 0x000004, 0x000006, 0x000009, 0x000036, 0x000003, 0x000001, 0x000001, 0x000004, 0x000005, 0x000007,
+ 0x000006, 0x000003, 0x000002, 0x000031, 0x000036, 0x000031, 0x000004, 0x00000e, 0x000006, 0x000010, 0x000006,
+ 0x000001, 0x000004, 0x000006, 0x000009, 0x00000d, 0x000006, 0x000006, 0x000009, 0x000009, 0x0000ef
};
/**
* Non-interval characters for ID_Continue.
*/
-static const uint32_t lit_unicode_id_continue_chars_sup[] JERRY_ATTR_CONST_DATA =
-{
- 0x0101fd, 0x0102e0, 0x010a3f, 0x011173, 0x01123e, 0x011357, 0x01145e, 0x011940, 0x0119e4, 0x011a47,
- 0x011d3a, 0x011d47, 0x016f4f, 0x016fe4, 0x01da75, 0x01da84
+static const uint32_t lit_unicode_id_continue_chars_sup[] JERRY_ATTR_CONST_DATA = {
+ 0x0101fd, 0x0102e0, 0x010a3f, 0x011173, 0x01123e, 0x011357, 0x01145e, 0x011940,
+ 0x0119e4, 0x011a47, 0x011d3a, 0x011d47, 0x016f4f, 0x016fe4, 0x01da75, 0x01da84
};
diff --git a/jerry-core/lit/lit-unicode-ranges.inc.h b/jerry-core/lit/lit-unicode-ranges.inc.h
index 24526c4d..75022dd2 100644
--- a/jerry-core/lit/lit-unicode-ranges.inc.h
+++ b/jerry-core/lit/lit-unicode-ranges.inc.h
@@ -19,208 +19,158 @@
/**
* Character interval starting points for ID_Start.
*/
-static const uint16_t lit_unicode_id_start_interval_starts[] JERRY_ATTR_CONST_DATA =
-{
- 0x00c0, 0x00d8, 0x00f8, 0x01f8, 0x02c6, 0x02e0, 0x0370, 0x0376, 0x037a, 0x0388,
- 0x038e, 0x03a3, 0x03f7, 0x048a, 0x0531, 0x0560, 0x05d0, 0x05ef, 0x0620, 0x066e,
- 0x0671, 0x06e5, 0x06ee, 0x06fa, 0x0712, 0x074d, 0x07ca, 0x07f4, 0x0800, 0x0840,
- 0x0860, 0x08a0, 0x08b6, 0x0904, 0x0958, 0x0971, 0x0985, 0x098f, 0x0993, 0x09aa,
- 0x09b6, 0x09dc, 0x09df, 0x09f0, 0x0a05, 0x0a0f, 0x0a13, 0x0a2a, 0x0a32, 0x0a35,
- 0x0a38, 0x0a59, 0x0a72, 0x0a85, 0x0a8f, 0x0a93, 0x0aaa, 0x0ab2, 0x0ab5, 0x0ae0,
- 0x0b05, 0x0b0f, 0x0b13, 0x0b2a, 0x0b32, 0x0b35, 0x0b5c, 0x0b5f, 0x0b85, 0x0b8e,
- 0x0b92, 0x0b99, 0x0b9e, 0x0ba3, 0x0ba8, 0x0bae, 0x0c05, 0x0c0e, 0x0c12, 0x0c2a,
- 0x0c58, 0x0c60, 0x0c85, 0x0c8e, 0x0c92, 0x0caa, 0x0cb5, 0x0ce0, 0x0cf1, 0x0d04,
- 0x0d0e, 0x0d12, 0x0d54, 0x0d5f, 0x0d7a, 0x0d85, 0x0d9a, 0x0db3, 0x0dc0, 0x0e01,
- 0x0e32, 0x0e40, 0x0e81, 0x0e86, 0x0e8c, 0x0ea7, 0x0eb2, 0x0ec0, 0x0edc, 0x0f40,
- 0x0f49, 0x0f88, 0x1000, 0x1050, 0x105a, 0x1065, 0x106e, 0x1075, 0x10a0, 0x10d0,
- 0x10fc, 0x11fc, 0x124a, 0x1250, 0x125a, 0x1260, 0x128a, 0x1290, 0x12b2, 0x12b8,
- 0x12c2, 0x12c8, 0x12d8, 0x1312, 0x1318, 0x1380, 0x13a0, 0x13f8, 0x1401, 0x1501,
- 0x1601, 0x166f, 0x1681, 0x16a0, 0x16ee, 0x1700, 0x170e, 0x1720, 0x1740, 0x1760,
- 0x176e, 0x1780, 0x1820, 0x1880, 0x18b0, 0x1900, 0x1950, 0x1970, 0x1980, 0x19b0,
- 0x1a00, 0x1a20, 0x1b05, 0x1b45, 0x1b83, 0x1bae, 0x1bba, 0x1c00, 0x1c4d, 0x1c5a,
- 0x1c80, 0x1c90, 0x1cbd, 0x1ce9, 0x1cee, 0x1cf5, 0x1d00, 0x1e00, 0x1f00, 0x1f18,
- 0x1f20, 0x1f48, 0x1f50, 0x1f5f, 0x1f80, 0x1fb6, 0x1fc2, 0x1fc6, 0x1fd0, 0x1fd6,
- 0x1fe0, 0x1ff2, 0x1ff6, 0x2090, 0x210a, 0x2118, 0x212a, 0x213c, 0x2145, 0x2160,
- 0x2c00, 0x2c30, 0x2c60, 0x2ceb, 0x2cf2, 0x2d00, 0x2d30, 0x2d80, 0x2da0, 0x2da8,
- 0x2db0, 0x2db8, 0x2dc0, 0x2dc8, 0x2dd0, 0x2dd8, 0x3005, 0x3021, 0x3031, 0x3038,
- 0x3041, 0x309b, 0x30a1, 0x30fc, 0x3105, 0x3131, 0x31a0, 0x31f0, 0x3400, 0x3500,
- 0x3600, 0x3700, 0x3800, 0x3900, 0x3a00, 0x3b00, 0x3c00, 0x3d00, 0x3e00, 0x3f00,
- 0x4000, 0x4100, 0x4200, 0x4300, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, 0x4900,
- 0x4a00, 0x4b00, 0x4c00, 0x4d00, 0x4e00, 0x4f00, 0x5000, 0x5100, 0x5200, 0x5300,
- 0x5400, 0x5500, 0x5600, 0x5700, 0x5800, 0x5900, 0x5a00, 0x5b00, 0x5c00, 0x5d00,
- 0x5e00, 0x5f00, 0x6000, 0x6100, 0x6200, 0x6300, 0x6400, 0x6500, 0x6600, 0x6700,
- 0x6800, 0x6900, 0x6a00, 0x6b00, 0x6c00, 0x6d00, 0x6e00, 0x6f00, 0x7000, 0x7100,
- 0x7200, 0x7300, 0x7400, 0x7500, 0x7600, 0x7700, 0x7800, 0x7900, 0x7a00, 0x7b00,
- 0x7c00, 0x7d00, 0x7e00, 0x7f00, 0x8000, 0x8100, 0x8200, 0x8300, 0x8400, 0x8500,
- 0x8600, 0x8700, 0x8800, 0x8900, 0x8a00, 0x8b00, 0x8c00, 0x8d00, 0x8e00, 0x8f00,
- 0x9000, 0x9100, 0x9200, 0x9300, 0x9400, 0x9500, 0x9600, 0x9700, 0x9800, 0x9900,
- 0x9a00, 0x9b00, 0x9c00, 0x9d00, 0x9e00, 0x9f00, 0xa000, 0xa100, 0xa200, 0xa300,
- 0xa400, 0xa4d0, 0xa500, 0xa600, 0xa610, 0xa62a, 0xa640, 0xa67f, 0xa6a0, 0xa717,
- 0xa722, 0xa78b, 0xa7c2, 0xa7f5, 0xa803, 0xa807, 0xa80c, 0xa840, 0xa882, 0xa8f2,
- 0xa8fd, 0xa90a, 0xa930, 0xa960, 0xa984, 0xa9e0, 0xa9e6, 0xa9fa, 0xaa00, 0xaa40,
- 0xaa44, 0xaa60, 0xaa7e, 0xaab5, 0xaab9, 0xaadb, 0xaae0, 0xaaf2, 0xab01, 0xab09,
- 0xab11, 0xab20, 0xab28, 0xab30, 0xab5c, 0xab70, 0xac00, 0xad00, 0xae00, 0xaf00,
- 0xb000, 0xb100, 0xb200, 0xb300, 0xb400, 0xb500, 0xb600, 0xb700, 0xb800, 0xb900,
- 0xba00, 0xbb00, 0xbc00, 0xbd00, 0xbe00, 0xbf00, 0xc000, 0xc100, 0xc200, 0xc300,
- 0xc400, 0xc500, 0xc600, 0xc700, 0xc800, 0xc900, 0xca00, 0xcb00, 0xcc00, 0xcd00,
- 0xce00, 0xcf00, 0xd000, 0xd100, 0xd200, 0xd300, 0xd400, 0xd500, 0xd600, 0xd700,
- 0xd7b0, 0xd7cb, 0xf900, 0xfa00, 0xfa70, 0xfb00, 0xfb13, 0xfb1f, 0xfb2a, 0xfb38,
- 0xfb40, 0xfb43, 0xfb46, 0xfbd3, 0xfcd3, 0xfd50, 0xfd92, 0xfdf0, 0xfe70, 0xfe76,
- 0xff21, 0xff41, 0xff66, 0xffc2, 0xffca, 0xffd2, 0xffda
+static const uint16_t lit_unicode_id_start_interval_starts[] JERRY_ATTR_CONST_DATA = {
+ 0x00c0, 0x00d8, 0x00f8, 0x01f8, 0x02c6, 0x02e0, 0x0370, 0x0376, 0x037a, 0x0388, 0x038e, 0x03a3, 0x03f7, 0x048a,
+ 0x0531, 0x0560, 0x05d0, 0x05ef, 0x0620, 0x066e, 0x0671, 0x06e5, 0x06ee, 0x06fa, 0x0712, 0x074d, 0x07ca, 0x07f4,
+ 0x0800, 0x0840, 0x0860, 0x08a0, 0x08b6, 0x0904, 0x0958, 0x0971, 0x0985, 0x098f, 0x0993, 0x09aa, 0x09b6, 0x09dc,
+ 0x09df, 0x09f0, 0x0a05, 0x0a0f, 0x0a13, 0x0a2a, 0x0a32, 0x0a35, 0x0a38, 0x0a59, 0x0a72, 0x0a85, 0x0a8f, 0x0a93,
+ 0x0aaa, 0x0ab2, 0x0ab5, 0x0ae0, 0x0b05, 0x0b0f, 0x0b13, 0x0b2a, 0x0b32, 0x0b35, 0x0b5c, 0x0b5f, 0x0b85, 0x0b8e,
+ 0x0b92, 0x0b99, 0x0b9e, 0x0ba3, 0x0ba8, 0x0bae, 0x0c05, 0x0c0e, 0x0c12, 0x0c2a, 0x0c58, 0x0c60, 0x0c85, 0x0c8e,
+ 0x0c92, 0x0caa, 0x0cb5, 0x0ce0, 0x0cf1, 0x0d04, 0x0d0e, 0x0d12, 0x0d54, 0x0d5f, 0x0d7a, 0x0d85, 0x0d9a, 0x0db3,
+ 0x0dc0, 0x0e01, 0x0e32, 0x0e40, 0x0e81, 0x0e86, 0x0e8c, 0x0ea7, 0x0eb2, 0x0ec0, 0x0edc, 0x0f40, 0x0f49, 0x0f88,
+ 0x1000, 0x1050, 0x105a, 0x1065, 0x106e, 0x1075, 0x10a0, 0x10d0, 0x10fc, 0x11fc, 0x124a, 0x1250, 0x125a, 0x1260,
+ 0x128a, 0x1290, 0x12b2, 0x12b8, 0x12c2, 0x12c8, 0x12d8, 0x1312, 0x1318, 0x1380, 0x13a0, 0x13f8, 0x1401, 0x1501,
+ 0x1601, 0x166f, 0x1681, 0x16a0, 0x16ee, 0x1700, 0x170e, 0x1720, 0x1740, 0x1760, 0x176e, 0x1780, 0x1820, 0x1880,
+ 0x18b0, 0x1900, 0x1950, 0x1970, 0x1980, 0x19b0, 0x1a00, 0x1a20, 0x1b05, 0x1b45, 0x1b83, 0x1bae, 0x1bba, 0x1c00,
+ 0x1c4d, 0x1c5a, 0x1c80, 0x1c90, 0x1cbd, 0x1ce9, 0x1cee, 0x1cf5, 0x1d00, 0x1e00, 0x1f00, 0x1f18, 0x1f20, 0x1f48,
+ 0x1f50, 0x1f5f, 0x1f80, 0x1fb6, 0x1fc2, 0x1fc6, 0x1fd0, 0x1fd6, 0x1fe0, 0x1ff2, 0x1ff6, 0x2090, 0x210a, 0x2118,
+ 0x212a, 0x213c, 0x2145, 0x2160, 0x2c00, 0x2c30, 0x2c60, 0x2ceb, 0x2cf2, 0x2d00, 0x2d30, 0x2d80, 0x2da0, 0x2da8,
+ 0x2db0, 0x2db8, 0x2dc0, 0x2dc8, 0x2dd0, 0x2dd8, 0x3005, 0x3021, 0x3031, 0x3038, 0x3041, 0x309b, 0x30a1, 0x30fc,
+ 0x3105, 0x3131, 0x31a0, 0x31f0, 0x3400, 0x3500, 0x3600, 0x3700, 0x3800, 0x3900, 0x3a00, 0x3b00, 0x3c00, 0x3d00,
+ 0x3e00, 0x3f00, 0x4000, 0x4100, 0x4200, 0x4300, 0x4400, 0x4500, 0x4600, 0x4700, 0x4800, 0x4900, 0x4a00, 0x4b00,
+ 0x4c00, 0x4d00, 0x4e00, 0x4f00, 0x5000, 0x5100, 0x5200, 0x5300, 0x5400, 0x5500, 0x5600, 0x5700, 0x5800, 0x5900,
+ 0x5a00, 0x5b00, 0x5c00, 0x5d00, 0x5e00, 0x5f00, 0x6000, 0x6100, 0x6200, 0x6300, 0x6400, 0x6500, 0x6600, 0x6700,
+ 0x6800, 0x6900, 0x6a00, 0x6b00, 0x6c00, 0x6d00, 0x6e00, 0x6f00, 0x7000, 0x7100, 0x7200, 0x7300, 0x7400, 0x7500,
+ 0x7600, 0x7700, 0x7800, 0x7900, 0x7a00, 0x7b00, 0x7c00, 0x7d00, 0x7e00, 0x7f00, 0x8000, 0x8100, 0x8200, 0x8300,
+ 0x8400, 0x8500, 0x8600, 0x8700, 0x8800, 0x8900, 0x8a00, 0x8b00, 0x8c00, 0x8d00, 0x8e00, 0x8f00, 0x9000, 0x9100,
+ 0x9200, 0x9300, 0x9400, 0x9500, 0x9600, 0x9700, 0x9800, 0x9900, 0x9a00, 0x9b00, 0x9c00, 0x9d00, 0x9e00, 0x9f00,
+ 0xa000, 0xa100, 0xa200, 0xa300, 0xa400, 0xa4d0, 0xa500, 0xa600, 0xa610, 0xa62a, 0xa640, 0xa67f, 0xa6a0, 0xa717,
+ 0xa722, 0xa78b, 0xa7c2, 0xa7f5, 0xa803, 0xa807, 0xa80c, 0xa840, 0xa882, 0xa8f2, 0xa8fd, 0xa90a, 0xa930, 0xa960,
+ 0xa984, 0xa9e0, 0xa9e6, 0xa9fa, 0xaa00, 0xaa40, 0xaa44, 0xaa60, 0xaa7e, 0xaab5, 0xaab9, 0xaadb, 0xaae0, 0xaaf2,
+ 0xab01, 0xab09, 0xab11, 0xab20, 0xab28, 0xab30, 0xab5c, 0xab70, 0xac00, 0xad00, 0xae00, 0xaf00, 0xb000, 0xb100,
+ 0xb200, 0xb300, 0xb400, 0xb500, 0xb600, 0xb700, 0xb800, 0xb900, 0xba00, 0xbb00, 0xbc00, 0xbd00, 0xbe00, 0xbf00,
+ 0xc000, 0xc100, 0xc200, 0xc300, 0xc400, 0xc500, 0xc600, 0xc700, 0xc800, 0xc900, 0xca00, 0xcb00, 0xcc00, 0xcd00,
+ 0xce00, 0xcf00, 0xd000, 0xd100, 0xd200, 0xd300, 0xd400, 0xd500, 0xd600, 0xd700, 0xd7b0, 0xd7cb, 0xf900, 0xfa00,
+ 0xfa70, 0xfb00, 0xfb13, 0xfb1f, 0xfb2a, 0xfb38, 0xfb40, 0xfb43, 0xfb46, 0xfbd3, 0xfcd3, 0xfd50, 0xfd92, 0xfdf0,
+ 0xfe70, 0xfe76, 0xff21, 0xff41, 0xff66, 0xffc2, 0xffca, 0xffd2, 0xffda
};
/**
* Character interval lengths for ID_Start.
*/
-static const uint8_t lit_unicode_id_start_interval_lengths[] JERRY_ATTR_CONST_DATA =
-{
- 0x0016, 0x001e, 0x00ff, 0x00c9, 0x000b, 0x0004, 0x0004, 0x0001, 0x0003, 0x0002,
- 0x0013, 0x0052, 0x008a, 0x00a5, 0x0025, 0x0028, 0x001a, 0x0003, 0x002a, 0x0001,
- 0x0062, 0x0001, 0x0001, 0x0002, 0x001d, 0x0058, 0x0020, 0x0001, 0x0015, 0x0018,
- 0x000a, 0x0014, 0x0011, 0x0035, 0x0009, 0x000f, 0x0007, 0x0001, 0x0015, 0x0006,
- 0x0003, 0x0001, 0x0002, 0x0001, 0x0005, 0x0001, 0x0015, 0x0006, 0x0001, 0x0001,
- 0x0001, 0x0003, 0x0002, 0x0008, 0x0002, 0x0015, 0x0006, 0x0001, 0x0004, 0x0001,
- 0x0007, 0x0001, 0x0015, 0x0006, 0x0001, 0x0004, 0x0001, 0x0002, 0x0005, 0x0002,
- 0x0003, 0x0001, 0x0001, 0x0001, 0x0002, 0x000b, 0x0007, 0x0002, 0x0016, 0x000f,
- 0x0002, 0x0001, 0x0007, 0x0002, 0x0016, 0x0009, 0x0004, 0x0001, 0x0001, 0x0008,
- 0x0002, 0x0028, 0x0002, 0x0002, 0x0005, 0x0011, 0x0017, 0x0008, 0x0006, 0x002f,
- 0x0001, 0x0006, 0x0001, 0x0004, 0x0017, 0x0009, 0x0001, 0x0004, 0x0003, 0x0007,
- 0x0023, 0x0004, 0x002a, 0x0005, 0x0003, 0x0001, 0x0002, 0x000c, 0x0025, 0x002a,
- 0x00ff, 0x004c, 0x0003, 0x0006, 0x0003, 0x0028, 0x0003, 0x0020, 0x0003, 0x0006,
- 0x0003, 0x000e, 0x0038, 0x0003, 0x0042, 0x000f, 0x0055, 0x0005, 0x00ff, 0x00ff,
- 0x006b, 0x0010, 0x0019, 0x004a, 0x000a, 0x000c, 0x0003, 0x0011, 0x0011, 0x000c,
- 0x0002, 0x0033, 0x0058, 0x0028, 0x0045, 0x001e, 0x001d, 0x0004, 0x002b, 0x0019,
- 0x0016, 0x0034, 0x002e, 0x0006, 0x001d, 0x0001, 0x002b, 0x0023, 0x0002, 0x0023,
- 0x0008, 0x002a, 0x0002, 0x0003, 0x0005, 0x0001, 0x00bf, 0x00ff, 0x0015, 0x0005,
- 0x0025, 0x0005, 0x0007, 0x001e, 0x0034, 0x0006, 0x0002, 0x0006, 0x0003, 0x0005,
- 0x000c, 0x0002, 0x0006, 0x000c, 0x0009, 0x0005, 0x000f, 0x0003, 0x0004, 0x0028,
- 0x002e, 0x002e, 0x0084, 0x0003, 0x0001, 0x0025, 0x0037, 0x0016, 0x0006, 0x0006,
- 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0002, 0x0008, 0x0004, 0x0004,
- 0x0055, 0x0004, 0x0059, 0x0003, 0x002a, 0x005d, 0x001f, 0x000f, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00bf, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00fc, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x008c, 0x002d, 0x00ff, 0x000c, 0x000f, 0x0001, 0x002e, 0x001e, 0x004f, 0x0008,
- 0x0066, 0x0034, 0x0008, 0x000c, 0x0002, 0x0003, 0x0016, 0x0033, 0x0031, 0x0005,
- 0x0001, 0x001b, 0x0016, 0x001c, 0x002e, 0x0004, 0x0009, 0x0004, 0x0028, 0x0002,
- 0x0007, 0x0016, 0x0031, 0x0001, 0x0004, 0x0002, 0x000a, 0x0002, 0x0005, 0x0005,
- 0x0005, 0x0006, 0x0006, 0x002a, 0x000d, 0x0072, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
- 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00a3,
- 0x0016, 0x0030, 0x00ff, 0x006d, 0x0069, 0x0006, 0x0004, 0x0009, 0x000c, 0x0004,
- 0x0001, 0x0001, 0x006b, 0x00ff, 0x006a, 0x003f, 0x0035, 0x000b, 0x0004, 0x0086,
- 0x0019, 0x0019, 0x0058, 0x0005, 0x0005, 0x0005, 0x0002
+static const uint8_t lit_unicode_id_start_interval_lengths[] JERRY_ATTR_CONST_DATA = {
+ 0x0016, 0x001e, 0x00ff, 0x00c9, 0x000b, 0x0004, 0x0004, 0x0001, 0x0003, 0x0002, 0x0013, 0x0052, 0x008a, 0x00a5,
+ 0x0025, 0x0028, 0x001a, 0x0003, 0x002a, 0x0001, 0x0062, 0x0001, 0x0001, 0x0002, 0x001d, 0x0058, 0x0020, 0x0001,
+ 0x0015, 0x0018, 0x000a, 0x0014, 0x0011, 0x0035, 0x0009, 0x000f, 0x0007, 0x0001, 0x0015, 0x0006, 0x0003, 0x0001,
+ 0x0002, 0x0001, 0x0005, 0x0001, 0x0015, 0x0006, 0x0001, 0x0001, 0x0001, 0x0003, 0x0002, 0x0008, 0x0002, 0x0015,
+ 0x0006, 0x0001, 0x0004, 0x0001, 0x0007, 0x0001, 0x0015, 0x0006, 0x0001, 0x0004, 0x0001, 0x0002, 0x0005, 0x0002,
+ 0x0003, 0x0001, 0x0001, 0x0001, 0x0002, 0x000b, 0x0007, 0x0002, 0x0016, 0x000f, 0x0002, 0x0001, 0x0007, 0x0002,
+ 0x0016, 0x0009, 0x0004, 0x0001, 0x0001, 0x0008, 0x0002, 0x0028, 0x0002, 0x0002, 0x0005, 0x0011, 0x0017, 0x0008,
+ 0x0006, 0x002f, 0x0001, 0x0006, 0x0001, 0x0004, 0x0017, 0x0009, 0x0001, 0x0004, 0x0003, 0x0007, 0x0023, 0x0004,
+ 0x002a, 0x0005, 0x0003, 0x0001, 0x0002, 0x000c, 0x0025, 0x002a, 0x00ff, 0x004c, 0x0003, 0x0006, 0x0003, 0x0028,
+ 0x0003, 0x0020, 0x0003, 0x0006, 0x0003, 0x000e, 0x0038, 0x0003, 0x0042, 0x000f, 0x0055, 0x0005, 0x00ff, 0x00ff,
+ 0x006b, 0x0010, 0x0019, 0x004a, 0x000a, 0x000c, 0x0003, 0x0011, 0x0011, 0x000c, 0x0002, 0x0033, 0x0058, 0x0028,
+ 0x0045, 0x001e, 0x001d, 0x0004, 0x002b, 0x0019, 0x0016, 0x0034, 0x002e, 0x0006, 0x001d, 0x0001, 0x002b, 0x0023,
+ 0x0002, 0x0023, 0x0008, 0x002a, 0x0002, 0x0003, 0x0005, 0x0001, 0x00bf, 0x00ff, 0x0015, 0x0005, 0x0025, 0x0005,
+ 0x0007, 0x001e, 0x0034, 0x0006, 0x0002, 0x0006, 0x0003, 0x0005, 0x000c, 0x0002, 0x0006, 0x000c, 0x0009, 0x0005,
+ 0x000f, 0x0003, 0x0004, 0x0028, 0x002e, 0x002e, 0x0084, 0x0003, 0x0001, 0x0025, 0x0037, 0x0016, 0x0006, 0x0006,
+ 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0006, 0x0002, 0x0008, 0x0004, 0x0004, 0x0055, 0x0004, 0x0059, 0x0003,
+ 0x002a, 0x005d, 0x001f, 0x000f, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
+ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
+ 0x00ff, 0x00bf, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
+ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
+ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
+ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
+ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
+ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00fc,
+ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x008c, 0x002d, 0x00ff, 0x000c, 0x000f, 0x0001, 0x002e, 0x001e, 0x004f, 0x0008,
+ 0x0066, 0x0034, 0x0008, 0x000c, 0x0002, 0x0003, 0x0016, 0x0033, 0x0031, 0x0005, 0x0001, 0x001b, 0x0016, 0x001c,
+ 0x002e, 0x0004, 0x0009, 0x0004, 0x0028, 0x0002, 0x0007, 0x0016, 0x0031, 0x0001, 0x0004, 0x0002, 0x000a, 0x0002,
+ 0x0005, 0x0005, 0x0005, 0x0006, 0x0006, 0x002a, 0x000d, 0x0072, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
+ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
+ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff,
+ 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00ff, 0x00a3, 0x0016, 0x0030, 0x00ff, 0x006d,
+ 0x0069, 0x0006, 0x0004, 0x0009, 0x000c, 0x0004, 0x0001, 0x0001, 0x006b, 0x00ff, 0x006a, 0x003f, 0x0035, 0x000b,
+ 0x0004, 0x0086, 0x0019, 0x0019, 0x0058, 0x0005, 0x0005, 0x0005, 0x0002
};
/**
* Non-interval characters for ID_Start.
*/
-static const uint16_t lit_unicode_id_start_chars[] JERRY_ATTR_CONST_DATA =
-{
- 0x00aa, 0x00b5, 0x00ba, 0x02ec, 0x02ee, 0x037f, 0x0386, 0x038c, 0x0559, 0x06d5,
- 0x06ff, 0x0710, 0x07b1, 0x07fa, 0x081a, 0x0824, 0x0828, 0x093d, 0x0950, 0x09b2,
- 0x09bd, 0x09ce, 0x09fc, 0x0a5e, 0x0abd, 0x0ad0, 0x0af9, 0x0b3d, 0x0b71, 0x0b83,
- 0x0b9c, 0x0bd0, 0x0c3d, 0x0c80, 0x0cbd, 0x0cde, 0x0d3d, 0x0d4e, 0x0dbd, 0x0e84,
- 0x0ea5, 0x0ebd, 0x0ec6, 0x0f00, 0x103f, 0x1061, 0x108e, 0x10c7, 0x10cd, 0x1258,
- 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1cfa, 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe,
- 0x2071, 0x207f, 0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2d27,
+static const uint16_t lit_unicode_id_start_chars[] JERRY_ATTR_CONST_DATA = {
+ 0x00aa, 0x00b5, 0x00ba, 0x02ec, 0x02ee, 0x037f, 0x0386, 0x038c, 0x0559, 0x06d5, 0x06ff, 0x0710, 0x07b1, 0x07fa,
+ 0x081a, 0x0824, 0x0828, 0x093d, 0x0950, 0x09b2, 0x09bd, 0x09ce, 0x09fc, 0x0a5e, 0x0abd, 0x0ad0, 0x0af9, 0x0b3d,
+ 0x0b71, 0x0b83, 0x0b9c, 0x0bd0, 0x0c3d, 0x0c80, 0x0cbd, 0x0cde, 0x0d3d, 0x0d4e, 0x0dbd, 0x0e84, 0x0ea5, 0x0ebd,
+ 0x0ec6, 0x0f00, 0x103f, 0x1061, 0x108e, 0x10c7, 0x10cd, 0x1258, 0x12c0, 0x17d7, 0x17dc, 0x18aa, 0x1aa7, 0x1cfa,
+ 0x1f59, 0x1f5b, 0x1f5d, 0x1fbe, 0x2071, 0x207f, 0x2102, 0x2107, 0x2115, 0x2124, 0x2126, 0x2128, 0x214e, 0x2d27,
0x2d2d, 0x2d6f, 0xa8fb, 0xa9cf, 0xaa7a, 0xaab1, 0xaac0, 0xaac2, 0xfb1d, 0xfb3e
};
/**
* Character interval starting points for ID_Continue.
*/
-static const uint16_t lit_unicode_id_continue_interval_starts[] JERRY_ATTR_CONST_DATA =
-{
- 0x0300, 0x0483, 0x0591, 0x05c1, 0x05c4, 0x0610, 0x064b, 0x06d6, 0x06df, 0x06e7,
- 0x06ea, 0x06f0, 0x0730, 0x07a6, 0x07c0, 0x07eb, 0x0816, 0x081b, 0x0825, 0x0829,
- 0x0859, 0x08d3, 0x08e3, 0x093a, 0x093e, 0x0951, 0x0962, 0x0966, 0x0981, 0x09be,
- 0x09c7, 0x09cb, 0x09e2, 0x09e6, 0x0a01, 0x0a3e, 0x0a47, 0x0a4b, 0x0a66, 0x0a81,
- 0x0abe, 0x0ac7, 0x0acb, 0x0ae2, 0x0ae6, 0x0afa, 0x0b01, 0x0b3e, 0x0b47, 0x0b4b,
- 0x0b55, 0x0b62, 0x0b66, 0x0bbe, 0x0bc6, 0x0bca, 0x0be6, 0x0c00, 0x0c3e, 0x0c46,
- 0x0c4a, 0x0c55, 0x0c62, 0x0c66, 0x0c81, 0x0cbe, 0x0cc6, 0x0cca, 0x0cd5, 0x0ce2,
- 0x0ce6, 0x0d00, 0x0d3b, 0x0d3e, 0x0d46, 0x0d4a, 0x0d62, 0x0d66, 0x0d81, 0x0dcf,
- 0x0dd8, 0x0de6, 0x0df2, 0x0e34, 0x0e47, 0x0e50, 0x0eb4, 0x0ec8, 0x0ed0, 0x0f18,
- 0x0f20, 0x0f3e, 0x0f71, 0x0f86, 0x0f8d, 0x0f99, 0x102b, 0x1040, 0x1056, 0x105e,
- 0x1062, 0x1067, 0x1071, 0x1082, 0x108f, 0x135d, 0x1369, 0x1712, 0x1732, 0x1752,
- 0x1772, 0x17b4, 0x17e0, 0x180b, 0x1810, 0x1920, 0x1930, 0x1946, 0x19d0, 0x1a17,
- 0x1a55, 0x1a60, 0x1a7f, 0x1a90, 0x1ab0, 0x1abf, 0x1b00, 0x1b34, 0x1b50, 0x1b6b,
- 0x1b80, 0x1ba1, 0x1bb0, 0x1be6, 0x1c24, 0x1c40, 0x1c50, 0x1cd0, 0x1cd4, 0x1cf7,
- 0x1dc0, 0x1dfb, 0x200c, 0x203f, 0x20d0, 0x20e5, 0x2cef, 0x2de0, 0x302a, 0x3099,
- 0xa620, 0xa674, 0xa69e, 0xa6f0, 0xa823, 0xa880, 0xa8b4, 0xa8d0, 0xa8e0, 0xa8ff,
- 0xa926, 0xa947, 0xa980, 0xa9b3, 0xa9d0, 0xa9f0, 0xaa29, 0xaa4c, 0xaa50, 0xaa7b,
- 0xaab2, 0xaab7, 0xaabe, 0xaaeb, 0xaaf5, 0xabe3, 0xabec, 0xabf0, 0xfe00, 0xfe20,
- 0xfe33, 0xfe4d, 0xff10
+static const uint16_t lit_unicode_id_continue_interval_starts[] JERRY_ATTR_CONST_DATA = {
+ 0x0300, 0x0483, 0x0591, 0x05c1, 0x05c4, 0x0610, 0x064b, 0x06d6, 0x06df, 0x06e7, 0x06ea, 0x06f0, 0x0730, 0x07a6,
+ 0x07c0, 0x07eb, 0x0816, 0x081b, 0x0825, 0x0829, 0x0859, 0x08d3, 0x08e3, 0x093a, 0x093e, 0x0951, 0x0962, 0x0966,
+ 0x0981, 0x09be, 0x09c7, 0x09cb, 0x09e2, 0x09e6, 0x0a01, 0x0a3e, 0x0a47, 0x0a4b, 0x0a66, 0x0a81, 0x0abe, 0x0ac7,
+ 0x0acb, 0x0ae2, 0x0ae6, 0x0afa, 0x0b01, 0x0b3e, 0x0b47, 0x0b4b, 0x0b55, 0x0b62, 0x0b66, 0x0bbe, 0x0bc6, 0x0bca,
+ 0x0be6, 0x0c00, 0x0c3e, 0x0c46, 0x0c4a, 0x0c55, 0x0c62, 0x0c66, 0x0c81, 0x0cbe, 0x0cc6, 0x0cca, 0x0cd5, 0x0ce2,
+ 0x0ce6, 0x0d00, 0x0d3b, 0x0d3e, 0x0d46, 0x0d4a, 0x0d62, 0x0d66, 0x0d81, 0x0dcf, 0x0dd8, 0x0de6, 0x0df2, 0x0e34,
+ 0x0e47, 0x0e50, 0x0eb4, 0x0ec8, 0x0ed0, 0x0f18, 0x0f20, 0x0f3e, 0x0f71, 0x0f86, 0x0f8d, 0x0f99, 0x102b, 0x1040,
+ 0x1056, 0x105e, 0x1062, 0x1067, 0x1071, 0x1082, 0x108f, 0x135d, 0x1369, 0x1712, 0x1732, 0x1752, 0x1772, 0x17b4,
+ 0x17e0, 0x180b, 0x1810, 0x1920, 0x1930, 0x1946, 0x19d0, 0x1a17, 0x1a55, 0x1a60, 0x1a7f, 0x1a90, 0x1ab0, 0x1abf,
+ 0x1b00, 0x1b34, 0x1b50, 0x1b6b, 0x1b80, 0x1ba1, 0x1bb0, 0x1be6, 0x1c24, 0x1c40, 0x1c50, 0x1cd0, 0x1cd4, 0x1cf7,
+ 0x1dc0, 0x1dfb, 0x200c, 0x203f, 0x20d0, 0x20e5, 0x2cef, 0x2de0, 0x302a, 0x3099, 0xa620, 0xa674, 0xa69e, 0xa6f0,
+ 0xa823, 0xa880, 0xa8b4, 0xa8d0, 0xa8e0, 0xa8ff, 0xa926, 0xa947, 0xa980, 0xa9b3, 0xa9d0, 0xa9f0, 0xaa29, 0xaa4c,
+ 0xaa50, 0xaa7b, 0xaab2, 0xaab7, 0xaabe, 0xaaeb, 0xaaf5, 0xabe3, 0xabec, 0xabf0, 0xfe00, 0xfe20, 0xfe33, 0xfe4d,
+ 0xff10
};
/**
* Character interval lengths for ID_Continue.
*/
-static const uint8_t lit_unicode_id_continue_interval_lengths[] JERRY_ATTR_CONST_DATA =
-{
- 0x006f, 0x0004, 0x002c, 0x0001, 0x0001, 0x000a, 0x001e, 0x0006, 0x0005, 0x0001,
- 0x0003, 0x0009, 0x001a, 0x000a, 0x0009, 0x0008, 0x0003, 0x0008, 0x0002, 0x0004,
- 0x0002, 0x000e, 0x0020, 0x0002, 0x0011, 0x0006, 0x0001, 0x0009, 0x0002, 0x0006,
- 0x0001, 0x0002, 0x0001, 0x0009, 0x0002, 0x0004, 0x0001, 0x0002, 0x000b, 0x0002,
- 0x0007, 0x0002, 0x0002, 0x0001, 0x0009, 0x0005, 0x0002, 0x0006, 0x0001, 0x0002,
- 0x0002, 0x0001, 0x0009, 0x0004, 0x0002, 0x0003, 0x0009, 0x0004, 0x0006, 0x0002,
- 0x0003, 0x0001, 0x0001, 0x0009, 0x0002, 0x0006, 0x0002, 0x0003, 0x0001, 0x0001,
- 0x0009, 0x0003, 0x0001, 0x0006, 0x0002, 0x0003, 0x0001, 0x0009, 0x0002, 0x0005,
- 0x0007, 0x0009, 0x0001, 0x0006, 0x0007, 0x0009, 0x0008, 0x0005, 0x0009, 0x0001,
- 0x0009, 0x0001, 0x0013, 0x0001, 0x000a, 0x0023, 0x0013, 0x0009, 0x0003, 0x0002,
- 0x0002, 0x0006, 0x0003, 0x000b, 0x000e, 0x0002, 0x0008, 0x0002, 0x0002, 0x0001,
- 0x0001, 0x001f, 0x0009, 0x0002, 0x0009, 0x000b, 0x000b, 0x0009, 0x000a, 0x0004,
- 0x0009, 0x001c, 0x000a, 0x0009, 0x000d, 0x0001, 0x0004, 0x0010, 0x0009, 0x0008,
- 0x0002, 0x000c, 0x0009, 0x000d, 0x0013, 0x0009, 0x0009, 0x0002, 0x0014, 0x0002,
- 0x0039, 0x0004, 0x0001, 0x0001, 0x000c, 0x000b, 0x0002, 0x001f, 0x0005, 0x0001,
- 0x0009, 0x0009, 0x0001, 0x0001, 0x0004, 0x0001, 0x0011, 0x0009, 0x0011, 0x000a,
- 0x0007, 0x000c, 0x0003, 0x000d, 0x0009, 0x0009, 0x000d, 0x0001, 0x0009, 0x0002,
- 0x0002, 0x0001, 0x0001, 0x0004, 0x0001, 0x0007, 0x0001, 0x0009, 0x000f, 0x000f,
- 0x0001, 0x0002, 0x0009
+static const uint8_t lit_unicode_id_continue_interval_lengths[] JERRY_ATTR_CONST_DATA = {
+ 0x006f, 0x0004, 0x002c, 0x0001, 0x0001, 0x000a, 0x001e, 0x0006, 0x0005, 0x0001, 0x0003, 0x0009, 0x001a, 0x000a,
+ 0x0009, 0x0008, 0x0003, 0x0008, 0x0002, 0x0004, 0x0002, 0x000e, 0x0020, 0x0002, 0x0011, 0x0006, 0x0001, 0x0009,
+ 0x0002, 0x0006, 0x0001, 0x0002, 0x0001, 0x0009, 0x0002, 0x0004, 0x0001, 0x0002, 0x000b, 0x0002, 0x0007, 0x0002,
+ 0x0002, 0x0001, 0x0009, 0x0005, 0x0002, 0x0006, 0x0001, 0x0002, 0x0002, 0x0001, 0x0009, 0x0004, 0x0002, 0x0003,
+ 0x0009, 0x0004, 0x0006, 0x0002, 0x0003, 0x0001, 0x0001, 0x0009, 0x0002, 0x0006, 0x0002, 0x0003, 0x0001, 0x0001,
+ 0x0009, 0x0003, 0x0001, 0x0006, 0x0002, 0x0003, 0x0001, 0x0009, 0x0002, 0x0005, 0x0007, 0x0009, 0x0001, 0x0006,
+ 0x0007, 0x0009, 0x0008, 0x0005, 0x0009, 0x0001, 0x0009, 0x0001, 0x0013, 0x0001, 0x000a, 0x0023, 0x0013, 0x0009,
+ 0x0003, 0x0002, 0x0002, 0x0006, 0x0003, 0x000b, 0x000e, 0x0002, 0x0008, 0x0002, 0x0002, 0x0001, 0x0001, 0x001f,
+ 0x0009, 0x0002, 0x0009, 0x000b, 0x000b, 0x0009, 0x000a, 0x0004, 0x0009, 0x001c, 0x000a, 0x0009, 0x000d, 0x0001,
+ 0x0004, 0x0010, 0x0009, 0x0008, 0x0002, 0x000c, 0x0009, 0x000d, 0x0013, 0x0009, 0x0009, 0x0002, 0x0014, 0x0002,
+ 0x0039, 0x0004, 0x0001, 0x0001, 0x000c, 0x000b, 0x0002, 0x001f, 0x0005, 0x0001, 0x0009, 0x0009, 0x0001, 0x0001,
+ 0x0004, 0x0001, 0x0011, 0x0009, 0x0011, 0x000a, 0x0007, 0x000c, 0x0003, 0x000d, 0x0009, 0x0009, 0x000d, 0x0001,
+ 0x0009, 0x0002, 0x0002, 0x0001, 0x0001, 0x0004, 0x0001, 0x0007, 0x0001, 0x0009, 0x000f, 0x000f, 0x0001, 0x0002,
+ 0x0009
};
/**
* Non-interval characters for ID_Continue.
*/
-static const uint16_t lit_unicode_id_continue_chars[] JERRY_ATTR_CONST_DATA =
-{
- 0x00b7, 0x0387, 0x05bf, 0x05c7, 0x0670, 0x0711, 0x07fd, 0x09bc, 0x09d7, 0x09fe,
- 0x0a3c, 0x0a51, 0x0a75, 0x0abc, 0x0b3c, 0x0b82, 0x0bd7, 0x0cbc, 0x0d57, 0x0dca,
- 0x0dd6, 0x0e31, 0x0eb1, 0x0f35, 0x0f37, 0x0f39, 0x0fc6, 0x17dd, 0x18a9, 0x1ced,
- 0x1cf4, 0x2054, 0x20e1, 0x2d7f, 0xa66f, 0xa802, 0xa806, 0xa80b, 0xa82c, 0xa9e5,
- 0xaa43, 0xaab0, 0xaac1, 0xfb1e, 0xff3f
+static const uint16_t lit_unicode_id_continue_chars[] JERRY_ATTR_CONST_DATA = {
+ 0x00b7, 0x0387, 0x05bf, 0x05c7, 0x0670, 0x0711, 0x07fd, 0x09bc, 0x09d7, 0x09fe, 0x0a3c, 0x0a51,
+ 0x0a75, 0x0abc, 0x0b3c, 0x0b82, 0x0bd7, 0x0cbc, 0x0d57, 0x0dca, 0x0dd6, 0x0e31, 0x0eb1, 0x0f35,
+ 0x0f37, 0x0f39, 0x0fc6, 0x17dd, 0x18a9, 0x1ced, 0x1cf4, 0x2054, 0x20e1, 0x2d7f, 0xa66f, 0xa802,
+ 0xa806, 0xa80b, 0xa82c, 0xa9e5, 0xaa43, 0xaab0, 0xaac1, 0xfb1e, 0xff3f
};
/**
* Character interval starting points for White_Space.
*/
-static const uint16_t lit_unicode_white_space_interval_starts[] JERRY_ATTR_CONST_DATA =
-{
- 0x2000
-};
+static const uint16_t lit_unicode_white_space_interval_starts[] JERRY_ATTR_CONST_DATA = { 0x2000 };
/**
* Character interval lengths for White_Space.
*/
-static const uint8_t lit_unicode_white_space_interval_lengths[] JERRY_ATTR_CONST_DATA =
-{
- 0x000a
-};
+static const uint8_t lit_unicode_white_space_interval_lengths[] JERRY_ATTR_CONST_DATA = { 0x000a };
/**
* Non-interval characters for White_Space.
*/
-static const uint16_t lit_unicode_white_space_chars[] JERRY_ATTR_CONST_DATA =
-{
- 0x00a0, 0x1680, 0x202f, 0x205f, 0x3000
-};
+static const uint16_t lit_unicode_white_space_chars[] JERRY_ATTR_CONST_DATA = { 0x00a0,
+ 0x1680,
+ 0x202f,
+ 0x205f,
+ 0x3000 };
diff --git a/jerry-core/parser/js/byte-code.c b/jerry-core/parser/js/byte-code.c
index 682d950c..9aee6903 100644
--- a/jerry-core/parser/js/byte-code.c
+++ b/jerry-core/parser/js/byte-code.c
@@ -16,11 +16,9 @@
#include "js-parser-internal.h"
/* These two checks only checks the compiler, they have no effect on the code. */
-JERRY_STATIC_ASSERT (sizeof (cbc_uint8_arguments_t) == 16,
- sizeof_cbc_uint8_arguments_t_must_be_16_byte_long);
+JERRY_STATIC_ASSERT (sizeof (cbc_uint8_arguments_t) == 16, sizeof_cbc_uint8_arguments_t_must_be_16_byte_long);
-JERRY_STATIC_ASSERT (sizeof (cbc_uint16_arguments_t) == 24,
- sizeof_cbc_uint16_arguments_t_must_be_24_byte_long);
+JERRY_STATIC_ASSERT (sizeof (cbc_uint16_arguments_t) == 24, sizeof_cbc_uint16_arguments_t_must_be_24_byte_long);
JERRY_STATIC_ASSERT (offsetof (cbc_uint8_arguments_t, script_value) == offsetof (cbc_uint16_arguments_t, script_value),
script_value_in_cbc_uint8_arguments_and_cbc_uint16_arguments_must_be_in_the_same_offset);
@@ -29,10 +27,8 @@ JERRY_STATIC_ASSERT (offsetof (cbc_uint8_arguments_t, script_value) == offsetof
* The reason of these two static asserts to notify the developer to increase the JERRY_SNAPSHOT_VERSION
* whenever new bytecodes are introduced or existing ones have been deleted.
*/
-JERRY_STATIC_ASSERT (CBC_END == 238,
- number_of_cbc_opcodes_changed);
-JERRY_STATIC_ASSERT (CBC_EXT_END == 148,
- number_of_cbc_ext_opcodes_changed);
+JERRY_STATIC_ASSERT (CBC_END == 238, number_of_cbc_opcodes_changed);
+JERRY_STATIC_ASSERT (CBC_EXT_END == 148, number_of_cbc_ext_opcodes_changed);
#if JERRY_PARSER || JERRY_PARSER_DUMP_BYTE_CODE
@@ -49,24 +45,17 @@ JERRY_STATIC_ASSERT (CBC_EXT_END == 148,
/**
* Compact bytecode definition
*/
-#define CBC_OPCODE(arg1, arg2, arg3, arg4) \
- ((arg2) | (((arg3) + CBC_STACK_ADJUST_BASE) << CBC_STACK_ADJUST_SHIFT)),
+#define CBC_OPCODE(arg1, arg2, arg3, arg4) ((arg2) | (((arg3) + CBC_STACK_ADJUST_BASE) << CBC_STACK_ADJUST_SHIFT)),
/**
* Flags of the opcodes.
*/
-const uint8_t cbc_flags[] JERRY_ATTR_CONST_DATA =
-{
- CBC_OPCODE_LIST
-};
+const uint8_t cbc_flags[] JERRY_ATTR_CONST_DATA = { CBC_OPCODE_LIST };
/**
* Flags of the extended opcodes.
*/
-const uint8_t cbc_ext_flags[] =
-{
- CBC_EXT_OPCODE_LIST
-};
+const uint8_t cbc_ext_flags[] = { CBC_EXT_OPCODE_LIST };
#undef CBC_OPCODE
@@ -79,18 +68,12 @@ const uint8_t cbc_ext_flags[] =
/**
* Names of the opcodes.
*/
-const char * const cbc_names[] =
-{
- CBC_OPCODE_LIST
-};
+const char* const cbc_names[] = { CBC_OPCODE_LIST };
/**
* Names of the extended opcodes.
*/
-const char * const cbc_ext_names[] =
-{
- CBC_EXT_OPCODE_LIST
-};
+const char* const cbc_ext_names[] = { CBC_EXT_OPCODE_LIST };
#undef CBC_OPCODE
diff --git a/jerry-core/parser/js/byte-code.h b/jerry-core/parser/js/byte-code.h
index 682052bb..09b0a78c 100644
--- a/jerry-core/parser/js/byte-code.h
+++ b/jerry-core/parser/js/byte-code.h
@@ -45,20 +45,19 @@
* three bits for each instruction between -4 and 3
* (except for call / construct opcodes).
*/
-#define CBC_STACK_ADJUST_BASE 4
-#define CBC_STACK_ADJUST_SHIFT 5
-#define CBC_STACK_ADJUST_VALUE(value) \
- (((value) >> CBC_STACK_ADJUST_SHIFT) - CBC_STACK_ADJUST_BASE)
+#define CBC_STACK_ADJUST_BASE 4
+#define CBC_STACK_ADJUST_SHIFT 5
+#define CBC_STACK_ADJUST_VALUE(value) (((value) >> CBC_STACK_ADJUST_SHIFT) - CBC_STACK_ADJUST_BASE)
-#define CBC_NO_FLAG 0x00u
-#define CBC_HAS_LITERAL_ARG 0x01u
-#define CBC_HAS_LITERAL_ARG2 0x02u
-#define CBC_HAS_BYTE_ARG 0x04u
-#define CBC_HAS_BRANCH_ARG 0x08u
+#define CBC_NO_FLAG 0x00u
+#define CBC_HAS_LITERAL_ARG 0x01u
+#define CBC_HAS_LITERAL_ARG2 0x02u
+#define CBC_HAS_BYTE_ARG 0x04u
+#define CBC_HAS_BRANCH_ARG 0x08u
/* These flags are shared */
-#define CBC_FORWARD_BRANCH_ARG 0x10u
-#define CBC_POP_STACK_BYTE_ARG 0x10u
+#define CBC_FORWARD_BRANCH_ARG 0x10u
+#define CBC_POP_STACK_BYTE_ARG 0x10u
#define CBC_ARG_TYPES (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2 | CBC_HAS_BYTE_ARG | CBC_HAS_BRANCH_ARG)
@@ -68,9 +67,9 @@
/**
* CBC_NO_RESULT_OPERATION for ext opcodes
*/
-#define CBC_EXT_NO_RESULT_OPERATION(opcode) \
+#define CBC_EXT_NO_RESULT_OPERATION(opcode) \
((opcode) >= PARSER_TO_EXT_OPCODE (CBC_EXT_ASSIGN_SUPER) \
- && (opcode) <= PARSER_TO_EXT_OPCODE (CBC_EXT_SPREAD_CALL_PROP_BLOCK))
+ && (opcode) <= PARSER_TO_EXT_OPCODE (CBC_EXT_SPREAD_CALL_PROP_BLOCK))
#else /* !JERRY_ESNEXT */
/**
* CBC_NO_RESULT_OPERATION for ext opcodes
@@ -79,46 +78,52 @@
#endif /* JERRY_ESNEXT */
/* Debug macro. */
-#define CBC_ARGS_EQ(op, types) \
- ((cbc_flags[op] & CBC_ARG_TYPES) == (types))
+#define CBC_ARGS_EQ(op, types) ((cbc_flags[op] & CBC_ARG_TYPES) == (types))
/* Debug macro. */
-#define CBC_SAME_ARGS(op1, op2) \
- (CBC_EXT_NO_RESULT_OPERATION (op1) ? ((cbc_ext_flags[PARSER_GET_EXT_OPCODE (op1)] & CBC_ARG_TYPES) \
- == (cbc_ext_flags[PARSER_GET_EXT_OPCODE (op2)] & CBC_ARG_TYPES)) \
+#define CBC_SAME_ARGS(op1, op2) \
+ (CBC_EXT_NO_RESULT_OPERATION (op1) ? ((cbc_ext_flags[PARSER_GET_EXT_OPCODE (op1)] & CBC_ARG_TYPES) \
+ == (cbc_ext_flags[PARSER_GET_EXT_OPCODE (op2)] & CBC_ARG_TYPES)) \
: ((cbc_flags[op1] & CBC_ARG_TYPES) == (cbc_flags[op2] & CBC_ARG_TYPES)))
-#define CBC_UNARY_OPERATION(name, group) \
- CBC_OPCODE (name, CBC_NO_FLAG, 0, \
- (VM_OC_ ## group) | VM_OC_GET_STACK | VM_OC_PUT_STACK) \
- CBC_OPCODE (name ## _LITERAL, CBC_HAS_LITERAL_ARG, 1, \
- (VM_OC_ ## group) | VM_OC_GET_LITERAL | VM_OC_PUT_STACK)
-
-#define CBC_BINARY_OPERATION(name, group) \
- CBC_OPCODE (name, CBC_NO_FLAG, -1, \
- (VM_OC_ ## group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \
- CBC_OPCODE (name ## _RIGHT_LITERAL, CBC_HAS_LITERAL_ARG, 0, \
- (VM_OC_ ## group) | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK) \
- CBC_OPCODE (name ## _TWO_LITERALS, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 1, \
- (VM_OC_ ## group) | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK)
-
-#define CBC_UNARY_LVALUE_OPERATION(name, group) \
- CBC_OPCODE (name, CBC_NO_FLAG, -2, \
- (VM_OC_PROP_ ## group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE) \
- CBC_OPCODE (name ## _PUSH_RESULT, CBC_NO_FLAG, -1, \
- (VM_OC_PROP_ ## group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \
- CBC_OPCODE (name ## _BLOCK, CBC_NO_FLAG, -2, \
- (VM_OC_PROP_ ## group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (name ## _IDENT, CBC_HAS_LITERAL_ARG, 0, \
- (VM_OC_ ## group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT) \
- CBC_OPCODE (name ## _IDENT_PUSH_RESULT, CBC_HAS_LITERAL_ARG, 1, \
- (VM_OC_ ## group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_STACK) \
- CBC_OPCODE (name ## _IDENT_BLOCK, CBC_HAS_LITERAL_ARG, 0, \
- (VM_OC_ ## group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK)
+#define CBC_UNARY_OPERATION(name, group) \
+ CBC_OPCODE (name, CBC_NO_FLAG, 0, (VM_OC_##group) | VM_OC_GET_STACK | VM_OC_PUT_STACK) \
+ CBC_OPCODE (name##_LITERAL, CBC_HAS_LITERAL_ARG, 1, (VM_OC_##group) | VM_OC_GET_LITERAL | VM_OC_PUT_STACK)
+
+#define CBC_BINARY_OPERATION(name, group) \
+ CBC_OPCODE (name, CBC_NO_FLAG, -1, (VM_OC_##group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \
+ CBC_OPCODE (name##_RIGHT_LITERAL, \
+ CBC_HAS_LITERAL_ARG, \
+ 0, \
+ (VM_OC_##group) | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (name##_TWO_LITERALS, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 1, \
+ (VM_OC_##group) | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK)
+
+#define CBC_UNARY_LVALUE_OPERATION(name, group) \
+ CBC_OPCODE (name, CBC_NO_FLAG, -2, (VM_OC_PROP_##group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE) \
+ CBC_OPCODE (name##_PUSH_RESULT, \
+ CBC_NO_FLAG, \
+ -1, \
+ (VM_OC_PROP_##group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \
+ CBC_OPCODE (name##_BLOCK, \
+ CBC_NO_FLAG, \
+ -2, \
+ (VM_OC_PROP_##group) | VM_OC_GET_STACK_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (name##_IDENT, CBC_HAS_LITERAL_ARG, 0, (VM_OC_##group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT) \
+ CBC_OPCODE (name##_IDENT_PUSH_RESULT, \
+ CBC_HAS_LITERAL_ARG, \
+ 1, \
+ (VM_OC_##group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_STACK) \
+ CBC_OPCODE (name##_IDENT_BLOCK, \
+ CBC_HAS_LITERAL_ARG, \
+ 0, \
+ (VM_OC_##group) | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK)
#define CBC_UNARY_LVALUE_WITH_IDENT 3
-#define CBC_BINARY_WITH_LITERAL 1
+#define CBC_BINARY_WITH_LITERAL 1
#define CBC_BINARY_WITH_TWO_LITERALS 2
/**
@@ -161,30 +166,21 @@
* The offset bytes are encoded in higher to lower order.
*/
-#define CBC_FORWARD_BRANCH(name, stack, vm_oc) \
- CBC_OPCODE (name, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, \
- (vm_oc) | VM_OC_GET_BRANCH) \
- CBC_OPCODE (name ## _2, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, \
- (vm_oc) | VM_OC_GET_BRANCH) \
- CBC_OPCODE (name ## _3, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, \
- (vm_oc) | VM_OC_GET_BRANCH)
+#define CBC_FORWARD_BRANCH(name, stack, vm_oc) \
+ CBC_OPCODE (name, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH) \
+ CBC_OPCODE (name##_2, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH) \
+ CBC_OPCODE (name##_3, CBC_HAS_BRANCH_ARG | CBC_FORWARD_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH)
-#define CBC_BACKWARD_BRANCH(name, stack, vm_oc) \
- CBC_OPCODE (name, CBC_HAS_BRANCH_ARG, stack, \
- (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH) \
- CBC_OPCODE (name ## _2, CBC_HAS_BRANCH_ARG, stack, \
- (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH) \
- CBC_OPCODE (name ## _3, CBC_HAS_BRANCH_ARG, stack, \
- (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH)
+#define CBC_BACKWARD_BRANCH(name, stack, vm_oc) \
+ CBC_OPCODE (name, CBC_HAS_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH) \
+ CBC_OPCODE (name##_2, CBC_HAS_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH) \
+ CBC_OPCODE (name##_3, CBC_HAS_BRANCH_ARG, stack, (vm_oc) | VM_OC_GET_BRANCH | VM_OC_BACKWARD_BRANCH)
-#define CBC_BRANCH_OFFSET_LENGTH(opcode) \
- ((opcode) & 0x3)
+#define CBC_BRANCH_OFFSET_LENGTH(opcode) ((opcode) &0x3)
-#define CBC_BRANCH_IS_BACKWARD(flags) \
- (!((flags) & CBC_FORWARD_BRANCH_ARG))
+#define CBC_BRANCH_IS_BACKWARD(flags) (!((flags) &CBC_FORWARD_BRANCH_ARG))
-#define CBC_BRANCH_IS_FORWARD(flags) \
- ((flags) & CBC_FORWARD_BRANCH_ARG)
+#define CBC_BRANCH_IS_FORWARD(flags) ((flags) &CBC_FORWARD_BRANCH_ARG)
/* Stack consumption of opcodes with context. */
@@ -218,600 +214,491 @@
/**
* Opcode definitions.
*/
-#define CBC_OPCODE_LIST \
- /* Branch opcodes first. Some other opcodes are mixed. */ \
- CBC_OPCODE (CBC_EXT_OPCODE, CBC_NO_FLAG, 0, \
- VM_OC_NONE) \
- CBC_FORWARD_BRANCH (CBC_JUMP_FORWARD, 0, \
- VM_OC_JUMP) \
- CBC_OPCODE (CBC_POP, CBC_NO_FLAG, -1, \
- VM_OC_POP) \
- CBC_BACKWARD_BRANCH (CBC_JUMP_BACKWARD, 0, \
- VM_OC_JUMP) \
- CBC_OPCODE (CBC_POP_BLOCK, CBC_NO_FLAG, -1, \
- VM_OC_POP_BLOCK | VM_OC_PUT_BLOCK) \
- CBC_FORWARD_BRANCH (CBC_BRANCH_IF_TRUE_FORWARD, -1, \
- VM_OC_BRANCH_IF_TRUE) \
- CBC_OPCODE (CBC_THROW, CBC_NO_FLAG, -1, \
- VM_OC_THROW | VM_OC_GET_STACK) \
- CBC_BACKWARD_BRANCH (CBC_BRANCH_IF_TRUE_BACKWARD, -1, \
- VM_OC_BRANCH_IF_TRUE) \
- CBC_OPCODE (CBC_CONTEXT_END, CBC_NO_FLAG, 0, \
- VM_OC_CONTEXT_END) \
- CBC_FORWARD_BRANCH (CBC_BRANCH_IF_FALSE_FORWARD, -1, \
- VM_OC_BRANCH_IF_FALSE) \
- CBC_OPCODE (CBC_CREATE_OBJECT, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_OBJECT | VM_OC_PUT_STACK) \
- CBC_BACKWARD_BRANCH (CBC_BRANCH_IF_FALSE_BACKWARD, -1, \
- VM_OC_BRANCH_IF_FALSE) \
- CBC_OPCODE (CBC_SET_PROPERTY, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_SET_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_LITERAL) \
- CBC_FORWARD_BRANCH (CBC_JUMP_FORWARD_EXIT_CONTEXT, 0, \
- VM_OC_JUMP_AND_EXIT_CONTEXT) \
- CBC_OPCODE (CBC_CREATE_ARRAY, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_ARRAY | VM_OC_PUT_STACK) \
- CBC_FORWARD_BRANCH (CBC_BRANCH_IF_LOGICAL_TRUE, -1, \
- VM_OC_BRANCH_IF_LOGICAL_TRUE) \
- CBC_OPCODE (CBC_ARRAY_APPEND, CBC_HAS_POP_STACK_BYTE_ARG, 0, \
- VM_OC_APPEND_ARRAY) \
- CBC_FORWARD_BRANCH (CBC_BRANCH_IF_LOGICAL_FALSE, -1, \
- VM_OC_BRANCH_IF_LOGICAL_FALSE) \
- CBC_OPCODE (CBC_PUSH_ELISION, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_ELISON | VM_OC_PUT_STACK) \
- CBC_FORWARD_BRANCH (CBC_BRANCH_IF_STRICT_EQUAL, -1, \
- VM_OC_BRANCH_IF_STRICT_EQUAL) \
- CBC_OPCODE (CBC_PUSH_NULL, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_NULL | VM_OC_PUT_STACK) \
- CBC_FORWARD_BRANCH (CBC_BLOCK_CREATE_CONTEXT, \
- PARSER_BLOCK_CONTEXT_STACK_ALLOCATION, VM_OC_BLOCK_CREATE_CONTEXT) \
- \
- /* Basic opcodes. Note: These 4 opcodes must me in this order */ \
- CBC_OPCODE (CBC_PUSH_LITERAL, CBC_HAS_LITERAL_ARG, 1, \
- VM_OC_PUSH | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_PUSH_TWO_LITERALS, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 2, \
- VM_OC_PUSH_TWO | VM_OC_GET_LITERAL_LITERAL) \
- CBC_OPCODE (CBC_PUSH_THIS_LITERAL, CBC_HAS_LITERAL_ARG, 2, \
- VM_OC_PUSH_TWO | VM_OC_GET_THIS_LITERAL) \
- CBC_OPCODE (CBC_PUSH_THREE_LITERALS, CBC_HAS_LITERAL_ARG2, 3, \
- VM_OC_PUSH_THREE | VM_OC_GET_LITERAL_LITERAL) \
- CBC_OPCODE (CBC_PUSH_UNDEFINED, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_UNDEFINED | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_TRUE, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_TRUE | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_FALSE, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_FALSE | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_THIS, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_THIS | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_NUMBER_0, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_0 | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_NUMBER_POS_BYTE, CBC_HAS_BYTE_ARG, 1, \
- VM_OC_PUSH_POS_BYTE | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_NUMBER_NEG_BYTE, CBC_HAS_BYTE_ARG, 1, \
- VM_OC_PUSH_NEG_BYTE | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_LITERAL_PUSH_NUMBER_0, CBC_HAS_LITERAL_ARG, 2, \
- VM_OC_PUSH_LIT_0 | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE, CBC_HAS_LITERAL_ARG | CBC_HAS_BYTE_ARG, 2, \
- VM_OC_PUSH_LIT_POS_BYTE | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE, CBC_HAS_LITERAL_ARG | CBC_HAS_BYTE_ARG, 2, \
- VM_OC_PUSH_LIT_NEG_BYTE | VM_OC_GET_LITERAL) \
- /* Note: These 4 opcodes must me in this order */ \
- CBC_OPCODE (CBC_PUSH_PROP, CBC_NO_FLAG, -1, \
- VM_OC_PROP_GET | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_PROP_LITERAL, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_PROP_GET | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_PROP_LITERAL_LITERAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 1, \
- VM_OC_PROP_GET | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_PROP_THIS_LITERAL, CBC_HAS_LITERAL_ARG, 1, \
- VM_OC_PROP_GET | VM_OC_GET_THIS_LITERAL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_IDENT_REFERENCE, CBC_HAS_LITERAL_ARG, 3, \
- VM_OC_IDENT_REFERENCE | VM_OC_PUT_STACK) \
- /* Note: These 4 opcodes must me in this order */ \
- CBC_OPCODE (CBC_PUSH_PROP_REFERENCE, CBC_NO_FLAG, 1, \
- VM_OC_PROP_REFERENCE | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_PROP_LITERAL_REFERENCE, CBC_HAS_LITERAL_ARG, 2, \
- VM_OC_PROP_REFERENCE | VM_OC_GET_LITERAL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_PROP_LITERAL_LITERAL_REFERENCE, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 3, \
- VM_OC_PROP_REFERENCE | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_PUSH_PROP_THIS_LITERAL_REFERENCE, CBC_HAS_LITERAL_ARG, 3, \
- VM_OC_PROP_REFERENCE | VM_OC_GET_THIS_LITERAL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_NEW, CBC_HAS_POP_STACK_BYTE_ARG, 0, \
- VM_OC_NEW | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_NEW0, CBC_NO_FLAG, 0, \
- VM_OC_NEW | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_NEW1, CBC_NO_FLAG, -1, \
- VM_OC_NEW | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EVAL, CBC_NO_FLAG, 0, \
- VM_OC_EVAL) \
- CBC_OPCODE (CBC_CHECK_VAR, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_CHECK_VAR) \
- CBC_OPCODE (CBC_CHECK_LET, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_CHECK_LET) \
- CBC_OPCODE (CBC_CREATE_VAR, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_CREATE_BINDING) \
- CBC_OPCODE (CBC_CREATE_LET, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_CREATE_BINDING) \
- CBC_OPCODE (CBC_CREATE_CONST, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_CREATE_BINDING) \
- CBC_OPCODE (CBC_CREATE_LOCAL, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_CREATE_BINDING) \
- CBC_OPCODE (CBC_INIT_ARG_OR_CATCH, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_INIT_BINDING) \
- CBC_OPCODE (CBC_INIT_LET, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_INIT_BINDING) \
- CBC_OPCODE (CBC_INIT_CONST, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_INIT_BINDING) \
- CBC_OPCODE (CBC_INIT_ARG_OR_FUNC, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_INIT_ARG_OR_FUNC) \
- CBC_OPCODE (CBC_CREATE_VAR_EVAL, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_VAR_EVAL) \
- CBC_OPCODE (CBC_CREATE_VAR_FUNC_EVAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_VAR_EVAL) \
- CBC_OPCODE (CBC_SET_VAR_FUNC, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT) \
- CBC_OPCODE (CBC_SET_BYTECODE_PTR, CBC_NO_FLAG, 0, \
- VM_OC_SET_BYTECODE_PTR) \
- CBC_OPCODE (CBC_RETURN, CBC_NO_FLAG, -1, \
- VM_OC_RETURN | VM_OC_GET_STACK) \
- CBC_OPCODE (CBC_RETURN_FUNCTION_END, CBC_NO_FLAG, 0, \
- VM_OC_RETURN_FUNCTION_END) \
- CBC_OPCODE (CBC_RETURN_WITH_LITERAL, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_RETURN | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_SET_LITERAL_PROPERTY, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_SET_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL) \
- CBC_OPCODE (CBC_COPY_TO_GLOBAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_COPY_TO_GLOBAL | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_BREAKPOINT_ENABLED, CBC_NO_FLAG, 0, \
- VM_OC_BREAKPOINT_ENABLED) \
- CBC_OPCODE (CBC_BREAKPOINT_DISABLED, CBC_NO_FLAG, 0, \
- VM_OC_BREAKPOINT_DISABLED) \
- \
- /* Unary opcodes. */ \
- CBC_UNARY_OPERATION (CBC_PLUS, \
- PLUS) \
- CBC_UNARY_OPERATION (CBC_NEGATE, \
- MINUS) \
- CBC_UNARY_OPERATION (CBC_LOGICAL_NOT, \
- NOT) \
- CBC_UNARY_OPERATION (CBC_BIT_NOT, \
- BIT_NOT) \
- CBC_UNARY_OPERATION (CBC_VOID, \
- VOID) \
- CBC_OPCODE (CBC_TYPEOF, CBC_NO_FLAG, 0, \
- VM_OC_TYPEOF | VM_OC_GET_STACK | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_TYPEOF_IDENT, CBC_HAS_LITERAL_ARG, 1, \
- VM_OC_TYPEOF_IDENT | VM_OC_PUT_STACK) \
- \
- /* Binary opcodes. */ \
- CBC_BINARY_OPERATION (CBC_BIT_OR, \
- BIT_OR) \
- CBC_BINARY_OPERATION (CBC_BIT_XOR, \
- BIT_XOR) \
- CBC_BINARY_OPERATION (CBC_BIT_AND, \
- BIT_AND) \
- CBC_BINARY_OPERATION (CBC_EQUAL, \
- EQUAL) \
- CBC_BINARY_OPERATION (CBC_NOT_EQUAL, \
- NOT_EQUAL) \
- CBC_BINARY_OPERATION (CBC_STRICT_EQUAL, \
- STRICT_EQUAL) \
- CBC_BINARY_OPERATION (CBC_STRICT_NOT_EQUAL, \
- STRICT_NOT_EQUAL) \
- CBC_BINARY_OPERATION (CBC_LESS, \
- LESS) \
- CBC_BINARY_OPERATION (CBC_GREATER, \
- GREATER) \
- CBC_BINARY_OPERATION (CBC_LESS_EQUAL, \
- LESS_EQUAL) \
- CBC_BINARY_OPERATION (CBC_GREATER_EQUAL, \
- GREATER_EQUAL) \
- CBC_BINARY_OPERATION (CBC_IN, \
- IN) \
- CBC_BINARY_OPERATION (CBC_INSTANCEOF, \
- INSTANCEOF) \
- CBC_BINARY_OPERATION (CBC_LEFT_SHIFT, \
- LEFT_SHIFT) \
- CBC_BINARY_OPERATION (CBC_RIGHT_SHIFT, \
- RIGHT_SHIFT) \
- CBC_BINARY_OPERATION (CBC_UNS_RIGHT_SHIFT, \
- UNS_RIGHT_SHIFT) \
- CBC_BINARY_OPERATION (CBC_ADD, \
- ADD) \
- CBC_BINARY_OPERATION (CBC_SUBTRACT, \
- SUB) \
- CBC_BINARY_OPERATION (CBC_MULTIPLY, \
- MUL) \
- CBC_BINARY_OPERATION (CBC_DIVIDE, \
- DIV) \
- CBC_BINARY_OPERATION (CBC_MODULO, \
- MOD) \
- CBC_BINARY_OPERATION (CBC_EXPONENTIATION, \
- EXP) \
- \
- /* Unary lvalue opcodes. */ \
- CBC_OPCODE (CBC_DELETE_PUSH_RESULT, CBC_NO_FLAG, -1, \
- VM_OC_PROP_DELETE | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_DELETE_IDENT_PUSH_RESULT, CBC_HAS_LITERAL_ARG, 1, \
- VM_OC_DELETE | VM_OC_PUT_STACK) \
- CBC_UNARY_LVALUE_OPERATION (CBC_PRE_INCR, \
- PRE_INCR) \
- CBC_UNARY_LVALUE_OPERATION (CBC_PRE_DECR, \
- PRE_DECR) \
- CBC_UNARY_LVALUE_OPERATION (CBC_POST_INCR, \
- POST_INCR) \
- CBC_UNARY_LVALUE_OPERATION (CBC_POST_DECR, \
- POST_DECR) \
- \
- /* Call opcodes. */ \
- CBC_OPCODE (CBC_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, \
- VM_OC_CALL) \
- CBC_OPCODE (CBC_CALL_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, 0, \
- VM_OC_CALL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, \
- VM_OC_CALL | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_CALL_PROP, CBC_HAS_POP_STACK_BYTE_ARG, -3, \
- VM_OC_CALL) \
- CBC_OPCODE (CBC_CALL_PROP_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, -2, \
- VM_OC_CALL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_CALL_PROP_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -3, \
- VM_OC_CALL | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_CALL0, CBC_NO_FLAG, -1, \
- VM_OC_CALL) \
- CBC_OPCODE (CBC_CALL0_PUSH_RESULT, CBC_NO_FLAG, 0, \
- VM_OC_CALL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_CALL0_BLOCK, CBC_NO_FLAG, -1, \
- VM_OC_CALL | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_CALL0_PROP, CBC_NO_FLAG, -3, \
- VM_OC_CALL) \
- CBC_OPCODE (CBC_CALL0_PROP_PUSH_RESULT, CBC_NO_FLAG, -2, \
- VM_OC_CALL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_CALL0_PROP_BLOCK, CBC_NO_FLAG, -3, \
- VM_OC_CALL | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_CALL1, CBC_NO_FLAG, -2, \
- VM_OC_CALL) \
- CBC_OPCODE (CBC_CALL1_PUSH_RESULT, CBC_NO_FLAG, -1, \
- VM_OC_CALL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_CALL1_BLOCK, CBC_NO_FLAG, -2, \
- VM_OC_CALL | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_CALL1_PROP, CBC_NO_FLAG, -4, \
- VM_OC_CALL) \
- CBC_OPCODE (CBC_CALL1_PROP_PUSH_RESULT, CBC_NO_FLAG, -3, \
- VM_OC_CALL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_CALL1_PROP_BLOCK, CBC_NO_FLAG, -4, \
- VM_OC_CALL | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_CALL2, CBC_NO_FLAG, -3, \
- VM_OC_CALL) \
- CBC_OPCODE (CBC_CALL2_PUSH_RESULT, CBC_NO_FLAG, -2, \
- VM_OC_CALL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_CALL2_BLOCK, CBC_NO_FLAG, -3, \
- VM_OC_CALL | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_CALL2_PROP, CBC_NO_FLAG, -4, \
- VM_OC_CALL) \
- CBC_OPCODE (CBC_CALL2_PROP_PUSH_RESULT, CBC_NO_FLAG, -3, \
- VM_OC_CALL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_CALL2_PROP_BLOCK, CBC_NO_FLAG, -4, \
- VM_OC_CALL | VM_OC_PUT_BLOCK) \
- \
- /* Binary assignment opcodes. */ \
- CBC_OPCODE (CBC_ASSIGN, CBC_NO_FLAG, -3, \
- VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE) \
- CBC_OPCODE (CBC_ASSIGN_PUSH_RESULT, CBC_NO_FLAG, -2, \
- VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_ASSIGN_BLOCK, CBC_NO_FLAG, -3, \
- VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_ASSIGN_SET_IDENT, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT) \
- CBC_OPCODE (CBC_ASSIGN_SET_IDENT_PUSH_RESULT, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_ASSIGN_SET_IDENT_BLOCK, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT) \
- CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT_PUSH_RESULT, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 1, \
- VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT_BLOCK, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL, CBC_HAS_LITERAL_ARG, -2, \
- VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE) \
- CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL_PUSH_RESULT, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL_BLOCK, CBC_HAS_LITERAL_ARG, -2, \
- VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE) \
- CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL_PUSH_RESULT, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL_BLOCK, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_MOV_IDENT, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_MOV_IDENT | VM_OC_GET_STACK | VM_OC_PUT_IDENT) \
- CBC_OPCODE (CBC_ASSIGN_LET_CONST, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_ASSIGN_LET_CONST | VM_OC_GET_STACK) \
- CBC_OPCODE (CBC_ASSIGN_LET_CONST_LITERAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_ASSIGN_LET_CONST | VM_OC_GET_LITERAL) \
- \
- /* Last opcode (not a real opcode). */ \
- CBC_OPCODE (CBC_END, CBC_NO_FLAG, 0, \
- VM_OC_NONE)
+#define CBC_OPCODE_LIST \
+ /* Branch opcodes first. Some other opcodes are mixed. */ \
+ CBC_OPCODE (CBC_EXT_OPCODE, CBC_NO_FLAG, 0, VM_OC_NONE) \
+ CBC_FORWARD_BRANCH (CBC_JUMP_FORWARD, 0, VM_OC_JUMP) \
+ CBC_OPCODE (CBC_POP, CBC_NO_FLAG, -1, VM_OC_POP) \
+ CBC_BACKWARD_BRANCH (CBC_JUMP_BACKWARD, 0, VM_OC_JUMP) \
+ CBC_OPCODE (CBC_POP_BLOCK, CBC_NO_FLAG, -1, VM_OC_POP_BLOCK | VM_OC_PUT_BLOCK) \
+ CBC_FORWARD_BRANCH (CBC_BRANCH_IF_TRUE_FORWARD, -1, VM_OC_BRANCH_IF_TRUE) \
+ CBC_OPCODE (CBC_THROW, CBC_NO_FLAG, -1, VM_OC_THROW | VM_OC_GET_STACK) \
+ CBC_BACKWARD_BRANCH (CBC_BRANCH_IF_TRUE_BACKWARD, -1, VM_OC_BRANCH_IF_TRUE) \
+ CBC_OPCODE (CBC_CONTEXT_END, CBC_NO_FLAG, 0, VM_OC_CONTEXT_END) \
+ CBC_FORWARD_BRANCH (CBC_BRANCH_IF_FALSE_FORWARD, -1, VM_OC_BRANCH_IF_FALSE) \
+ CBC_OPCODE (CBC_CREATE_OBJECT, CBC_NO_FLAG, 1, VM_OC_PUSH_OBJECT | VM_OC_PUT_STACK) \
+ CBC_BACKWARD_BRANCH (CBC_BRANCH_IF_FALSE_BACKWARD, -1, VM_OC_BRANCH_IF_FALSE) \
+ CBC_OPCODE (CBC_SET_PROPERTY, \
+ CBC_HAS_LITERAL_ARG, \
+ -1, \
+ VM_OC_SET_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_LITERAL) \
+ CBC_FORWARD_BRANCH (CBC_JUMP_FORWARD_EXIT_CONTEXT, 0, VM_OC_JUMP_AND_EXIT_CONTEXT) \
+ CBC_OPCODE (CBC_CREATE_ARRAY, CBC_NO_FLAG, 1, VM_OC_PUSH_ARRAY | VM_OC_PUT_STACK) \
+ CBC_FORWARD_BRANCH (CBC_BRANCH_IF_LOGICAL_TRUE, -1, VM_OC_BRANCH_IF_LOGICAL_TRUE) \
+ CBC_OPCODE (CBC_ARRAY_APPEND, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_APPEND_ARRAY) \
+ CBC_FORWARD_BRANCH (CBC_BRANCH_IF_LOGICAL_FALSE, -1, VM_OC_BRANCH_IF_LOGICAL_FALSE) \
+ CBC_OPCODE (CBC_PUSH_ELISION, CBC_NO_FLAG, 1, VM_OC_PUSH_ELISON | VM_OC_PUT_STACK) \
+ CBC_FORWARD_BRANCH (CBC_BRANCH_IF_STRICT_EQUAL, -1, VM_OC_BRANCH_IF_STRICT_EQUAL) \
+ CBC_OPCODE (CBC_PUSH_NULL, CBC_NO_FLAG, 1, VM_OC_PUSH_NULL | VM_OC_PUT_STACK) \
+ CBC_FORWARD_BRANCH (CBC_BLOCK_CREATE_CONTEXT, PARSER_BLOCK_CONTEXT_STACK_ALLOCATION, VM_OC_BLOCK_CREATE_CONTEXT) \
+ \
+ /* Basic opcodes. Note: These 4 opcodes must me in this order */ \
+ CBC_OPCODE (CBC_PUSH_LITERAL, CBC_HAS_LITERAL_ARG, 1, VM_OC_PUSH | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_PUSH_TWO_LITERALS, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 2, \
+ VM_OC_PUSH_TWO | VM_OC_GET_LITERAL_LITERAL) \
+ CBC_OPCODE (CBC_PUSH_THIS_LITERAL, CBC_HAS_LITERAL_ARG, 2, VM_OC_PUSH_TWO | VM_OC_GET_THIS_LITERAL) \
+ CBC_OPCODE (CBC_PUSH_THREE_LITERALS, CBC_HAS_LITERAL_ARG2, 3, VM_OC_PUSH_THREE | VM_OC_GET_LITERAL_LITERAL) \
+ CBC_OPCODE (CBC_PUSH_UNDEFINED, CBC_NO_FLAG, 1, VM_OC_PUSH_UNDEFINED | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_TRUE, CBC_NO_FLAG, 1, VM_OC_PUSH_TRUE | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_FALSE, CBC_NO_FLAG, 1, VM_OC_PUSH_FALSE | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_THIS, CBC_NO_FLAG, 1, VM_OC_PUSH_THIS | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_NUMBER_0, CBC_NO_FLAG, 1, VM_OC_PUSH_0 | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_NUMBER_POS_BYTE, CBC_HAS_BYTE_ARG, 1, VM_OC_PUSH_POS_BYTE | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_NUMBER_NEG_BYTE, CBC_HAS_BYTE_ARG, 1, VM_OC_PUSH_NEG_BYTE | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_LITERAL_PUSH_NUMBER_0, CBC_HAS_LITERAL_ARG, 2, VM_OC_PUSH_LIT_0 | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_BYTE_ARG, \
+ 2, \
+ VM_OC_PUSH_LIT_POS_BYTE | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_BYTE_ARG, \
+ 2, \
+ VM_OC_PUSH_LIT_NEG_BYTE | VM_OC_GET_LITERAL) \
+ /* Note: These 4 opcodes must me in this order */ \
+ CBC_OPCODE (CBC_PUSH_PROP, CBC_NO_FLAG, -1, VM_OC_PROP_GET | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_PROP_LITERAL, \
+ CBC_HAS_LITERAL_ARG, \
+ 0, \
+ VM_OC_PROP_GET | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_PROP_LITERAL_LITERAL, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 1, \
+ VM_OC_PROP_GET | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_PROP_THIS_LITERAL, \
+ CBC_HAS_LITERAL_ARG, \
+ 1, \
+ VM_OC_PROP_GET | VM_OC_GET_THIS_LITERAL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_IDENT_REFERENCE, CBC_HAS_LITERAL_ARG, 3, VM_OC_IDENT_REFERENCE | VM_OC_PUT_STACK) \
+ /* Note: These 4 opcodes must me in this order */ \
+ CBC_OPCODE (CBC_PUSH_PROP_REFERENCE, CBC_NO_FLAG, 1, VM_OC_PROP_REFERENCE | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_PROP_LITERAL_REFERENCE, \
+ CBC_HAS_LITERAL_ARG, \
+ 2, \
+ VM_OC_PROP_REFERENCE | VM_OC_GET_LITERAL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_PROP_LITERAL_LITERAL_REFERENCE, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 3, \
+ VM_OC_PROP_REFERENCE | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_PUSH_PROP_THIS_LITERAL_REFERENCE, \
+ CBC_HAS_LITERAL_ARG, \
+ 3, \
+ VM_OC_PROP_REFERENCE | VM_OC_GET_THIS_LITERAL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_NEW, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_NEW | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_NEW0, CBC_NO_FLAG, 0, VM_OC_NEW | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_NEW1, CBC_NO_FLAG, -1, VM_OC_NEW | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EVAL, CBC_NO_FLAG, 0, VM_OC_EVAL) \
+ CBC_OPCODE (CBC_CHECK_VAR, CBC_HAS_LITERAL_ARG, 0, VM_OC_CHECK_VAR) \
+ CBC_OPCODE (CBC_CHECK_LET, CBC_HAS_LITERAL_ARG, 0, VM_OC_CHECK_LET) \
+ CBC_OPCODE (CBC_CREATE_VAR, CBC_HAS_LITERAL_ARG, 0, VM_OC_CREATE_BINDING) \
+ CBC_OPCODE (CBC_CREATE_LET, CBC_HAS_LITERAL_ARG, 0, VM_OC_CREATE_BINDING) \
+ CBC_OPCODE (CBC_CREATE_CONST, CBC_HAS_LITERAL_ARG, 0, VM_OC_CREATE_BINDING) \
+ CBC_OPCODE (CBC_CREATE_LOCAL, CBC_HAS_LITERAL_ARG, 0, VM_OC_CREATE_BINDING) \
+ CBC_OPCODE (CBC_INIT_ARG_OR_CATCH, CBC_HAS_LITERAL_ARG, -1, VM_OC_INIT_BINDING) \
+ CBC_OPCODE (CBC_INIT_LET, CBC_HAS_LITERAL_ARG, -1, VM_OC_INIT_BINDING) \
+ CBC_OPCODE (CBC_INIT_CONST, CBC_HAS_LITERAL_ARG, -1, VM_OC_INIT_BINDING) \
+ CBC_OPCODE (CBC_INIT_ARG_OR_FUNC, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, VM_OC_INIT_ARG_OR_FUNC) \
+ CBC_OPCODE (CBC_CREATE_VAR_EVAL, CBC_HAS_LITERAL_ARG, 0, VM_OC_VAR_EVAL) \
+ CBC_OPCODE (CBC_CREATE_VAR_FUNC_EVAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, VM_OC_VAR_EVAL) \
+ CBC_OPCODE (CBC_SET_VAR_FUNC, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 0, \
+ VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT) \
+ CBC_OPCODE (CBC_SET_BYTECODE_PTR, CBC_NO_FLAG, 0, VM_OC_SET_BYTECODE_PTR) \
+ CBC_OPCODE (CBC_RETURN, CBC_NO_FLAG, -1, VM_OC_RETURN | VM_OC_GET_STACK) \
+ CBC_OPCODE (CBC_RETURN_FUNCTION_END, CBC_NO_FLAG, 0, VM_OC_RETURN_FUNCTION_END) \
+ CBC_OPCODE (CBC_RETURN_WITH_LITERAL, CBC_HAS_LITERAL_ARG, 0, VM_OC_RETURN | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_SET_LITERAL_PROPERTY, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 0, \
+ VM_OC_SET_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL) \
+ CBC_OPCODE (CBC_COPY_TO_GLOBAL, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 0, \
+ VM_OC_COPY_TO_GLOBAL | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_BREAKPOINT_ENABLED, CBC_NO_FLAG, 0, VM_OC_BREAKPOINT_ENABLED) \
+ CBC_OPCODE (CBC_BREAKPOINT_DISABLED, CBC_NO_FLAG, 0, VM_OC_BREAKPOINT_DISABLED) \
+ \
+ /* Unary opcodes. */ \
+ CBC_UNARY_OPERATION (CBC_PLUS, PLUS) \
+ CBC_UNARY_OPERATION (CBC_NEGATE, MINUS) \
+ CBC_UNARY_OPERATION (CBC_LOGICAL_NOT, NOT) \
+ CBC_UNARY_OPERATION (CBC_BIT_NOT, BIT_NOT) \
+ CBC_UNARY_OPERATION (CBC_VOID, VOID) \
+ CBC_OPCODE (CBC_TYPEOF, CBC_NO_FLAG, 0, VM_OC_TYPEOF | VM_OC_GET_STACK | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_TYPEOF_IDENT, CBC_HAS_LITERAL_ARG, 1, VM_OC_TYPEOF_IDENT | VM_OC_PUT_STACK) \
+ \
+ /* Binary opcodes. */ \
+ CBC_BINARY_OPERATION (CBC_BIT_OR, BIT_OR) \
+ CBC_BINARY_OPERATION (CBC_BIT_XOR, BIT_XOR) \
+ CBC_BINARY_OPERATION (CBC_BIT_AND, BIT_AND) \
+ CBC_BINARY_OPERATION (CBC_EQUAL, EQUAL) \
+ CBC_BINARY_OPERATION (CBC_NOT_EQUAL, NOT_EQUAL) \
+ CBC_BINARY_OPERATION (CBC_STRICT_EQUAL, STRICT_EQUAL) \
+ CBC_BINARY_OPERATION (CBC_STRICT_NOT_EQUAL, STRICT_NOT_EQUAL) \
+ CBC_BINARY_OPERATION (CBC_LESS, LESS) \
+ CBC_BINARY_OPERATION (CBC_GREATER, GREATER) \
+ CBC_BINARY_OPERATION (CBC_LESS_EQUAL, LESS_EQUAL) \
+ CBC_BINARY_OPERATION (CBC_GREATER_EQUAL, GREATER_EQUAL) \
+ CBC_BINARY_OPERATION (CBC_IN, IN) \
+ CBC_BINARY_OPERATION (CBC_INSTANCEOF, INSTANCEOF) \
+ CBC_BINARY_OPERATION (CBC_LEFT_SHIFT, LEFT_SHIFT) \
+ CBC_BINARY_OPERATION (CBC_RIGHT_SHIFT, RIGHT_SHIFT) \
+ CBC_BINARY_OPERATION (CBC_UNS_RIGHT_SHIFT, UNS_RIGHT_SHIFT) \
+ CBC_BINARY_OPERATION (CBC_ADD, ADD) \
+ CBC_BINARY_OPERATION (CBC_SUBTRACT, SUB) \
+ CBC_BINARY_OPERATION (CBC_MULTIPLY, MUL) \
+ CBC_BINARY_OPERATION (CBC_DIVIDE, DIV) \
+ CBC_BINARY_OPERATION (CBC_MODULO, MOD) \
+ CBC_BINARY_OPERATION (CBC_EXPONENTIATION, EXP) \
+ \
+ /* Unary lvalue opcodes. */ \
+ CBC_OPCODE (CBC_DELETE_PUSH_RESULT, CBC_NO_FLAG, -1, VM_OC_PROP_DELETE | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_DELETE_IDENT_PUSH_RESULT, CBC_HAS_LITERAL_ARG, 1, VM_OC_DELETE | VM_OC_PUT_STACK) \
+ CBC_UNARY_LVALUE_OPERATION (CBC_PRE_INCR, PRE_INCR) \
+ CBC_UNARY_LVALUE_OPERATION (CBC_PRE_DECR, PRE_DECR) \
+ CBC_UNARY_LVALUE_OPERATION (CBC_POST_INCR, POST_INCR) \
+ CBC_UNARY_LVALUE_OPERATION (CBC_POST_DECR, POST_DECR) \
+ \
+ /* Call opcodes. */ \
+ CBC_OPCODE (CBC_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_CALL) \
+ CBC_OPCODE (CBC_CALL_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_CALL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_CALL | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_CALL_PROP, CBC_HAS_POP_STACK_BYTE_ARG, -3, VM_OC_CALL) \
+ CBC_OPCODE (CBC_CALL_PROP_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, -2, VM_OC_CALL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_CALL_PROP_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -3, VM_OC_CALL | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_CALL0, CBC_NO_FLAG, -1, VM_OC_CALL) \
+ CBC_OPCODE (CBC_CALL0_PUSH_RESULT, CBC_NO_FLAG, 0, VM_OC_CALL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_CALL0_BLOCK, CBC_NO_FLAG, -1, VM_OC_CALL | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_CALL0_PROP, CBC_NO_FLAG, -3, VM_OC_CALL) \
+ CBC_OPCODE (CBC_CALL0_PROP_PUSH_RESULT, CBC_NO_FLAG, -2, VM_OC_CALL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_CALL0_PROP_BLOCK, CBC_NO_FLAG, -3, VM_OC_CALL | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_CALL1, CBC_NO_FLAG, -2, VM_OC_CALL) \
+ CBC_OPCODE (CBC_CALL1_PUSH_RESULT, CBC_NO_FLAG, -1, VM_OC_CALL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_CALL1_BLOCK, CBC_NO_FLAG, -2, VM_OC_CALL | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_CALL1_PROP, CBC_NO_FLAG, -4, VM_OC_CALL) \
+ CBC_OPCODE (CBC_CALL1_PROP_PUSH_RESULT, CBC_NO_FLAG, -3, VM_OC_CALL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_CALL1_PROP_BLOCK, CBC_NO_FLAG, -4, VM_OC_CALL | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_CALL2, CBC_NO_FLAG, -3, VM_OC_CALL) \
+ CBC_OPCODE (CBC_CALL2_PUSH_RESULT, CBC_NO_FLAG, -2, VM_OC_CALL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_CALL2_BLOCK, CBC_NO_FLAG, -3, VM_OC_CALL | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_CALL2_PROP, CBC_NO_FLAG, -4, VM_OC_CALL) \
+ CBC_OPCODE (CBC_CALL2_PROP_PUSH_RESULT, CBC_NO_FLAG, -3, VM_OC_CALL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_CALL2_PROP_BLOCK, CBC_NO_FLAG, -4, VM_OC_CALL | VM_OC_PUT_BLOCK) \
+ \
+ /* Binary assignment opcodes. */ \
+ CBC_OPCODE (CBC_ASSIGN, CBC_NO_FLAG, -3, VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE) \
+ CBC_OPCODE (CBC_ASSIGN_PUSH_RESULT, \
+ CBC_NO_FLAG, \
+ -2, \
+ VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_ASSIGN_BLOCK, \
+ CBC_NO_FLAG, \
+ -3, \
+ VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_ASSIGN_SET_IDENT, CBC_HAS_LITERAL_ARG, -1, VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT) \
+ CBC_OPCODE (CBC_ASSIGN_SET_IDENT_PUSH_RESULT, \
+ CBC_HAS_LITERAL_ARG, \
+ 0, \
+ VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_ASSIGN_SET_IDENT_BLOCK, \
+ CBC_HAS_LITERAL_ARG, \
+ -1, \
+ VM_OC_ASSIGN | VM_OC_GET_STACK | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 0, \
+ VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT) \
+ CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT_PUSH_RESULT, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 1, \
+ VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_ASSIGN_LITERAL_SET_IDENT_BLOCK, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 0, \
+ VM_OC_ASSIGN | VM_OC_GET_LITERAL | VM_OC_PUT_IDENT | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL, \
+ CBC_HAS_LITERAL_ARG, \
+ -2, \
+ VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE) \
+ CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL_PUSH_RESULT, \
+ CBC_HAS_LITERAL_ARG, \
+ -1, \
+ VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_ASSIGN_PROP_LITERAL_BLOCK, \
+ CBC_HAS_LITERAL_ARG, \
+ -2, \
+ VM_OC_ASSIGN_PROP | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL, \
+ CBC_HAS_LITERAL_ARG, \
+ -1, \
+ VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE) \
+ CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL_PUSH_RESULT, \
+ CBC_HAS_LITERAL_ARG, \
+ 0, \
+ VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_ASSIGN_PROP_THIS_LITERAL_BLOCK, \
+ CBC_HAS_LITERAL_ARG, \
+ -1, \
+ VM_OC_ASSIGN_PROP_THIS | VM_OC_GET_LITERAL | VM_OC_PUT_REFERENCE | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_MOV_IDENT, CBC_HAS_LITERAL_ARG, -1, VM_OC_MOV_IDENT | VM_OC_GET_STACK | VM_OC_PUT_IDENT) \
+ CBC_OPCODE (CBC_ASSIGN_LET_CONST, CBC_HAS_LITERAL_ARG, -1, VM_OC_ASSIGN_LET_CONST | VM_OC_GET_STACK) \
+ CBC_OPCODE (CBC_ASSIGN_LET_CONST_LITERAL, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 0, \
+ VM_OC_ASSIGN_LET_CONST | VM_OC_GET_LITERAL) \
+ \
+ /* Last opcode (not a real opcode). */ \
+ CBC_OPCODE (CBC_END, CBC_NO_FLAG, 0, VM_OC_NONE)
/* All EXT branches are statement block end
* marks, so they are always forward branches. */
-#define CBC_EXT_OPCODE_LIST \
- /* Branch opcodes first. Some other opcodes are mixed. */ \
- CBC_OPCODE (CBC_EXT_NOP, CBC_NO_FLAG, 0, \
- VM_OC_NONE) \
- CBC_FORWARD_BRANCH (CBC_EXT_WITH_CREATE_CONTEXT, \
- -1 + PARSER_WITH_CONTEXT_STACK_ALLOCATION, VM_OC_WITH) \
- CBC_OPCODE (CBC_EXT_FOR_IN_GET_NEXT, CBC_NO_FLAG, 1, \
- VM_OC_FOR_IN_GET_NEXT | VM_OC_PUT_STACK) \
- CBC_FORWARD_BRANCH (CBC_EXT_FOR_IN_INIT, \
- -1 + PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION, VM_OC_FOR_IN_INIT) \
- CBC_OPCODE (CBC_EXT_SET_GETTER, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_SET_GETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL) \
- CBC_BACKWARD_BRANCH (CBC_EXT_BRANCH_IF_FOR_IN_HAS_NEXT, 0, \
- VM_OC_FOR_IN_HAS_NEXT) \
- CBC_OPCODE (CBC_EXT_FOR_OF_GET_NEXT, CBC_NO_FLAG, 1, \
- VM_OC_FOR_OF_GET_NEXT | VM_OC_PUT_STACK) \
- CBC_FORWARD_BRANCH (CBC_EXT_FOR_OF_INIT, \
- -1 + PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION, VM_OC_FOR_OF_INIT) \
- CBC_OPCODE (CBC_EXT_PUSH_NAMED_FUNC_EXPRESSION, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 1, \
- VM_OC_PUSH_NAMED_FUNC_EXPR | VM_OC_GET_LITERAL_LITERAL) \
- CBC_BACKWARD_BRANCH (CBC_EXT_BRANCH_IF_FOR_OF_HAS_NEXT, 0, \
- VM_OC_FOR_OF_HAS_NEXT) \
- CBC_OPCODE (CBC_EXT_CLONE_CONTEXT, CBC_NO_FLAG, 0, \
- VM_OC_CLONE_CONTEXT) \
- CBC_FORWARD_BRANCH (CBC_EXT_FOR_AWAIT_OF_INIT, \
- -1 + PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION, VM_OC_FOR_AWAIT_OF_INIT) \
- CBC_OPCODE (CBC_EXT_CLONE_FULL_CONTEXT, CBC_NO_FLAG, 0, \
- VM_OC_CLONE_CONTEXT) \
- CBC_BACKWARD_BRANCH (CBC_EXT_BRANCH_IF_FOR_AWAIT_OF_HAS_NEXT, 0, \
- VM_OC_FOR_AWAIT_OF_HAS_NEXT) \
- CBC_OPCODE (CBC_EXT_SET_SETTER, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_SET_SETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL) \
- CBC_FORWARD_BRANCH (CBC_EXT_TRY_CREATE_CONTEXT, PARSER_TRY_CONTEXT_STACK_ALLOCATION, \
- VM_OC_TRY) \
- CBC_OPCODE (CBC_EXT_TRY_CREATE_ENV, CBC_NO_FLAG, 0, \
- VM_OC_BLOCK_CREATE_CONTEXT) \
- CBC_FORWARD_BRANCH (CBC_EXT_CATCH, 1, \
- VM_OC_CATCH) \
- CBC_OPCODE (CBC_EXT_RESOLVE_BASE, CBC_NO_FLAG, 0, \
- VM_OC_RESOLVE_BASE_FOR_CALL) \
- CBC_FORWARD_BRANCH (CBC_EXT_FINALLY, PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION, \
- VM_OC_FINALLY) \
- CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_PROP, CBC_NO_FLAG, 0, \
- VM_OC_INITIALIZER_PUSH_PROP) \
- CBC_FORWARD_BRANCH (CBC_EXT_DEFAULT_INITIALIZER, -1, \
- VM_OC_DEFAULT_INITIALIZER) \
- CBC_OPCODE (CBC_EXT_ERROR, CBC_NO_FLAG, 0, \
- VM_OC_ERROR) \
- CBC_FORWARD_BRANCH (CBC_EXT_BRANCH_IF_NULLISH, -1, \
- VM_OC_BRANCH_IF_NULLISH) \
- \
- /* Basic opcodes. */ \
- CBC_OPCODE (CBC_EXT_CREATE_ARGUMENTS, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_CREATE_ARGUMENTS) \
- CBC_OPCODE (CBC_EXT_CREATE_VAR_EVAL, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_EXT_VAR_EVAL) \
- CBC_OPCODE (CBC_EXT_CREATE_VAR_FUNC_EVAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_EXT_VAR_EVAL) \
- CBC_OPCODE (CBC_EXT_COPY_FROM_ARG, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_COPY_FROM_ARG) \
- CBC_OPCODE (CBC_EXT_PUSH_REST_OBJECT, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_REST_OBJECT) \
- CBC_OPCODE (CBC_EXT_MODULE_IMPORT, CBC_NO_FLAG, 0, \
- VM_OC_MODULE_IMPORT) \
- CBC_OPCODE (CBC_EXT_MODULE_IMPORT_META, CBC_NO_FLAG, 1, \
- VM_OC_MODULE_IMPORT_META) \
- CBC_OPCODE (CBC_EXT_STRING_CONCAT, CBC_NO_FLAG, -1, \
- VM_OC_STRING_CONCAT | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_STRING_CONCAT_RIGHT_LITERAL, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_STRING_CONCAT | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_STRING_CONCAT_TWO_LITERALS, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 1, \
- VM_OC_STRING_CONCAT | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_GET_TAGGED_TEMPLATE_LITERAL, CBC_HAS_BYTE_ARG, 1, \
- VM_OC_GET_TEMPLATE_OBJECT | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_THROW_REFERENCE_ERROR, CBC_NO_FLAG, 1, \
- VM_OC_THROW_REFERENCE_ERROR) \
- CBC_OPCODE (CBC_EXT_THROW_ASSIGN_CONST_ERROR, CBC_NO_FLAG, 0, \
- VM_OC_THROW_CONST_ERROR) \
- CBC_OPCODE (CBC_EXT_REQUIRE_OBJECT_COERCIBLE, CBC_NO_FLAG, 0, \
- VM_OC_REQUIRE_OBJECT_COERCIBLE) \
- CBC_OPCODE (CBC_EXT_COPY_DATA_PROPERTIES, CBC_NO_FLAG, -1, \
- VM_OC_COPY_DATA_PROPERTIES) \
- CBC_OPCODE (CBC_EXT_SET_FUNCTION_NAME, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_SET_FUNCTION_NAME | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_EXT_SET_CLASS_NAME, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_SET_FUNCTION_NAME) \
- CBC_OPCODE (CBC_EXT_SET_COMPUTED_FUNCTION_NAME, CBC_NO_FLAG, 0, \
- VM_OC_SET_FUNCTION_NAME) \
- CBC_OPCODE (CBC_EXT_SET_COMPUTED_GETTER_NAME, CBC_NO_FLAG, 0, \
- VM_OC_SET_FUNCTION_NAME) \
- CBC_OPCODE (CBC_EXT_SET_COMPUTED_SETTER_NAME, CBC_NO_FLAG, 0, \
- VM_OC_SET_FUNCTION_NAME) \
- \
- /* Computed / class property related opcodes. */ \
- CBC_OPCODE (CBC_EXT_SET_COMPUTED_PROPERTY, CBC_NO_FLAG, -2, \
- VM_OC_SET_COMPUTED_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_STACK) \
- CBC_OPCODE (CBC_EXT_SET_COMPUTED_PROPERTY_LITERAL, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_SET_COMPUTED_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_LITERAL) \
- CBC_OPCODE (CBC_EXT_SET_COMPUTED_GETTER, CBC_NO_FLAG, -2, \
- VM_OC_SET_GETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_STACK) \
- CBC_OPCODE (CBC_EXT_SET_COMPUTED_SETTER, CBC_NO_FLAG, -2, \
- VM_OC_SET_SETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_STACK) \
- CBC_OPCODE (CBC_EXT_SET_STATIC_PROPERTY, CBC_HAS_LITERAL_ARG, -1, \
- VM_OC_SET_PROPERTY | VM_OC_GET_STACK_LITERAL) \
- CBC_OPCODE (CBC_EXT_SET_STATIC_PROPERTY_LITERAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_SET_PROPERTY | VM_OC_GET_LITERAL_LITERAL) \
- CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_PROPERTY, CBC_NO_FLAG, -2, \
- VM_OC_SET_COMPUTED_PROPERTY | VM_OC_GET_STACK_STACK) \
- CBC_OPCODE (CBC_EXT_SET_STATIC_GETTER, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_SET_GETTER | VM_OC_GET_LITERAL_LITERAL) \
- CBC_OPCODE (CBC_EXT_SET_STATIC_SETTER, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, \
- VM_OC_SET_SETTER | VM_OC_GET_LITERAL_LITERAL) \
- CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_GETTER, CBC_NO_FLAG, -2, \
- VM_OC_SET_GETTER | VM_OC_GET_STACK_STACK) \
- CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_SETTER, CBC_NO_FLAG, -2, \
- VM_OC_SET_SETTER | VM_OC_GET_STACK_STACK) \
- CBC_OPCODE (CBC_EXT_SET__PROTO__, CBC_NO_FLAG, -1, \
- VM_OC_SET__PROTO__ | VM_OC_GET_STACK) \
- CBC_OPCODE (CBC_EXT_PUSH_STATIC_FIELD_FUNC, CBC_HAS_LITERAL_ARG, 1, \
- VM_OC_PUSH_STATIC_FIELD_FUNC | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_EXT_PUSH_STATIC_COMPUTED_FIELD_FUNC, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_PUSH_STATIC_FIELD_FUNC | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_EXT_ADD_COMPUTED_FIELD, CBC_NO_FLAG, -1, \
- VM_OC_ADD_COMPUTED_FIELD | VM_OC_GET_STACK) \
- CBC_OPCODE (CBC_EXT_ADD_STATIC_COMPUTED_FIELD, CBC_NO_FLAG, -1, \
- VM_OC_ADD_COMPUTED_FIELD | VM_OC_GET_STACK) \
- \
- /* Class related opcodes. */ \
- CBC_OPCODE (CBC_EXT_PUSH_NAMED_CLASS_ENV, CBC_HAS_LITERAL_ARG, 1, \
- VM_OC_PUSH_CLASS_ENVIRONMENT) \
- CBC_OPCODE (CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_IMPLICIT_CTOR | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR_HERITAGE, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_IMPLICIT_CTOR | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_INIT_CLASS, CBC_NO_FLAG, 0, \
- VM_OC_INIT_CLASS | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_FINALIZE_NAMED_CLASS, CBC_HAS_LITERAL_ARG, -2, \
- VM_OC_FINALIZE_CLASS) \
- CBC_OPCODE (CBC_EXT_FINALIZE_ANONYMOUS_CLASS, CBC_NO_FLAG, -2, \
- VM_OC_FINALIZE_CLASS) \
- CBC_OPCODE (CBC_EXT_SET_FIELD_INIT, CBC_HAS_LITERAL_ARG, 0, \
- VM_OC_SET_FIELD_INIT | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_EXT_RUN_FIELD_INIT, CBC_NO_FLAG, 0, \
- VM_OC_RUN_FIELD_INIT) \
- CBC_OPCODE (CBC_EXT_RUN_STATIC_FIELD_INIT, CBC_NO_FLAG, -1, \
- VM_OC_RUN_STATIC_FIELD_INIT) \
- CBC_OPCODE (CBC_EXT_SET_NEXT_COMPUTED_FIELD, CBC_NO_FLAG, -1, \
- VM_OC_SET_NEXT_COMPUTED_FIELD | VM_OC_PUT_REFERENCE) \
- CBC_OPCODE (CBC_EXT_PUSH_SUPER, CBC_NO_FLAG, 1, \
- VM_OC_NONE) \
- CBC_OPCODE (CBC_EXT_PUSH_SUPER_CONSTRUCTOR, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_SUPER_CONSTRUCTOR) \
- CBC_OPCODE (CBC_EXT_PUSH_SUPER_PROP, CBC_NO_FLAG, 0, \
- VM_OC_SUPER_REFERENCE | VM_OC_GET_STACK) \
- CBC_OPCODE (CBC_EXT_SUPER_PROP_REFERENCE, CBC_NO_FLAG, 2, \
- VM_OC_SUPER_REFERENCE | VM_OC_GET_STACK) \
- CBC_OPCODE (CBC_EXT_PUSH_SUPER_PROP_LITERAL, CBC_HAS_LITERAL_ARG, 1, \
- VM_OC_SUPER_REFERENCE | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_EXT_SUPER_PROP_LITERAL_REFERENCE, CBC_HAS_LITERAL_ARG, 3, \
- VM_OC_SUPER_REFERENCE | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_EXT_SUPER_PROP_ASSIGNMENT_REFERENCE, CBC_NO_FLAG, 1, \
- VM_OC_SUPER_REFERENCE | VM_OC_GET_STACK) \
- CBC_OPCODE (CBC_EXT_SUPER_PROP_LITERAL_ASSIGNMENT_REFERENCE, CBC_HAS_LITERAL_ARG, 2, \
- VM_OC_SUPER_REFERENCE | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT, CBC_NO_FLAG, 0, \
- VM_OC_SET_HOME_OBJECT) \
- CBC_OPCODE (CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT_COMPUTED, CBC_NO_FLAG, 0, \
- VM_OC_SET_HOME_OBJECT) \
- CBC_OPCODE (CBC_EXT_PUSH_OBJECT_SUPER_ENVIRONMENT, CBC_NO_FLAG, 1, \
- VM_OC_OBJECT_LITERAL_HOME_ENV) \
- CBC_OPCODE (CBC_EXT_POP_OBJECT_SUPER_ENVIRONMENT, CBC_NO_FLAG, -1, \
- VM_OC_OBJECT_LITERAL_HOME_ENV) \
- CBC_OPCODE (CBC_EXT_RESOLVE_LEXICAL_THIS, CBC_NO_FLAG, 1, \
- VM_OC_RESOLVE_LEXICAL_THIS | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_LOCAL_EVAL, CBC_HAS_BYTE_ARG, 0, \
- VM_OC_LOCAL_EVAL) \
- CBC_OPCODE (CBC_EXT_ASSIGN_SUPER, CBC_NO_FLAG, -3, \
- VM_OC_ASSIGN_SUPER) \
- CBC_OPCODE (CBC_EXT_ASSIGN_SUPER_PUSH_RESULT, CBC_NO_FLAG, -2, \
- VM_OC_ASSIGN_SUPER | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_ASSIGN_SUPER_BLOCK, CBC_NO_FLAG, -3, \
- VM_OC_ASSIGN_SUPER | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_EXT_SUPER_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, \
- VM_OC_SUPER_CALL) \
- CBC_OPCODE (CBC_EXT_SUPER_CALL_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, 0, \
- VM_OC_SUPER_CALL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_SUPER_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, \
- VM_OC_SUPER_CALL | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_EXT_SPREAD_SUPER_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, \
- VM_OC_SUPER_CALL) \
- CBC_OPCODE (CBC_EXT_SPREAD_SUPER_CALL_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, 0, \
- VM_OC_SUPER_CALL | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_SPREAD_SUPER_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, \
- VM_OC_SUPER_CALL | VM_OC_PUT_BLOCK) \
- \
- /* Spread / rest operation related opcodes. */ \
- CBC_OPCODE (CBC_EXT_SPREAD_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, \
- VM_OC_SPREAD_ARGUMENTS) \
- CBC_OPCODE (CBC_EXT_SPREAD_CALL_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, 0, \
- VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_SPREAD_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, \
- VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_EXT_SPREAD_CALL_PROP, CBC_HAS_POP_STACK_BYTE_ARG, -3, \
- VM_OC_SPREAD_ARGUMENTS) \
- CBC_OPCODE (CBC_EXT_SPREAD_CALL_PROP_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, -2, \
- VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_STACK) \
- CBC_OPCODE (CBC_EXT_SPREAD_CALL_PROP_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -3, \
- VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_BLOCK) \
- CBC_OPCODE (CBC_EXT_PUSH_SPREAD_ELEMENT, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_SPREAD_ELEMENT) \
- CBC_OPCODE (CBC_EXT_SPREAD_ARRAY_APPEND, CBC_HAS_POP_STACK_BYTE_ARG, 0, \
- VM_OC_APPEND_ARRAY) \
- CBC_OPCODE (CBC_EXT_REST_INITIALIZER, CBC_NO_FLAG, 1, \
- VM_OC_REST_INITIALIZER) \
- CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_PROP_LITERAL, CBC_HAS_LITERAL_ARG, 1, \
- VM_OC_INITIALIZER_PUSH_PROP | VM_OC_GET_LITERAL) \
- CBC_OPCODE (CBC_EXT_SPREAD_NEW, CBC_HAS_POP_STACK_BYTE_ARG, 0, \
- VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_STACK) \
- \
- /* Iterator related opcodes. */ \
- CBC_OPCODE (CBC_EXT_ITERATOR_CONTEXT_CREATE, CBC_NO_FLAG, PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION, \
- VM_OC_ITERATOR_CONTEXT_CREATE) \
- CBC_OPCODE (CBC_EXT_ITERATOR_CONTEXT_END, CBC_NO_FLAG, -PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION, \
- VM_OC_ITERATOR_CONTEXT_END) \
- CBC_OPCODE (CBC_EXT_ITERATOR_STEP, CBC_NO_FLAG, 1, \
- VM_OC_ITERATOR_STEP) \
- \
- /* Object initializer related opcodes. */ \
- CBC_OPCODE (CBC_EXT_OBJ_INIT_CONTEXT_CREATE, CBC_NO_FLAG, PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION, \
- VM_OC_OBJ_INIT_CONTEXT_CREATE) \
- CBC_OPCODE (CBC_EXT_OBJ_INIT_REST_CONTEXT_CREATE, CBC_NO_FLAG, PARSER_OBJ_INIT_REST_CONTEXT_STACK_ALLOCATION, \
- VM_OC_OBJ_INIT_CONTEXT_CREATE) \
- CBC_OPCODE (CBC_EXT_OBJ_INIT_PUSH_REST, CBC_NO_FLAG, 1, \
- VM_OC_OBJ_INIT_PUSH_REST) \
- CBC_OPCODE (CBC_EXT_OBJ_INIT_CONTEXT_END, CBC_NO_FLAG, -PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION, \
- VM_OC_OBJ_INIT_CONTEXT_END) \
- CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_NAME, CBC_NO_FLAG, 0, \
- VM_OC_INITIALIZER_PUSH_NAME | VM_OC_GET_STACK) \
- CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_NAME_LITERAL, CBC_HAS_LITERAL_ARG, 1, \
- VM_OC_INITIALIZER_PUSH_NAME | VM_OC_GET_LITERAL) \
- \
- /* Executable object related opcodes. */ \
- CBC_OPCODE (CBC_EXT_CREATE_GENERATOR, CBC_NO_FLAG, 1, \
- VM_OC_CREATE_GENERATOR) \
- CBC_OPCODE (CBC_EXT_YIELD, CBC_NO_FLAG, 0, \
- VM_OC_YIELD) \
- CBC_OPCODE (CBC_EXT_YIELD_ITERATOR, CBC_NO_FLAG, 0, \
- VM_OC_YIELD) \
- CBC_OPCODE (CBC_EXT_ASYNC_YIELD, CBC_NO_FLAG, 0, \
- VM_OC_ASYNC_YIELD) \
- CBC_OPCODE (CBC_EXT_ASYNC_YIELD_ITERATOR, CBC_NO_FLAG, 0, \
- VM_OC_ASYNC_YIELD_ITERATOR) \
- CBC_OPCODE (CBC_EXT_AWAIT, CBC_NO_FLAG, 0, \
- VM_OC_AWAIT) \
- CBC_OPCODE (CBC_EXT_GENERATOR_AWAIT, CBC_NO_FLAG, 0, \
- VM_OC_GENERATOR_AWAIT) \
- CBC_OPCODE (CBC_EXT_ASYNC_EXIT, CBC_NO_FLAG, 0, \
- VM_OC_ASYNC_EXIT) \
- CBC_OPCODE (CBC_EXT_RETURN, CBC_NO_FLAG, -1, \
- VM_OC_EXT_RETURN | VM_OC_GET_STACK) \
- CBC_OPCODE (CBC_EXT_RETURN_UNDEFINED, CBC_NO_FLAG, 0, \
- VM_OC_EXT_RETURN) \
- CBC_OPCODE (CBC_EXT_PUSH_NEW_TARGET, CBC_NO_FLAG, 1, \
- VM_OC_PUSH_NEW_TARGET | VM_OC_PUT_STACK) \
- \
- /* Last opcode (not a real opcode). */ \
- CBC_OPCODE (CBC_EXT_END, CBC_NO_FLAG, 0, \
- VM_OC_NONE)
-
-#define CBC_MAXIMUM_BYTE_VALUE 255
+#define CBC_EXT_OPCODE_LIST \
+ /* Branch opcodes first. Some other opcodes are mixed. */ \
+ CBC_OPCODE (CBC_EXT_NOP, CBC_NO_FLAG, 0, VM_OC_NONE) \
+ CBC_FORWARD_BRANCH (CBC_EXT_WITH_CREATE_CONTEXT, -1 + PARSER_WITH_CONTEXT_STACK_ALLOCATION, VM_OC_WITH) \
+ CBC_OPCODE (CBC_EXT_FOR_IN_GET_NEXT, CBC_NO_FLAG, 1, VM_OC_FOR_IN_GET_NEXT | VM_OC_PUT_STACK) \
+ CBC_FORWARD_BRANCH (CBC_EXT_FOR_IN_INIT, -1 + PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION, VM_OC_FOR_IN_INIT) \
+ CBC_OPCODE (CBC_EXT_SET_GETTER, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 0, \
+ VM_OC_SET_GETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL) \
+ CBC_BACKWARD_BRANCH (CBC_EXT_BRANCH_IF_FOR_IN_HAS_NEXT, 0, VM_OC_FOR_IN_HAS_NEXT) \
+ CBC_OPCODE (CBC_EXT_FOR_OF_GET_NEXT, CBC_NO_FLAG, 1, VM_OC_FOR_OF_GET_NEXT | VM_OC_PUT_STACK) \
+ CBC_FORWARD_BRANCH (CBC_EXT_FOR_OF_INIT, -1 + PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION, VM_OC_FOR_OF_INIT) \
+ CBC_OPCODE (CBC_EXT_PUSH_NAMED_FUNC_EXPRESSION, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 1, \
+ VM_OC_PUSH_NAMED_FUNC_EXPR | VM_OC_GET_LITERAL_LITERAL) \
+ CBC_BACKWARD_BRANCH (CBC_EXT_BRANCH_IF_FOR_OF_HAS_NEXT, 0, VM_OC_FOR_OF_HAS_NEXT) \
+ CBC_OPCODE (CBC_EXT_CLONE_CONTEXT, CBC_NO_FLAG, 0, VM_OC_CLONE_CONTEXT) \
+ CBC_FORWARD_BRANCH (CBC_EXT_FOR_AWAIT_OF_INIT, \
+ -1 + PARSER_FOR_AWAIT_OF_CONTEXT_STACK_ALLOCATION, \
+ VM_OC_FOR_AWAIT_OF_INIT) \
+ CBC_OPCODE (CBC_EXT_CLONE_FULL_CONTEXT, CBC_NO_FLAG, 0, VM_OC_CLONE_CONTEXT) \
+ CBC_BACKWARD_BRANCH (CBC_EXT_BRANCH_IF_FOR_AWAIT_OF_HAS_NEXT, 0, VM_OC_FOR_AWAIT_OF_HAS_NEXT) \
+ CBC_OPCODE (CBC_EXT_SET_SETTER, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 0, \
+ VM_OC_SET_SETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_LITERAL_LITERAL) \
+ CBC_FORWARD_BRANCH (CBC_EXT_TRY_CREATE_CONTEXT, PARSER_TRY_CONTEXT_STACK_ALLOCATION, VM_OC_TRY) \
+ CBC_OPCODE (CBC_EXT_TRY_CREATE_ENV, CBC_NO_FLAG, 0, VM_OC_BLOCK_CREATE_CONTEXT) \
+ CBC_FORWARD_BRANCH (CBC_EXT_CATCH, 1, VM_OC_CATCH) \
+ CBC_OPCODE (CBC_EXT_RESOLVE_BASE, CBC_NO_FLAG, 0, VM_OC_RESOLVE_BASE_FOR_CALL) \
+ CBC_FORWARD_BRANCH (CBC_EXT_FINALLY, PARSER_FINALLY_CONTEXT_EXTRA_STACK_ALLOCATION, VM_OC_FINALLY) \
+ CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_PROP, CBC_NO_FLAG, 0, VM_OC_INITIALIZER_PUSH_PROP) \
+ CBC_FORWARD_BRANCH (CBC_EXT_DEFAULT_INITIALIZER, -1, VM_OC_DEFAULT_INITIALIZER) \
+ CBC_OPCODE (CBC_EXT_ERROR, CBC_NO_FLAG, 0, VM_OC_ERROR) \
+ CBC_FORWARD_BRANCH (CBC_EXT_BRANCH_IF_NULLISH, -1, VM_OC_BRANCH_IF_NULLISH) \
+ \
+ /* Basic opcodes. */ \
+ CBC_OPCODE (CBC_EXT_CREATE_ARGUMENTS, CBC_HAS_LITERAL_ARG, 0, VM_OC_CREATE_ARGUMENTS) \
+ CBC_OPCODE (CBC_EXT_CREATE_VAR_EVAL, CBC_HAS_LITERAL_ARG, 0, VM_OC_EXT_VAR_EVAL) \
+ CBC_OPCODE (CBC_EXT_CREATE_VAR_FUNC_EVAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, 0, VM_OC_EXT_VAR_EVAL) \
+ CBC_OPCODE (CBC_EXT_COPY_FROM_ARG, CBC_HAS_LITERAL_ARG, 0, VM_OC_COPY_FROM_ARG) \
+ CBC_OPCODE (CBC_EXT_PUSH_REST_OBJECT, CBC_NO_FLAG, 1, VM_OC_PUSH_REST_OBJECT) \
+ CBC_OPCODE (CBC_EXT_MODULE_IMPORT, CBC_NO_FLAG, 0, VM_OC_MODULE_IMPORT) \
+ CBC_OPCODE (CBC_EXT_MODULE_IMPORT_META, CBC_NO_FLAG, 1, VM_OC_MODULE_IMPORT_META) \
+ CBC_OPCODE (CBC_EXT_STRING_CONCAT, CBC_NO_FLAG, -1, VM_OC_STRING_CONCAT | VM_OC_GET_STACK_STACK | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_STRING_CONCAT_RIGHT_LITERAL, \
+ CBC_HAS_LITERAL_ARG, \
+ 0, \
+ VM_OC_STRING_CONCAT | VM_OC_GET_STACK_LITERAL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_STRING_CONCAT_TWO_LITERALS, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 1, \
+ VM_OC_STRING_CONCAT | VM_OC_GET_LITERAL_LITERAL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_GET_TAGGED_TEMPLATE_LITERAL, CBC_HAS_BYTE_ARG, 1, VM_OC_GET_TEMPLATE_OBJECT | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_THROW_REFERENCE_ERROR, CBC_NO_FLAG, 1, VM_OC_THROW_REFERENCE_ERROR) \
+ CBC_OPCODE (CBC_EXT_THROW_ASSIGN_CONST_ERROR, CBC_NO_FLAG, 0, VM_OC_THROW_CONST_ERROR) \
+ CBC_OPCODE (CBC_EXT_REQUIRE_OBJECT_COERCIBLE, CBC_NO_FLAG, 0, VM_OC_REQUIRE_OBJECT_COERCIBLE) \
+ CBC_OPCODE (CBC_EXT_COPY_DATA_PROPERTIES, CBC_NO_FLAG, -1, VM_OC_COPY_DATA_PROPERTIES) \
+ CBC_OPCODE (CBC_EXT_SET_FUNCTION_NAME, CBC_HAS_LITERAL_ARG, 0, VM_OC_SET_FUNCTION_NAME | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_EXT_SET_CLASS_NAME, CBC_HAS_LITERAL_ARG, 0, VM_OC_SET_FUNCTION_NAME) \
+ CBC_OPCODE (CBC_EXT_SET_COMPUTED_FUNCTION_NAME, CBC_NO_FLAG, 0, VM_OC_SET_FUNCTION_NAME) \
+ CBC_OPCODE (CBC_EXT_SET_COMPUTED_GETTER_NAME, CBC_NO_FLAG, 0, VM_OC_SET_FUNCTION_NAME) \
+ CBC_OPCODE (CBC_EXT_SET_COMPUTED_SETTER_NAME, CBC_NO_FLAG, 0, VM_OC_SET_FUNCTION_NAME) \
+ \
+ /* Computed / class property related opcodes. */ \
+ CBC_OPCODE (CBC_EXT_SET_COMPUTED_PROPERTY, \
+ CBC_NO_FLAG, \
+ -2, \
+ VM_OC_SET_COMPUTED_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_STACK) \
+ CBC_OPCODE (CBC_EXT_SET_COMPUTED_PROPERTY_LITERAL, \
+ CBC_HAS_LITERAL_ARG, \
+ -1, \
+ VM_OC_SET_COMPUTED_PROPERTY | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_LITERAL) \
+ CBC_OPCODE (CBC_EXT_SET_COMPUTED_GETTER, \
+ CBC_NO_FLAG, \
+ -2, \
+ VM_OC_SET_GETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_STACK) \
+ CBC_OPCODE (CBC_EXT_SET_COMPUTED_SETTER, \
+ CBC_NO_FLAG, \
+ -2, \
+ VM_OC_SET_SETTER | VM_OC_NON_STATIC_FLAG | VM_OC_GET_STACK_STACK) \
+ CBC_OPCODE (CBC_EXT_SET_STATIC_PROPERTY, CBC_HAS_LITERAL_ARG, -1, VM_OC_SET_PROPERTY | VM_OC_GET_STACK_LITERAL) \
+ CBC_OPCODE (CBC_EXT_SET_STATIC_PROPERTY_LITERAL, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 0, \
+ VM_OC_SET_PROPERTY | VM_OC_GET_LITERAL_LITERAL) \
+ CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_PROPERTY, \
+ CBC_NO_FLAG, \
+ -2, \
+ VM_OC_SET_COMPUTED_PROPERTY | VM_OC_GET_STACK_STACK) \
+ CBC_OPCODE (CBC_EXT_SET_STATIC_GETTER, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 0, \
+ VM_OC_SET_GETTER | VM_OC_GET_LITERAL_LITERAL) \
+ CBC_OPCODE (CBC_EXT_SET_STATIC_SETTER, \
+ CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2, \
+ 0, \
+ VM_OC_SET_SETTER | VM_OC_GET_LITERAL_LITERAL) \
+ CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_GETTER, CBC_NO_FLAG, -2, VM_OC_SET_GETTER | VM_OC_GET_STACK_STACK) \
+ CBC_OPCODE (CBC_EXT_SET_STATIC_COMPUTED_SETTER, CBC_NO_FLAG, -2, VM_OC_SET_SETTER | VM_OC_GET_STACK_STACK) \
+ CBC_OPCODE (CBC_EXT_SET__PROTO__, CBC_NO_FLAG, -1, VM_OC_SET__PROTO__ | VM_OC_GET_STACK) \
+ CBC_OPCODE (CBC_EXT_PUSH_STATIC_FIELD_FUNC, \
+ CBC_HAS_LITERAL_ARG, \
+ 1, \
+ VM_OC_PUSH_STATIC_FIELD_FUNC | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_EXT_PUSH_STATIC_COMPUTED_FIELD_FUNC, \
+ CBC_HAS_LITERAL_ARG, \
+ 0, \
+ VM_OC_PUSH_STATIC_FIELD_FUNC | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_EXT_ADD_COMPUTED_FIELD, CBC_NO_FLAG, -1, VM_OC_ADD_COMPUTED_FIELD | VM_OC_GET_STACK) \
+ CBC_OPCODE (CBC_EXT_ADD_STATIC_COMPUTED_FIELD, CBC_NO_FLAG, -1, VM_OC_ADD_COMPUTED_FIELD | VM_OC_GET_STACK) \
+ \
+ /* Class related opcodes. */ \
+ CBC_OPCODE (CBC_EXT_PUSH_NAMED_CLASS_ENV, CBC_HAS_LITERAL_ARG, 1, VM_OC_PUSH_CLASS_ENVIRONMENT) \
+ CBC_OPCODE (CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR, CBC_NO_FLAG, 1, VM_OC_PUSH_IMPLICIT_CTOR | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_PUSH_IMPLICIT_CONSTRUCTOR_HERITAGE, CBC_NO_FLAG, 1, VM_OC_PUSH_IMPLICIT_CTOR | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_INIT_CLASS, CBC_NO_FLAG, 0, VM_OC_INIT_CLASS | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_FINALIZE_NAMED_CLASS, CBC_HAS_LITERAL_ARG, -2, VM_OC_FINALIZE_CLASS) \
+ CBC_OPCODE (CBC_EXT_FINALIZE_ANONYMOUS_CLASS, CBC_NO_FLAG, -2, VM_OC_FINALIZE_CLASS) \
+ CBC_OPCODE (CBC_EXT_SET_FIELD_INIT, CBC_HAS_LITERAL_ARG, 0, VM_OC_SET_FIELD_INIT | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_EXT_RUN_FIELD_INIT, CBC_NO_FLAG, 0, VM_OC_RUN_FIELD_INIT) \
+ CBC_OPCODE (CBC_EXT_RUN_STATIC_FIELD_INIT, CBC_NO_FLAG, -1, VM_OC_RUN_STATIC_FIELD_INIT) \
+ CBC_OPCODE (CBC_EXT_SET_NEXT_COMPUTED_FIELD, CBC_NO_FLAG, -1, VM_OC_SET_NEXT_COMPUTED_FIELD | VM_OC_PUT_REFERENCE) \
+ CBC_OPCODE (CBC_EXT_PUSH_SUPER, CBC_NO_FLAG, 1, VM_OC_NONE) \
+ CBC_OPCODE (CBC_EXT_PUSH_SUPER_CONSTRUCTOR, CBC_NO_FLAG, 1, VM_OC_PUSH_SUPER_CONSTRUCTOR) \
+ CBC_OPCODE (CBC_EXT_PUSH_SUPER_PROP, CBC_NO_FLAG, 0, VM_OC_SUPER_REFERENCE | VM_OC_GET_STACK) \
+ CBC_OPCODE (CBC_EXT_SUPER_PROP_REFERENCE, CBC_NO_FLAG, 2, VM_OC_SUPER_REFERENCE | VM_OC_GET_STACK) \
+ CBC_OPCODE (CBC_EXT_PUSH_SUPER_PROP_LITERAL, CBC_HAS_LITERAL_ARG, 1, VM_OC_SUPER_REFERENCE | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_EXT_SUPER_PROP_LITERAL_REFERENCE, CBC_HAS_LITERAL_ARG, 3, VM_OC_SUPER_REFERENCE | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_EXT_SUPER_PROP_ASSIGNMENT_REFERENCE, CBC_NO_FLAG, 1, VM_OC_SUPER_REFERENCE | VM_OC_GET_STACK) \
+ CBC_OPCODE (CBC_EXT_SUPER_PROP_LITERAL_ASSIGNMENT_REFERENCE, \
+ CBC_HAS_LITERAL_ARG, \
+ 2, \
+ VM_OC_SUPER_REFERENCE | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT, CBC_NO_FLAG, 0, VM_OC_SET_HOME_OBJECT) \
+ CBC_OPCODE (CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT_COMPUTED, CBC_NO_FLAG, 0, VM_OC_SET_HOME_OBJECT) \
+ CBC_OPCODE (CBC_EXT_PUSH_OBJECT_SUPER_ENVIRONMENT, CBC_NO_FLAG, 1, VM_OC_OBJECT_LITERAL_HOME_ENV) \
+ CBC_OPCODE (CBC_EXT_POP_OBJECT_SUPER_ENVIRONMENT, CBC_NO_FLAG, -1, VM_OC_OBJECT_LITERAL_HOME_ENV) \
+ CBC_OPCODE (CBC_EXT_RESOLVE_LEXICAL_THIS, CBC_NO_FLAG, 1, VM_OC_RESOLVE_LEXICAL_THIS | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_LOCAL_EVAL, CBC_HAS_BYTE_ARG, 0, VM_OC_LOCAL_EVAL) \
+ CBC_OPCODE (CBC_EXT_ASSIGN_SUPER, CBC_NO_FLAG, -3, VM_OC_ASSIGN_SUPER) \
+ CBC_OPCODE (CBC_EXT_ASSIGN_SUPER_PUSH_RESULT, CBC_NO_FLAG, -2, VM_OC_ASSIGN_SUPER | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_ASSIGN_SUPER_BLOCK, CBC_NO_FLAG, -3, VM_OC_ASSIGN_SUPER | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_EXT_SUPER_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SUPER_CALL) \
+ CBC_OPCODE (CBC_EXT_SUPER_CALL_PUSH_RESULT, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_SUPER_CALL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_SUPER_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SUPER_CALL | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_EXT_SPREAD_SUPER_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SUPER_CALL) \
+ CBC_OPCODE (CBC_EXT_SPREAD_SUPER_CALL_PUSH_RESULT, \
+ CBC_HAS_POP_STACK_BYTE_ARG, \
+ 0, \
+ VM_OC_SUPER_CALL | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_SPREAD_SUPER_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SUPER_CALL | VM_OC_PUT_BLOCK) \
+ \
+ /* Spread / rest operation related opcodes. */ \
+ CBC_OPCODE (CBC_EXT_SPREAD_CALL, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SPREAD_ARGUMENTS) \
+ CBC_OPCODE (CBC_EXT_SPREAD_CALL_PUSH_RESULT, \
+ CBC_HAS_POP_STACK_BYTE_ARG, \
+ 0, \
+ VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_SPREAD_CALL_BLOCK, CBC_HAS_POP_STACK_BYTE_ARG, -1, VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_EXT_SPREAD_CALL_PROP, CBC_HAS_POP_STACK_BYTE_ARG, -3, VM_OC_SPREAD_ARGUMENTS) \
+ CBC_OPCODE (CBC_EXT_SPREAD_CALL_PROP_PUSH_RESULT, \
+ CBC_HAS_POP_STACK_BYTE_ARG, \
+ -2, \
+ VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_STACK) \
+ CBC_OPCODE (CBC_EXT_SPREAD_CALL_PROP_BLOCK, \
+ CBC_HAS_POP_STACK_BYTE_ARG, \
+ -3, \
+ VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_BLOCK) \
+ CBC_OPCODE (CBC_EXT_PUSH_SPREAD_ELEMENT, CBC_NO_FLAG, 1, VM_OC_PUSH_SPREAD_ELEMENT) \
+ CBC_OPCODE (CBC_EXT_SPREAD_ARRAY_APPEND, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_APPEND_ARRAY) \
+ CBC_OPCODE (CBC_EXT_REST_INITIALIZER, CBC_NO_FLAG, 1, VM_OC_REST_INITIALIZER) \
+ CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_PROP_LITERAL, \
+ CBC_HAS_LITERAL_ARG, \
+ 1, \
+ VM_OC_INITIALIZER_PUSH_PROP | VM_OC_GET_LITERAL) \
+ CBC_OPCODE (CBC_EXT_SPREAD_NEW, CBC_HAS_POP_STACK_BYTE_ARG, 0, VM_OC_SPREAD_ARGUMENTS | VM_OC_PUT_STACK) \
+ \
+ /* Iterator related opcodes. */ \
+ CBC_OPCODE (CBC_EXT_ITERATOR_CONTEXT_CREATE, \
+ CBC_NO_FLAG, \
+ PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION, \
+ VM_OC_ITERATOR_CONTEXT_CREATE) \
+ CBC_OPCODE (CBC_EXT_ITERATOR_CONTEXT_END, \
+ CBC_NO_FLAG, \
+ -PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION, \
+ VM_OC_ITERATOR_CONTEXT_END) \
+ CBC_OPCODE (CBC_EXT_ITERATOR_STEP, CBC_NO_FLAG, 1, VM_OC_ITERATOR_STEP) \
+ \
+ /* Object initializer related opcodes. */ \
+ CBC_OPCODE (CBC_EXT_OBJ_INIT_CONTEXT_CREATE, \
+ CBC_NO_FLAG, \
+ PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION, \
+ VM_OC_OBJ_INIT_CONTEXT_CREATE) \
+ CBC_OPCODE (CBC_EXT_OBJ_INIT_REST_CONTEXT_CREATE, \
+ CBC_NO_FLAG, \
+ PARSER_OBJ_INIT_REST_CONTEXT_STACK_ALLOCATION, \
+ VM_OC_OBJ_INIT_CONTEXT_CREATE) \
+ CBC_OPCODE (CBC_EXT_OBJ_INIT_PUSH_REST, CBC_NO_FLAG, 1, VM_OC_OBJ_INIT_PUSH_REST) \
+ CBC_OPCODE (CBC_EXT_OBJ_INIT_CONTEXT_END, \
+ CBC_NO_FLAG, \
+ -PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION, \
+ VM_OC_OBJ_INIT_CONTEXT_END) \
+ CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_NAME, CBC_NO_FLAG, 0, VM_OC_INITIALIZER_PUSH_NAME | VM_OC_GET_STACK) \
+ CBC_OPCODE (CBC_EXT_INITIALIZER_PUSH_NAME_LITERAL, \
+ CBC_HAS_LITERAL_ARG, \
+ 1, \
+ VM_OC_INITIALIZER_PUSH_NAME | VM_OC_GET_LITERAL) \
+ \
+ /* Executable object related opcodes. */ \
+ CBC_OPCODE (CBC_EXT_CREATE_GENERATOR, CBC_NO_FLAG, 1, VM_OC_CREATE_GENERATOR) \
+ CBC_OPCODE (CBC_EXT_YIELD, CBC_NO_FLAG, 0, VM_OC_YIELD) \
+ CBC_OPCODE (CBC_EXT_YIELD_ITERATOR, CBC_NO_FLAG, 0, VM_OC_YIELD) \
+ CBC_OPCODE (CBC_EXT_ASYNC_YIELD, CBC_NO_FLAG, 0, VM_OC_ASYNC_YIELD) \
+ CBC_OPCODE (CBC_EXT_ASYNC_YIELD_ITERATOR, CBC_NO_FLAG, 0, VM_OC_ASYNC_YIELD_ITERATOR) \
+ CBC_OPCODE (CBC_EXT_AWAIT, CBC_NO_FLAG, 0, VM_OC_AWAIT) \
+ CBC_OPCODE (CBC_EXT_GENERATOR_AWAIT, CBC_NO_FLAG, 0, VM_OC_GENERATOR_AWAIT) \
+ CBC_OPCODE (CBC_EXT_ASYNC_EXIT, CBC_NO_FLAG, 0, VM_OC_ASYNC_EXIT) \
+ CBC_OPCODE (CBC_EXT_RETURN, CBC_NO_FLAG, -1, VM_OC_EXT_RETURN | VM_OC_GET_STACK) \
+ CBC_OPCODE (CBC_EXT_RETURN_UNDEFINED, CBC_NO_FLAG, 0, VM_OC_EXT_RETURN) \
+ CBC_OPCODE (CBC_EXT_PUSH_NEW_TARGET, CBC_NO_FLAG, 1, VM_OC_PUSH_NEW_TARGET | VM_OC_PUT_STACK) \
+ \
+ /* Last opcode (not a real opcode). */ \
+ CBC_OPCODE (CBC_EXT_END, CBC_NO_FLAG, 0, VM_OC_NONE)
+
+#define CBC_MAXIMUM_BYTE_VALUE 255
#define CBC_MAXIMUM_SMALL_VALUE 510
-#define CBC_MAXIMUM_FULL_VALUE 32767
+#define CBC_MAXIMUM_FULL_VALUE 32767
#define CBC_PUSH_NUMBER_BYTE_RANGE_END 256
-#define CBC_HIGHEST_BIT_MASK 0x80
+#define CBC_HIGHEST_BIT_MASK 0x80
#define CBC_LOWER_SEVEN_BIT_MASK 0x7f
/**
@@ -849,14 +736,14 @@
*/
typedef struct
{
- ecma_compiled_code_t header; /**< compiled code header */
- uint8_t stack_limit; /**< maximum number of values stored on the stack */
- uint8_t argument_end; /**< number of arguments expected by the function */
- ecma_value_t script_value; /**< script value */
- uint8_t register_end; /**< end position of the register group */
- uint8_t ident_end; /**< end position of the identifier group */
- uint8_t const_literal_end; /**< end position of the const literal group */
- uint8_t literal_end; /**< end position of the literal group */
+ ecma_compiled_code_t header; /**< compiled code header */
+ uint8_t stack_limit; /**< maximum number of values stored on the stack */
+ uint8_t argument_end; /**< number of arguments expected by the function */
+ ecma_value_t script_value; /**< script value */
+ uint8_t register_end; /**< end position of the register group */
+ uint8_t ident_end; /**< end position of the identifier group */
+ uint8_t const_literal_end; /**< end position of the const literal group */
+ uint8_t literal_end; /**< end position of the literal group */
} cbc_uint8_arguments_t;
/**
@@ -864,15 +751,15 @@ typedef struct
*/
typedef struct
{
- ecma_compiled_code_t header; /**< compiled code header */
- uint16_t stack_limit; /**< maximum number of values stored on the stack */
- ecma_value_t script_value; /**< script value */
- uint16_t argument_end; /**< number of arguments expected by the function */
- uint16_t register_end; /**< end position of the register group */
- uint16_t ident_end; /**< end position of the identifier group */
- uint16_t const_literal_end; /**< end position of the const literal group */
- uint16_t literal_end; /**< end position of the literal group */
- uint16_t padding; /**< an unused value */
+ ecma_compiled_code_t header; /**< compiled code header */
+ uint16_t stack_limit; /**< maximum number of values stored on the stack */
+ ecma_value_t script_value; /**< script value */
+ uint16_t argument_end; /**< number of arguments expected by the function */
+ uint16_t register_end; /**< end position of the register group */
+ uint16_t ident_end; /**< end position of the identifier group */
+ uint16_t const_literal_end; /**< end position of the const literal group */
+ uint16_t literal_end; /**< end position of the literal group */
+ uint16_t padding; /**< an unused value */
} cbc_uint16_arguments_t;
/**
@@ -951,38 +838,32 @@ typedef enum
/**
* Compute function type bits in code flags.
*/
-#define CBC_FUNCTION_TO_TYPE_BITS(name) \
- ((name) << CBC_FUNCTION_TYPE_SHIFT)
+#define CBC_FUNCTION_TO_TYPE_BITS(name) ((name) << CBC_FUNCTION_TYPE_SHIFT)
/**
* Get function type from code flags.
*/
-#define CBC_FUNCTION_GET_TYPE(flags) \
- ((uint16_t) ((flags) >> CBC_FUNCTION_TYPE_SHIFT))
+#define CBC_FUNCTION_GET_TYPE(flags) ((uint16_t) ((flags) >> CBC_FUNCTION_TYPE_SHIFT))
/**
* Checks whether the byte code is a function or a regular expression.
*/
-#define CBC_IS_FUNCTION(flags) \
- ((flags) >= (CBC_FUNCTION_NORMAL << CBC_FUNCTION_TYPE_SHIFT))
+#define CBC_IS_FUNCTION(flags) ((flags) >= (CBC_FUNCTION_NORMAL << CBC_FUNCTION_TYPE_SHIFT))
/**
* Checks whether the function can be constructed with new operator.
*/
-#define CBC_FUNCTION_IS_CONSTRUCTABLE(flags) \
- ((flags) < (CBC_FUNCTION_GENERATOR << CBC_FUNCTION_TYPE_SHIFT))
+#define CBC_FUNCTION_IS_CONSTRUCTABLE(flags) ((flags) < (CBC_FUNCTION_GENERATOR << CBC_FUNCTION_TYPE_SHIFT))
/**
* Checks whether the function has prototype property.
*/
-#define CBC_FUNCTION_HAS_PROTOTYPE(flags) \
- ((flags) < (CBC_FUNCTION_ACCESSOR << CBC_FUNCTION_TYPE_SHIFT))
+#define CBC_FUNCTION_HAS_PROTOTYPE(flags) ((flags) < (CBC_FUNCTION_ACCESSOR << CBC_FUNCTION_TYPE_SHIFT))
/**
* Checks whether the function is an arrow function.
*/
-#define CBC_FUNCTION_IS_ARROW(flags) \
- ((flags) >= (CBC_FUNCTION_ARROW << CBC_FUNCTION_TYPE_SHIFT))
+#define CBC_FUNCTION_IS_ARROW(flags) ((flags) >= (CBC_FUNCTION_ARROW << CBC_FUNCTION_TYPE_SHIFT))
/**
* Compact byte code extended status flags.
@@ -1020,20 +901,19 @@ typedef enum
/**
* Sets the type of a script using the user_value.
*/
-#define CBC_SCRIPT_SET_TYPE(script_p, user_value, ref_count) \
- do \
- { \
- (script_p)->refs_and_type = (ref_count); \
- if ((user_value) != ECMA_VALUE_EMPTY) \
- { \
- (script_p)->refs_and_type |= CBC_SCRIPT_HAS_USER_VALUE; \
- if (ecma_is_value_object (user_value)) \
- { \
+#define CBC_SCRIPT_SET_TYPE(script_p, user_value, ref_count) \
+ do \
+ { \
+ (script_p)->refs_and_type = (ref_count); \
+ if ((user_value) != ECMA_VALUE_EMPTY) \
+ { \
+ (script_p)->refs_and_type |= CBC_SCRIPT_HAS_USER_VALUE; \
+ if (ecma_is_value_object (user_value)) \
+ { \
(script_p)->refs_and_type |= CBC_SCRIPT_USER_VALUE_IS_OBJECT; \
- } \
- } \
- } \
- while (false)
+ } \
+ } \
+ } while (false)
/**
* Shared script data.
@@ -1063,20 +943,19 @@ typedef struct
/**
* Get user value.
*/
-#define CBC_SCRIPT_GET_USER_VALUE(script_p) \
- (CBC_SCRIPT_GET_OPTIONAL_VALUES (script_p)[0])
+#define CBC_SCRIPT_GET_USER_VALUE(script_p) (CBC_SCRIPT_GET_OPTIONAL_VALUES (script_p)[0])
/**
* Get function arguments.
*/
#define CBC_SCRIPT_GET_FUNCTION_ARGUMENTS(script_p, type) \
- (CBC_SCRIPT_GET_OPTIONAL_VALUES (script_p)[((type) & CBC_SCRIPT_HAS_USER_VALUE) ? 1 : 0])
+ (CBC_SCRIPT_GET_OPTIONAL_VALUES (script_p)[((type) &CBC_SCRIPT_HAS_USER_VALUE) ? 1 : 0])
/**
* Get import.meta object.
*/
#define CBC_SCRIPT_GET_IMPORT_META(script_p, type) \
- (CBC_SCRIPT_GET_OPTIONAL_VALUES (script_p)[((type) & CBC_SCRIPT_HAS_USER_VALUE) ? 1 : 0])
+ (CBC_SCRIPT_GET_OPTIONAL_VALUES (script_p)[((type) &CBC_SCRIPT_HAS_USER_VALUE) ? 1 : 0])
#define CBC_OPCODE(arg1, arg2, arg3, arg4) arg1,
@@ -1085,7 +964,7 @@ typedef struct
*/
typedef enum
{
- CBC_OPCODE_LIST /**< list of opcodes */
+ CBC_OPCODE_LIST /**< list of opcodes */
} cbc_opcode_t;
/**
@@ -1093,7 +972,7 @@ typedef enum
*/
typedef enum
{
- CBC_EXT_OPCODE_LIST /**< list extended opcodes */
+ CBC_EXT_OPCODE_LIST /**< list extended opcodes */
} cbc_ext_opcode_t;
#undef CBC_OPCODE
@@ -1109,8 +988,8 @@ extern const uint8_t cbc_ext_flags[];
/**
* Opcode names for debugging.
*/
-extern const char * const cbc_names[];
-extern const char * const cbc_ext_names[];
+extern const char *const cbc_names[];
+extern const char *const cbc_ext_names[];
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
diff --git a/jerry-core/parser/js/common.c b/jerry-core/parser/js/common.c
index cf241a12..53b0a7f1 100644
--- a/jerry-core/parser/js/common.c
+++ b/jerry-core/parser/js/common.c
@@ -14,10 +14,12 @@
*/
#include "common.h"
-#include "ecma-helpers.h"
-#include "ecma-extended-info.h"
+
#include "ecma-big-uint.h"
#include "ecma-bigint.h"
+#include "ecma-extended-info.h"
+#include "ecma-helpers.h"
+
#include "js-parser-internal.h"
#include "lit-char-helpers.h"
@@ -39,16 +41,14 @@
void
util_free_literal (lexer_literal_t *literal_p) /**< literal */
{
- if (literal_p->type == LEXER_IDENT_LITERAL
- || literal_p->type == LEXER_STRING_LITERAL)
+ if (literal_p->type == LEXER_IDENT_LITERAL || literal_p->type == LEXER_STRING_LITERAL)
{
if (!(literal_p->status_flags & LEXER_FLAG_SOURCE_PTR))
{
jmem_heap_free_block ((void *) literal_p->u.char_p, literal_p->prop.length);
}
}
- else if ((literal_p->type == LEXER_FUNCTION_LITERAL)
- || (literal_p->type == LEXER_REGEXP_LITERAL))
+ else if ((literal_p->type == LEXER_FUNCTION_LITERAL) || (literal_p->type == LEXER_REGEXP_LITERAL))
{
ecma_bytecode_deref (literal_p->u.bytecode_p);
}
@@ -262,12 +262,12 @@ util_print_literal_value (ecma_compiled_code_t *compiled_code_p, /**< compiled c
JERRY_DEBUG_MSG (")");
} /* util_print_literal_value */
-#define PARSER_READ_IDENTIFIER_INDEX(name) \
- name = *byte_code_p++; \
- if (name >= encoding_limit) \
- { \
+#define PARSER_READ_IDENTIFIER_INDEX(name) \
+ name = *byte_code_p++; \
+ if (name >= encoding_limit) \
+ { \
name = (uint16_t) (((name << 8) | byte_code_p[0]) - encoding_delta); \
- byte_code_p++; \
+ byte_code_p++; \
}
/**
@@ -311,8 +311,7 @@ util_print_cbc (ecma_compiled_code_t *compiled_code_p) /**< compiled code */
literal_end = args->literal_end;
}
- JERRY_DEBUG_MSG ("\nByte code dump:\n\n Maximum stack depth: %d\n Flags: [",
- (int) (stack_limit + register_end));
+ JERRY_DEBUG_MSG ("\nByte code dump:\n\n Maximum stack depth: %d\n Flags: [", (int) (stack_limit + register_end));
if (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_FULL_LITERAL_ENCODING))
{
@@ -509,13 +508,11 @@ util_print_cbc (ecma_compiled_code_t *compiled_code_p) /**< compiled code */
if (flags & CBC_HAS_BYTE_ARG)
{
- if (opcode == CBC_PUSH_NUMBER_POS_BYTE
- || opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE)
+ if (opcode == CBC_PUSH_NUMBER_POS_BYTE || opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE)
{
JERRY_DEBUG_MSG (" number:%d", (int) *byte_code_p + 1);
}
- else if (opcode == CBC_PUSH_NUMBER_NEG_BYTE
- || opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)
+ else if (opcode == CBC_PUSH_NUMBER_NEG_BYTE || opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)
{
JERRY_DEBUG_MSG (" number:%d", -((int) *byte_code_p + 1));
}
@@ -528,15 +525,14 @@ util_print_cbc (ecma_compiled_code_t *compiled_code_p) /**< compiled code */
if (flags & CBC_HAS_BRANCH_ARG)
{
- size_t branch_offset_length = (opcode != CBC_EXT_OPCODE ? CBC_BRANCH_OFFSET_LENGTH (opcode)
- : CBC_BRANCH_OFFSET_LENGTH (ext_opcode));
+ size_t branch_offset_length =
+ (opcode != CBC_EXT_OPCODE ? CBC_BRANCH_OFFSET_LENGTH (opcode) : CBC_BRANCH_OFFSET_LENGTH (ext_opcode));
size_t offset = 0;
do
{
offset = (offset << 8) | *byte_code_p++;
- }
- while (--branch_offset_length > 0);
+ } while (--branch_offset_length > 0);
JERRY_DEBUG_MSG (" offset:%d(->%d)",
(int) offset,
diff --git a/jerry-core/parser/js/common.h b/jerry-core/parser/js/common.h
index 05775f04..00f3b6ed 100644
--- a/jerry-core/parser/js/common.h
+++ b/jerry-core/parser/js/common.h
@@ -16,11 +16,11 @@
#ifndef COMMON_H
#define COMMON_H
+#include <inttypes.h>
+#include <setjmp.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
-#include <inttypes.h>
-#include <setjmp.h>
/** \addtogroup parser Parser
* @{
@@ -32,9 +32,10 @@
* @{
*/
-#include "config.h"
#include "ecma-globals.h"
#include "ecma-regexp-object.h"
+
+#include "config.h"
#include "jmem.h"
/* Immediate management. */
@@ -48,15 +49,15 @@
typedef enum
{
/* The LEXER_IS_IDENT_OR_STRING macro must be updated if the order is changed. */
- LEXER_IDENT_LITERAL = 0, /**< identifier literal */
- LEXER_STRING_LITERAL = 1, /**< string literal */
- LEXER_NUMBER_LITERAL = 2, /**< number literal */
- LEXER_FUNCTION_LITERAL = 3, /**< function literal */
- LEXER_REGEXP_LITERAL = 4, /**< regexp literal */
- LEXER_UNUSED_LITERAL = 5, /**< unused literal, can only be
- used by the byte code generator. */
- LEXER_NEW_IDENT_LITERAL = 6, /**< new local variable, can only be
- used by the byte code generator. */
+ LEXER_IDENT_LITERAL = 0, /**< identifier literal */
+ LEXER_STRING_LITERAL = 1, /**< string literal */
+ LEXER_NUMBER_LITERAL = 2, /**< number literal */
+ LEXER_FUNCTION_LITERAL = 3, /**< function literal */
+ LEXER_REGEXP_LITERAL = 4, /**< regexp literal */
+ LEXER_UNUSED_LITERAL = 5, /**< unused literal, can only be
+ used by the byte code generator. */
+ LEXER_NEW_IDENT_LITERAL = 6, /**< new local variable, can only be
+ used by the byte code generator. */
} lexer_literal_type_t;
/**
@@ -96,10 +97,10 @@ typedef struct
{
union
{
- ecma_value_t value; /**< literal value (not processed by the parser) */
- const uint8_t *char_p; /**< character value */
- ecma_compiled_code_t *bytecode_p; /**< compiled function or regexp pointer */
- uint32_t source_data; /**< encoded source literal */
+ ecma_value_t value; /**< literal value (not processed by the parser) */
+ const uint8_t *char_p; /**< character value */
+ ecma_compiled_code_t *bytecode_p; /**< compiled function or regexp pointer */
+ uint32_t source_data; /**< encoded source literal */
} u;
#if JERRY_PARSER_DUMP_BYTE_CODE
@@ -108,12 +109,12 @@ typedef struct
union
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
{
- prop_length_t length; /**< length of ident / string literal */
- uint16_t index; /**< real index during post processing */
+ prop_length_t length; /**< length of ident / string literal */
+ uint16_t index; /**< real index during post processing */
} prop;
- uint8_t type; /**< type of the literal */
- uint8_t status_flags; /**< status flags */
+ uint8_t type; /**< type of the literal */
+ uint8_t status_flags; /**< status flags */
} lexer_literal_t;
void util_free_literal (lexer_literal_t *literal_p);
@@ -122,26 +123,36 @@ void util_free_literal (lexer_literal_t *literal_p);
void util_print_literal (lexer_literal_t *);
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
+/**
+ * Source code line counter type.
+ */
+typedef uint32_t parser_line_counter_t;
+
+/**
+ * Source code as character data.
+ */
+typedef struct
+{
+ const uint8_t *source_p; /**< valid UTF-8 source code */
+ size_t source_size; /**< size of the source code */
+} parser_source_char_t;
+
/* TRY/CATCH block */
-#define PARSER_TRY_CONTEXT(context_name) \
- jmp_buf context_name
+#define PARSER_TRY_CONTEXT(context_name) jmp_buf context_name
-#define PARSER_THROW(context_name) \
- longjmp (context_name, 1);
+#define PARSER_THROW(context_name) longjmp (context_name, 1);
#define PARSER_TRY(context_name) \
- { \
- if (!setjmp (context_name)) \
- { \
-
-#define PARSER_CATCH \
- } \
- else \
+ { \
+ if (!setjmp (context_name)) \
{
-
+#define PARSER_CATCH \
+ } \
+ else \
+ {
#define PARSER_TRY_END \
- } \
+ } \
}
/**
diff --git a/jerry-core/parser/js/js-lexer.c b/jerry-core/parser/js/js-lexer.c
index e0c7220b..b38c19d3 100644
--- a/jerry-core/parser/js/js-lexer.c
+++ b/jerry-core/parser/js/js-lexer.c
@@ -15,12 +15,13 @@
#include "ecma-alloc.h"
#include "ecma-bigint.h"
-#include "ecma-helpers.h"
#include "ecma-function-object.h"
+#include "ecma-helpers.h"
#include "ecma-literal-storage.h"
+
+#include "jcontext.h"
#include "js-parser-internal.h"
#include "lit-char-helpers.h"
-#include "jcontext.h"
#if JERRY_PARSER
@@ -40,7 +41,7 @@ JERRY_STATIC_ASSERT (LEXER_NUMBER_BINARY > LEXER_NUMBER_OCTAL,
/**
* Check whether the UTF-8 intermediate is an octet or not
*/
-#define IS_UTF8_INTERMEDIATE_OCTET(byte) (((byte) & LIT_UTF8_EXTRA_BYTE_MASK) == LIT_UTF8_2_BYTE_CODE_POINT_MIN)
+#define IS_UTF8_INTERMEDIATE_OCTET(byte) (((byte) &LIT_UTF8_EXTRA_BYTE_MASK) == LIT_UTF8_2_BYTE_CODE_POINT_MIN)
/**
* Align column to the next tab position.
@@ -87,8 +88,7 @@ lexer_hex_to_code_point (const uint8_t *source_p, /**< current source position *
return UINT32_MAX;
}
}
- }
- while (--length > 0);
+ } while (--length > 0);
return result;
} /* lexer_hex_to_code_point */
@@ -140,8 +140,7 @@ lexer_hex_in_braces_to_code_point (const uint8_t *source_p, /**< current source
return UINT32_MAX;
}
length++;
- }
- while (*source_p != LIT_CHAR_RIGHT_BRACE);
+ } while (*source_p != LIT_CHAR_RIGHT_BRACE);
*length_p = length;
return result;
@@ -214,9 +213,9 @@ lexer_unchecked_hex_to_character (const uint8_t **source_p) /**< [in, out] curre
*/
typedef enum
{
- LEXER_SKIP_SPACES, /**< skip spaces mode */
- LEXER_SKIP_SINGLE_LINE_COMMENT, /**< parse single line comment */
- LEXER_SKIP_MULTI_LINE_COMMENT, /**< parse multi line comment */
+ LEXER_SKIP_SPACES, /**< skip spaces mode */
+ LEXER_SKIP_SINGLE_LINE_COMMENT, /**< parse single line comment */
+ LEXER_SKIP_MULTI_LINE_COMMENT, /**< parse multi line comment */
} skip_mode_t;
/**
@@ -251,8 +250,7 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
{
case LIT_CHAR_CR:
{
- if (context_p->source_p + 1 < source_end_p
- && context_p->source_p[1] == LIT_CHAR_LF)
+ if (context_p->source_p + 1 < source_end_p && context_p->source_p[1] == LIT_CHAR_LF)
{
context_p->source_p++;
}
@@ -290,8 +288,7 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
case LIT_CHAR_SLASH:
{
- if (mode == LEXER_SKIP_SPACES
- && context_p->source_p + 1 < source_end_p)
+ if (mode == LEXER_SKIP_SPACES && context_p->source_p + 1 < source_end_p)
{
if (context_p->source_p[1] == LIT_CHAR_SLASH)
{
@@ -316,8 +313,7 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
case LIT_CHAR_ASTERISK:
{
- if (mode == LEXER_SKIP_MULTI_LINE_COMMENT
- && context_p->source_p + 1 < source_end_p
+ if (mode == LEXER_SKIP_MULTI_LINE_COMMENT && context_p->source_p + 1 < source_end_p
&& context_p->source_p[1] == LIT_CHAR_SLASH)
{
mode = LEXER_SKIP_SPACES;
@@ -330,8 +326,7 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
case 0xc2:
{
- if (context_p->source_p + 1 < source_end_p
- && context_p->source_p[1] == 0xa0)
+ if (context_p->source_p + 1 < source_end_p && context_p->source_p[1] == 0xa0)
{
/* Codepoint \u00A0 */
context_p->source_p += 2;
@@ -363,9 +358,7 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
case 0xef:
{
- if (context_p->source_p + 2 < source_end_p
- && context_p->source_p[1] == 0xbb
- && context_p->source_p[2] == 0xbf)
+ if (context_p->source_p + 2 < source_end_p && context_p->source_p[1] == 0xbb && context_p->source_p[2] == 0xbf)
{
/* Codepoint \uFEFF */
context_p->source_p += 3;
@@ -388,8 +381,7 @@ lexer_skip_spaces (parser_context_t *context_p) /**< context */
context_p->source_p++;
- if (context_p->source_p < source_end_p
- && !IS_UTF8_INTERMEDIATE_OCTET (context_p->source_p[0]))
+ if (context_p->source_p < source_end_p && !IS_UTF8_INTERMEDIATE_OCTET (context_p->source_p[0]))
{
context_p->column++;
}
@@ -406,8 +398,7 @@ lexer_skip_empty_statements (parser_context_t *context_p) /**< context */
{
lexer_skip_spaces (context_p);
- while (context_p->source_p < context_p->source_end_p
- && *context_p->source_p == LIT_CHAR_SEMICOLON)
+ while (context_p->source_p < context_p->source_end_p && *context_p->source_p == LIT_CHAR_SEMICOLON)
{
lexer_consume_next_character (context_p);
lexer_skip_spaces (context_p);
@@ -423,14 +414,13 @@ lexer_skip_empty_statements (parser_context_t *context_p) /**< context */
* Checks whether the keyword has escape sequences.
*/
#define LEXER_CHECK_INVALID_KEYWORD(ident_start_p, buffer_p) \
- (JERRY_UNLIKELY ((ident_start_p) == (buffer_p)) \
+ (JERRY_UNLIKELY ((ident_start_p) == (buffer_p)) \
&& !(context_p->global_status_flags & ECMA_PARSE_INTERNAL_PRE_SCANNING))
-#else /* !JERRY_ESNEXT */
+#else /* !JERRY_ESNEXT */
/**
* Checks whether the keyword has escape sequences.
*/
-#define LEXER_CHECK_INVALID_KEYWORD(ident_start_p, buffer_p) \
- (JERRY_UNLIKELY ((ident_start_p) == (buffer_p)))
+#define LEXER_CHECK_INVALID_KEYWORD(ident_start_p, buffer_p) (JERRY_UNLIKELY ((ident_start_p) == (buffer_p)))
#endif /* JERRY_ESNEXT */
/**
@@ -439,14 +429,17 @@ lexer_skip_empty_statements (parser_context_t *context_p) /**< context */
typedef struct
{
const uint8_t *keyword_p; /**< keyword string */
- lexer_token_type_t type; /**< keyword token type */
+ lexer_token_type_t type; /**< keyword token type */
} keyword_string_t;
/**
* @{
* Keyword defines
*/
-#define LEXER_KEYWORD(name, type) { (const uint8_t *) (name), (type) }
+#define LEXER_KEYWORD(name, type) \
+ { \
+ (const uint8_t *) (name), (type) \
+ }
#define LEXER_KEYWORD_LIST_LENGTH(name) (const uint8_t) (sizeof ((name)) / sizeof ((name)[0]))
/** @} */
@@ -463,8 +456,7 @@ typedef struct
/**
* Keywords with 2 characters.
*/
-static const keyword_string_t keywords_with_length_2[] =
-{
+static const keyword_string_t keywords_with_length_2[] = {
LEXER_KEYWORD ("do", LEXER_KEYW_DO),
LEXER_KEYWORD ("if", LEXER_KEYW_IF),
LEXER_KEYWORD ("in", LEXER_KEYW_IN),
@@ -473,86 +465,62 @@ static const keyword_string_t keywords_with_length_2[] =
/**
* Keywords with 3 characters.
*/
-static const keyword_string_t keywords_with_length_3[] =
-{
- LEXER_KEYWORD ("for", LEXER_KEYW_FOR),
- LEXER_KEYWORD ("let", LEXER_KEYW_LET),
- LEXER_KEYWORD ("new", LEXER_KEYW_NEW),
- LEXER_KEYWORD ("try", LEXER_KEYW_TRY),
- LEXER_KEYWORD ("var", LEXER_KEYW_VAR),
+static const keyword_string_t keywords_with_length_3[] = {
+ LEXER_KEYWORD ("for", LEXER_KEYW_FOR), LEXER_KEYWORD ("let", LEXER_KEYW_LET), LEXER_KEYWORD ("new", LEXER_KEYW_NEW),
+ LEXER_KEYWORD ("try", LEXER_KEYW_TRY), LEXER_KEYWORD ("var", LEXER_KEYW_VAR),
};
/**
* Keywords with 4 characters.
*/
-static const keyword_string_t keywords_with_length_4[] =
-{
- LEXER_KEYWORD ("case", LEXER_KEYW_CASE),
- LEXER_KEYWORD ("else", LEXER_KEYW_ELSE),
- LEXER_KEYWORD ("enum", LEXER_KEYW_ENUM),
- LEXER_KEYWORD ("eval", LEXER_KEYW_EVAL),
+static const keyword_string_t keywords_with_length_4[] = {
+ LEXER_KEYWORD ("case", LEXER_KEYW_CASE), LEXER_KEYWORD ("else", LEXER_KEYW_ELSE),
+ LEXER_KEYWORD ("enum", LEXER_KEYW_ENUM), LEXER_KEYWORD ("eval", LEXER_KEYW_EVAL),
#if JERRY_MODULE_SYSTEM
LEXER_KEYWORD ("meta", LEXER_KEYW_META),
#endif /* JERRY_MODULE_SYSTEM */
- LEXER_KEYWORD ("null", LEXER_LIT_NULL),
- LEXER_KEYWORD ("this", LEXER_KEYW_THIS),
- LEXER_KEYWORD ("true", LEXER_LIT_TRUE),
- LEXER_KEYWORD ("void", LEXER_KEYW_VOID),
+ LEXER_KEYWORD ("null", LEXER_LIT_NULL), LEXER_KEYWORD ("this", LEXER_KEYW_THIS),
+ LEXER_KEYWORD ("true", LEXER_LIT_TRUE), LEXER_KEYWORD ("void", LEXER_KEYW_VOID),
LEXER_KEYWORD ("with", LEXER_KEYW_WITH),
};
/**
* Keywords with 5 characters.
*/
-static const keyword_string_t keywords_with_length_5[] =
-{
+static const keyword_string_t keywords_with_length_5[] = {
#if JERRY_ESNEXT
- LEXER_KEYWORD ("async", LEXER_KEYW_ASYNC),
- LEXER_KEYWORD ("await", LEXER_KEYW_AWAIT),
+ LEXER_KEYWORD ("async", LEXER_KEYW_ASYNC), LEXER_KEYWORD ("await", LEXER_KEYW_AWAIT),
#endif /* JERRY_ESNEXT */
- LEXER_KEYWORD ("break", LEXER_KEYW_BREAK),
- LEXER_KEYWORD ("catch", LEXER_KEYW_CATCH),
- LEXER_KEYWORD ("class", LEXER_KEYW_CLASS),
- LEXER_KEYWORD ("const", LEXER_KEYW_CONST),
- LEXER_KEYWORD ("false", LEXER_LIT_FALSE),
- LEXER_KEYWORD ("super", LEXER_KEYW_SUPER),
- LEXER_KEYWORD ("throw", LEXER_KEYW_THROW),
- LEXER_KEYWORD ("while", LEXER_KEYW_WHILE),
+ LEXER_KEYWORD ("break", LEXER_KEYW_BREAK), LEXER_KEYWORD ("catch", LEXER_KEYW_CATCH),
+ LEXER_KEYWORD ("class", LEXER_KEYW_CLASS), LEXER_KEYWORD ("const", LEXER_KEYW_CONST),
+ LEXER_KEYWORD ("false", LEXER_LIT_FALSE), LEXER_KEYWORD ("super", LEXER_KEYW_SUPER),
+ LEXER_KEYWORD ("throw", LEXER_KEYW_THROW), LEXER_KEYWORD ("while", LEXER_KEYW_WHILE),
LEXER_KEYWORD ("yield", LEXER_KEYW_YIELD),
};
/**
* Keywords with 6 characters.
*/
-static const keyword_string_t keywords_with_length_6[] =
-{
- LEXER_KEYWORD ("delete", LEXER_KEYW_DELETE),
- LEXER_KEYWORD ("export", LEXER_KEYW_EXPORT),
- LEXER_KEYWORD ("import", LEXER_KEYW_IMPORT),
- LEXER_KEYWORD ("public", LEXER_KEYW_PUBLIC),
- LEXER_KEYWORD ("return", LEXER_KEYW_RETURN),
- LEXER_KEYWORD ("static", LEXER_KEYW_STATIC),
- LEXER_KEYWORD ("switch", LEXER_KEYW_SWITCH),
- LEXER_KEYWORD ("typeof", LEXER_KEYW_TYPEOF),
+static const keyword_string_t keywords_with_length_6[] = {
+ LEXER_KEYWORD ("delete", LEXER_KEYW_DELETE), LEXER_KEYWORD ("export", LEXER_KEYW_EXPORT),
+ LEXER_KEYWORD ("import", LEXER_KEYW_IMPORT), LEXER_KEYWORD ("public", LEXER_KEYW_PUBLIC),
+ LEXER_KEYWORD ("return", LEXER_KEYW_RETURN), LEXER_KEYWORD ("static", LEXER_KEYW_STATIC),
+ LEXER_KEYWORD ("switch", LEXER_KEYW_SWITCH), LEXER_KEYWORD ("typeof", LEXER_KEYW_TYPEOF),
};
/**
* Keywords with 7 characters.
*/
-static const keyword_string_t keywords_with_length_7[] =
-{
- LEXER_KEYWORD ("default", LEXER_KEYW_DEFAULT),
- LEXER_KEYWORD ("extends", LEXER_KEYW_EXTENDS),
- LEXER_KEYWORD ("finally", LEXER_KEYW_FINALLY),
- LEXER_KEYWORD ("package", LEXER_KEYW_PACKAGE),
+static const keyword_string_t keywords_with_length_7[] = {
+ LEXER_KEYWORD ("default", LEXER_KEYW_DEFAULT), LEXER_KEYWORD ("extends", LEXER_KEYW_EXTENDS),
+ LEXER_KEYWORD ("finally", LEXER_KEYW_FINALLY), LEXER_KEYWORD ("package", LEXER_KEYW_PACKAGE),
LEXER_KEYWORD ("private", LEXER_KEYW_PRIVATE),
};
/**
* Keywords with 8 characters.
*/
-static const keyword_string_t keywords_with_length_8[] =
-{
+static const keyword_string_t keywords_with_length_8[] = {
LEXER_KEYWORD ("continue", LEXER_KEYW_CONTINUE),
LEXER_KEYWORD ("debugger", LEXER_KEYW_DEBUGGER),
LEXER_KEYWORD ("function", LEXER_KEYW_FUNCTION),
@@ -561,8 +529,7 @@ static const keyword_string_t keywords_with_length_8[] =
/**
* Keywords with 9 characters.
*/
-static const keyword_string_t keywords_with_length_9[] =
-{
+static const keyword_string_t keywords_with_length_9[] = {
LEXER_KEYWORD ("arguments", LEXER_KEYW_ARGUMENTS),
LEXER_KEYWORD ("interface", LEXER_KEYW_INTERFACE),
LEXER_KEYWORD ("protected", LEXER_KEYW_PROTECTED),
@@ -571,8 +538,7 @@ static const keyword_string_t keywords_with_length_9[] =
/**
* Keywords with 10 characters.
*/
-static const keyword_string_t keywords_with_length_10[] =
-{
+static const keyword_string_t keywords_with_length_10[] = {
LEXER_KEYWORD ("implements", LEXER_KEYW_IMPLEMENTS),
LEXER_KEYWORD ("instanceof", LEXER_KEYW_INSTANCEOF),
};
@@ -580,36 +546,24 @@ static const keyword_string_t keywords_with_length_10[] =
/**
* List of the keyword groups.
*/
-static const keyword_string_t * const keyword_strings_list[] =
-{
- keywords_with_length_2,
- keywords_with_length_3,
- keywords_with_length_4,
- keywords_with_length_5,
- keywords_with_length_6,
- keywords_with_length_7,
- keywords_with_length_8,
- keywords_with_length_9,
- keywords_with_length_10
-};
+static const keyword_string_t *const keyword_strings_list[] = { keywords_with_length_2, keywords_with_length_3,
+ keywords_with_length_4, keywords_with_length_5,
+ keywords_with_length_6, keywords_with_length_7,
+ keywords_with_length_8, keywords_with_length_9,
+ keywords_with_length_10 };
JERRY_STATIC_ASSERT (sizeof (keyword_strings_list) / sizeof (const keyword_string_t *)
- == (LEXER_KEYWORD_MAX_LENGTH - LEXER_KEYWORD_MIN_LENGTH) + 1,
+ == (LEXER_KEYWORD_MAX_LENGTH - LEXER_KEYWORD_MIN_LENGTH) + 1,
keyword_strings_list_size_must_equal_to_keyword_max_length_difference);
/**
* List of the keyword groups length.
*/
-static const uint8_t keyword_lengths_list[] =
-{
- LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_2),
- LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_3),
- LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_4),
- LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_5),
- LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_6),
- LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_7),
- LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_8),
- LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_9),
+static const uint8_t keyword_lengths_list[] = {
+ LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_2), LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_3),
+ LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_4), LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_5),
+ LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_6), LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_7),
+ LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_8), LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_9),
LEXER_KEYWORD_LIST_LENGTH (keywords_with_length_10)
};
@@ -717,9 +671,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
status_flags &= (uint32_t) ~LEXER_LIT_LOCATION_IS_ASCII;
#if JERRY_ESNEXT
- utf8_length = lit_read_code_point_from_utf8 (source_p,
- (lit_utf8_size_t) (source_end_p - source_p),
- &code_point);
+ utf8_length = lit_read_code_point_from_utf8 (source_p, (lit_utf8_size_t) (source_end_p - source_p), &code_point);
decoded_length = utf8_length;
/* Only ES2015+ supports code points outside of the basic plane which can be part of an identifier. */
@@ -727,14 +679,11 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
&& source_p + 3 < source_end_p)
{
lit_code_point_t low_surrogate;
- lit_read_code_point_from_utf8 (source_p + 3,
- (lit_utf8_size_t) (source_end_p - (source_p + 3)),
- &low_surrogate);
+ lit_read_code_point_from_utf8 (source_p + 3, (lit_utf8_size_t) (source_end_p - (source_p + 3)), &low_surrogate);
if (low_surrogate >= LIT_UTF16_LOW_SURROGATE_MIN && low_surrogate <= LIT_UTF16_LOW_SURROGATE_MAX)
{
- code_point = lit_convert_surrogate_pair_to_code_point ((ecma_char_t) code_point,
- (ecma_char_t) low_surrogate);
+ code_point = lit_convert_surrogate_pair_to_code_point ((ecma_char_t) code_point, (ecma_char_t) low_surrogate);
utf8_length = 2 * 3;
decoded_length = 2 * 3;
char_count = 2;
@@ -751,9 +700,8 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
#else /* !JERRY_ESNEXT */
if (code_point < LIT_UTF8_4_BYTE_MARKER)
{
- utf8_length = lit_read_code_point_from_utf8 (source_p,
- (lit_utf8_size_t) (source_end_p - source_p),
- &code_point);
+ utf8_length =
+ lit_read_code_point_from_utf8 (source_p, (lit_utf8_size_t) (source_end_p - source_p), &code_point);
decoded_length = utf8_length;
}
else
@@ -790,8 +738,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
source_p += utf8_length;
length += decoded_length;
PARSER_PLUS_EQUAL_LC (column, char_count);
- }
- while (source_p < source_end_p);
+ } while (source_p < source_end_p);
JERRY_ASSERT (length > 0);
@@ -928,8 +875,7 @@ lexer_parse_identifier (parser_context_t *context_p, /**< context */
}
middle = (start + end) / 2;
- }
- while (start < end);
+ } while (start < end);
}
context_p->source_p = source_p;
@@ -1000,8 +946,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
if (*source_p == LIT_CHAR_CR)
{
source_p++;
- if (source_p < source_end_p
- && *source_p == LIT_CHAR_LF)
+ if (source_p < source_end_p && *source_p == LIT_CHAR_LF)
{
#if JERRY_ESNEXT
raw_length_adjust--;
@@ -1041,8 +986,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
}
#endif /* JERRY_ESNEXT */
- if (*source_p == LIT_CHAR_0
- && source_p + 1 < source_end_p
+ if (*source_p == LIT_CHAR_0 && source_p + 1 < source_end_p
&& (*(source_p + 1) < LIT_CHAR_0 || *(source_p + 1) > LIT_CHAR_9))
{
source_p++;
@@ -1060,7 +1004,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
{
parser_raise_error (context_p, PARSER_ERR_TEMPLATE_STR_OCTAL_ESCAPE);
}
-#endif
+#endif /* JERRY_ESNEXT */
if (context_p->status_flags & PARSER_IS_STRICT)
{
@@ -1121,9 +1065,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
lit_code_point_t code_point = UINT32_MAX;
#if JERRY_ESNEXT
- if (source_p + 4 <= source_end_p
- && source_p[0] == LIT_CHAR_LOWERCASE_U
- && source_p[1] == LIT_CHAR_LEFT_BRACE)
+ if (source_p + 4 <= source_end_p && source_p[0] == LIT_CHAR_LOWERCASE_U && source_p[1] == LIT_CHAR_LEFT_BRACE)
{
code_point = lexer_hex_in_braces_to_code_point (source_p + 2, source_end_p, &escape_length);
escape_length--;
@@ -1154,10 +1096,8 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
}
}
#if JERRY_ESNEXT
- else if (str_end_character == LIT_CHAR_GRAVE_ACCENT &&
- source_p[0] == LIT_CHAR_DOLLAR_SIGN &&
- source_p + 1 < source_end_p &&
- source_p[1] == LIT_CHAR_LEFT_BRACE)
+ else if (str_end_character == LIT_CHAR_GRAVE_ACCENT && source_p[0] == LIT_CHAR_DOLLAR_SIGN
+ && source_p + 1 < source_end_p && source_p[1] == LIT_CHAR_LEFT_BRACE)
{
raw_length_adjust--;
source_p++;
@@ -1206,8 +1146,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
status_flags = LEXER_LIT_LOCATION_HAS_ESCAPE;
source_p++;
length++;
- if (source_p < source_end_p
- && *source_p == LIT_CHAR_LF)
+ if (source_p < source_end_p && *source_p == LIT_CHAR_LF)
{
source_p++;
raw_length_adjust--;
@@ -1241,8 +1180,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
column++;
length++;
- while (source_p < source_end_p
- && IS_UTF8_INTERMEDIATE_OCTET (*source_p))
+ while (source_p < source_end_p && IS_UTF8_INTERMEDIATE_OCTET (*source_p))
{
source_p++;
length++;
@@ -1262,8 +1200,7 @@ lexer_parse_string (parser_context_t *context_p, /**< context */
}
#if JERRY_ESNEXT
- context_p->token.type = ((str_end_character != LIT_CHAR_GRAVE_ACCENT) ? LEXER_LITERAL
- : LEXER_TEMPLATE_LITERAL);
+ context_p->token.type = ((str_end_character != LIT_CHAR_GRAVE_ACCENT) ? LEXER_LITERAL : LEXER_TEMPLATE_LITERAL);
#else /* !JERRY_ESNEXT */
context_p->token.type = LEXER_LITERAL;
#endif /* JERRY_ESNEXT */
@@ -1295,9 +1232,7 @@ lexer_check_numbers (parser_context_t *context_p, /**< context */
#endif /* !JERRY_ESNEXT */
while (true)
{
- while (*source_p < source_end_p
- && *source_p[0] >= LIT_CHAR_0
- && *source_p[0] <= digit_max)
+ while (*source_p < source_end_p && *source_p[0] >= LIT_CHAR_0 && *source_p[0] <= digit_max)
{
*source_p += 1;
}
@@ -1305,10 +1240,7 @@ lexer_check_numbers (parser_context_t *context_p, /**< context */
if (*source_p != source_end_p && *source_p[0] == LIT_CHAR_UNDERSCORE)
{
*source_p += 1;
- if (is_legacy
- || *source_p == source_end_p
- || *source_p[0] == LIT_CHAR_UNDERSCORE
- || *source_p[0] > digit_max
+ if (is_legacy || *source_p == source_end_p || *source_p[0] == LIT_CHAR_UNDERSCORE || *source_p[0] > digit_max
|| *source_p[0] < LIT_CHAR_0)
{
parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);
@@ -1341,8 +1273,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
context_p->token.lit_location.type = LEXER_NUMBER_LITERAL;
context_p->token.lit_location.status_flags = LEXER_LIT_LOCATION_IS_ASCII;
- if (source_p[0] == LIT_CHAR_0
- && source_p + 1 < source_end_p)
+ if (source_p[0] == LIT_CHAR_0 && source_p + 1 < source_end_p)
{
#if JERRY_ESNEXT
if (source_p[1] == LIT_CHAR_UNDERSCORE)
@@ -1355,8 +1286,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
context_p->token.extra_value = LEXER_NUMBER_HEXADECIMAL;
source_p += 2;
- if (source_p >= source_end_p
- || !lit_char_is_hex_digit (source_p[0]))
+ if (source_p >= source_end_p || !lit_char_is_hex_digit (source_p[0]))
{
parser_raise_error (context_p, PARSER_ERR_INVALID_HEX_DIGIT);
}
@@ -1374,9 +1304,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
}
}
#endif /* JERRY_ESNEXT */
- }
- while (source_p < source_end_p
- && lit_char_is_hex_digit (source_p[0]));
+ } while (source_p < source_end_p && lit_char_is_hex_digit (source_p[0]));
}
#if JERRY_ESNEXT
else if (LEXER_TO_ASCII_LOWERCASE (source_p[1]) == LIT_CHAR_LOWERCASE_O)
@@ -1384,8 +1312,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
context_p->token.extra_value = LEXER_NUMBER_OCTAL;
source_p += 2;
- if (source_p >= source_end_p
- || !lit_char_is_octal_digit (source_p[0]))
+ if (source_p >= source_end_p || !lit_char_is_octal_digit (source_p[0]))
{
parser_raise_error (context_p, PARSER_ERR_INVALID_OCTAL_DIGIT);
}
@@ -1393,8 +1320,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_7, false);
}
#endif /* JERRY_ESNEXT */
- else if (source_p[1] >= LIT_CHAR_0
- && source_p[1] <= LIT_CHAR_9)
+ else if (source_p[1] >= LIT_CHAR_0 && source_p[1] <= LIT_CHAR_9)
{
context_p->token.extra_value = LEXER_NUMBER_OCTAL;
#if JERRY_BUILTIN_BIGINT
@@ -1408,9 +1334,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_7, true);
- if (source_p < source_end_p
- && source_p[0] >= LIT_CHAR_8
- && source_p[0] <= LIT_CHAR_9)
+ if (source_p < source_end_p && source_p[0] >= LIT_CHAR_8 && source_p[0] <= LIT_CHAR_9)
{
#if JERRY_ESNEXT
lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_9, true);
@@ -1426,8 +1350,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
context_p->token.extra_value = LEXER_NUMBER_BINARY;
source_p += 2;
- if (source_p >= source_end_p
- || !lit_char_is_binary_digit (source_p[0]))
+ if (source_p >= source_end_p || !lit_char_is_binary_digit (source_p[0]))
{
parser_raise_error (context_p, PARSER_ERR_INVALID_BIN_DIGIT);
}
@@ -1438,16 +1361,12 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
if (source_p < source_end_p && source_p[0] == LIT_CHAR_UNDERSCORE)
{
source_p++;
- if (source_p == source_end_p
- || source_p[0] > LIT_CHAR_9
- || source_p[0] < LIT_CHAR_0)
+ if (source_p == source_end_p || source_p[0] > LIT_CHAR_9 || source_p[0] < LIT_CHAR_0)
{
parser_raise_error (context_p, PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER);
}
}
- }
- while (source_p < source_end_p
- && lit_char_is_binary_digit (source_p[0]));
+ } while (source_p < source_end_p && lit_char_is_binary_digit (source_p[0]));
}
#endif /* JERRY_ESNEXT */
else
@@ -1464,8 +1383,7 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
if (can_be_float)
{
- if (source_p < source_end_p
- && source_p[0] == LIT_CHAR_DOT)
+ if (source_p < source_end_p && source_p[0] == LIT_CHAR_DOT)
{
source_p++;
#if JERRY_BUILTIN_BIGINT
@@ -1481,23 +1399,19 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
lexer_check_numbers (context_p, &source_p, source_end_p, LIT_CHAR_9, false);
}
- if (source_p < source_end_p
- && LEXER_TO_ASCII_LOWERCASE (source_p[0]) == LIT_CHAR_LOWERCASE_E)
+ if (source_p < source_end_p && LEXER_TO_ASCII_LOWERCASE (source_p[0]) == LIT_CHAR_LOWERCASE_E)
{
source_p++;
#if JERRY_BUILTIN_BIGINT
can_be_bigint = false;
#endif /* JERRY_BUILTIN_BIGINT */
- if (source_p < source_end_p
- && (source_p[0] == LIT_CHAR_PLUS || source_p[0] == LIT_CHAR_MINUS))
+ if (source_p < source_end_p && (source_p[0] == LIT_CHAR_PLUS || source_p[0] == LIT_CHAR_MINUS))
{
source_p++;
}
- if (source_p >= source_end_p
- || source_p[0] < LIT_CHAR_0
- || source_p[0] > LIT_CHAR_9)
+ if (source_p >= source_end_p || source_p[0] < LIT_CHAR_0 || source_p[0] > LIT_CHAR_9)
{
parser_raise_error (context_p, PARSER_ERR_MISSING_EXPONENT);
}
@@ -1541,11 +1455,11 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
* @param type1 type
*/
#define LEXER_TYPE_A_TOKEN(char1, type1) \
- case (uint8_t) (char1): \
- { \
- context_p->token.type = (type1); \
- length = 1; \
- break; \
+ case (uint8_t) (char1): \
+ { \
+ context_p->token.type = (type1); \
+ length = 1; \
+ break; \
}
/**
@@ -1556,19 +1470,19 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
* @param char2 second character
* @param type2 type of the second character
*/
-#define LEXER_TYPE_B_TOKEN(char1, type1, char2, type2) \
- case (uint8_t) (char1): \
- { \
+#define LEXER_TYPE_B_TOKEN(char1, type1, char2, type2) \
+ case (uint8_t) (char1): \
+ { \
if (length >= 2 && context_p->source_p[1] == (uint8_t) (char2)) \
- { \
- context_p->token.type = (type2); \
- length = 2; \
- break; \
- } \
- \
- context_p->token.type = (type1); \
- length = 1; \
- break; \
+ { \
+ context_p->token.type = (type2); \
+ length = 2; \
+ break; \
+ } \
+ \
+ context_p->token.type = (type1); \
+ length = 1; \
+ break; \
}
/**
@@ -1582,28 +1496,28 @@ lexer_parse_number (parser_context_t *context_p) /**< context */
* @param type3 type of the third character
*/
#define LEXER_TYPE_C_TOKEN(char1, type1, char2, type2, char3, type3) \
- case (uint8_t) (char1): \
- { \
- if (length >= 2) \
- { \
- if (context_p->source_p[1] == (uint8_t) (char2)) \
- { \
- context_p->token.type = (type2); \
- length = 2; \
- break; \
- } \
- \
- if (context_p->source_p[1] == (uint8_t) (char3)) \
- { \
- context_p->token.type = (type3); \
- length = 2; \
- break; \
- } \
- } \
- \
- context_p->token.type = (type1); \
- length = 1; \
- break; \
+ case (uint8_t) (char1): \
+ { \
+ if (length >= 2) \
+ { \
+ if (context_p->source_p[1] == (uint8_t) (char2)) \
+ { \
+ context_p->token.type = (type2); \
+ length = 2; \
+ break; \
+ } \
+ \
+ if (context_p->source_p[1] == (uint8_t) (char3)) \
+ { \
+ context_p->token.type = (type3); \
+ length = 2; \
+ break; \
+ } \
+ } \
+ \
+ context_p->token.type = (type1); \
+ length = 1; \
+ break; \
}
/**
@@ -1656,17 +1570,14 @@ lexer_next_token (parser_context_t *context_p) /**< context */
case (uint8_t) LIT_CHAR_DOT:
{
- if (length >= 2
- && (context_p->source_p[1] >= LIT_CHAR_0 && context_p->source_p[1] <= LIT_CHAR_9))
+ if (length >= 2 && (context_p->source_p[1] >= LIT_CHAR_0 && context_p->source_p[1] <= LIT_CHAR_9))
{
lexer_parse_number (context_p);
return;
}
#if JERRY_ESNEXT
- if (length >= 3
- && context_p->source_p[1] == LIT_CHAR_DOT
- && context_p->source_p[2] == LIT_CHAR_DOT)
+ if (length >= 3 && context_p->source_p[1] == LIT_CHAR_DOT && context_p->source_p[2] == LIT_CHAR_DOT)
{
context_p->token.type = LEXER_THREE_DOTS;
length = 3;
@@ -1812,10 +1723,13 @@ lexer_next_token (parser_context_t *context_p) /**< context */
break;
}
- LEXER_TYPE_C_TOKEN (LIT_CHAR_PLUS, LEXER_ADD, LIT_CHAR_EQUALS,
- LEXER_ASSIGN_ADD, LIT_CHAR_PLUS, LEXER_INCREASE)
- LEXER_TYPE_C_TOKEN (LIT_CHAR_MINUS, LEXER_SUBTRACT, LIT_CHAR_EQUALS,
- LEXER_ASSIGN_SUBTRACT, LIT_CHAR_MINUS, LEXER_DECREASE)
+ LEXER_TYPE_C_TOKEN (LIT_CHAR_PLUS, LEXER_ADD, LIT_CHAR_EQUALS, LEXER_ASSIGN_ADD, LIT_CHAR_PLUS, LEXER_INCREASE)
+ LEXER_TYPE_C_TOKEN (LIT_CHAR_MINUS,
+ LEXER_SUBTRACT,
+ LIT_CHAR_EQUALS,
+ LEXER_ASSIGN_SUBTRACT,
+ LIT_CHAR_MINUS,
+ LEXER_DECREASE)
case (uint8_t) LIT_CHAR_ASTERISK:
{
@@ -1850,20 +1764,25 @@ lexer_next_token (parser_context_t *context_p) /**< context */
break;
}
- LEXER_TYPE_B_TOKEN (LIT_CHAR_SLASH, LEXER_DIVIDE, LIT_CHAR_EQUALS,
- LEXER_ASSIGN_DIVIDE)
- LEXER_TYPE_B_TOKEN (LIT_CHAR_PERCENT, LEXER_MODULO, LIT_CHAR_EQUALS,
- LEXER_ASSIGN_MODULO)
+ LEXER_TYPE_B_TOKEN (LIT_CHAR_SLASH, LEXER_DIVIDE, LIT_CHAR_EQUALS, LEXER_ASSIGN_DIVIDE)
+ LEXER_TYPE_B_TOKEN (LIT_CHAR_PERCENT, LEXER_MODULO, LIT_CHAR_EQUALS, LEXER_ASSIGN_MODULO)
- LEXER_TYPE_C_TOKEN (LIT_CHAR_AMPERSAND, LEXER_BIT_AND, LIT_CHAR_EQUALS,
- LEXER_ASSIGN_BIT_AND, LIT_CHAR_AMPERSAND, LEXER_LOGICAL_AND)
- LEXER_TYPE_C_TOKEN (LIT_CHAR_VLINE, LEXER_BIT_OR, LIT_CHAR_EQUALS,
- LEXER_ASSIGN_BIT_OR, LIT_CHAR_VLINE, LEXER_LOGICAL_OR)
+ LEXER_TYPE_C_TOKEN (LIT_CHAR_AMPERSAND,
+ LEXER_BIT_AND,
+ LIT_CHAR_EQUALS,
+ LEXER_ASSIGN_BIT_AND,
+ LIT_CHAR_AMPERSAND,
+ LEXER_LOGICAL_AND)
+ LEXER_TYPE_C_TOKEN (LIT_CHAR_VLINE,
+ LEXER_BIT_OR,
+ LIT_CHAR_EQUALS,
+ LEXER_ASSIGN_BIT_OR,
+ LIT_CHAR_VLINE,
+ LEXER_LOGICAL_OR)
- LEXER_TYPE_B_TOKEN (LIT_CHAR_CIRCUMFLEX, LEXER_BIT_XOR, LIT_CHAR_EQUALS,
- LEXER_ASSIGN_BIT_XOR)
+ LEXER_TYPE_B_TOKEN (LIT_CHAR_CIRCUMFLEX, LEXER_BIT_XOR, LIT_CHAR_EQUALS, LEXER_ASSIGN_BIT_XOR)
- LEXER_TYPE_A_TOKEN (LIT_CHAR_TILDE, LEXER_BIT_NOT);
+ LEXER_TYPE_A_TOKEN (LIT_CHAR_TILDE, LEXER_BIT_NOT);
case (uint8_t) (LIT_CHAR_QUESTION):
{
#if JERRY_ESNEXT
@@ -1882,7 +1801,7 @@ lexer_next_token (parser_context_t *context_p) /**< context */
break;
}
- LEXER_TYPE_A_TOKEN (LIT_CHAR_COLON, LEXER_COLON);
+ LEXER_TYPE_A_TOKEN (LIT_CHAR_COLON, LEXER_COLON);
case LIT_CHAR_SINGLE_QUOTE:
case LIT_CHAR_DOUBLE_QUOTE:
@@ -1925,8 +1844,7 @@ lexer_check_next_character (parser_context_t *context_p, /**< context */
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
}
- return (context_p->source_p < context_p->source_end_p
- && context_p->source_p[0] == (uint8_t) character);
+ return (context_p->source_p < context_p->source_end_p && context_p->source_p[0] == (uint8_t) character);
} /* lexer_check_next_character */
/**
@@ -1947,8 +1865,7 @@ lexer_check_next_characters (parser_context_t *context_p, /**< context */
}
return (context_p->source_p < context_p->source_end_p
- && (context_p->source_p[0] == (uint8_t) character1
- || context_p->source_p[0] == (uint8_t) character2));
+ && (context_p->source_p[0] == (uint8_t) character1 || context_p->source_p[0] == (uint8_t) character2));
} /* lexer_check_next_characters */
/**
@@ -2004,8 +1921,7 @@ lexer_check_post_primary_exp (parser_context_t *context_p) /**< context */
case LIT_CHAR_PLUS:
case LIT_CHAR_MINUS:
{
- return (!(context_p->token.flags & LEXER_WAS_NEWLINE)
- && context_p->source_p + 1 < context_p->source_end_p
+ return (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->source_p + 1 < context_p->source_end_p
&& context_p->source_p[1] == context_p->source_p[0]);
}
#if JERRY_ESNEXT
@@ -2036,8 +1952,7 @@ lexer_check_arrow (parser_context_t *context_p) /**< context */
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
}
- return (!(context_p->token.flags & LEXER_WAS_NEWLINE)
- && context_p->source_p + 2 <= context_p->source_end_p
+ return (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->source_p + 2 <= context_p->source_end_p
&& context_p->source_p[0] == (uint8_t) LIT_CHAR_EQUALS
&& context_p->source_p[1] == (uint8_t) LIT_CHAR_GREATER_THAN);
} /* lexer_check_arrow */
@@ -2067,8 +1982,7 @@ lexer_check_arrow_param (parser_context_t *context_p) /**< context */
return false;
}
- return (context_p->source_p + 1 >= context_p->source_end_p
- || context_p->source_p[1] != LIT_CHAR_EQUALS);
+ return (context_p->source_p + 1 >= context_p->source_end_p || context_p->source_p[1] != LIT_CHAR_EQUALS);
} /* lexer_check_arrow_param */
/**
@@ -2117,8 +2031,7 @@ lexer_consume_generator (parser_context_t *context_p) /**< context */
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
}
- if (context_p->source_p >= context_p->source_end_p
- || context_p->source_p[0] != LIT_CHAR_ASTERISK
+ if (context_p->source_p >= context_p->source_end_p || context_p->source_p[0] != LIT_CHAR_ASTERISK
|| (context_p->source_p + 1 < context_p->source_end_p
&& (context_p->source_p[1] == LIT_CHAR_EQUALS || context_p->source_p[1] == LIT_CHAR_ASTERISK)))
{
@@ -2144,8 +2057,7 @@ lexer_consume_assign (parser_context_t *context_p) /**< context */
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
}
- if (context_p->source_p >= context_p->source_end_p
- || context_p->source_p[0] != LIT_CHAR_EQUALS
+ if (context_p->source_p >= context_p->source_end_p || context_p->source_p[0] != LIT_CHAR_EQUALS
|| (context_p->source_p + 1 < context_p->source_end_p
&& (context_p->source_p[1] == LIT_CHAR_EQUALS || context_p->source_p[1] == LIT_CHAR_GREATER_THAN)))
{
@@ -2168,8 +2080,7 @@ lexer_update_await_yield (parser_context_t *context_p, /**< context */
{
if (status_flags & PARSER_IS_GENERATOR_FUNCTION)
{
- if (context_p->token.type == LEXER_LITERAL
- && context_p->token.keyword_type == LEXER_KEYW_YIELD)
+ if (context_p->token.type == LEXER_LITERAL && context_p->token.keyword_type == LEXER_KEYW_YIELD)
{
context_p->token.type = LEXER_KEYW_YIELD;
}
@@ -2188,8 +2099,7 @@ lexer_update_await_yield (parser_context_t *context_p, /**< context */
{
if (status_flags & PARSER_IS_ASYNC_FUNCTION)
{
- if (context_p->token.type == LEXER_LITERAL
- && context_p->token.keyword_type == LEXER_KEYW_AWAIT)
+ if (context_p->token.type == LEXER_LITERAL && context_p->token.keyword_type == LEXER_KEYW_AWAIT)
{
context_p->token.type = LEXER_KEYW_AWAIT;
}
@@ -2224,8 +2134,7 @@ lexer_convert_ident_to_cesu8 (uint8_t *destination_p, /**< destination string */
if (*source_p == LIT_CHAR_BACKSLASH)
{
source_p += 2;
- destination_p += lit_code_point_to_cesu8_bytes (destination_p,
- lexer_unchecked_hex_to_character (&source_p));
+ destination_p += lit_code_point_to_cesu8_bytes (destination_p, lexer_unchecked_hex_to_character (&source_p));
continue;
}
@@ -2241,8 +2150,7 @@ lexer_convert_ident_to_cesu8 (uint8_t *destination_p, /**< destination string */
#endif /* JERRY_ESNEXT */
*destination_p++ = *source_p++;
- }
- while (destination_p < destination_end_p);
+ } while (destination_p < destination_end_p);
} /* lexer_convert_ident_to_cesu8 */
/**
@@ -2379,8 +2287,7 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
if (*source_p == LIT_CHAR_LOWERCASE_X || *source_p == LIT_CHAR_LOWERCASE_U)
{
source_p++;
- destination_p += lit_code_point_to_cesu8_bytes (destination_p,
- lexer_unchecked_hex_to_character (&source_p));
+ destination_p += lit_code_point_to_cesu8_bytes (destination_p, lexer_unchecked_hex_to_character (&source_p));
continue;
}
@@ -2429,8 +2336,7 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
#if JERRY_ESNEXT
else if (str_end_character == LIT_CHAR_GRAVE_ACCENT)
{
- if (source_p[0] == LIT_CHAR_DOLLAR_SIGN
- && source_p[1] == LIT_CHAR_LEFT_BRACE)
+ if (source_p[0] == LIT_CHAR_DOLLAR_SIGN && source_p[1] == LIT_CHAR_LEFT_BRACE)
{
source_p++;
JERRY_ASSERT (source_p < context_p->source_end_p);
@@ -2440,8 +2346,7 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
{
*destination_p++ = LIT_CHAR_LF;
source_p++;
- if (*source_p != str_end_character
- && *source_p == LIT_CHAR_LF)
+ if (*source_p != str_end_character && *source_p == LIT_CHAR_LF)
{
source_p++;
}
@@ -2463,8 +2368,8 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
if (*source_p >= LIT_UTF8_4_BYTE_MARKER)
{
/* Processing 4 byte unicode sequence (even if it is
- * after a backslash). Always converted to two 3 byte
- * long sequence. */
+ * after a backslash). Always converted to two 3 byte
+ * long sequence. */
lit_four_byte_utf8_char_to_cesu8 (destination_p, source_p);
destination_p += 6;
@@ -2475,7 +2380,7 @@ lexer_convert_literal_to_chars (parser_context_t *context_p, /**< context */
*destination_p++ = *source_p++;
/* There is no need to check the source_end_p
- * since the string is terminated by a quotation mark. */
+ * since the string is terminated by a quotation mark. */
while (IS_UTF8_INTERMEDIATE_OCTET (*source_p))
{
*destination_p++ = *source_p++;
@@ -2518,10 +2423,8 @@ lexer_construct_literal_object (parser_context_t *context_p, /**< context */
{
uint8_t local_byte_array[LEXER_MAX_LITERAL_LOCAL_BUFFER_SIZE];
- const uint8_t *char_p = lexer_convert_literal_to_chars (context_p,
- lit_location_p,
- local_byte_array,
- LEXER_STRING_NO_OPTS);
+ const uint8_t *char_p =
+ lexer_convert_literal_to_chars (context_p, lit_location_p, local_byte_array, LEXER_STRING_NO_OPTS);
size_t length = lit_location_p->length;
parser_list_iterator_t literal_iterator;
@@ -2534,8 +2437,7 @@ lexer_construct_literal_object (parser_context_t *context_p, /**< context */
literal_type = LEXER_IDENT_LITERAL;
}
- JERRY_ASSERT (literal_type == LEXER_IDENT_LITERAL
- || literal_type == LEXER_STRING_LITERAL);
+ JERRY_ASSERT (literal_type == LEXER_IDENT_LITERAL || literal_type == LEXER_STRING_LITERAL);
JERRY_ASSERT (literal_type != LEXER_IDENT_LITERAL || length <= PARSER_MAXIMUM_IDENT_LENGTH);
JERRY_ASSERT (literal_type != LEXER_STRING_LITERAL || length <= PARSER_MAXIMUM_STRING_LENGTH);
@@ -2544,8 +2446,7 @@ lexer_construct_literal_object (parser_context_t *context_p, /**< context */
while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)
{
- if (literal_p->type == literal_type
- && literal_p->prop.length == length
+ if (literal_p->type == literal_type && literal_p->prop.length == length
&& memcmp (literal_p->u.char_p, char_p, length) == 0)
{
context_p->lit_object.literal_p = literal_p;
@@ -2656,11 +2557,9 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
if (context_p->token.extra_value < LEXER_NUMBER_OCTAL)
{
#if JERRY_ESNEXT
- num = ecma_utf8_string_to_number (context_p->token.lit_location.char_p,
- length,
- ECMA_CONVERSION_ALLOW_UNDERSCORE);
-#else
- num = ecma_utf8_string_to_number (context_p->token.lit_location.char_p, length, 0);
+ num = ecma_utf8_string_to_number (context_p->token.lit_location.char_p, length, ECMA_CONVERSION_ALLOW_UNDERSCORE);
+#else /* !JERRY_ESNEXT */
+ num = ecma_utf8_string_to_number (context_p->token.lit_location.char_p, length, 0);
#endif /* JERRY_ESNEXT */
}
else
@@ -2691,17 +2590,14 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
src_p++;
}
num = num * multiplier + (ecma_number_t) (*(++src_p) - LIT_CHAR_0);
- }
- while (src_p < src_end_p);
+ } while (src_p < src_end_p);
}
if (is_expr)
{
int32_t int_num = (int32_t) num;
- if (int_num == num
- && int_num <= CBC_PUSH_NUMBER_BYTE_RANGE_END
- && (int_num != 0 || !is_negative_number))
+ if (int_num == num && int_num <= CBC_PUSH_NUMBER_BYTE_RANGE_END && (int_num != 0 || !is_negative_number))
{
context_p->lit_object.index = (uint16_t) int_num;
return true;
@@ -2718,8 +2614,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
}
else
{
- uint32_t options = (ECMA_BIGINT_PARSE_DISALLOW_SYNTAX_ERROR
- | ECMA_BIGINT_PARSE_DISALLOW_MEMORY_ERROR
+ uint32_t options = (ECMA_BIGINT_PARSE_DISALLOW_SYNTAX_ERROR | ECMA_BIGINT_PARSE_DISALLOW_MEMORY_ERROR
| ECMA_BIGINT_PARSE_ALLOW_UNDERSCORE);
if (is_negative_number)
@@ -2728,9 +2623,8 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
}
JERRY_ASSERT (length >= 2);
- lit_value = ecma_bigint_parse_string (context_p->token.lit_location.char_p,
- (lit_utf8_size_t) (length - 1),
- options);
+ lit_value =
+ ecma_bigint_parse_string (context_p->token.lit_location.char_p, (lit_utf8_size_t) (length - 1), options);
JERRY_ASSERT (lit_value != ECMA_VALUE_FALSE && !ECMA_IS_VALUE_ERROR (lit_value));
@@ -2747,8 +2641,7 @@ lexer_construct_number_object (parser_context_t *context_p, /**< context */
while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)
{
- if (literal_p->type == LEXER_NUMBER_LITERAL
- && literal_p->u.value == lit_value)
+ if (literal_p->type == LEXER_NUMBER_LITERAL && literal_p->u.value == lit_value)
{
context_p->lit_object.literal_p = literal_p;
context_p->lit_object.index = (uint16_t) literal_index;
@@ -2787,8 +2680,7 @@ lexer_convert_push_number_to_push_literal (parser_context_t *context_p) /**< con
ecma_integer_value_t value;
bool two_literals = context_p->last_cbc_opcode >= CBC_PUSH_LITERAL_PUSH_NUMBER_0;
- if (context_p->last_cbc_opcode == CBC_PUSH_NUMBER_0
- || context_p->last_cbc_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_0)
+ if (context_p->last_cbc_opcode == CBC_PUSH_NUMBER_0 || context_p->last_cbc_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_0)
{
value = 0;
}
@@ -2816,8 +2708,7 @@ lexer_convert_push_number_to_push_literal (parser_context_t *context_p) /**< con
while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)) != NULL)
{
- if (literal_p->type == LEXER_NUMBER_LITERAL
- && literal_p->u.value == lit_value)
+ if (literal_p->type == LEXER_NUMBER_LITERAL && literal_p->u.value == lit_value)
{
if (two_literals)
{
@@ -2922,8 +2813,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
uint16_t current_flags;
lit_utf8_size_t length;
- JERRY_ASSERT (context_p->token.type == LEXER_DIVIDE
- || context_p->token.type == LEXER_ASSIGN_DIVIDE);
+ JERRY_ASSERT (context_p->token.type == LEXER_DIVIDE || context_p->token.type == LEXER_ASSIGN_DIVIDE);
if (context_p->token.type == LEXER_ASSIGN_DIVIDE)
{
@@ -2951,8 +2841,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
case LIT_CHAR_LF:
case LEXER_NEWLINE_LS_PS_BYTE_1:
{
- if (source_p[0] != LEXER_NEWLINE_LS_PS_BYTE_1
- || LEXER_NEWLINE_LS_PS_BYTE_23 (source_p))
+ if (source_p[0] != LEXER_NEWLINE_LS_PS_BYTE_1 || LEXER_NEWLINE_LS_PS_BYTE_23 (source_p))
{
parser_raise_error (context_p, PARSER_ERR_NEWLINE_NOT_ALLOWED);
}
@@ -2961,7 +2850,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
case LIT_CHAR_TAB:
{
column = align_column_to_tab (column);
- /* Subtract -1 because column is increased below. */
+ /* Subtract -1 because column is increased below. */
column--;
break;
}
@@ -2993,8 +2882,7 @@ lexer_construct_regexp_object (parser_context_t *context_p, /**< context */
source_p++;
column++;
- while (source_p < source_end_p
- && IS_UTF8_INTERMEDIATE_OCTET (source_p[0]))
+ while (source_p < source_end_p && IS_UTF8_INTERMEDIATE_OCTET (source_p[0]))
{
source_p++;
}
@@ -3119,8 +3007,7 @@ void
lexer_expect_identifier (parser_context_t *context_p, /**< context */
uint8_t literal_type) /**< literal type */
{
- JERRY_ASSERT (literal_type == LEXER_STRING_LITERAL
- || literal_type == LEXER_IDENT_LITERAL
+ JERRY_ASSERT (literal_type == LEXER_STRING_LITERAL || literal_type == LEXER_IDENT_LITERAL
|| literal_type == LEXER_NEW_IDENT_LITERAL);
lexer_skip_spaces (context_p);
@@ -3129,19 +3016,17 @@ lexer_expect_identifier (parser_context_t *context_p, /**< context */
context_p->token.column = context_p->column;
if (context_p->source_p < context_p->source_end_p
- && lexer_parse_identifier (context_p, (literal_type != LEXER_STRING_LITERAL ? LEXER_PARSE_CHECK_KEYWORDS
- : LEXER_PARSE_NO_OPTS)))
+ && lexer_parse_identifier (
+ context_p,
+ (literal_type != LEXER_STRING_LITERAL ? LEXER_PARSE_CHECK_KEYWORDS : LEXER_PARSE_NO_OPTS)))
{
if (context_p->token.type == LEXER_LITERAL)
{
JERRY_ASSERT (context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
- lexer_construct_literal_object (context_p,
- &context_p->token.lit_location,
- literal_type);
+ lexer_construct_literal_object (context_p, &context_p->token.lit_location, literal_type);
- if (literal_type != LEXER_STRING_LITERAL
- && (context_p->status_flags & PARSER_IS_STRICT))
+ if (literal_type != LEXER_STRING_LITERAL && (context_p->status_flags & PARSER_IS_STRICT))
{
if (context_p->token.keyword_type == LEXER_KEYW_EVAL)
{
@@ -3200,8 +3085,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
context_p->token.column = context_p->column;
bool create_literal_object = false;
- JERRY_ASSERT ((ident_opts & LEXER_OBJ_IDENT_CLASS_IDENTIFIER)
- || !(ident_opts & LEXER_OBJ_IDENT_CLASS_NO_STATIC));
+ JERRY_ASSERT ((ident_opts & LEXER_OBJ_IDENT_CLASS_IDENTIFIER) || !(ident_opts & LEXER_OBJ_IDENT_CLASS_NO_STATIC));
#if JERRY_FUNCTION_TO_STRING
if (ident_opts & LEXER_OBJ_IDENT_SET_FUNCTION_START)
@@ -3219,10 +3103,8 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
if (context_p->source_p < context_p->source_end_p
#if JERRY_ESNEXT
- && context_p->source_p[0] != LIT_CHAR_COMMA
- && context_p->source_p[0] != LIT_CHAR_RIGHT_BRACE
- && context_p->source_p[0] != LIT_CHAR_LEFT_PAREN
- && context_p->source_p[0] != LIT_CHAR_SEMICOLON
+ && context_p->source_p[0] != LIT_CHAR_COMMA && context_p->source_p[0] != LIT_CHAR_RIGHT_BRACE
+ && context_p->source_p[0] != LIT_CHAR_LEFT_PAREN && context_p->source_p[0] != LIT_CHAR_SEMICOLON
&& context_p->source_p[0] != LIT_CHAR_EQUALS
#endif /* JERRY_ESNEXT */
&& context_p->source_p[0] != LIT_CHAR_COLON)
@@ -3307,8 +3189,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
case LIT_CHAR_DOT:
{
if ((ident_opts & ((uint32_t) ~(LEXER_OBJ_IDENT_OBJECT_PATTERN | LEXER_OBJ_IDENT_SET_FUNCTION_START)))
- || context_p->source_p + 2 >= context_p->source_end_p
- || context_p->source_p[1] != LIT_CHAR_DOT
+ || context_p->source_p + 2 >= context_p->source_end_p || context_p->source_p[1] != LIT_CHAR_DOT
|| context_p->source_p[2] != LIT_CHAR_DOT)
{
break;
@@ -3341,9 +3222,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
char_p++;
}
- if (char_p < context_p->source_end_p
- && char_p[0] >= LIT_CHAR_0
- && char_p[0] <= LIT_CHAR_9)
+ if (char_p < context_p->source_end_p && char_p[0] >= LIT_CHAR_0 && char_p[0] <= LIT_CHAR_9)
{
lexer_parse_number (context_p);
@@ -3367,9 +3246,7 @@ lexer_expect_object_literal_id (parser_context_t *context_p, /**< context */
}
#endif /* JERRY_ESNEXT */
- lexer_construct_literal_object (context_p,
- &context_p->token.lit_location,
- LEXER_STRING_LITERAL);
+ lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_STRING_LITERAL);
return;
}
@@ -3389,8 +3266,7 @@ lexer_scan_identifier (parser_context_t *context_p) /**< context */
context_p->token.line = context_p->line;
context_p->token.column = context_p->column;
- if (context_p->source_p < context_p->source_end_p
- && lexer_parse_identifier (context_p, LEXER_PARSE_NO_OPTS))
+ if (context_p->source_p < context_p->source_end_p && lexer_parse_identifier (context_p, LEXER_PARSE_NO_OPTS))
{
return true;
}
@@ -3407,18 +3283,15 @@ void
lexer_check_property_modifier (parser_context_t *context_p) /**< context */
{
JERRY_ASSERT (!(context_p->token.flags & LEXER_NO_SKIP_SPACES));
- JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
+ JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
lexer_skip_spaces (context_p);
context_p->token.flags = (uint8_t) (context_p->token.flags | LEXER_NO_SKIP_SPACES);
if (context_p->source_p >= context_p->source_end_p
#if JERRY_ESNEXT
- || context_p->source_p[0] == LIT_CHAR_COMMA
- || context_p->source_p[0] == LIT_CHAR_RIGHT_BRACE
- || context_p->source_p[0] == LIT_CHAR_LEFT_PAREN
- || context_p->source_p[0] == LIT_CHAR_EQUALS
+ || context_p->source_p[0] == LIT_CHAR_COMMA || context_p->source_p[0] == LIT_CHAR_RIGHT_BRACE
+ || context_p->source_p[0] == LIT_CHAR_LEFT_PAREN || context_p->source_p[0] == LIT_CHAR_EQUALS
#endif /* JERRY_ESNEXT */
|| context_p->source_p[0] == LIT_CHAR_COLON)
{
@@ -3500,10 +3373,8 @@ lexer_compare_identifier_to_chars (const uint8_t *left_p, /**< left identifier *
{
return false;
}
- }
- while (--escape_size > 0);
- }
- while (size > 0);
+ } while (--escape_size > 0);
+ } while (size > 0);
return true;
} /* lexer_compare_identifier_to_chars */
@@ -3592,8 +3463,7 @@ bool
lexer_current_is_literal (parser_context_t *context_p, /**< context */
const lexer_lit_location_t *right_ident_p) /**< identifier */
{
- JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
+ JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
lexer_lit_location_t *left_ident_p = &context_p->token.lit_location;
@@ -3623,8 +3493,7 @@ lexer_current_is_literal (parser_context_t *context_p, /**< context */
extern inline bool JERRY_ATTR_ALWAYS_INLINE
lexer_string_is_use_strict (parser_context_t *context_p) /**< context */
{
- JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_STRING_LITERAL);
+ JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL);
return (context_p->token.lit_location.length == 10
&& !(context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)
@@ -3639,13 +3508,10 @@ lexer_string_is_use_strict (parser_context_t *context_p) /**< context */
extern inline bool JERRY_ATTR_ALWAYS_INLINE
lexer_string_is_directive (parser_context_t *context_p) /**< context */
{
- return (context_p->token.type == LEXER_SEMICOLON
- || context_p->token.type == LEXER_RIGHT_BRACE
+ return (context_p->token.type == LEXER_SEMICOLON || context_p->token.type == LEXER_RIGHT_BRACE
|| context_p->token.type == LEXER_EOS
- || ((context_p->token.flags & LEXER_WAS_NEWLINE)
- && !LEXER_IS_BINARY_OP_TOKEN (context_p->token.type)
- && context_p->token.type != LEXER_LEFT_PAREN
- && context_p->token.type != LEXER_LEFT_SQUARE
+ || ((context_p->token.flags & LEXER_WAS_NEWLINE) && !LEXER_IS_BINARY_OP_TOKEN (context_p->token.type)
+ && context_p->token.type != LEXER_LEFT_PAREN && context_p->token.type != LEXER_LEFT_SQUARE
&& context_p->token.type != LEXER_DOT));
} /* lexer_string_is_directive */
@@ -3665,8 +3531,7 @@ lexer_token_is_identifier (parser_context_t *context_p, /**< context */
size_t identifier_length) /**< identifier length */
{
/* Checking has_escape is unnecessary because memcmp will fail if escape sequences are present. */
- return (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL
+ return (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL
&& context_p->token.lit_location.length == identifier_length
&& memcmp (context_p->token.lit_location.char_p, identifier_p, identifier_length) == 0);
} /* lexer_token_is_identifier */
@@ -3699,8 +3564,7 @@ lexer_token_is_let (parser_context_t *context_p) /**< context */
extern inline bool JERRY_ATTR_ALWAYS_INLINE
lexer_token_is_async (parser_context_t *context_p) /**< context */
{
- JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
- || context_p->token.type == LEXER_TEMPLATE_LITERAL);
+ JERRY_ASSERT (context_p->token.type == LEXER_LITERAL || context_p->token.type == LEXER_TEMPLATE_LITERAL);
return (context_p->token.keyword_type == LEXER_KEYW_ASYNC
&& !(context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE));
diff --git a/jerry-core/parser/js/js-lexer.h b/jerry-core/parser/js/js-lexer.h
index 8f2a5e84..d959cd7d 100644
--- a/jerry-core/parser/js/js-lexer.h
+++ b/jerry-core/parser/js/js-lexer.h
@@ -18,6 +18,8 @@
#include "ecma-globals.h"
+#include "common.h"
+
/** \addtogroup parser Parser
* @{
*
@@ -33,44 +35,42 @@
*/
typedef enum
{
- LEXER_EOS, /**< end of source */
+ LEXER_EOS, /**< end of source */
/* Primary expressions */
- LEXER_LITERAL, /**< literal token */
- LEXER_KEYW_THIS, /**< this */
- LEXER_LIT_TRUE, /**< true (not a keyword!) */
- LEXER_LIT_FALSE, /**< false (not a keyword!) */
- LEXER_LIT_NULL, /**< null (not a keyword!) */
+ LEXER_LITERAL, /**< literal token */
+ LEXER_KEYW_THIS, /**< this */
+ LEXER_LIT_TRUE, /**< true (not a keyword!) */
+ LEXER_LIT_FALSE, /**< false (not a keyword!) */
+ LEXER_LIT_NULL, /**< null (not a keyword!) */
#if JERRY_ESNEXT
- LEXER_TEMPLATE_LITERAL, /**< multi segment template literal */
- LEXER_THREE_DOTS, /**< ... (rest or spread operator) */
+ LEXER_TEMPLATE_LITERAL, /**< multi segment template literal */
+ LEXER_THREE_DOTS, /**< ... (rest or spread operator) */
#endif /* JERRY_ESNEXT */
- /* Unary operators
- * IMPORTANT: update CBC_UNARY_OP_TOKEN_TO_OPCODE and
- * CBC_UNARY_LVALUE_OP_TOKEN_TO_OPCODE after changes. */
-#define LEXER_IS_UNARY_OP_TOKEN(token_type) \
- ((token_type) >= LEXER_PLUS && (token_type) <= LEXER_DECREASE)
-#define LEXER_IS_UNARY_LVALUE_OP_TOKEN(token_type) \
- ((token_type) >= LEXER_KEYW_DELETE && (token_type) <= LEXER_DECREASE)
-
- LEXER_PLUS, /**< "+" */
- LEXER_NEGATE, /**< "-" */
- LEXER_LOGICAL_NOT, /**< "!" */
- LEXER_BIT_NOT, /**< "~" */
- LEXER_KEYW_VOID, /**< void */
- LEXER_KEYW_TYPEOF, /**< typeof */
+/* Unary operators
+ * IMPORTANT: update CBC_UNARY_OP_TOKEN_TO_OPCODE and
+ * CBC_UNARY_LVALUE_OP_TOKEN_TO_OPCODE after changes. */
+#define LEXER_IS_UNARY_OP_TOKEN(token_type) ((token_type) >= LEXER_PLUS && (token_type) <= LEXER_DECREASE)
+#define LEXER_IS_UNARY_LVALUE_OP_TOKEN(token_type) ((token_type) >= LEXER_KEYW_DELETE && (token_type) <= LEXER_DECREASE)
+
+ LEXER_PLUS, /**< "+" */
+ LEXER_NEGATE, /**< "-" */
+ LEXER_LOGICAL_NOT, /**< "!" */
+ LEXER_BIT_NOT, /**< "~" */
+ LEXER_KEYW_VOID, /**< void */
+ LEXER_KEYW_TYPEOF, /**< typeof */
#if JERRY_ESNEXT
- LEXER_KEYW_AWAIT, /**< await */
+ LEXER_KEYW_AWAIT, /**< await */
#endif /* JERRY_ESNEXT */
- LEXER_KEYW_DELETE, /**< delete */
- LEXER_INCREASE, /**< "++" */
- LEXER_DECREASE, /**< "--" */
-
- /* Binary operators
- * IMPORTANT: update CBC_BINARY_OP_TOKEN_TO_OPCODE,
- * CBC_BINARY_LVALUE_OP_TOKEN_TO_OPCODE and
- * parser_binary_precedence_table after changes. */
+ LEXER_KEYW_DELETE, /**< delete */
+ LEXER_INCREASE, /**< "++" */
+ LEXER_DECREASE, /**< "--" */
+
+/* Binary operators
+ * IMPORTANT: update CBC_BINARY_OP_TOKEN_TO_OPCODE,
+ * CBC_BINARY_LVALUE_OP_TOKEN_TO_OPCODE and
+ * parser_binary_precedence_table after changes. */
/**
* Index of first binary operation opcode.
*/
@@ -103,136 +103,136 @@ typedef enum
#define LEXER_IS_BINARY_NON_LVALUE_OP_TOKEN(token_type) \
((token_type) >= LEXER_QUESTION_MARK && (token_type) <= LEXER_LAST_BINARY_OP)
- LEXER_ASSIGN, /**< "=" (prec: 3) */
- LEXER_ASSIGN_ADD, /**< "+=" (prec: 3) */
- LEXER_ASSIGN_SUBTRACT, /**< "-=" (prec: 3) */
- LEXER_ASSIGN_MULTIPLY, /**< "*=" (prec: 3) */
- LEXER_ASSIGN_DIVIDE, /**< "/=" (prec: 3) */
- LEXER_ASSIGN_MODULO, /**< "%=" (prec: 3) */
+ LEXER_ASSIGN, /**< "=" (prec: 3) */
+ LEXER_ASSIGN_ADD, /**< "+=" (prec: 3) */
+ LEXER_ASSIGN_SUBTRACT, /**< "-=" (prec: 3) */
+ LEXER_ASSIGN_MULTIPLY, /**< "*=" (prec: 3) */
+ LEXER_ASSIGN_DIVIDE, /**< "/=" (prec: 3) */
+ LEXER_ASSIGN_MODULO, /**< "%=" (prec: 3) */
#if JERRY_ESNEXT
- LEXER_ASSIGN_EXPONENTIATION, /**< "**=" (prec: 3) */
+ LEXER_ASSIGN_EXPONENTIATION, /**< "**=" (prec: 3) */
#endif /* JERRY_ESNEXT */
- LEXER_ASSIGN_LEFT_SHIFT, /**< "<<=" (prec: 3) */
- LEXER_ASSIGN_RIGHT_SHIFT, /**< ">>=" (prec: 3) */
- LEXER_ASSIGN_UNS_RIGHT_SHIFT, /**< ">>>=" (prec: 3) */
- LEXER_ASSIGN_BIT_AND, /**< "&=" (prec: 3) */
- LEXER_ASSIGN_BIT_OR, /**< "|=" (prec: 3) */
- LEXER_ASSIGN_BIT_XOR, /**< "^=" (prec: 3) */
- LEXER_QUESTION_MARK, /**< "?" (prec: 4) */
+ LEXER_ASSIGN_LEFT_SHIFT, /**< "<<=" (prec: 3) */
+ LEXER_ASSIGN_RIGHT_SHIFT, /**< ">>=" (prec: 3) */
+ LEXER_ASSIGN_UNS_RIGHT_SHIFT, /**< ">>>=" (prec: 3) */
+ LEXER_ASSIGN_BIT_AND, /**< "&=" (prec: 3) */
+ LEXER_ASSIGN_BIT_OR, /**< "|=" (prec: 3) */
+ LEXER_ASSIGN_BIT_XOR, /**< "^=" (prec: 3) */
+ LEXER_QUESTION_MARK, /**< "?" (prec: 4) */
#if JERRY_ESNEXT
- LEXER_NULLISH_COALESCING, /**< "??" (prec: 5) */
+ LEXER_NULLISH_COALESCING, /**< "??" (prec: 5) */
#endif /* JERRY_ESNEXT */
- LEXER_LOGICAL_OR, /**< "||" (prec: 6) */
- LEXER_LOGICAL_AND, /**< "&&" (prec: 7) */
- LEXER_BIT_OR, /**< "|" (prec: 8) */
- LEXER_BIT_XOR, /**< "^" (prec: 9) */
- LEXER_BIT_AND, /**< "&" (prec: 10) */
- LEXER_EQUAL, /**< "==" (prec: 11) */
- LEXER_NOT_EQUAL, /**< "!=" (prec: 11) */
- LEXER_STRICT_EQUAL, /**< "===" (prec: 11) */
- LEXER_STRICT_NOT_EQUAL, /**< "!==" (prec: 11) */
- LEXER_LESS, /**< "<" (prec: 12) */
- LEXER_GREATER, /**< ">" (prec: 12) */
- LEXER_LESS_EQUAL, /**< "<=" (prec: 12) */
- LEXER_GREATER_EQUAL, /**< ">=" (prec: 12) */
- LEXER_KEYW_IN, /**< in (prec: 12) */
- LEXER_KEYW_INSTANCEOF, /**< instanceof (prec: 12) */
- LEXER_LEFT_SHIFT, /**< "<<" (prec: 13) */
- LEXER_RIGHT_SHIFT, /**< ">>" (prec: 13) */
- LEXER_UNS_RIGHT_SHIFT, /**< ">>>" (prec: 13) */
- LEXER_ADD, /**< "+" (prec: 14) */
- LEXER_SUBTRACT, /**< "-" (prec: 14) */
- LEXER_MULTIPLY, /**< "*" (prec: 15) */
- LEXER_DIVIDE, /**< "/" (prec: 15) */
- LEXER_MODULO, /**< "%" (prec: 15) */
+ LEXER_LOGICAL_OR, /**< "||" (prec: 6) */
+ LEXER_LOGICAL_AND, /**< "&&" (prec: 7) */
+ LEXER_BIT_OR, /**< "|" (prec: 8) */
+ LEXER_BIT_XOR, /**< "^" (prec: 9) */
+ LEXER_BIT_AND, /**< "&" (prec: 10) */
+ LEXER_EQUAL, /**< "==" (prec: 11) */
+ LEXER_NOT_EQUAL, /**< "!=" (prec: 11) */
+ LEXER_STRICT_EQUAL, /**< "===" (prec: 11) */
+ LEXER_STRICT_NOT_EQUAL, /**< "!==" (prec: 11) */
+ LEXER_LESS, /**< "<" (prec: 12) */
+ LEXER_GREATER, /**< ">" (prec: 12) */
+ LEXER_LESS_EQUAL, /**< "<=" (prec: 12) */
+ LEXER_GREATER_EQUAL, /**< ">=" (prec: 12) */
+ LEXER_KEYW_IN, /**< in (prec: 12) */
+ LEXER_KEYW_INSTANCEOF, /**< instanceof (prec: 12) */
+ LEXER_LEFT_SHIFT, /**< "<<" (prec: 13) */
+ LEXER_RIGHT_SHIFT, /**< ">>" (prec: 13) */
+ LEXER_UNS_RIGHT_SHIFT, /**< ">>>" (prec: 13) */
+ LEXER_ADD, /**< "+" (prec: 14) */
+ LEXER_SUBTRACT, /**< "-" (prec: 14) */
+ LEXER_MULTIPLY, /**< "*" (prec: 15) */
+ LEXER_DIVIDE, /**< "/" (prec: 15) */
+ LEXER_MODULO, /**< "%" (prec: 15) */
#if JERRY_ESNEXT
- LEXER_EXPONENTIATION, /**< "**" (prec: 16) */
+ LEXER_EXPONENTIATION, /**< "**" (prec: 16) */
#endif /* JERRY_ESNEXT */
- LEXER_LEFT_BRACE, /**< "{" */
- LEXER_LEFT_PAREN, /**< "(" */
- LEXER_LEFT_SQUARE, /**< "[" */
- LEXER_RIGHT_BRACE, /**< "}" */
- LEXER_RIGHT_PAREN, /**< ")" */
- LEXER_RIGHT_SQUARE, /**< "]" */
- LEXER_DOT, /**< "." */
- LEXER_SEMICOLON, /**< ";" */
- LEXER_COLON, /**< ":" */
- LEXER_COMMA, /**< "," */
+ LEXER_LEFT_BRACE, /**< "{" */
+ LEXER_LEFT_PAREN, /**< "(" */
+ LEXER_LEFT_SQUARE, /**< "[" */
+ LEXER_RIGHT_BRACE, /**< "}" */
+ LEXER_RIGHT_PAREN, /**< ")" */
+ LEXER_RIGHT_SQUARE, /**< "]" */
+ LEXER_DOT, /**< "." */
+ LEXER_SEMICOLON, /**< ";" */
+ LEXER_COLON, /**< ":" */
+ LEXER_COMMA, /**< "," */
#if JERRY_ESNEXT
- LEXER_ARROW, /**< "=>" */
+ LEXER_ARROW, /**< "=>" */
#endif /* JERRY_ESNEXT */
- LEXER_KEYW_BREAK, /**< break */
- LEXER_KEYW_DO, /**< do */
- LEXER_KEYW_CASE, /**< case */
- LEXER_KEYW_ELSE, /**< else */
- LEXER_KEYW_NEW, /**< new */
- LEXER_KEYW_VAR, /**< var */
- LEXER_KEYW_CATCH, /**< catch */
- LEXER_KEYW_FINALLY, /**< finally */
- LEXER_KEYW_RETURN, /**< return */
- LEXER_KEYW_CONTINUE, /**< continue */
- LEXER_KEYW_FOR, /**< for */
- LEXER_KEYW_SWITCH, /**< switch */
- LEXER_KEYW_WHILE, /**< while */
- LEXER_KEYW_DEBUGGER, /**< debugger */
- LEXER_KEYW_FUNCTION, /**< function */
- LEXER_KEYW_WITH, /**< with */
- LEXER_KEYW_DEFAULT, /**< default */
- LEXER_KEYW_IF, /**< if */
- LEXER_KEYW_THROW, /**< throw */
- LEXER_KEYW_TRY, /**< try */
-
- LEXER_KEYW_CLASS, /**< class */
- LEXER_KEYW_EXTENDS, /**< extends */
- LEXER_KEYW_SUPER, /**< super */
- LEXER_KEYW_CONST, /**< const */
- LEXER_KEYW_EXPORT, /**< export */
- LEXER_KEYW_IMPORT, /**< import */
- LEXER_KEYW_ENUM, /**< enum */
+ LEXER_KEYW_BREAK, /**< break */
+ LEXER_KEYW_DO, /**< do */
+ LEXER_KEYW_CASE, /**< case */
+ LEXER_KEYW_ELSE, /**< else */
+ LEXER_KEYW_NEW, /**< new */
+ LEXER_KEYW_VAR, /**< var */
+ LEXER_KEYW_CATCH, /**< catch */
+ LEXER_KEYW_FINALLY, /**< finally */
+ LEXER_KEYW_RETURN, /**< return */
+ LEXER_KEYW_CONTINUE, /**< continue */
+ LEXER_KEYW_FOR, /**< for */
+ LEXER_KEYW_SWITCH, /**< switch */
+ LEXER_KEYW_WHILE, /**< while */
+ LEXER_KEYW_DEBUGGER, /**< debugger */
+ LEXER_KEYW_FUNCTION, /**< function */
+ LEXER_KEYW_WITH, /**< with */
+ LEXER_KEYW_DEFAULT, /**< default */
+ LEXER_KEYW_IF, /**< if */
+ LEXER_KEYW_THROW, /**< throw */
+ LEXER_KEYW_TRY, /**< try */
+
+ LEXER_KEYW_CLASS, /**< class */
+ LEXER_KEYW_EXTENDS, /**< extends */
+ LEXER_KEYW_SUPER, /**< super */
+ LEXER_KEYW_CONST, /**< const */
+ LEXER_KEYW_EXPORT, /**< export */
+ LEXER_KEYW_IMPORT, /**< import */
+ LEXER_KEYW_ENUM, /**< enum */
#define LEXER_FIRST_NON_RESERVED_KEYWORD LEXER_EXPRESSION_START
/* These are virtual tokens. */
- LEXER_EXPRESSION_START, /**< expression start */
- LEXER_PROPERTY_GETTER, /**< property getter function */
- LEXER_PROPERTY_SETTER, /**< property setter function */
- LEXER_COMMA_SEP_LIST, /**< comma separated bracketed expression list */
+ LEXER_EXPRESSION_START, /**< expression start */
+ LEXER_PROPERTY_GETTER, /**< property getter function */
+ LEXER_PROPERTY_SETTER, /**< property setter function */
+ LEXER_COMMA_SEP_LIST, /**< comma separated bracketed expression list */
#if JERRY_ESNEXT
- LEXER_ASSIGN_GROUP_EXPR, /**< indetifier for the assignment is located in a group expression */
- LEXER_ASSIGN_CONST, /**< a const binding is reassigned */
- LEXER_INVALID_PATTERN, /**< special value for invalid destructuring pattern */
+ LEXER_ASSIGN_GROUP_EXPR, /**< indetifier for the assignment is located in a group expression */
+ LEXER_ASSIGN_CONST, /**< a const binding is reassigned */
+ LEXER_INVALID_PATTERN, /**< special value for invalid destructuring pattern */
#endif /* JERRY_ESNEXT */
- /* Keywords which are not keyword tokens. */
+/* Keywords which are not keyword tokens. */
#if JERRY_ESNEXT
- LEXER_KEYW_ASYNC, /**< async */
+ LEXER_KEYW_ASYNC, /**< async */
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
- LEXER_KEYW_META, /**< meta */
+ LEXER_KEYW_META, /**< meta */
#endif /* JERRY_MODULE_SYSTEM */
- /* Keywords which cannot be assigned in strict mode. */
+/* Keywords which cannot be assigned in strict mode. */
#define LEXER_FIRST_NON_STRICT_ARGUMENTS LEXER_KEYW_EVAL
- LEXER_KEYW_EVAL, /**< eval */
- LEXER_KEYW_ARGUMENTS, /**< arguments */
+ LEXER_KEYW_EVAL, /**< eval */
+ LEXER_KEYW_ARGUMENTS, /**< arguments */
- /* Future strict reserved words: these keywords
- * must form a group after non-reserved keywords. */
+/* Future strict reserved words: these keywords
+ * must form a group after non-reserved keywords. */
#define LEXER_FIRST_FUTURE_STRICT_RESERVED_WORD LEXER_KEYW_IMPLEMENTS
- LEXER_KEYW_IMPLEMENTS, /**< implements */
- LEXER_KEYW_PRIVATE, /**< private */
- LEXER_KEYW_PUBLIC, /**< public */
- LEXER_KEYW_INTERFACE, /**< interface */
- LEXER_KEYW_PACKAGE, /**< package */
- LEXER_KEYW_PROTECTED, /**< protected */
+ LEXER_KEYW_IMPLEMENTS, /**< implements */
+ LEXER_KEYW_PRIVATE, /**< private */
+ LEXER_KEYW_PUBLIC, /**< public */
+ LEXER_KEYW_INTERFACE, /**< interface */
+ LEXER_KEYW_PACKAGE, /**< package */
+ LEXER_KEYW_PROTECTED, /**< protected */
/* Context dependent future strict reserved words:
* See also: ECMA-262 v6, 11.6.2.1 */
- LEXER_KEYW_LET, /**< let */
- LEXER_KEYW_YIELD, /**< yield */
- LEXER_KEYW_STATIC, /**< static */
+ LEXER_KEYW_LET, /**< let */
+ LEXER_KEYW_YIELD, /**< yield */
+ LEXER_KEYW_STATIC, /**< static */
} lexer_token_type_t;
#define LEXER_NEWLINE_LS_PS_BYTE_1 0xe2
@@ -245,17 +245,14 @@ typedef enum
#define LEXER_IS_RIGHT_BRACKET(type) \
((type) == LEXER_RIGHT_BRACE || (type) == LEXER_RIGHT_PAREN || (type) == LEXER_RIGHT_SQUARE)
-#define LEXER_UNARY_OP_TOKEN_TO_OPCODE(token_type) \
- ((((token_type) - LEXER_PLUS) * 2) + CBC_PLUS)
+#define LEXER_UNARY_OP_TOKEN_TO_OPCODE(token_type) ((((token_type) -LEXER_PLUS) * 2) + CBC_PLUS)
-#define LEXER_UNARY_LVALUE_OP_TOKEN_TO_OPCODE(token_type) \
- ((((token_type) - LEXER_INCREASE) * 6) + CBC_PRE_INCR)
+#define LEXER_UNARY_LVALUE_OP_TOKEN_TO_OPCODE(token_type) ((((token_type) -LEXER_INCREASE) * 6) + CBC_PRE_INCR)
-#define LEXER_BINARY_OP_TOKEN_TO_OPCODE(token_type) \
- ((uint16_t) ((((token_type) - LEXER_BIT_OR) * 3) + CBC_BIT_OR))
+#define LEXER_BINARY_OP_TOKEN_TO_OPCODE(token_type) ((uint16_t) ((((token_type) -LEXER_BIT_OR) * 3) + CBC_BIT_OR))
#define LEXER_BINARY_LVALUE_OP_TOKEN_TO_OPCODE(token_type) \
- ((cbc_opcode_t) ((((token_type) - LEXER_ASSIGN_ADD) * 2) + CBC_ASSIGN_ADD))
+ ((cbc_opcode_t) ((((token_type) -LEXER_ASSIGN_ADD) * 2) + CBC_ASSIGN_ADD))
/**
* Maximum local buffer size for identifiers which contains escape sequences.
@@ -267,8 +264,8 @@ typedef enum
*/
typedef enum
{
- LEXER_WAS_NEWLINE = (1u << 0), /**< newline was seen */
- LEXER_NO_SKIP_SPACES = (1u << 1) /**< ignore skip spaces */
+ LEXER_WAS_NEWLINE = (1u << 0), /**< newline was seen */
+ LEXER_NO_SKIP_SPACES = (1u << 1) /**< ignore skip spaces */
} lexer_newline_flags_t;
/**
@@ -276,15 +273,15 @@ typedef enum
*/
typedef enum
{
- LEXER_OBJ_IDENT_NO_OPTS = 0, /**< no options */
- LEXER_OBJ_IDENT_ONLY_IDENTIFIERS = (1u << 0), /**< only identifiers are accepted */
- LEXER_OBJ_IDENT_CLASS_IDENTIFIER = (1u << 1), /**< expect identifier inside a class body */
- LEXER_OBJ_IDENT_CLASS_NO_STATIC = (1u << 2), /**< static keyword was not present before the identifier */
- LEXER_OBJ_IDENT_OBJECT_PATTERN = (1u << 3), /**< parse "get"/"set" as string literal in object pattern */
+ LEXER_OBJ_IDENT_NO_OPTS = 0, /**< no options */
+ LEXER_OBJ_IDENT_ONLY_IDENTIFIERS = (1u << 0), /**< only identifiers are accepted */
+ LEXER_OBJ_IDENT_CLASS_IDENTIFIER = (1u << 1), /**< expect identifier inside a class body */
+ LEXER_OBJ_IDENT_CLASS_NO_STATIC = (1u << 2), /**< static keyword was not present before the identifier */
+ LEXER_OBJ_IDENT_OBJECT_PATTERN = (1u << 3), /**< parse "get"/"set" as string literal in object pattern */
#if JERRY_FUNCTION_TO_STRING
LEXER_OBJ_IDENT_SET_FUNCTION_START = (1u << 4), /**< set function start */
#else /* !JERRY_FUNCTION_TO_STRING */
- LEXER_OBJ_IDENT_SET_FUNCTION_START = 0, /**< set function start (disabled) */
+ LEXER_OBJ_IDENT_SET_FUNCTION_START = 0, /**< set function start (disabled) */
#endif /* JERRY_FUNCTION_TO_STRING */
} lexer_obj_ident_opts_t;
@@ -293,8 +290,8 @@ typedef enum
*/
typedef enum
{
- LEXER_STRING_NO_OPTS = (1u << 0), /**< no options */
- LEXER_STRING_RAW = (1u << 1), /**< raw string ECMAScript v6, 11.8.6.1: TVR */
+ LEXER_STRING_NO_OPTS = (1u << 0), /**< no options */
+ LEXER_STRING_RAW = (1u << 1), /**< raw string ECMAScript v6, 11.8.6.1: TVR */
} lexer_string_options_t;
/**
@@ -302,12 +299,12 @@ typedef enum
*/
typedef enum
{
- LEXER_NUMBER_DECIMAL, /**< decimal number */
- LEXER_NUMBER_HEXADECIMAL, /**< hexadecimal number */
- LEXER_NUMBER_OCTAL, /**< octal number */
- LEXER_NUMBER_BINARY, /**< binary number */
+ LEXER_NUMBER_DECIMAL, /**< decimal number */
+ LEXER_NUMBER_HEXADECIMAL, /**< hexadecimal number */
+ LEXER_NUMBER_OCTAL, /**< octal number */
+ LEXER_NUMBER_BINARY, /**< binary number */
#if JERRY_BUILTIN_BIGINT
- LEXER_NUMBER_BIGINT, /**< bigint number */
+ LEXER_NUMBER_BIGINT, /**< bigint number */
#endif /* JERRY_BUILTIN_BIGINT */
} lexer_number_type_t;
@@ -316,9 +313,9 @@ typedef enum
**/
typedef enum
{
- LEXER_LIT_LOCATION_NO_OPTS = 0, /**< no options */
+ LEXER_LIT_LOCATION_NO_OPTS = 0, /**< no options */
LEXER_LIT_LOCATION_HAS_ESCAPE = (1 << 0), /**< binding has escape */
- LEXER_LIT_LOCATION_IS_ASCII = (1 << 1), /**< all characters are ascii characters */
+ LEXER_LIT_LOCATION_IS_ASCII = (1 << 1), /**< all characters are ascii characters */
} lexer_lit_location_flags_t;
/**
@@ -326,10 +323,10 @@ typedef enum
*/
typedef struct
{
- const uint8_t *char_p; /**< start of identifier or string token */
- prop_length_t length; /**< length or index of a literal */
- uint8_t type; /**< type of the current literal */
- uint8_t status_flags; /**< any combination of lexer_lit_location_flags_t status bits */
+ const uint8_t *char_p; /**< start of identifier or string token */
+ prop_length_t length; /**< length or index of a literal */
+ uint8_t type; /**< type of the current literal */
+ uint8_t status_flags; /**< any combination of lexer_lit_location_flags_t status bits */
} lexer_lit_location_t;
/**
@@ -337,13 +334,13 @@ typedef struct
*/
typedef struct
{
- uint8_t type; /**< token type */
- uint8_t keyword_type; /**< keyword type for identifiers */
- uint8_t extra_value; /**< helper value for different purposes */
- uint8_t flags; /**< flag bits for the current token */
- parser_line_counter_t line; /**< token start line */
- parser_line_counter_t column; /**< token start column */
- lexer_lit_location_t lit_location; /**< extra data for character literals */
+ uint8_t type; /**< token type */
+ uint8_t keyword_type; /**< keyword type for identifiers */
+ uint8_t extra_value; /**< helper value for different purposes */
+ uint8_t flags; /**< flag bits for the current token */
+ parser_line_counter_t line; /**< token start line */
+ parser_line_counter_t column; /**< token start column */
+ lexer_lit_location_t lit_location; /**< extra data for character literals */
} lexer_token_t;
/**
@@ -351,8 +348,8 @@ typedef struct
*/
typedef struct
{
- lexer_literal_t *literal_p; /**< pointer to the literal object */
- uint16_t index; /**< literal index */
+ lexer_literal_t *literal_p; /**< pointer to the literal object */
+ uint16_t index; /**< literal index */
} lexer_lit_object_t;
/**
diff --git a/jerry-core/parser/js/js-parser-expr.c b/jerry-core/parser/js/js-parser-expr.c
index 87d53ca7..9250fa57 100644
--- a/jerry-core/parser/js/js-parser-expr.c
+++ b/jerry-core/parser/js/js-parser-expr.c
@@ -16,11 +16,11 @@
#include "js-parser-internal.h"
#if JERRY_PARSER
-#include "jcontext.h"
-
#include "ecma-helpers.h"
-#include "lit-char-helpers.h"
+
+#include "jcontext.h"
#include "js-parser-tagged-template-literal.h"
+#include "lit-char-helpers.h"
/** \addtogroup parser Parser
* @{
@@ -58,8 +58,7 @@
* See also:
* lexer_token_type_t
*/
-static const uint8_t parser_binary_precedence_table[] =
-{
+static const uint8_t parser_binary_precedence_table[] = {
3, /**< "=" */
3, /**< "+=" */
3, /**< "-=" */
@@ -125,8 +124,7 @@ parser_push_result (parser_context_t *context_p) /**< context */
{
JERRY_ASSERT (CBC_SAME_ARGS (context_p->last_cbc_opcode, context_p->last_cbc_opcode + 1));
- if ((context_p->last_cbc_opcode == CBC_POST_INCR
- || context_p->last_cbc_opcode == CBC_POST_DECR)
+ if ((context_p->last_cbc_opcode == CBC_POST_INCR || context_p->last_cbc_opcode == CBC_POST_DECR)
&& context_p->stack_depth >= context_p->stack_limit)
{
/* Stack limit is increased for CBC_POST_INCR_PUSH_RESULT
@@ -181,10 +179,10 @@ parser_check_invalid_new_target (parser_context_t *context_p, /**< parser contex
{
/* Make sure that the call side is a post/pre increment or an assignment expression.
* There should be no other ways the "new.target" expression should be here. */
- JERRY_ASSERT ((opcode >= CBC_PRE_INCR && opcode <= CBC_POST_DECR)
- || (opcode == CBC_ASSIGN
- && (context_p->token.type == LEXER_ASSIGN
- || LEXER_IS_BINARY_LVALUE_OP_TOKEN (context_p->token.type))));
+ JERRY_ASSERT (
+ (opcode >= CBC_PRE_INCR && opcode <= CBC_POST_DECR)
+ || (opcode == CBC_ASSIGN
+ && (context_p->token.type == LEXER_ASSIGN || LEXER_IS_BINARY_LVALUE_OP_TOKEN (context_p->token.type))));
parser_raise_error (context_p, PARSER_ERR_NEW_TARGET_NOT_ALLOWED);
}
@@ -396,11 +394,11 @@ parser_parse_array_literal (parser_context_t *context_p) /**< context */
*/
typedef enum
{
- PARSER_OBJECT_PROPERTY_START, /**< marks the start of the property list */
- PARSER_OBJECT_PROPERTY_VALUE, /**< value property */
- PARSER_OBJECT_PROPERTY_GETTER, /**< getter property */
- PARSER_OBJECT_PROPERTY_SETTER, /**< setter property */
- PARSER_OBJECT_PROPERTY_BOTH_ACCESSORS, /**< both getter and setter properties are set */
+ PARSER_OBJECT_PROPERTY_START, /**< marks the start of the property list */
+ PARSER_OBJECT_PROPERTY_VALUE, /**< value property */
+ PARSER_OBJECT_PROPERTY_GETTER, /**< getter property */
+ PARSER_OBJECT_PROPERTY_SETTER, /**< setter property */
+ PARSER_OBJECT_PROPERTY_BOTH_ACCESSORS, /**< both getter and setter properties are set */
} parser_object_literal_item_types_t;
/**
@@ -455,21 +453,18 @@ parser_append_object_literal_item (parser_context_t *context_p, /**< context */
if (current_item_index == item_index)
{
- if (item_type == PARSER_OBJECT_PROPERTY_VALUE
- && *current_item_type_p == PARSER_OBJECT_PROPERTY_VALUE
+ if (item_type == PARSER_OBJECT_PROPERTY_VALUE && *current_item_type_p == PARSER_OBJECT_PROPERTY_VALUE
&& !(context_p->status_flags & PARSER_IS_STRICT))
{
return;
}
- if (item_type == PARSER_OBJECT_PROPERTY_GETTER
- && *current_item_type_p == PARSER_OBJECT_PROPERTY_SETTER)
+ if (item_type == PARSER_OBJECT_PROPERTY_GETTER && *current_item_type_p == PARSER_OBJECT_PROPERTY_SETTER)
{
break;
}
- if (item_type == PARSER_OBJECT_PROPERTY_SETTER
- && *current_item_type_p == PARSER_OBJECT_PROPERTY_GETTER)
+ if (item_type == PARSER_OBJECT_PROPERTY_SETTER && *current_item_type_p == PARSER_OBJECT_PROPERTY_GETTER)
{
break;
}
@@ -491,21 +486,19 @@ parser_append_object_literal_item (parser_context_t *context_p, /**< context */
#if JERRY_ESNEXT
/** Forward definition of parse array initializer. */
-static void
-parser_parse_array_initializer (parser_context_t *context_p, parser_pattern_flags_t flags);
+static void parser_parse_array_initializer (parser_context_t *context_p, parser_pattern_flags_t flags);
/** Forward definition of parse object initializer. */
-static void
-parser_parse_object_initializer (parser_context_t *context_p, parser_pattern_flags_t flags);
+static void parser_parse_object_initializer (parser_context_t *context_p, parser_pattern_flags_t flags);
/**
* Class literal parsing options.
*/
typedef enum
{
- PARSER_CLASS_LITERAL_NO_OPTS = 0, /**< no options are provided */
- PARSER_CLASS_LITERAL_CTOR_PRESENT = (1 << 0), /**< class constructor is present */
- PARSER_CLASS_LITERAL_HERTIAGE_PRESENT = (1 << 1), /**< class heritage is present */
+ PARSER_CLASS_LITERAL_NO_OPTS = 0, /**< no options are provided */
+ PARSER_CLASS_LITERAL_CTOR_PRESENT = (1 << 0), /**< class constructor is present */
+ PARSER_CLASS_LITERAL_HERTIAGE_PRESENT = (1 << 1), /**< class heritage is present */
} parser_class_literal_opts_t;
/**
@@ -561,9 +554,9 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
lexer_skip_empty_statements (context_p);
}
- lexer_expect_object_literal_id (context_p, (LEXER_OBJ_IDENT_CLASS_IDENTIFIER
- | LEXER_OBJ_IDENT_SET_FUNCTION_START
- | (is_static ? 0 : LEXER_OBJ_IDENT_CLASS_NO_STATIC)));
+ lexer_expect_object_literal_id (context_p,
+ (LEXER_OBJ_IDENT_CLASS_IDENTIFIER | LEXER_OBJ_IDENT_SET_FUNCTION_START
+ | (is_static ? 0 : LEXER_OBJ_IDENT_CLASS_NO_STATIC)));
if (context_p->token.type == LEXER_RIGHT_BRACE)
{
@@ -590,10 +583,8 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
parser_raise_error (context_p, PARSER_ERR_MULTIPLE_CLASS_CONSTRUCTORS);
}
- uint32_t constructor_status_flags = (PARSER_FUNCTION_CLOSURE
- | PARSER_ALLOW_SUPER
- | PARSER_CLASS_CONSTRUCTOR
- | PARSER_LEXICAL_ENV_NEEDED);
+ uint32_t constructor_status_flags =
+ (PARSER_FUNCTION_CLOSURE | PARSER_ALLOW_SUPER | PARSER_CLASS_CONSTRUCTOR | PARSER_LEXICAL_ENV_NEEDED);
if (opts & PARSER_CLASS_LITERAL_HERTIAGE_PRESENT)
{
@@ -645,9 +636,7 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
function_literal_index = lexer_construct_function_object (context_p, accessor_status_flags);
- parser_emit_cbc_literal (context_p,
- CBC_PUSH_LITERAL,
- literal_index);
+ parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, literal_index);
JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);
@@ -682,8 +671,8 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
if (is_computed)
{
- parser_emit_cbc_ext (context_p, is_getter ? CBC_EXT_SET_COMPUTED_GETTER_NAME
- : CBC_EXT_SET_COMPUTED_SETTER_NAME);
+ parser_emit_cbc_ext (context_p,
+ is_getter ? CBC_EXT_SET_COMPUTED_GETTER_NAME : CBC_EXT_SET_COMPUTED_SETTER_NAME);
parser_emit_cbc_ext (context_p, opcode);
}
else
@@ -780,8 +769,8 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
}
else
{
- parser_emit_cbc_ext (context_p, (is_static ? CBC_EXT_ADD_STATIC_COMPUTED_FIELD
- : CBC_EXT_ADD_COMPUTED_FIELD));
+ parser_emit_cbc_ext (context_p,
+ (is_static ? CBC_EXT_ADD_STATIC_COMPUTED_FIELD : CBC_EXT_ADD_COMPUTED_FIELD));
}
}
@@ -839,9 +828,7 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
{
JERRY_ASSERT (context_p->token.lit_location.type == LEXER_IDENT_LITERAL
|| context_p->token.lit_location.type == LEXER_STRING_LITERAL);
- lexer_construct_literal_object (context_p,
- &context_p->token.lit_location,
- LEXER_STRING_LITERAL);
+ lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_STRING_LITERAL);
}
else
{
@@ -853,15 +840,12 @@ parser_parse_class_body (parser_context_t *context_p, /**< context */
uint16_t literal_index = context_p->lit_object.index;
uint16_t function_literal_index = lexer_construct_function_object (context_p, status_flags | PARSER_IS_METHOD);
- parser_emit_cbc_literal (context_p,
- CBC_PUSH_LITERAL,
- function_literal_index);
+ parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, function_literal_index);
if (is_computed)
{
parser_emit_cbc_ext (context_p, CBC_EXT_SET_COMPUTED_FUNCTION_NAME);
- parser_emit_cbc_ext (context_p, is_static ? CBC_EXT_SET_STATIC_COMPUTED_PROPERTY
- : CBC_EXT_SET_COMPUTED_PROPERTY);
+ parser_emit_cbc_ext (context_p, is_static ? CBC_EXT_SET_STATIC_COMPUTED_PROPERTY : CBC_EXT_SET_COMPUTED_PROPERTY);
is_static = false;
continue;
}
@@ -952,8 +936,7 @@ parser_parse_class (parser_context_t *context_p, /**< context */
{
/* Class statement must contain an identifier. */
lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL);
- JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
+ JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
if (context_p->next_scanner_info_p->source_p == context_p->source_p)
{
@@ -1055,8 +1038,7 @@ parser_parse_class (parser_context_t *context_p, /**< context */
if (class_ident_index < PARSER_REGISTER_START)
{
- opcode = (scanner_literal_is_created (context_p, class_ident_index) ? CBC_ASSIGN_LET_CONST
- : CBC_INIT_LET);
+ opcode = (scanner_literal_is_created (context_p, class_ident_index) ? CBC_ASSIGN_LET_CONST : CBC_INIT_LET);
}
parser_emit_cbc_literal (context_p, (uint16_t) opcode, class_ident_index);
@@ -1085,13 +1067,10 @@ parser_parse_object_method (parser_context_t *context_p) /**< context */
{
context_p->source_p--;
context_p->column--;
- uint16_t function_literal_index = lexer_construct_function_object (context_p, (PARSER_FUNCTION_CLOSURE
- | PARSER_ALLOW_SUPER
- | PARSER_IS_METHOD));
+ uint16_t function_literal_index =
+ lexer_construct_function_object (context_p, (PARSER_FUNCTION_CLOSURE | PARSER_ALLOW_SUPER | PARSER_IS_METHOD));
- parser_emit_cbc_literal (context_p,
- CBC_PUSH_LITERAL,
- function_literal_index);
+ parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, function_literal_index);
context_p->last_cbc.literal_type = LEXER_FUNCTION_LITERAL;
@@ -1127,9 +1106,7 @@ parser_reparse_as_common_identifier (parser_context_t *context_p, /**< context *
JERRY_ASSERT (context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
- lexer_construct_literal_object (context_p,
- &context_p->token.lit_location,
- LEXER_IDENT_LITERAL);
+ lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_IDENT_LITERAL);
} /* parser_reparse_as_common_identifier */
#endif /* JERRY_ESNEXT */
@@ -1217,8 +1194,7 @@ parser_parse_object_literal (parser_context_t *context_p) /**< context */
if (is_computed)
{
- opcode = ((opcode == CBC_EXT_SET_GETTER) ? CBC_EXT_SET_COMPUTED_GETTER
- : CBC_EXT_SET_COMPUTED_SETTER);
+ opcode = ((opcode == CBC_EXT_SET_GETTER) ? CBC_EXT_SET_COMPUTED_GETTER : CBC_EXT_SET_COMPUTED_SETTER);
}
#else /* !JERRY_ESNEXT */
parser_append_object_literal_item (context_p, literal_index, item_type);
@@ -1233,17 +1209,15 @@ parser_parse_object_literal (parser_context_t *context_p) /**< context */
}
#endif /* JERRY_ESNEXT */
- parser_emit_cbc_literal (context_p,
- CBC_PUSH_LITERAL,
- literal_index);
+ parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, literal_index);
JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);
#if JERRY_ESNEXT
if (is_computed)
{
- parser_emit_cbc_ext (context_p, is_getter ? CBC_EXT_SET_COMPUTED_GETTER_NAME
- : CBC_EXT_SET_COMPUTED_SETTER_NAME);
+ parser_emit_cbc_ext (context_p,
+ is_getter ? CBC_EXT_SET_COMPUTED_GETTER_NAME : CBC_EXT_SET_COMPUTED_SETTER_NAME);
if (has_super_env)
{
@@ -1261,8 +1235,7 @@ parser_parse_object_literal (parser_context_t *context_p) /**< context */
context_p->last_cbc_opcode = CBC_PUSH_TWO_LITERALS;
context_p->last_cbc.value = function_literal_index;
parser_emit_cbc_ext (context_p, CBC_EXT_OBJECT_LITERAL_SET_HOME_OBJECT_COMPUTED);
- parser_emit_cbc_ext (context_p, is_getter ? CBC_EXT_SET_COMPUTED_GETTER
- : CBC_EXT_SET_COMPUTED_SETTER);
+ parser_emit_cbc_ext (context_p, is_getter ? CBC_EXT_SET_COMPUTED_GETTER : CBC_EXT_SET_COMPUTED_SETTER);
}
else
#endif /* JERRY_ESNEXT */
@@ -1366,9 +1339,7 @@ parser_parse_object_literal (parser_context_t *context_p) /**< context */
uint16_t function_literal_index = lexer_construct_function_object (context_p, status_flags);
- parser_emit_cbc_literal (context_p,
- CBC_PUSH_LITERAL,
- function_literal_index);
+ parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, function_literal_index);
JERRY_ASSERT (context_p->last_cbc_opcode == CBC_PUSH_LITERAL);
@@ -1426,9 +1397,7 @@ parser_parse_object_literal (parser_context_t *context_p) /**< context */
parser_line_counter_t start_line = context_p->token.line;
parser_line_counter_t start_column = context_p->token.column;
#else /* !JERRY_ESNEXT */
- parser_append_object_literal_item (context_p,
- literal_index,
- PARSER_OBJECT_PROPERTY_VALUE);
+ parser_append_object_literal_item (context_p, literal_index, PARSER_OBJECT_PROPERTY_VALUE);
#endif /* JERRY_ESNEXT */
lexer_next_token (context_p);
@@ -1453,8 +1422,7 @@ parser_parse_object_literal (parser_context_t *context_p) /**< context */
break;
}
- if ((context_p->token.type == LEXER_RIGHT_BRACE || context_p->token.type == LEXER_COMMA)
- && !is_proto)
+ if ((context_p->token.type == LEXER_RIGHT_BRACE || context_p->token.type == LEXER_COMMA) && !is_proto)
{
parser_reparse_as_common_identifier (context_p, start_line, start_column);
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
@@ -1565,9 +1533,8 @@ parser_parse_function_expression (parser_context_t *context_p, /**< context */
#if JERRY_ESNEXT
uint32_t parent_status_flags = context_p->status_flags;
- context_p->status_flags &= (uint32_t) ~(PARSER_IS_ASYNC_FUNCTION
- | PARSER_IS_GENERATOR_FUNCTION
- | PARSER_DISALLOW_AWAIT_YIELD);
+ context_p->status_flags &=
+ (uint32_t) ~(PARSER_IS_ASYNC_FUNCTION | PARSER_IS_GENERATOR_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD);
if (status_flags & PARSER_IS_ASYNC_FUNCTION)
{
@@ -1587,8 +1554,7 @@ parser_parse_function_expression (parser_context_t *context_p, /**< context */
{
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
}
@@ -1664,9 +1630,7 @@ parser_parse_function_expression (parser_context_t *context_p, /**< context */
}
else
{
- parser_emit_cbc_literal (context_p,
- CBC_PUSH_LITERAL,
- function_literal_index);
+ parser_emit_cbc_literal (context_p, CBC_PUSH_LITERAL, function_literal_index);
if (function_name_index != -1)
{
@@ -1693,9 +1657,7 @@ parser_parse_template_literal (parser_context_t *context_p) /**< context */
{
is_empty_head = false;
- lexer_construct_literal_object (context_p,
- &context_p->token.lit_location,
- context_p->token.lit_location.type);
+ lexer_construct_literal_object (context_p, &context_p->token.lit_location, context_p->token.lit_location.type);
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
}
@@ -1730,9 +1692,7 @@ parser_parse_template_literal (parser_context_t *context_p) /**< context */
if (is_empty_head || context_p->token.lit_location.length > 0)
{
- lexer_construct_literal_object (context_p,
- &context_p->token.lit_location,
- context_p->token.lit_location.type);
+ lexer_construct_literal_object (context_p, &context_p->token.lit_location, context_p->token.lit_location.type);
if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)
{
@@ -1773,9 +1733,7 @@ parser_parse_template_literal (parser_context_t *context_p) /**< context */
if (context_p->token.lit_location.length > 0)
{
- lexer_construct_literal_object (context_p,
- &context_p->token.lit_location,
- context_p->token.lit_location.type);
+ lexer_construct_literal_object (context_p, &context_p->token.lit_location, context_p->token.lit_location.type);
parser_emit_cbc_ext_literal_from_token (context_p, CBC_EXT_STRING_CONCAT_RIGHT_LITERAL);
}
@@ -1855,8 +1813,7 @@ parser_parse_tagged_template_literal (parser_context_t *context_p) /**< context
static inline bool JERRY_ATTR_ALWAYS_INLINE
parser_is_assignment_expr (parser_context_t *context_p)
{
- return (context_p->stack_top_uint8 == LEXER_EXPRESSION_START
- || context_p->stack_top_uint8 == LEXER_LEFT_PAREN
+ return (context_p->stack_top_uint8 == LEXER_EXPRESSION_START || context_p->stack_top_uint8 == LEXER_LEFT_PAREN
|| context_p->stack_top_uint8 == LEXER_COMMA_SEP_LIST
|| LEXER_IS_BINARY_LVALUE_OP_TOKEN (context_p->stack_top_uint8));
} /* parser_is_assignment_expr */
@@ -1879,8 +1836,7 @@ parser_check_assignment_expr (parser_context_t *context_p)
static inline bool JERRY_ATTR_ALWAYS_INLINE
parser_abort_parsing_after_assignment_expression (parser_context_t *context_p)
{
- return (context_p->token.type != LEXER_RIGHT_PAREN
- && context_p->token.type != LEXER_COMMA);
+ return (context_p->token.type != LEXER_RIGHT_PAREN && context_p->token.type != LEXER_COMMA);
} /* parser_abort_parsing_after_assignment_expression */
#endif /* JERRY_ESNEXT */
@@ -1968,8 +1924,7 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
}
#endif /* JERRY_ESNEXT */
}
- else if (new_was_seen
- || (*grouping_level_p == PARSE_EXPR_LEFT_HAND_SIDE)
+ else if (new_was_seen || (*grouping_level_p == PARSE_EXPR_LEFT_HAND_SIDE)
|| !LEXER_IS_UNARY_OP_TOKEN (context_p->token.type))
{
break;
@@ -2006,9 +1961,8 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
context_p->function_start_p = context_p->token.lit_location.char_p;
#endif /* JERRY_FUNCTION_TO_STRING */
- uint32_t arrow_status_flags = (PARSER_IS_FUNCTION
- | PARSER_IS_ARROW_FUNCTION
- | (context_p->status_flags & PARSER_INSIDE_CLASS_FIELD));
+ uint32_t arrow_status_flags =
+ (PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION | (context_p->status_flags & PARSER_INSIDE_CLASS_FIELD));
if (context_p->next_scanner_info_p->u8_arg & SCANNER_FUNCTION_ASYNC)
{
@@ -2023,18 +1977,14 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
if (context_p->token.type == LEXER_KEYW_FUNCTION)
{
- uint32_t status_flags = (PARSER_FUNCTION_CLOSURE
- | PARSER_IS_FUNC_EXPRESSION
- | PARSER_IS_ASYNC_FUNCTION
+ uint32_t status_flags = (PARSER_FUNCTION_CLOSURE | PARSER_IS_FUNC_EXPRESSION | PARSER_IS_ASYNC_FUNCTION
| PARSER_DISALLOW_AWAIT_YIELD);
parser_parse_function_expression (context_p, status_flags);
break;
}
- arrow_status_flags = (PARSER_IS_FUNCTION
- | PARSER_IS_ARROW_FUNCTION
- | PARSER_IS_ASYNC_FUNCTION
- | PARSER_DISALLOW_AWAIT_YIELD);
+ arrow_status_flags =
+ (PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION | PARSER_IS_ASYNC_FUNCTION | PARSER_DISALLOW_AWAIT_YIELD);
}
parser_check_assignment_expr (context_p);
@@ -2047,9 +1997,7 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
if (type == LEXER_IDENT_LITERAL || type == LEXER_STRING_LITERAL)
{
- lexer_construct_literal_object (context_p,
- &context_p->token.lit_location,
- context_p->token.lit_location.type);
+ lexer_construct_literal_object (context_p, &context_p->token.lit_location, context_p->token.lit_location.type);
}
else if (type == LEXER_NUMBER_LITERAL)
{
@@ -2071,9 +2019,7 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
}
#endif /* JERRY_BUILTIN_BIGINT */
parser_stack_pop_uint8 (context_p);
- }
- while (context_p->stack_top_uint8 == LEXER_PLUS
- || context_p->stack_top_uint8 == LEXER_NEGATE);
+ } while (context_p->stack_top_uint8 == LEXER_PLUS || context_p->stack_top_uint8 == LEXER_NEGATE);
}
if (lexer_construct_number_object (context_p, true, is_negative_number))
@@ -2272,9 +2218,8 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
context_p->function_start_p = context_p->source_p - 1;
#endif /* JERRY_FUNCTION_TO_STRING */
- uint32_t arrow_status_flags = (PARSER_IS_FUNCTION
- | PARSER_IS_ARROW_FUNCTION
- | (context_p->status_flags & PARSER_INSIDE_CLASS_FIELD));
+ uint32_t arrow_status_flags =
+ (PARSER_IS_FUNCTION | PARSER_IS_ARROW_FUNCTION | (context_p->status_flags & PARSER_INSIDE_CLASS_FIELD));
parser_parse_function_expression (context_p, arrow_status_flags);
return parser_abort_parsing_after_assignment_expression (context_p);
}
@@ -2291,8 +2236,8 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
parser_check_assignment_expr (context_p);
lexer_next_token (context_p);
- cbc_ext_opcode_t opcode = ((context_p->status_flags & PARSER_IS_ASYNC_FUNCTION) ? CBC_EXT_ASYNC_YIELD
- : CBC_EXT_YIELD);
+ cbc_ext_opcode_t opcode =
+ ((context_p->status_flags & PARSER_IS_ASYNC_FUNCTION) ? CBC_EXT_ASYNC_YIELD : CBC_EXT_YIELD);
if (!lexer_check_yield_no_arg (context_p))
{
if (context_p->token.type == LEXER_MULTIPLY)
@@ -2311,8 +2256,7 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
parser_emit_cbc_ext (context_p, opcode);
- return (context_p->token.type != LEXER_RIGHT_PAREN
- && context_p->token.type != LEXER_COMMA);
+ return (context_p->token.type != LEXER_RIGHT_PAREN && context_p->token.type != LEXER_COMMA);
}
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
@@ -2324,8 +2268,7 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
{
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL
|| context_p->token.keyword_type != LEXER_KEYW_META
|| (context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))
{
@@ -2368,8 +2311,8 @@ parser_parse_unary_expression (parser_context_t *context_p, /**< context */
default:
{
bool is_left_hand_side = (*grouping_level_p == PARSE_EXPR_LEFT_HAND_SIDE);
- parser_raise_error (context_p, (is_left_hand_side ? PARSER_ERR_LEFT_HAND_SIDE_EXP_EXPECTED
- : PARSER_ERR_UNEXPECTED_END));
+ parser_raise_error (context_p,
+ (is_left_hand_side ? PARSER_ERR_LEFT_HAND_SIDE_EXP_EXPECTED : PARSER_ERR_UNEXPECTED_END));
break;
}
}
@@ -2404,8 +2347,7 @@ parser_process_unary_expression (parser_context_t *context_p, /**< context */
if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL)
{
- JERRY_ASSERT (CBC_ARGS_EQ (CBC_PUSH_PROP_LITERAL_LITERAL,
- CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2));
+ JERRY_ASSERT (CBC_ARGS_EQ (CBC_PUSH_PROP_LITERAL_LITERAL, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2));
context_p->last_cbc_opcode = CBC_PUSH_PROP_LITERAL_LITERAL;
context_p->last_cbc.value = context_p->lit_object.index;
}
@@ -2739,8 +2681,7 @@ parser_process_unary_expression (parser_context_t *context_p, /**< context */
if (!LEXER_IS_UNARY_OP_TOKEN (token))
{
#if JERRY_ESNEXT
- if (context_p->token.type == LEXER_EXPONENTIATION
- && last_unary_token != LEXER_INCREASE
+ if (context_p->token.type == LEXER_EXPONENTIATION && last_unary_token != LEXER_INCREASE
&& last_unary_token != LEXER_DECREASE)
{
parser_raise_error (context_p, PARSER_ERR_INVALID_EXPONENTIATION);
@@ -2771,8 +2712,8 @@ parser_process_unary_expression (parser_context_t *context_p, /**< context */
#if JERRY_ESNEXT
else if (JERRY_UNLIKELY (token == LEXER_KEYW_AWAIT))
{
- cbc_ext_opcode_t opcode = ((context_p->status_flags & PARSER_IS_GENERATOR_FUNCTION) ? CBC_EXT_GENERATOR_AWAIT
- : CBC_EXT_AWAIT);
+ cbc_ext_opcode_t opcode =
+ ((context_p->status_flags & PARSER_IS_GENERATOR_FUNCTION) ? CBC_EXT_GENERATOR_AWAIT : CBC_EXT_AWAIT);
parser_emit_cbc_ext (context_p, opcode);
}
#endif /* JERRY_ESNEXT */
@@ -2950,7 +2891,7 @@ parser_append_binary_single_assignment_token (parser_context_t *context_p, /**<
#endif /* JERRY_ESNEXT */
else
{
- /* Invalid LeftHandSide expression. */ //3820, 3815
+ /* Invalid LeftHandSide expression. */ // 3820, 3815
#if JERRY_ESNEXT
parser_check_invalid_new_target (context_p, CBC_ASSIGN);
parser_raise_error (context_p, PARSER_ERR_INVALID_LHS_ASSIGNMENT);
@@ -3051,8 +2992,7 @@ parser_append_binary_token (parser_context_t *context_p) /**< context */
parser_emit_cbc (context_p, CBC_PUSH_PROP_REFERENCE);
}
}
- else if (context_p->token.type == LEXER_LOGICAL_OR
- || context_p->token.type == LEXER_LOGICAL_AND)
+ else if (context_p->token.type == LEXER_LOGICAL_OR || context_p->token.type == LEXER_LOGICAL_AND)
{
parser_branch_t branch;
uint16_t opcode = CBC_BRANCH_IF_LOGICAL_TRUE;
@@ -3134,13 +3074,9 @@ parser_process_binary_opcodes (parser_context_t *context_p, /**< context */
if (cbc_flags[opcode] & CBC_HAS_LITERAL_ARG)
{
- JERRY_ASSERT (opcode == CBC_ASSIGN_SET_IDENT
- || opcode == CBC_ASSIGN_PROP_LITERAL
- || opcode == CBC_ASSIGN_PROP_THIS_LITERAL
- || opcode == CBC_ASSIGN_LET_CONST
- || opcode == CBC_INIT_ARG_OR_CATCH
- || opcode == CBC_INIT_LET
- || opcode == CBC_INIT_CONST);
+ JERRY_ASSERT (opcode == CBC_ASSIGN_SET_IDENT || opcode == CBC_ASSIGN_PROP_LITERAL
+ || opcode == CBC_ASSIGN_PROP_THIS_LITERAL || opcode == CBC_ASSIGN_LET_CONST
+ || opcode == CBC_INIT_ARG_OR_CATCH || opcode == CBC_INIT_LET || opcode == CBC_INIT_CONST);
index = parser_stack_pop_uint16 (context_p);
}
@@ -3181,11 +3117,9 @@ parser_process_binary_opcodes (parser_context_t *context_p, /**< context */
}
#endif /* JERRY_ESNEXT */
- if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL
- && opcode == CBC_ASSIGN_SET_IDENT)
+ if (context_p->last_cbc_opcode == CBC_PUSH_LITERAL && opcode == CBC_ASSIGN_SET_IDENT)
{
- JERRY_ASSERT (CBC_ARGS_EQ (CBC_ASSIGN_LITERAL_SET_IDENT,
- CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2));
+ JERRY_ASSERT (CBC_ARGS_EQ (CBC_ASSIGN_LITERAL_SET_IDENT, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2));
context_p->last_cbc.value = index;
context_p->last_cbc_opcode = CBC_ASSIGN_LITERAL_SET_IDENT;
@@ -3194,8 +3128,7 @@ parser_process_binary_opcodes (parser_context_t *context_p, /**< context */
parser_emit_cbc_literal (context_p, (uint16_t) opcode, index);
- if (opcode == CBC_ASSIGN_PROP_THIS_LITERAL
- && (context_p->stack_depth >= context_p->stack_limit))
+ if (opcode == CBC_ASSIGN_PROP_THIS_LITERAL && (context_p->stack_depth >= context_p->stack_limit))
{
/* Stack limit is increased for VM_OC_ASSIGN_PROP_THIS. Needed by vm.c. */
JERRY_ASSERT (context_p->stack_depth == context_p->stack_limit);
@@ -3250,8 +3183,7 @@ parser_process_binary_opcodes (parser_context_t *context_p, /**< context */
}
else if (context_p->last_cbc_opcode == CBC_PUSH_TWO_LITERALS)
{
- JERRY_ASSERT (CBC_ARGS_EQ (opcode + CBC_BINARY_WITH_TWO_LITERALS,
- CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2));
+ JERRY_ASSERT (CBC_ARGS_EQ (opcode + CBC_BINARY_WITH_TWO_LITERALS, CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2));
context_p->last_cbc_opcode = (uint16_t) (opcode + CBC_BINARY_WITH_TWO_LITERALS);
continue;
}
@@ -3298,8 +3230,7 @@ parser_pattern_get_target (parser_context_t *context_p, /**< context */
scanner_location_t start_location;
if (context_p->next_scanner_info_p->source_p != context_p->source_p
- || context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED
- || (flags & PARSER_PATTERN_REST_ELEMENT))
+ || context_p->next_scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED || (flags & PARSER_PATTERN_REST_ELEMENT))
{
/* Found invalid pattern, push null value to fake the rhs target. */
parser_emit_cbc (context_p, CBC_PUSH_NULL);
@@ -3398,8 +3329,7 @@ parser_pattern_form_assignment (parser_context_t *context_p, /**< context */
uint16_t name_index = PARSER_INVALID_LITERAL_INDEX;
if ((flags & PARSER_PATTERN_BINDING)
- || (context_p->last_cbc_opcode == CBC_PUSH_LITERAL
- && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL))
+ || (context_p->last_cbc_opcode == CBC_PUSH_LITERAL && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL))
{
name_index = context_p->lit_object.index;
}
@@ -3463,13 +3393,10 @@ parser_pattern_process_nested_pattern (parser_context_t *context_p, /**< context
{
JERRY_ASSERT (context_p->token.type == LEXER_LEFT_BRACE || context_p->token.type == LEXER_LEFT_SQUARE);
- parser_pattern_flags_t options = (PARSER_PATTERN_NESTED_PATTERN
- | PARSER_PATTERN_TARGET_ON_STACK
- | (flags & (PARSER_PATTERN_BINDING
- | PARSER_PATTERN_LET
- | PARSER_PATTERN_CONST
- | PARSER_PATTERN_LOCAL
- | PARSER_PATTERN_ARGUMENTS)));
+ parser_pattern_flags_t options = (PARSER_PATTERN_NESTED_PATTERN | PARSER_PATTERN_TARGET_ON_STACK
+ | (flags
+ & (PARSER_PATTERN_BINDING | PARSER_PATTERN_LET | PARSER_PATTERN_CONST
+ | PARSER_PATTERN_LOCAL | PARSER_PATTERN_ARGUMENTS)));
JERRY_ASSERT (context_p->next_scanner_info_p->source_p != context_p->source_p
|| context_p->next_scanner_info_p->type == SCANNER_TYPE_INITIALIZER
@@ -3551,8 +3478,7 @@ parser_pattern_process_assignment (parser_context_t *context_p, /**< context */
lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_IDENT_LITERAL);
- if (flags & (PARSER_PATTERN_LET | PARSER_PATTERN_CONST)
- && context_p->token.keyword_type == LEXER_KEYW_LET)
+ if (flags & (PARSER_PATTERN_LET | PARSER_PATTERN_CONST) && context_p->token.keyword_type == LEXER_KEYW_LET)
{
parser_raise_error (context_p, PARSER_ERR_LEXICAL_LET_BINDING);
}
@@ -3578,8 +3504,7 @@ parser_pattern_process_assignment (parser_context_t *context_p, /**< context */
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
lexer_next_token (context_p);
- if (context_p->token.type != end_type
- && context_p->token.type != LEXER_ASSIGN
+ if (context_p->token.type != end_type && context_p->token.type != LEXER_ASSIGN
&& context_p->token.type != LEXER_COMMA)
{
parser_raise_error (context_p, PARSER_ERR_ILLEGAL_PROPERTY_IN_DECLARATION);
@@ -3722,8 +3647,8 @@ parser_parse_object_initializer (parser_context_t *context_p, /**< context */
if (context_p->token.type == LEXER_RIGHT_SQUARE)
{
prop_index = PARSER_PATTERN_RHS_NO_LIT;
- push_prop_opcode = ((flags & PARSER_PATTERN_HAS_REST_ELEMENT) ? CBC_EXT_INITIALIZER_PUSH_NAME
- : CBC_EXT_INITIALIZER_PUSH_PROP);
+ push_prop_opcode =
+ ((flags & PARSER_PATTERN_HAS_REST_ELEMENT) ? CBC_EXT_INITIALIZER_PUSH_NAME : CBC_EXT_INITIALIZER_PUSH_PROP);
}
else if (flags & PARSER_PATTERN_HAS_REST_ELEMENT)
{
@@ -3745,14 +3670,12 @@ parser_parse_object_initializer (parser_context_t *context_p, /**< context */
}
else
{
- if (push_prop_opcode == CBC_EXT_INITIALIZER_PUSH_NAME
- || push_prop_opcode == CBC_EXT_INITIALIZER_PUSH_PROP)
+ if (push_prop_opcode == CBC_EXT_INITIALIZER_PUSH_NAME || push_prop_opcode == CBC_EXT_INITIALIZER_PUSH_PROP)
{
parser_raise_error (context_p, PARSER_ERR_COLON_EXPECTED);
}
- if (context_p->token.type != LEXER_RIGHT_BRACE
- && context_p->token.type != LEXER_ASSIGN
+ if (context_p->token.type != LEXER_RIGHT_BRACE && context_p->token.type != LEXER_ASSIGN
&& context_p->token.type != LEXER_COMMA)
{
parser_raise_error (context_p, PARSER_ERR_OBJECT_ITEM_SEPARATOR_EXPECTED);
@@ -3776,8 +3699,7 @@ parser_parse_object_initializer (parser_context_t *context_p, /**< context */
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
lexer_next_token (context_p);
- JERRY_ASSERT (context_p->token.type == LEXER_RIGHT_BRACE
- || context_p->token.type == LEXER_ASSIGN
+ JERRY_ASSERT (context_p->token.type == LEXER_RIGHT_BRACE || context_p->token.type == LEXER_ASSIGN
|| context_p->token.type == LEXER_COMMA);
parser_pattern_form_assignment (context_p, flags, push_prop_opcode, prop_index, start_line);
@@ -3798,8 +3720,8 @@ parser_parse_object_initializer (parser_context_t *context_p, /**< context */
if (flags & PARSER_PATTERN_HAS_REST_ELEMENT)
{
- PARSER_MINUS_EQUAL_U16 (context_p->stack_depth, (PARSER_OBJ_INIT_REST_CONTEXT_STACK_ALLOCATION
- - PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION));
+ PARSER_MINUS_EQUAL_U16 (context_p->stack_depth,
+ (PARSER_OBJ_INIT_REST_CONTEXT_STACK_ALLOCATION - PARSER_OBJ_INIT_CONTEXT_STACK_ALLOCATION));
}
parser_emit_cbc_ext (context_p, CBC_EXT_OBJ_INIT_CONTEXT_END);
@@ -3963,8 +3885,7 @@ parser_process_group_expression (parser_context_t *context_p, /**< context */
if (JERRY_UNLIKELY (context_p->token.type == LEXER_ASSIGN
&& PARSER_IS_PUSH_LITERALS_WITH_THIS (context_p->last_cbc_opcode)
&& context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL
- && parser_is_assignment_expr (context_p)
- && *grouping_level_p != PARSE_EXPR_LEFT_HAND_SIDE))
+ && parser_is_assignment_expr (context_p) && *grouping_level_p != PARSE_EXPR_LEFT_HAND_SIDE))
{
parser_stack_push_uint8 (context_p, LEXER_ASSIGN_GROUP_EXPR);
}
@@ -4007,8 +3928,7 @@ parser_parse_expression_statement (parser_context_t *context_p, /**< context */
}
} /* parser_parse_expression_statement */
-JERRY_STATIC_ASSERT (PARSE_EXPR_LEFT_HAND_SIDE == 0x1,
- value_of_parse_expr_left_hand_side_must_be_1);
+JERRY_STATIC_ASSERT (PARSE_EXPR_LEFT_HAND_SIDE == 0x1, value_of_parse_expr_left_hand_side_must_be_1);
/**
* Parse expression.
@@ -4037,7 +3957,7 @@ parser_parse_expression (parser_context_t *context_p, /**< context */
while (true)
{
-process_unary_expression:
+ process_unary_expression:
parser_process_unary_expression (context_p, grouping_level);
if (JERRY_LIKELY (grouping_level != PARSE_EXPR_LEFT_HAND_SIDE))
@@ -4078,8 +3998,7 @@ process_unary_expression:
parser_process_binary_opcodes (context_p, min_prec_treshold);
}
if (context_p->token.type == LEXER_RIGHT_PAREN
- && (context_p->stack_top_uint8 == LEXER_LEFT_PAREN
- || context_p->stack_top_uint8 == LEXER_COMMA_SEP_LIST))
+ && (context_p->stack_top_uint8 == LEXER_LEFT_PAREN || context_p->stack_top_uint8 == LEXER_COMMA_SEP_LIST))
{
parser_process_group_expression (context_p, &grouping_level);
continue;
diff --git a/jerry-core/parser/js/js-parser-internal.h b/jerry-core/parser/js/js-parser-internal.h
index 352ea611..b8a3e7e0 100644
--- a/jerry-core/parser/js/js-parser-internal.h
+++ b/jerry-core/parser/js/js-parser-internal.h
@@ -16,17 +16,16 @@
#ifndef JS_PARSER_INTERNAL_H
#define JS_PARSER_INTERNAL_H
-#include "common.h"
+#include "ecma-module.h"
#include "byte-code.h"
+#include "common.h"
#include "debugger.h"
-#include "js-parser.h"
-#include "js-parser-limits.h"
#include "js-lexer.h"
+#include "js-parser-limits.h"
+#include "js-parser.h"
#include "js-scanner.h"
-#include "ecma-module.h"
-
/** \addtogroup parser Parser
* @{
*
@@ -42,47 +41,47 @@
*/
typedef enum
{
- PARSER_IS_STRICT = (1u << 0), /**< strict mode code */
- PARSER_IS_FUNCTION = (1u << 1), /**< function body is parsed */
- PARSER_IS_CLOSURE = (1u << 2), /**< function body is encapsulated in {} block */
- PARSER_IS_FUNC_EXPRESSION = (1u << 3), /**< a function expression is parsed */
- PARSER_IS_PROPERTY_GETTER = (1u << 4), /**< a property getter function is parsed */
- PARSER_IS_PROPERTY_SETTER = (1u << 5), /**< a property setter function is parsed */
- PARSER_HAS_NON_STRICT_ARG = (1u << 6), /**< the function has arguments which
- * are not supported in strict mode */
- PARSER_ARGUMENTS_NEEDED = (1u << 7), /**< arguments object must be created */
- PARSER_LEXICAL_ENV_NEEDED = (1u << 8), /**< lexical environment object must be created */
- PARSER_INSIDE_WITH = (1u << 9), /**< code block is inside a with statement */
- PARSER_NO_END_LABEL = (1u << 10), /**< return instruction must be inserted
- * after the last byte code */
+ PARSER_IS_STRICT = (1u << 0), /**< strict mode code */
+ PARSER_IS_FUNCTION = (1u << 1), /**< function body is parsed */
+ PARSER_IS_CLOSURE = (1u << 2), /**< function body is encapsulated in {} block */
+ PARSER_IS_FUNC_EXPRESSION = (1u << 3), /**< a function expression is parsed */
+ PARSER_IS_PROPERTY_GETTER = (1u << 4), /**< a property getter function is parsed */
+ PARSER_IS_PROPERTY_SETTER = (1u << 5), /**< a property setter function is parsed */
+ PARSER_HAS_NON_STRICT_ARG = (1u << 6), /**< the function has arguments which
+ * are not supported in strict mode */
+ PARSER_ARGUMENTS_NEEDED = (1u << 7), /**< arguments object must be created */
+ PARSER_LEXICAL_ENV_NEEDED = (1u << 8), /**< lexical environment object must be created */
+ PARSER_INSIDE_WITH = (1u << 9), /**< code block is inside a with statement */
+ PARSER_NO_END_LABEL = (1u << 10), /**< return instruction must be inserted
+ * after the last byte code */
PARSER_DEBUGGER_BREAKPOINT_APPENDED = (1u << 11), /**< pending (unsent) breakpoint
* info is available */
#if JERRY_ESNEXT
- PARSER_LEXICAL_BLOCK_NEEDED = (1u << 12), /**< global script: needs a lexical environment for let and const
- * function: needs a lexical environment for arguments */
- PARSER_IS_ARROW_FUNCTION = (1u << 13), /**< an arrow function is parsed */
- PARSER_IS_GENERATOR_FUNCTION = (1u << 14), /**< a generator function is parsed */
- PARSER_IS_ASYNC_FUNCTION = (1u << 15), /**< an async function is parsed */
- PARSER_DISALLOW_AWAIT_YIELD = (1u << 16), /**< throw SyntaxError for await / yield keywords */
+ PARSER_LEXICAL_BLOCK_NEEDED = (1u << 12), /**< global script: needs a lexical environment for let and const
+ * function: needs a lexical environment for arguments */
+ PARSER_IS_ARROW_FUNCTION = (1u << 13), /**< an arrow function is parsed */
+ PARSER_IS_GENERATOR_FUNCTION = (1u << 14), /**< a generator function is parsed */
+ PARSER_IS_ASYNC_FUNCTION = (1u << 15), /**< an async function is parsed */
+ PARSER_DISALLOW_AWAIT_YIELD = (1u << 16), /**< throw SyntaxError for await / yield keywords */
PARSER_FUNCTION_IS_PARSING_ARGS = (1u << 17), /**< set when parsing function arguments */
PARSER_FUNCTION_HAS_COMPLEX_ARGUMENT = (1u << 18), /**< function has complex (ES2015+) argument definition */
PARSER_FUNCTION_HAS_REST_PARAM = (1u << 19), /**< function has rest parameter */
- PARSER_CLASS_CONSTRUCTOR = (1u << 20), /**< a class constructor is parsed
- * Note: PARSER_ALLOW_SUPER must be present */
+ PARSER_CLASS_CONSTRUCTOR = (1u << 20), /**< a class constructor is parsed
+ * Note: PARSER_ALLOW_SUPER must be present */
/* These four status flags must be in this order. See PARSER_SAVED_FLAGS_OFFSET. */
- PARSER_ALLOW_SUPER = (1u << 21), /**< allow super property access */
- PARSER_ALLOW_SUPER_CALL = (1u << 22), /**< allow super constructor call
- * Note: PARSER_CLASS_CONSTRUCTOR must be present */
- PARSER_INSIDE_CLASS_FIELD = (1u << 23), /**< a class field is being parsed */
- PARSER_ALLOW_NEW_TARGET = (1u << 24), /**< allow new.target parsing in the current context */
- PARSER_IS_METHOD = (1u << 25), /**< method is parsed */
+ PARSER_ALLOW_SUPER = (1u << 21), /**< allow super property access */
+ PARSER_ALLOW_SUPER_CALL = (1u << 22), /**< allow super constructor call
+ * Note: PARSER_CLASS_CONSTRUCTOR must be present */
+ PARSER_INSIDE_CLASS_FIELD = (1u << 23), /**< a class field is being parsed */
+ PARSER_ALLOW_NEW_TARGET = (1u << 24), /**< allow new.target parsing in the current context */
+ PARSER_IS_METHOD = (1u << 25), /**< method is parsed */
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
- PARSER_MODULE_DEFAULT_CLASS_OR_FUNC = (1u << 26), /**< parsing a function or class default export */
- PARSER_MODULE_STORE_IDENT = (1u << 27), /**< store identifier of the current export statement */
+ PARSER_MODULE_DEFAULT_CLASS_OR_FUNC = (1u << 26), /**< parsing a function or class default export */
+ PARSER_MODULE_STORE_IDENT = (1u << 27), /**< store identifier of the current export statement */
#endif /* JERRY_MODULE_SYSTEM */
- PARSER_HAS_LATE_LIT_INIT = (1u << 30), /**< there are identifier or string literals which construction
- * is postponed after the local parser data is freed */
+ PARSER_HAS_LATE_LIT_INIT = (1u << 30), /**< there are identifier or string literals which construction
+ * is postponed after the local parser data is freed */
#ifndef JERRY_NDEBUG
PARSER_SCANNING_SUCCESSFUL = PARSER_HAS_LATE_LIT_INIT, /**< scanning process was successful */
#endif /* !JERRY_NDEBUG */
@@ -93,12 +92,12 @@ typedef enum
*/
typedef enum
{
- PARSE_EXPR = 0, /**< parse an expression without any special flags */
- PARSE_EXPR_LEFT_HAND_SIDE = (1u << 0), /**< parse a left-hand-side expression */
- PARSE_EXPR_NO_PUSH_RESULT = (1u << 1), /**< do not push the result of the expression onto the stack */
- PARSE_EXPR_NO_COMMA = (1u << 2), /**< do not parse comma operator */
- PARSE_EXPR_HAS_LITERAL = (1u << 3), /**< a primary literal is provided by a
- * CBC_PUSH_LITERAL instruction */
+ PARSE_EXPR = 0, /**< parse an expression without any special flags */
+ PARSE_EXPR_LEFT_HAND_SIDE = (1u << 0), /**< parse a left-hand-side expression */
+ PARSE_EXPR_NO_PUSH_RESULT = (1u << 1), /**< do not push the result of the expression onto the stack */
+ PARSE_EXPR_NO_COMMA = (1u << 2), /**< do not parse comma operator */
+ PARSE_EXPR_HAS_LITERAL = (1u << 3), /**< a primary literal is provided by a
+ * CBC_PUSH_LITERAL instruction */
} parser_expression_flags_t;
/**
@@ -106,17 +105,17 @@ typedef enum
*/
typedef enum
{
- PARSER_PATTERN_NO_OPTS = 0, /**< parse the expression after '=' */
- PARSER_PATTERN_BINDING = (1u << 0), /**< parse BindingPattern */
- PARSER_PATTERN_TARGET_ON_STACK = (1u << 1), /**< assignment target is the topmost element on the stack */
- PARSER_PATTERN_TARGET_DEFAULT = (1u << 2), /**< perform default value comparison for assignment target */
- PARSER_PATTERN_NESTED_PATTERN = (1u << 3), /**< parse pattern inside a pattern */
- PARSER_PATTERN_LET = (1u << 4), /**< pattern is a let declaration */
- PARSER_PATTERN_CONST = (1u << 5), /**< pattern is a const declaration */
- PARSER_PATTERN_LOCAL = (1u << 6), /**< pattern is a local (catch parameter) declaration */
- PARSER_PATTERN_REST_ELEMENT = (1u << 7), /**< parse rest array / object element */
+ PARSER_PATTERN_NO_OPTS = 0, /**< parse the expression after '=' */
+ PARSER_PATTERN_BINDING = (1u << 0), /**< parse BindingPattern */
+ PARSER_PATTERN_TARGET_ON_STACK = (1u << 1), /**< assignment target is the topmost element on the stack */
+ PARSER_PATTERN_TARGET_DEFAULT = (1u << 2), /**< perform default value comparison for assignment target */
+ PARSER_PATTERN_NESTED_PATTERN = (1u << 3), /**< parse pattern inside a pattern */
+ PARSER_PATTERN_LET = (1u << 4), /**< pattern is a let declaration */
+ PARSER_PATTERN_CONST = (1u << 5), /**< pattern is a const declaration */
+ PARSER_PATTERN_LOCAL = (1u << 6), /**< pattern is a local (catch parameter) declaration */
+ PARSER_PATTERN_REST_ELEMENT = (1u << 7), /**< parse rest array / object element */
PARSER_PATTERN_HAS_REST_ELEMENT = (1u << 8), /**< object literal rest element will be present */
- PARSER_PATTERN_ARGUMENTS = (1u << 9), /**< parse arguments binding */
+ PARSER_PATTERN_ARGUMENTS = (1u << 9), /**< parse arguments binding */
} parser_pattern_flags_t;
/**
@@ -124,10 +123,10 @@ typedef enum
*/
typedef enum
{
- PARSER_CHECK_BLOCK_CONTEXT, /**< check block context */
+ PARSER_CHECK_BLOCK_CONTEXT, /**< check block context */
#if JERRY_ESNEXT
- PARSER_CHECK_GLOBAL_CONTEXT, /**< check global context */
- PARSER_CHECK_FUNCTION_CONTEXT, /**< check function context */
+ PARSER_CHECK_GLOBAL_CONTEXT, /**< check global context */
+ PARSER_CHECK_FUNCTION_CONTEXT, /**< check function context */
#endif /* JERRY_ESNEXT */
} parser_check_context_type_t;
@@ -138,10 +137,10 @@ typedef enum
*/
typedef enum
{
- PARSER_CLASS_FIELD_END = (1u << 0), /**< last class field */
- PARSER_CLASS_FIELD_NORMAL = (1u << 1), /**< normal (non-computed) class field */
- PARSER_CLASS_FIELD_INITIALIZED = (1u << 2), /**< class field is initialized */
- PARSER_CLASS_FIELD_STATIC = (1u << 3), /**< static class field */
+ PARSER_CLASS_FIELD_END = (1u << 0), /**< last class field */
+ PARSER_CLASS_FIELD_NORMAL = (1u << 1), /**< normal (non-computed) class field */
+ PARSER_CLASS_FIELD_INITIALIZED = (1u << 2), /**< class field is initialized */
+ PARSER_CLASS_FIELD_STATIC = (1u << 3), /**< static class field */
} parser_class_field_type_t;
#endif /* JERRY_ESNEXT */
@@ -172,8 +171,7 @@ typedef enum
/**
* Offset of PARSER_ALLOW_SUPER
*/
-#define PARSER_SAVED_FLAGS_OFFSET \
- JERRY_LOG2 (PARSER_ALLOW_SUPER)
+#define PARSER_SAVED_FLAGS_OFFSET JERRY_LOG2 (PARSER_ALLOW_SUPER)
/**
* Mask of saved flags
@@ -184,26 +182,23 @@ typedef enum
/**
* Get class option bits from parser_general_flags_t
*/
-#define PARSER_SAVE_STATUS_FLAGS(opts) \
- ((uint16_t) (((opts) >> PARSER_SAVED_FLAGS_OFFSET) & PARSER_SAVED_FLAGS_MASK))
+#define PARSER_SAVE_STATUS_FLAGS(opts) ((uint16_t) (((opts) >> PARSER_SAVED_FLAGS_OFFSET) & PARSER_SAVED_FLAGS_MASK))
/**
* Mask for get class option bits from ecma_parse_opts_t
*/
-#define PARSER_RESTORE_STATUS_FLAGS_MASK \
- (((ECMA_PARSE_ALLOW_NEW_TARGET << 1) - 1) - (ECMA_PARSE_ALLOW_SUPER - 1))
+#define PARSER_RESTORE_STATUS_FLAGS_MASK (((ECMA_PARSE_ALLOW_NEW_TARGET << 1) - 1) - (ECMA_PARSE_ALLOW_SUPER - 1))
/**
* Shift for get class option bits from ecma_parse_opts_t
*/
-#define PARSER_RESTORE_STATUS_FLAGS_SHIFT \
- (JERRY_LOG2 (PARSER_ALLOW_SUPER) - JERRY_LOG2 (ECMA_PARSE_ALLOW_SUPER))
+#define PARSER_RESTORE_STATUS_FLAGS_SHIFT (JERRY_LOG2 (PARSER_ALLOW_SUPER) - JERRY_LOG2 (ECMA_PARSE_ALLOW_SUPER))
/**
* Get class option bits from ecma_parse_opts_t
*/
#define PARSER_RESTORE_STATUS_FLAGS(opts) \
- (((opts) & PARSER_RESTORE_STATUS_FLAGS_MASK) << PARSER_RESTORE_STATUS_FLAGS_SHIFT)
+ (((opts) &PARSER_RESTORE_STATUS_FLAGS_MASK) << PARSER_RESTORE_STATUS_FLAGS_SHIFT)
/**
* All flags that affect exotic arguments object creation.
@@ -214,8 +209,7 @@ typedef enum
/**
* Get the corresponding eval flag for a ecma_parse_opts_t flag
*/
-#define PARSER_GET_EVAL_FLAG(type) \
- ((type) >> JERRY_LOG2 (ECMA_PARSE_ALLOW_SUPER))
+#define PARSER_GET_EVAL_FLAG(type) ((type) >> JERRY_LOG2 (ECMA_PARSE_ALLOW_SUPER))
/**
* Check non-generator async functions
@@ -228,63 +222,54 @@ typedef enum
/**
* All flags that affect exotic arguments object creation.
*/
-#define PARSER_ARGUMENTS_RELATED_FLAGS \
- (PARSER_ARGUMENTS_NEEDED | PARSER_IS_STRICT)
+#define PARSER_ARGUMENTS_RELATED_FLAGS (PARSER_ARGUMENTS_NEEDED | PARSER_IS_STRICT)
#endif /* JERRY_ESNEXT */
/* Checks whether unmapped arguments are needed. */
#define PARSER_NEEDS_MAPPED_ARGUMENTS(status_flags) \
- (((status_flags) & PARSER_ARGUMENTS_RELATED_FLAGS) == PARSER_ARGUMENTS_NEEDED)
+ (((status_flags) &PARSER_ARGUMENTS_RELATED_FLAGS) == PARSER_ARGUMENTS_NEEDED)
/* The maximum of PARSER_CBC_STREAM_PAGE_SIZE is 127. */
-#define PARSER_CBC_STREAM_PAGE_SIZE \
- ((uint32_t) (64 - sizeof (void *)))
+#define PARSER_CBC_STREAM_PAGE_SIZE ((uint32_t) (64 - sizeof (void *)))
/* Defines the size of the max page. */
-#define PARSER_STACK_PAGE_SIZE \
- ((uint32_t) (((sizeof (void *) > 4) ? 128 : 64) - sizeof (void *)))
+#define PARSER_STACK_PAGE_SIZE ((uint32_t) (((sizeof (void *) > 4) ? 128 : 64) - sizeof (void *)))
/* Avoid compiler warnings for += operations. */
-#define PARSER_PLUS_EQUAL_U16(base, value) (base) = (uint16_t) ((base) + (value))
+#define PARSER_PLUS_EQUAL_U16(base, value) (base) = (uint16_t) ((base) + (value))
#define PARSER_MINUS_EQUAL_U16(base, value) (base) = (uint16_t) ((base) - (value))
-#define PARSER_PLUS_EQUAL_LC(base, value) (base) = (parser_line_counter_t) ((base) + (value))
+#define PARSER_PLUS_EQUAL_LC(base, value) (base) = (parser_line_counter_t) ((base) + (value))
/**
* Argument for a compact-byte code.
*/
typedef struct
{
- uint16_t literal_index; /**< literal index argument */
- uint16_t value; /**< other argument (second literal or byte). */
- uint16_t third_literal_index; /**< literal index argument */
- uint8_t literal_type; /**< last literal type */
- uint8_t literal_keyword_type; /**< last literal keyword type */
+ uint16_t literal_index; /**< literal index argument */
+ uint16_t value; /**< other argument (second literal or byte). */
+ uint16_t third_literal_index; /**< literal index argument */
+ uint8_t literal_type; /**< last literal type */
+ uint8_t literal_keyword_type; /**< last literal keyword type */
} cbc_argument_t;
/* Useful parser macros. */
#define PARSER_CBC_UNAVAILABLE CBC_EXT_OPCODE
-#define PARSER_TO_EXT_OPCODE(opcode) ((uint16_t) ((opcode) + 256))
-#define PARSER_GET_EXT_OPCODE(opcode) ((opcode) - 256)
+#define PARSER_TO_EXT_OPCODE(opcode) ((uint16_t) ((opcode) + 256))
+#define PARSER_GET_EXT_OPCODE(opcode) ((opcode) -256)
#define PARSER_IS_BASIC_OPCODE(opcode) ((opcode) < 256)
#define PARSER_IS_PUSH_LITERAL(opcode) \
- ((opcode) == CBC_PUSH_LITERAL \
- || (opcode) == CBC_PUSH_TWO_LITERALS \
- || (opcode) == CBC_PUSH_THREE_LITERALS)
+ ((opcode) == CBC_PUSH_LITERAL || (opcode) == CBC_PUSH_TWO_LITERALS || (opcode) == CBC_PUSH_THREE_LITERALS)
#define PARSER_IS_PUSH_NUMBER(opcode) \
- ((opcode) >= CBC_PUSH_NUMBER_0 \
- && (opcode) <= CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)
+ ((opcode) >= CBC_PUSH_NUMBER_0 && (opcode) <= CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)
-#define PARSER_IS_MUTABLE_PUSH_LITERAL(opcode) \
- ((opcode) >= CBC_PUSH_LITERAL && (opcode) <= CBC_PUSH_THIS_LITERAL)
+#define PARSER_IS_MUTABLE_PUSH_LITERAL(opcode) ((opcode) >= CBC_PUSH_LITERAL && (opcode) <= CBC_PUSH_THIS_LITERAL)
-#define PARSER_IS_PUSH_LITERALS_WITH_THIS(opcode) \
- ((opcode) >= CBC_PUSH_LITERAL && (opcode) <= CBC_PUSH_THREE_LITERALS)
+#define PARSER_IS_PUSH_LITERALS_WITH_THIS(opcode) ((opcode) >= CBC_PUSH_LITERAL && (opcode) <= CBC_PUSH_THREE_LITERALS)
-#define PARSER_IS_PUSH_PROP(opcode) \
- ((opcode) >= CBC_PUSH_PROP && (opcode) <= CBC_PUSH_PROP_THIS_LITERAL)
+#define PARSER_IS_PUSH_PROP(opcode) ((opcode) >= CBC_PUSH_PROP && (opcode) <= CBC_PUSH_PROP_THIS_LITERAL)
#define PARSER_IS_PUSH_PROP_LITERAL(opcode) \
((opcode) >= CBC_PUSH_PROP_LITERAL && (opcode) <= CBC_PUSH_PROP_THIS_LITERAL)
@@ -305,21 +290,17 @@ typedef struct
((lexer_literal_t *) parser_list_get (&context_p->literal_pool, (literal_index)))
#define PARSER_TO_BINARY_OPERATION_WITH_RESULT(opcode) \
- (PARSER_TO_EXT_OPCODE(opcode) - CBC_ASSIGN_ADD + CBC_EXT_ASSIGN_ADD_PUSH_RESULT)
+ (PARSER_TO_EXT_OPCODE (opcode) - CBC_ASSIGN_ADD + CBC_EXT_ASSIGN_ADD_PUSH_RESULT)
#define PARSER_TO_BINARY_OPERATION_WITH_BLOCK(opcode) \
- ((uint16_t) (PARSER_TO_EXT_OPCODE(opcode) - CBC_ASSIGN_ADD + CBC_EXT_ASSIGN_ADD_BLOCK))
+ ((uint16_t) (PARSER_TO_EXT_OPCODE (opcode) - CBC_ASSIGN_ADD + CBC_EXT_ASSIGN_ADD_BLOCK))
-#define PARSER_GET_FLAGS(op) \
- (PARSER_IS_BASIC_OPCODE (op) ? cbc_flags[(op)] : cbc_ext_flags[PARSER_GET_EXT_OPCODE (op)])
+#define PARSER_GET_FLAGS(op) (PARSER_IS_BASIC_OPCODE (op) ? cbc_flags[(op)] : cbc_ext_flags[PARSER_GET_EXT_OPCODE (op)])
#define PARSER_OPCODE_IS_RETURN(op) \
- ((op) == CBC_RETURN \
- || (op) == CBC_RETURN_FUNCTION_END \
- || (op) == CBC_RETURN_WITH_LITERAL)
+ ((op) == CBC_RETURN || (op) == CBC_RETURN_FUNCTION_END || (op) == CBC_RETURN_WITH_LITERAL)
-#define PARSER_ARGS_EQ(op, types) \
- ((PARSER_GET_FLAGS (op) & CBC_ARG_TYPES) == (types))
+#define PARSER_ARGS_EQ(op, types) ((PARSER_GET_FLAGS (op) & CBC_ARG_TYPES) == (types))
/**
* All data allocated by the parser is
@@ -327,8 +308,8 @@ typedef struct
*/
typedef struct parser_mem_page_t
{
- struct parser_mem_page_t *next_p; /**< next page */
- uint8_t bytes[]; /**< memory bytes, C99 flexible array member */
+ struct parser_mem_page_t *next_p; /**< next page */
+ uint8_t bytes[]; /**< memory bytes, C99 flexible array member */
} parser_mem_page_t;
/**
@@ -336,9 +317,9 @@ typedef struct parser_mem_page_t
*/
typedef struct
{
- parser_mem_page_t *first_p; /**< first allocated page */
- parser_mem_page_t *last_p; /**< last allocated page */
- uint32_t last_position; /**< position of the last allocated byte */
+ parser_mem_page_t *first_p; /**< first allocated page */
+ parser_mem_page_t *last_p; /**< last allocated page */
+ uint32_t last_position; /**< position of the last allocated byte */
} parser_mem_data_t;
/**
@@ -346,10 +327,10 @@ typedef struct
*/
typedef struct
{
- parser_mem_data_t data; /**< storage space */
- uint32_t page_size; /**< size of each page */
- uint32_t item_size; /**< size of each item */
- uint32_t item_count; /**< number of items on each page */
+ parser_mem_data_t data; /**< storage space */
+ uint32_t page_size; /**< size of each page */
+ uint32_t item_size; /**< size of each item */
+ uint32_t item_count; /**< number of items on each page */
} parser_list_t;
/**
@@ -357,9 +338,9 @@ typedef struct
*/
typedef struct
{
- parser_list_t *list_p; /**< parser list */
- parser_mem_page_t *current_p; /**< currently processed page */
- size_t current_position; /**< current position on the page */
+ parser_list_t *list_p; /**< parser list */
+ parser_mem_page_t *current_p; /**< currently processed page */
+ size_t current_position; /**< current position on the page */
} parser_list_iterator_t;
/**
@@ -367,8 +348,8 @@ typedef struct
*/
typedef struct
{
- parser_mem_data_t data; /**< storage space */
- parser_mem_page_t *free_page_p; /**< space for fast allocation */
+ parser_mem_data_t data; /**< storage space */
+ parser_mem_page_t *free_page_p; /**< space for fast allocation */
} parser_stack_t;
/**
@@ -376,8 +357,8 @@ typedef struct
*/
typedef struct
{
- parser_mem_page_t *current_p; /**< currently processed page */
- size_t current_position; /**< current position on the page */
+ parser_mem_page_t *current_p; /**< currently processed page */
+ size_t current_position; /**< current position on the page */
} parser_stack_iterator_t;
/**
@@ -385,8 +366,8 @@ typedef struct
*/
typedef struct
{
- parser_mem_page_t *page_p; /**< branch location page */
- uint32_t offset; /**< branch location offset */
+ parser_mem_page_t *page_p; /**< branch location page */
+ uint32_t offset; /**< branch location offset */
} parser_branch_t;
/**
@@ -394,8 +375,8 @@ typedef struct
*/
typedef struct parser_branch_node_t
{
- struct parser_branch_node_t *next_p; /**< next linked list node */
- parser_branch_t branch; /**< branch */
+ struct parser_branch_node_t *next_p; /**< next linked list node */
+ parser_branch_t branch; /**< branch */
} parser_branch_node_t;
/**
@@ -403,8 +384,8 @@ typedef struct parser_branch_node_t
*/
typedef struct
{
- uint16_t map_from; /**< original literal index */
- uint16_t map_to; /**< encoded register or literal index and flags */
+ uint16_t map_from; /**< original literal index */
+ uint16_t map_to; /**< encoded register or literal index and flags */
} parser_scope_stack_t;
/**
@@ -477,14 +458,13 @@ typedef struct scanner_context_t scanner_context_t;
*/
typedef struct
{
- uint32_t value; /**< line or offset of the breakpoint */
+ uint32_t value; /**< line or offset of the breakpoint */
} parser_breakpoint_info_t;
/**
* Maximum number of breakpoint info.
*/
-#define PARSER_MAX_BREAKPOINT_INFO_COUNT \
- (JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE / sizeof (parser_breakpoint_info_t))
+#define PARSER_MAX_BREAKPOINT_INFO_COUNT (JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE / sizeof (parser_breakpoint_info_t))
#endif /* JERRY_DEBUGGER */
@@ -492,10 +472,10 @@ typedef struct
typedef struct
{
- parser_mem_page_t *last_page_p; /**< last page of line info data */
- uint32_t byte_code_position; /**< last byte code position */
- parser_line_counter_t line; /**< last line */
- parser_line_counter_t column; /**< last column */
+ parser_mem_page_t *last_page_p; /**< last page of line info data */
+ uint32_t byte_code_position; /**< last byte code position */
+ parser_line_counter_t line; /**< last line */
+ parser_line_counter_t column; /**< last column */
} parser_line_info_data_t;
#endif /* JERRY_LINE_INFO */
@@ -507,43 +487,43 @@ typedef struct
typedef struct parser_saved_context_t
{
/* Parser members. */
- uint32_t status_flags; /**< parsing options */
- uint16_t stack_depth; /**< current stack depth */
- uint16_t stack_limit; /**< maximum stack depth */
+ uint32_t status_flags; /**< parsing options */
+ uint16_t stack_depth; /**< current stack depth */
+ uint16_t stack_limit; /**< maximum stack depth */
struct parser_saved_context_t *prev_context_p; /**< last saved context */
- parser_stack_iterator_t last_statement; /**< last statement position */
+ parser_stack_iterator_t last_statement; /**< last statement position */
/* Literal types */
- uint16_t argument_count; /**< number of function arguments */
+ uint16_t argument_count; /**< number of function arguments */
#if JERRY_ESNEXT
- uint16_t argument_length; /**< length property of arguments */
+ uint16_t argument_length; /**< length property of arguments */
#endif /* JERRY_ESNEXT */
- uint16_t register_count; /**< number of registers */
- uint16_t literal_count; /**< number of literals */
+ uint16_t register_count; /**< number of registers */
+ uint16_t literal_count; /**< number of literals */
/* Memory storage members. */
- parser_mem_data_t byte_code; /**< byte code buffer */
- uint32_t byte_code_size; /**< byte code size for branches */
- parser_mem_data_t literal_pool_data; /**< literal list */
- parser_scope_stack_t *scope_stack_p; /**< scope stack */
- uint16_t scope_stack_size; /**< size of scope stack */
- uint16_t scope_stack_top; /**< preserved top of scope stack */
- uint16_t scope_stack_reg_top; /**< preserved top register of scope stack */
+ parser_mem_data_t byte_code; /**< byte code buffer */
+ uint32_t byte_code_size; /**< byte code size for branches */
+ parser_mem_data_t literal_pool_data; /**< literal list */
+ parser_scope_stack_t *scope_stack_p; /**< scope stack */
+ uint16_t scope_stack_size; /**< size of scope stack */
+ uint16_t scope_stack_top; /**< preserved top of scope stack */
+ uint16_t scope_stack_reg_top; /**< preserved top register of scope stack */
#if JERRY_ESNEXT
- uint16_t scope_stack_global_end; /**< end of global declarations of a function */
- ecma_value_t tagged_template_literal_cp; /**< compessed pointer to the tagged template literal collection */
+ uint16_t scope_stack_global_end; /**< end of global declarations of a function */
+ ecma_value_t tagged_template_literal_cp; /**< compessed pointer to the tagged template literal collection */
#endif /* JERRY_ESNEXT */
#ifndef JERRY_NDEBUG
- uint16_t context_stack_depth; /**< current context stack depth */
+ uint16_t context_stack_depth; /**< current context stack depth */
#endif /* !JERRY_NDEBUG */
#if JERRY_LINE_INFO
- parser_line_info_data_t *line_info_p; /**< line info data */
+ parser_line_info_data_t *line_info_p; /**< line info data */
#endif /* JERRY_LINE_INFO */
#if JERRY_FUNCTION_TO_STRING
- const uint8_t *function_start_p; /**< start position of the current function */
+ const uint8_t *function_start_p; /**< start position of the current function */
#endif /* JERRY_FUNCTION_TO_STRING */
} parser_saved_context_t;
@@ -552,104 +532,104 @@ typedef struct parser_saved_context_t
*/
typedef struct
{
- PARSER_TRY_CONTEXT (try_buffer); /**< try_buffer */
- parser_error_t error; /**< error code */
+ PARSER_TRY_CONTEXT (try_buffer); /**< try_buffer */
+ parser_error_t error; /**< error code */
/** Union for rarely used members. */
union
{
- void *allocated_buffer_p; /**< dinamically allocated buffer
- * which needs to be freed on error */
- scanner_context_t *scanner_context_p; /**< scanner context for the pre-scanner */
+ void *allocated_buffer_p; /**< dinamically allocated buffer
+ * which needs to be freed on error */
+ scanner_context_t *scanner_context_p; /**< scanner context for the pre-scanner */
} u;
- uint32_t allocated_buffer_size; /**< size of the dinamically allocated buffer */
+ uint32_t allocated_buffer_size; /**< size of the dinamically allocated buffer */
/* Parser members. */
- uint32_t status_flags; /**< status flags */
- uint32_t global_status_flags; /**< global status flags */
- uint16_t stack_depth; /**< current stack depth */
- uint16_t stack_limit; /**< maximum stack depth */
- const jerry_parse_options_t *options_p; /**< parse options */
- parser_saved_context_t *last_context_p; /**< last saved context */
- parser_stack_iterator_t last_statement; /**< last statement position */
- cbc_script_t *script_p; /**< current script */
- const uint8_t *source_start_p; /**< source start */
- lit_utf8_size_t source_size; /**< source size */
- const uint8_t *arguments_start_p; /**< function argument list start */
- lit_utf8_size_t arguments_size; /**< function argument list size */
- ecma_value_t script_value; /**< current script as value */
- ecma_value_t argument_list; /**< current argument list as value */
- ecma_value_t user_value; /**< current user value */
+ uint32_t status_flags; /**< status flags */
+ uint32_t global_status_flags; /**< global status flags */
+ uint16_t stack_depth; /**< current stack depth */
+ uint16_t stack_limit; /**< maximum stack depth */
+ const jerry_parse_options_t *options_p; /**< parse options */
+ parser_saved_context_t *last_context_p; /**< last saved context */
+ parser_stack_iterator_t last_statement; /**< last statement position */
+ cbc_script_t *script_p; /**< current script */
+ const uint8_t *source_start_p; /**< source start */
+ lit_utf8_size_t source_size; /**< source size */
+ const uint8_t *arguments_start_p; /**< function argument list start */
+ lit_utf8_size_t arguments_size; /**< function argument list size */
+ ecma_value_t script_value; /**< current script as value */
+ ecma_value_t argument_list; /**< current argument list as value */
+ ecma_value_t user_value; /**< current user value */
#if JERRY_MODULE_SYSTEM
- ecma_module_names_t *module_names_p; /**< import / export names that is being processed */
- lexer_literal_t *module_identifier_lit_p; /**< the literal for the identifier of the current element */
+ ecma_module_names_t *module_names_p; /**< import / export names that is being processed */
+ lexer_literal_t *module_identifier_lit_p; /**< the literal for the identifier of the current element */
#endif /* JERRY_MODULE_SYSTEM */
/* Lexer members. */
- lexer_token_t token; /**< current token */
- lexer_lit_object_t lit_object; /**< current literal object */
- const uint8_t *source_p; /**< next source byte */
- const uint8_t *source_end_p; /**< last source byte */
- parser_line_counter_t line; /**< current line */
- parser_line_counter_t column; /**< current column */
+ lexer_token_t token; /**< current token */
+ lexer_lit_object_t lit_object; /**< current literal object */
+ const uint8_t *source_p; /**< next source byte */
+ const uint8_t *source_end_p; /**< last source byte */
+ parser_line_counter_t line; /**< current line */
+ parser_line_counter_t column; /**< current column */
/* Scanner members. */
- scanner_info_t *next_scanner_info_p; /**< next scanner info block */
- scanner_info_t *active_scanner_info_p; /**< currently active scanner info block */
- scanner_info_t *skipped_scanner_info_p; /**< next scanner info block */
+ scanner_info_t *next_scanner_info_p; /**< next scanner info block */
+ scanner_info_t *active_scanner_info_p; /**< currently active scanner info block */
+ scanner_info_t *skipped_scanner_info_p; /**< next scanner info block */
scanner_info_t *skipped_scanner_info_end_p; /**< currently active scanner info block */
/* Compact byte code members. */
- cbc_argument_t last_cbc; /**< argument of the last cbc */
- uint16_t last_cbc_opcode; /**< opcode of the last cbc */
+ cbc_argument_t last_cbc; /**< argument of the last cbc */
+ uint16_t last_cbc_opcode; /**< opcode of the last cbc */
/* Literal types */
- uint16_t argument_count; /**< number of function arguments */
+ uint16_t argument_count; /**< number of function arguments */
#if JERRY_ESNEXT
- uint16_t argument_length; /**< length property of arguments */
+ uint16_t argument_length; /**< length property of arguments */
#endif /* JERRY_ESNEXT */
- uint16_t register_count; /**< number of registers */
- uint16_t literal_count; /**< number of literals */
+ uint16_t register_count; /**< number of registers */
+ uint16_t literal_count; /**< number of literals */
/* Memory storage members. */
- parser_mem_data_t byte_code; /**< byte code buffer */
- uint32_t byte_code_size; /**< current byte code size for branches */
- parser_list_t literal_pool; /**< literal list */
- parser_mem_data_t stack; /**< storage space */
- parser_scope_stack_t *scope_stack_p; /**< scope stack */
- parser_mem_page_t *free_page_p; /**< space for fast allocation */
- uint16_t scope_stack_size; /**< size of scope stack */
- uint16_t scope_stack_top; /**< current top of scope stack */
- uint16_t scope_stack_reg_top; /**< current top register of scope stack */
+ parser_mem_data_t byte_code; /**< byte code buffer */
+ uint32_t byte_code_size; /**< current byte code size for branches */
+ parser_list_t literal_pool; /**< literal list */
+ parser_mem_data_t stack; /**< storage space */
+ parser_scope_stack_t *scope_stack_p; /**< scope stack */
+ parser_mem_page_t *free_page_p; /**< space for fast allocation */
+ uint16_t scope_stack_size; /**< size of scope stack */
+ uint16_t scope_stack_top; /**< current top of scope stack */
+ uint16_t scope_stack_reg_top; /**< current top register of scope stack */
#if JERRY_ESNEXT
- uint16_t scope_stack_global_end; /**< end of global declarations of a function */
- ecma_value_t tagged_template_literal_cp; /**< compessed pointer to the tagged template literal collection */
+ uint16_t scope_stack_global_end; /**< end of global declarations of a function */
+ ecma_value_t tagged_template_literal_cp; /**< compessed pointer to the tagged template literal collection */
#endif /* JERRY_ESNEXT */
- uint8_t stack_top_uint8; /**< top byte stored on the stack */
+ uint8_t stack_top_uint8; /**< top byte stored on the stack */
#ifndef JERRY_NDEBUG
/* Variables for debugging / logging. */
- uint16_t context_stack_depth; /**< current context stack depth */
+ uint16_t context_stack_depth; /**< current context stack depth */
#endif /* !JERRY_NDEBUG */
#if JERRY_PARSER_DUMP_BYTE_CODE
- int is_show_opcodes; /**< show opcodes */
- uint32_t total_byte_code_size; /**< total byte code size */
+ int is_show_opcodes; /**< show opcodes */
+ uint32_t total_byte_code_size; /**< total byte code size */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
#if JERRY_DEBUGGER
parser_breakpoint_info_t breakpoint_info[PARSER_MAX_BREAKPOINT_INFO_COUNT]; /**< breakpoint info list */
- uint16_t breakpoint_info_count; /**< current breakpoint index */
+ uint16_t breakpoint_info_count; /**< current breakpoint index */
parser_line_counter_t last_breakpoint_line; /**< last line where breakpoint has been inserted */
#endif /* JERRY_DEBUGGER */
#if JERRY_LINE_INFO
- parser_line_info_data_t *line_info_p; /**< line info data */
+ parser_line_info_data_t *line_info_p; /**< line info data */
#endif /* JERRY_LINE_INFO */
#if JERRY_FUNCTION_TO_STRING
- const uint8_t *function_start_p; /**< start position of the function which will be parsed */
- const uint8_t *function_end_p; /**< end position of the current function */
+ const uint8_t *function_start_p; /**< start position of the function which will be parsed */
+ const uint8_t *function_end_p; /**< end position of the current function */
#endif /* JERRY_FUNCTION_TO_STRING */
} parser_context_t;
@@ -727,14 +707,14 @@ void parser_stack_iterator_write (parser_stack_iterator_t *iterator, const void
void parser_flush_cbc (parser_context_t *context_p);
void parser_emit_cbc (parser_context_t *context_p, uint16_t opcode);
void parser_emit_cbc_literal (parser_context_t *context_p, uint16_t opcode, uint16_t literal_index);
-void parser_emit_cbc_literal_value (parser_context_t *context_p, uint16_t opcode, uint16_t literal_index,
- uint16_t value);
+void
+parser_emit_cbc_literal_value (parser_context_t *context_p, uint16_t opcode, uint16_t literal_index, uint16_t value);
void parser_emit_cbc_literal_from_token (parser_context_t *context_p, uint16_t opcode);
void parser_emit_cbc_call (parser_context_t *context_p, uint16_t opcode, size_t call_arguments);
void parser_emit_cbc_push_number (parser_context_t *context_p, bool is_negative_number);
void parser_emit_cbc_forward_branch (parser_context_t *context_p, uint16_t opcode, parser_branch_t *branch_p);
-parser_branch_node_t *parser_emit_cbc_forward_branch_item (parser_context_t *context_p, uint16_t opcode,
- parser_branch_node_t *next_p);
+parser_branch_node_t *
+parser_emit_cbc_forward_branch_item (parser_context_t *context_p, uint16_t opcode, parser_branch_node_t *next_p);
void parser_emit_cbc_backward_branch (parser_context_t *context_p, uint16_t opcode, uint32_t offset);
ecma_string_t *parser_new_ecma_string_from_literal (lexer_literal_t *literal_p);
void parser_set_branch_to_current_position (parser_context_t *context_p, parser_branch_t *branch_p);
@@ -742,8 +722,7 @@ void parser_set_breaks_to_current_position (parser_context_t *context_p, parser_
void parser_set_continues_to_current_position (parser_context_t *context_p, parser_branch_node_t *current_p);
/* Convenience macros. */
-#define parser_emit_cbc_ext(context_p, opcode) \
- parser_emit_cbc ((context_p), PARSER_TO_EXT_OPCODE (opcode))
+#define parser_emit_cbc_ext(context_p, opcode) parser_emit_cbc ((context_p), PARSER_TO_EXT_OPCODE (opcode))
#define parser_emit_cbc_ext_literal(context_p, opcode, literal_index) \
parser_emit_cbc_literal ((context_p), PARSER_TO_EXT_OPCODE (opcode), (literal_index))
#define parser_emit_cbc_ext_literal_from_token(context_p, opcode) \
@@ -772,8 +751,7 @@ void parser_reverse_class_fields (parser_context_t *context_p, size_t fields_siz
void lexer_next_token (parser_context_t *context_p);
bool lexer_check_next_character (parser_context_t *context_p, lit_utf8_byte_t character);
-bool lexer_check_next_characters (parser_context_t *context_p, lit_utf8_byte_t character1,
- lit_utf8_byte_t character2);
+bool lexer_check_next_characters (parser_context_t *context_p, lit_utf8_byte_t character1, lit_utf8_byte_t character2);
uint8_t lexer_consume_next_character (parser_context_t *context_p);
bool lexer_check_post_primary_exp (parser_context_t *context_p);
#if JERRY_ESNEXT
@@ -791,25 +769,28 @@ bool lexer_scan_identifier (parser_context_t *context_p);
void lexer_check_property_modifier (parser_context_t *context_p);
void lexer_convert_ident_to_cesu8 (uint8_t *destination_p, const uint8_t *source_p, prop_length_t length);
-const uint8_t *lexer_convert_literal_to_chars (parser_context_t *context_p, const lexer_lit_location_t *literal_p,
- uint8_t *local_byte_array_p, lexer_string_options_t opts);
+const uint8_t *lexer_convert_literal_to_chars (parser_context_t *context_p,
+ const lexer_lit_location_t *literal_p,
+ uint8_t *local_byte_array_p,
+ lexer_string_options_t opts);
void lexer_expect_object_literal_id (parser_context_t *context_p, uint32_t ident_opts);
lexer_literal_t *lexer_construct_unused_literal (parser_context_t *context_p);
-void lexer_construct_literal_object (parser_context_t *context_p, const lexer_lit_location_t *lit_location_p,
+void lexer_construct_literal_object (parser_context_t *context_p,
+ const lexer_lit_location_t *lit_location_p,
uint8_t literal_type);
bool lexer_construct_number_object (parser_context_t *context_p, bool is_expr, bool is_negative_number);
void lexer_convert_push_number_to_push_literal (parser_context_t *context_p);
uint16_t lexer_construct_function_object (parser_context_t *context_p, uint32_t extra_status_flags);
void lexer_construct_regexp_object (parser_context_t *context_p, bool parse_only);
bool lexer_compare_identifier_to_string (const lexer_lit_location_t *left_p, const uint8_t *right_p, size_t size);
-bool lexer_compare_identifiers (parser_context_t *context_p, const lexer_lit_location_t *left_p,
+bool lexer_compare_identifiers (parser_context_t *context_p,
+ const lexer_lit_location_t *left_p,
const lexer_lit_location_t *right_p);
bool lexer_current_is_literal (parser_context_t *context_p, const lexer_lit_location_t *right_ident_p);
bool lexer_string_is_use_strict (parser_context_t *context_p);
bool lexer_string_is_directive (parser_context_t *context_p);
#if JERRY_ESNEXT
-bool lexer_token_is_identifier (parser_context_t *context_p, const char *identifier_p,
- size_t identifier_length);
+bool lexer_token_is_identifier (parser_context_t *context_p, const char *identifier_p, size_t identifier_length);
bool lexer_token_is_let (parser_context_t *context_p);
bool lexer_token_is_async (parser_context_t *context_p);
#endif /* JERRY_ESNEXT */
@@ -900,9 +881,8 @@ void parser_module_set_default (parser_context_t *context_p);
bool parser_module_check_duplicate_import (parser_context_t *context_p, ecma_string_t *local_name_p);
bool parser_module_check_duplicate_export (parser_context_t *context_p, ecma_string_t *export_name_p);
void parser_module_append_export_name (parser_context_t *context_p);
-void parser_module_add_names_to_node (parser_context_t *context_p,
- ecma_string_t *imex_name_p,
- ecma_string_t *local_name_p);
+void
+parser_module_add_names_to_node (parser_context_t *context_p, ecma_string_t *imex_name_p, ecma_string_t *local_name_p);
#endif /* JERRY_MODULE_SYSTEM */
@@ -915,8 +895,7 @@ void parser_module_add_names_to_node (parser_context_t *context_p,
#if JERRY_LINE_INFO
void parser_line_info_free (parser_line_info_data_t *line_info_p);
-void parser_line_info_append (parser_context_t *context_p,
- parser_line_counter_t line, parser_line_counter_t column);
+void parser_line_info_append (parser_context_t *context_p, parser_line_counter_t line, parser_line_counter_t column);
uint8_t *parser_line_info_generate (parser_context_t *context_p);
#endif /* JERRY_LINE_INFO */
@@ -931,10 +910,14 @@ ecma_compiled_code_t *parser_parse_function (parser_context_t *context_p, uint32
#if JERRY_ESNEXT
ecma_compiled_code_t *parser_parse_arrow_function (parser_context_t *context_p, uint32_t status_flags);
ecma_compiled_code_t *parser_parse_class_fields (parser_context_t *context_p);
-void parser_set_function_name (parser_context_t *context_p, uint16_t function_literal_index, uint16_t name_index,
+void parser_set_function_name (parser_context_t *context_p,
+ uint16_t function_literal_index,
+ uint16_t name_index,
uint32_t status_flags);
-void parser_compiled_code_set_function_name (parser_context_t *context_p, ecma_compiled_code_t *bytecode_p,
- uint16_t name_index, uint32_t status_flags);
+void parser_compiled_code_set_function_name (parser_context_t *context_p,
+ ecma_compiled_code_t *bytecode_p,
+ uint16_t name_index,
+ uint32_t status_flags);
uint16_t parser_check_anonymous_function_declaration (parser_context_t *context_p);
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/parser/js/js-parser-line-info-create.c b/jerry-core/parser/js/js-parser-line-info-create.c
index 90eca632..e26b13ed 100644
--- a/jerry-core/parser/js/js-parser-line-info-create.c
+++ b/jerry-core/parser/js/js-parser-line-info-create.c
@@ -14,6 +14,7 @@
*/
#include "ecma-line-info.h"
+
#include "js-parser-internal.h"
#if JERRY_PARSER
@@ -100,20 +101,17 @@
/**
* Page size of line info pages excluding the first one.
*/
-#define PARSER_LINE_INFO_PAGE_SIZE \
- (sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE)
+#define PARSER_LINE_INFO_PAGE_SIZE (sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE)
/**
* Page size of the first line info page.
*/
-#define PARSER_LINE_INFO_FIRST_PAGE_SIZE \
- (sizeof (parser_line_info_data_t) + PARSER_LINE_INFO_PAGE_SIZE)
+#define PARSER_LINE_INFO_FIRST_PAGE_SIZE (sizeof (parser_line_info_data_t) + PARSER_LINE_INFO_PAGE_SIZE)
/**
* Get memory data of the first page.
*/
-#define PARSER_LINE_INFO_GET_FIRST_PAGE(line_info_p) \
- (((parser_mem_page_t *) ((line_info_p) + 1)))
+#define PARSER_LINE_INFO_GET_FIRST_PAGE(line_info_p) (((parser_mem_page_t *) ((line_info_p) + 1)))
/**
* Free line info temporary data collected during parsing.
@@ -160,8 +158,7 @@ parser_line_info_encode_vlq (uint8_t *buffer_p, /**< target buffer */
{
current_value >>= ECMA_LINE_INFO_VLQ_SHIFT;
length++;
- }
- while (current_value > 0);
+ } while (current_value > 0);
buffer_p += length;
@@ -169,8 +166,7 @@ parser_line_info_encode_vlq (uint8_t *buffer_p, /**< target buffer */
{
*(--buffer_p) = (uint8_t) (value | ECMA_LINE_INFO_VLQ_CONTINUE);
value >>= ECMA_LINE_INFO_VLQ_SHIFT;
- }
- while (value > 0);
+ } while (value > 0);
buffer_p[length - 1] &= ECMA_LINE_INFO_VLQ_MASK;
return length;
@@ -529,8 +525,7 @@ parser_line_info_generate (parser_context_t *context_p) /**< context */
stream_prev_column = ECMA_LINE_INFO_COLUMN_DEFAULT;
stream_size = 0;
stream_value_count = 0;
- }
- while (iterator.current_page_p != NULL);
+ } while (iterator.current_page_p != NULL);
value = (stream_prev_line != stream_current_line);
diff --git a/jerry-core/parser/js/js-parser-mem.c b/jerry-core/parser/js/js-parser-mem.c
index 38fe55bf..14f87c2c 100644
--- a/jerry-core/parser/js/js-parser-mem.c
+++ b/jerry-core/parser/js/js-parser-mem.c
@@ -97,8 +97,7 @@ parser_free_allocated_buffer (parser_context_t *context_p) /**< context */
{
if (context_p->u.allocated_buffer_p != NULL)
{
- parser_free_local (context_p->u.allocated_buffer_p,
- context_p->allocated_buffer_size);
+ parser_free_local (context_p->u.allocated_buffer_p, context_p->allocated_buffer_size);
context_p->u.allocated_buffer_p = NULL;
}
} /* parser_free_allocated_buffer */
@@ -156,8 +155,7 @@ parser_cbc_stream_init (parser_mem_data_t *data_p) /**< memory manager */
void
parser_cbc_stream_free (parser_mem_data_t *data_p) /**< memory manager */
{
- parser_data_free (data_p,
- sizeof (parser_mem_page_t *) + PARSER_CBC_STREAM_PAGE_SIZE);
+ parser_data_free (data_p, sizeof (parser_mem_page_t *) + PARSER_CBC_STREAM_PAGE_SIZE);
} /* parser_cbc_stream_free */
/**
@@ -210,8 +208,7 @@ parser_list_init (parser_list_t *list_p, /**< parser list */
void
parser_list_free (parser_list_t *list_p) /**< parser list */
{
- parser_data_free (&list_p->data,
- (uint32_t) (sizeof (parser_mem_page_t *) + list_p->page_size));
+ parser_data_free (&list_p->data, (uint32_t) (sizeof (parser_mem_page_t *) + list_p->page_size));
} /* parser_list_free */
/**
@@ -280,8 +277,7 @@ parser_list_get (parser_list_t *list_p, /**< parser list */
}
JERRY_ASSERT (page_p != NULL);
- JERRY_ASSERT (page_p != list_p->data.last_p
- || (index * list_p->item_size < list_p->data.last_position));
+ JERRY_ASSERT (page_p != list_p->data.last_p || (index * list_p->item_size < list_p->data.last_position));
return page_p->bytes + (index * list_p->item_size);
} /* parser_list_get */
@@ -353,13 +349,11 @@ parser_stack_init (parser_context_t *context_p) /**< context */
void
parser_stack_free (parser_context_t *context_p) /**< context */
{
- parser_data_free (&context_p->stack,
- sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);
+ parser_data_free (&context_p->stack, sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);
if (context_p->free_page_p != NULL)
{
- parser_free (context_p->free_page_p,
- sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);
+ parser_free (context_p->free_page_p, sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);
}
} /* parser_stack_free */
@@ -375,8 +369,7 @@ parser_stack_push_uint8 (parser_context_t *context_p, /**< context */
/* This assert might trigger false positive valgrind errors, when
* parser_stack_push() pushes not fully initialized structures.
* More precisely when the last byte of the structure is uninitialized. */
- JERRY_ASSERT (page_p == NULL
- || context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);
+ JERRY_ASSERT (page_p == NULL || context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);
if (context_p->stack.last_position >= PARSER_STACK_PAGE_SIZE)
{
@@ -408,8 +401,7 @@ parser_stack_pop_uint8 (parser_context_t *context_p) /**< context */
{
parser_mem_page_t *page_p = context_p->stack.first_p;
- JERRY_ASSERT (page_p != NULL
- && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);
+ JERRY_ASSERT (page_p != NULL && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);
context_p->stack.last_position--;
@@ -424,8 +416,7 @@ parser_stack_pop_uint8 (parser_context_t *context_p) /**< context */
}
else
{
- parser_free (page_p,
- sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);
+ parser_free (page_p, sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);
}
page_p = context_p->stack.first_p;
@@ -445,8 +436,7 @@ parser_stack_change_last_uint8 (parser_context_t *context_p, /**< context */
{
parser_mem_page_t *page_p = context_p->stack.first_p;
- JERRY_ASSERT (page_p != NULL
- && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);
+ JERRY_ASSERT (page_p != NULL && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);
page_p->bytes[context_p->stack.last_position - 1] = new_value;
context_p->stack_top_uint8 = new_value;
@@ -483,8 +473,7 @@ parser_stack_push_uint16 (parser_context_t *context_p, /**< context */
{
parser_mem_page_t *page_p = context_p->stack.first_p;
- JERRY_ASSERT (page_p != NULL
- && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);
+ JERRY_ASSERT (page_p != NULL && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);
page_p->bytes[context_p->stack.last_position++] = (uint8_t) (uint16_value >> 8);
page_p->bytes[context_p->stack.last_position++] = (uint8_t) uint16_value;
@@ -511,8 +500,7 @@ parser_stack_pop_uint16 (parser_context_t *context_p) /**< context */
{
parser_mem_page_t *page_p = context_p->stack.first_p;
- JERRY_ASSERT (page_p != NULL
- && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);
+ JERRY_ASSERT (page_p != NULL && context_p->stack_top_uint8 == page_p->bytes[context_p->stack.last_position - 1]);
value |= ((uint32_t) page_p->bytes[context_p->stack.last_position - 2]) << 8;
context_p->stack_top_uint8 = page_p->bytes[context_p->stack.last_position - 3];
@@ -551,9 +539,7 @@ parser_stack_push (parser_context_t *context_p, /**< context */
fragment_length = length;
}
- memcpy (context_p->stack.first_p->bytes + context_p->stack.last_position,
- bytes_p,
- fragment_length);
+ memcpy (context_p->stack.first_p->bytes + context_p->stack.last_position, bytes_p, fragment_length);
if (fragment_length == length)
{
@@ -636,8 +622,7 @@ parser_stack_pop (parser_context_t *context_p, /**< context */
}
else
{
- parser_free (page_p,
- sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);
+ parser_free (page_p, sizeof (parser_mem_page_t *) + PARSER_STACK_PAGE_SIZE);
}
} /* parser_stack_pop */
@@ -698,21 +683,15 @@ parser_stack_iterator_read (parser_stack_iterator_t *iterator, /**< iterator */
if (length <= iterator->current_position)
{
- memcpy (bytes_p,
- iterator->current_p->bytes + iterator->current_position - length,
- length);
+ memcpy (bytes_p, iterator->current_p->bytes + iterator->current_position - length, length);
}
else
{
JERRY_ASSERT (iterator->current_p->next_p != NULL);
length -= iterator->current_position;
- memcpy (bytes_p + length,
- iterator->current_p->bytes,
- iterator->current_position);
- memcpy (bytes_p,
- iterator->current_p->next_p->bytes + PARSER_STACK_PAGE_SIZE - length,
- length);
+ memcpy (bytes_p + length, iterator->current_p->bytes, iterator->current_position);
+ memcpy (bytes_p, iterator->current_p->next_p->bytes + PARSER_STACK_PAGE_SIZE - length, length);
}
} /* parser_stack_iterator_read */
@@ -730,21 +709,15 @@ parser_stack_iterator_write (parser_stack_iterator_t *iterator, /**< iterator */
if (length <= iterator->current_position)
{
- memcpy (iterator->current_p->bytes + iterator->current_position - length,
- bytes_p,
- length);
+ memcpy (iterator->current_p->bytes + iterator->current_position - length, bytes_p, length);
}
else
{
JERRY_ASSERT (iterator->current_p->next_p != NULL);
length -= iterator->current_position;
- memcpy (iterator->current_p->bytes,
- bytes_p + length,
- iterator->current_position);
- memcpy (iterator->current_p->next_p->bytes + PARSER_STACK_PAGE_SIZE - length,
- bytes_p,
- length);
+ memcpy (iterator->current_p->bytes, bytes_p + length, iterator->current_position);
+ memcpy (iterator->current_p->next_p->bytes + PARSER_STACK_PAGE_SIZE - length, bytes_p, length);
}
} /* parser_stack_iterator_write */
diff --git a/jerry-core/parser/js/js-parser-module.c b/jerry-core/parser/js/js-parser-module.c
index 3a7189e4..465f8122 100644
--- a/jerry-core/parser/js/js-parser-module.c
+++ b/jerry-core/parser/js/js-parser-module.c
@@ -16,8 +16,6 @@
#include "js-parser-internal.h"
#if JERRY_MODULE_SYSTEM
-#include "jcontext.h"
-
#include "ecma-function-object.h"
#include "ecma-gc.h"
#include "ecma-globals.h"
@@ -25,13 +23,15 @@
#include "ecma-lex-env.h"
#include "ecma-module.h"
+#include "jcontext.h"
+
/**
* Description of "*default*" literal string.
*/
-const lexer_lit_location_t lexer_default_literal =
-{
- (const uint8_t *) "*default*", 9, LEXER_IDENT_LITERAL, LEXER_LIT_LOCATION_IS_ASCII
-};
+const lexer_lit_location_t lexer_default_literal = { (const uint8_t *) "*default*",
+ 9,
+ LEXER_IDENT_LITERAL,
+ LEXER_LIT_LOCATION_IS_ASCII };
/**
* Check for duplicated imported binding names.
@@ -89,7 +89,7 @@ parser_module_append_export_name (parser_context_t *context_p) /**< parser conte
}
context_p->module_identifier_lit_p = context_p->lit_object.literal_p;
- ecma_string_t *name_p = parser_new_ecma_string_from_literal (context_p->lit_object.literal_p);
+ ecma_string_t *name_p = parser_new_ecma_string_from_literal (context_p->lit_object.literal_p);
if (parser_module_check_duplicate_export (context_p, name_p))
{
@@ -97,9 +97,7 @@ parser_module_append_export_name (parser_context_t *context_p) /**< parser conte
parser_raise_error (context_p, PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER);
}
- parser_module_add_names_to_node (context_p,
- name_p,
- name_p);
+ parser_module_add_names_to_node (context_p, name_p, name_p);
ecma_deref_ecma_string (name_p);
} /* parser_module_append_export_name */
@@ -167,8 +165,7 @@ parser_module_add_names_to_node (parser_context_t *context_p, /**< parser contex
ecma_string_t *imex_name_p, /**< import/export name */
ecma_string_t *local_name_p) /**< local name */
{
- ecma_module_names_t *new_name_p = (ecma_module_names_t *) parser_malloc (context_p,
- sizeof (ecma_module_names_t));
+ ecma_module_names_t *new_name_p = (ecma_module_names_t *) parser_malloc (context_p, sizeof (ecma_module_names_t));
new_name_p->next_p = context_p->module_names_p;
context_p->module_names_p = new_name_p;
@@ -209,8 +206,7 @@ parser_module_parse_export_clause (parser_context_t *context_p) /**< parser cont
}
/* 15.2.3.1 The referenced binding cannot be a reserved word. */
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL
|| context_p->token.keyword_type >= LEXER_FIRST_FUTURE_STRICT_RESERVED_WORD)
{
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
@@ -221,8 +217,7 @@ parser_module_parse_export_clause (parser_context_t *context_p) /**< parser cont
lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_NEW_IDENT_LITERAL);
- if (!has_module_specifier
- && !scanner_literal_exists (context_p, context_p->lit_object.index))
+ if (!has_module_specifier && !scanner_literal_exists (context_p, context_p->lit_object.index))
{
parser_raise_error (context_p, PARSER_ERR_EXPORT_NOT_DEFINED);
}
@@ -235,8 +230,7 @@ parser_module_parse_export_clause (parser_context_t *context_p) /**< parser cont
{
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
}
@@ -271,8 +265,7 @@ parser_module_parse_export_clause (parser_context_t *context_p) /**< parser cont
ecma_deref_ecma_string (local_name_p);
ecma_deref_ecma_string (export_name_p);
- if (context_p->token.type != LEXER_COMMA
- && context_p->token.type != LEXER_RIGHT_BRACE)
+ if (context_p->token.type != LEXER_COMMA && context_p->token.type != LEXER_RIGHT_BRACE)
{
parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_COMMA_EXPECTED);
}
@@ -305,8 +298,7 @@ parser_module_parse_import_clause (parser_context_t *context_p) /**< parser cont
break;
}
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
}
@@ -330,8 +322,7 @@ parser_module_parse_import_clause (parser_context_t *context_p) /**< parser cont
{
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
}
@@ -372,8 +363,7 @@ parser_module_parse_import_clause (parser_context_t *context_p) /**< parser cont
ecma_deref_ecma_string (local_name_p);
ecma_deref_ecma_string (import_name_p);
- if (context_p->token.type != LEXER_COMMA
- && (context_p->token.type != LEXER_RIGHT_BRACE))
+ if (context_p->token.type != LEXER_COMMA && (context_p->token.type != LEXER_RIGHT_BRACE))
{
parser_raise_error (context_p, PARSER_ERR_RIGHT_BRACE_COMMA_EXPECTED);
}
@@ -395,10 +385,8 @@ parser_module_parse_import_clause (parser_context_t *context_p) /**< parser cont
void
parser_module_check_request_place (parser_context_t *context_p) /**< parser context */
{
- if (context_p->last_context_p != NULL
- || context_p->stack_top_uint8 != 0
- || (context_p->status_flags & PARSER_IS_FUNCTION)
- || (context_p->global_status_flags & ECMA_PARSE_EVAL)
+ if (context_p->last_context_p != NULL || context_p->stack_top_uint8 != 0
+ || (context_p->status_flags & PARSER_IS_FUNCTION) || (context_p->global_status_flags & ECMA_PARSE_EVAL)
|| (context_p->global_status_flags & ECMA_PARSE_MODULE) == 0)
{
parser_raise_error (context_p, PARSER_ERR_MODULE_UNEXPECTED);
@@ -440,8 +428,7 @@ void
parser_module_handle_module_specifier (parser_context_t *context_p, /**< parser context */
ecma_module_node_t **node_list_p) /**< target node list */
{
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_STRING_LITERAL
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_STRING_LITERAL
|| context_p->token.lit_location.length == 0)
{
parser_raise_error (context_p, PARSER_ERR_STRING_EXPECTED);
diff --git a/jerry-core/parser/js/js-parser-statm.c b/jerry-core/parser/js/js-parser-statm.c
index e648960c..ce0a51bc 100644
--- a/jerry-core/parser/js/js-parser-statm.c
+++ b/jerry-core/parser/js/js-parser-statm.c
@@ -16,9 +16,9 @@
#include "js-parser-internal.h"
#if JERRY_PARSER
-#include "jcontext.h"
-
#include "ecma-helpers.h"
+
+#include "jcontext.h"
#include "lit-char-helpers.h"
/** \addtogroup parser Parser
@@ -83,8 +83,7 @@ typedef enum
* Parser statement attributes.
* Note: the order of the attributes must be keep in sync with parser_statement_type_t
*/
-static const uint8_t parser_statement_flags[] =
-{
+static const uint8_t parser_statement_flags[] = {
/* PARSER_STATEMENT_START */
PARSER_STATM_HAS_BLOCK,
/* PARSER_STATEMENT_BLOCK, */
@@ -135,8 +134,8 @@ static const uint8_t parser_statement_flags[] =
*/
typedef struct
{
- uint16_t scope_stack_top; /**< preserved top of scope stack */
- uint16_t scope_stack_reg_top; /**< preserved top register of scope stack */
+ uint16_t scope_stack_top; /**< preserved top of scope stack */
+ uint16_t scope_stack_reg_top; /**< preserved top register of scope stack */
} parser_block_statement_t;
/**
@@ -144,7 +143,7 @@ typedef struct
*/
typedef struct
{
- parser_branch_t branch; /**< branch to the end */
+ parser_branch_t branch; /**< branch to the end */
} parser_block_context_t;
#endif /* !JERRY_ESNEXT */
@@ -154,7 +153,7 @@ typedef struct
*/
typedef struct
{
- parser_branch_node_t *branch_list_p; /**< list of breaks and continues targeting this statement */
+ parser_branch_node_t *branch_list_p; /**< list of breaks and continues targeting this statement */
} parser_loop_statement_t;
/**
@@ -162,8 +161,8 @@ typedef struct
*/
typedef struct
{
- lexer_lit_location_t label_ident; /**< name of the label */
- parser_branch_node_t *break_list_p; /**< list of breaks targeting this label */
+ lexer_lit_location_t label_ident; /**< name of the label */
+ parser_branch_node_t *break_list_p; /**< list of breaks targeting this label */
} parser_label_statement_t;
/**
@@ -171,7 +170,7 @@ typedef struct
*/
typedef struct
{
- parser_branch_t branch; /**< branch to the end */
+ parser_branch_t branch; /**< branch to the end */
} parser_if_else_statement_t;
/**
@@ -179,8 +178,8 @@ typedef struct
*/
typedef struct
{
- parser_branch_t default_branch; /**< branch to the default case */
- parser_branch_node_t *branch_list_p; /**< branches of case statements */
+ parser_branch_t default_branch; /**< branch to the default case */
+ parser_branch_node_t *branch_list_p; /**< branches of case statements */
} parser_switch_statement_t;
/**
@@ -188,7 +187,7 @@ typedef struct
*/
typedef struct
{
- uint32_t start_offset; /**< start byte code offset */
+ uint32_t start_offset; /**< start byte code offset */
} parser_do_while_statement_t;
/**
@@ -196,9 +195,9 @@ typedef struct
*/
typedef struct
{
- parser_branch_t branch; /**< branch to the end */
- scanner_location_t condition_location; /**< condition part */
- uint32_t start_offset; /**< start byte code offset */
+ parser_branch_t branch; /**< branch to the end */
+ scanner_location_t condition_location; /**< condition part */
+ uint32_t start_offset; /**< start byte code offset */
} parser_while_statement_t;
/**
@@ -206,10 +205,10 @@ typedef struct
*/
typedef struct
{
- parser_branch_t branch; /**< branch to the end */
- scanner_location_t condition_location; /**< condition part */
+ parser_branch_t branch; /**< branch to the end */
+ scanner_location_t condition_location; /**< condition part */
scanner_location_t expression_location; /**< expression part */
- uint32_t start_offset; /**< start byte code offset */
+ uint32_t start_offset; /**< start byte code offset */
} parser_for_statement_t;
/**
@@ -217,8 +216,8 @@ typedef struct
*/
typedef struct
{
- parser_branch_t branch; /**< branch to the end */
- uint32_t start_offset; /**< start byte code offset */
+ parser_branch_t branch; /**< branch to the end */
+ uint32_t start_offset; /**< start byte code offset */
} parser_for_in_of_statement_t;
/**
@@ -226,7 +225,7 @@ typedef struct
*/
typedef struct
{
- parser_branch_t branch; /**< branch to the end */
+ parser_branch_t branch; /**< branch to the end */
} parser_with_statement_t;
/**
@@ -234,9 +233,9 @@ typedef struct
*/
typedef enum
{
- parser_try_block, /**< try block */
- parser_catch_block, /**< catch block */
- parser_finally_block, /**< finally block */
+ parser_try_block, /**< try block */
+ parser_catch_block, /**< catch block */
+ parser_finally_block, /**< finally block */
} parser_try_block_type_t;
/**
@@ -244,10 +243,10 @@ typedef enum
*/
typedef struct
{
- parser_try_block_type_t type; /**< current block type */
- uint16_t scope_stack_top; /**< current top of scope stack */
- uint16_t scope_stack_reg_top; /**< current top register of scope stack */
- parser_branch_t branch; /**< branch to the end of the current block */
+ parser_try_block_type_t type; /**< current block type */
+ uint16_t scope_stack_top; /**< current top of scope stack */
+ uint16_t scope_stack_reg_top; /**< current top register of scope stack */
+ parser_branch_t branch; /**< branch to the end of the current block */
} parser_try_statement_t;
/**
@@ -259,8 +258,7 @@ typedef struct
static inline size_t
parser_statement_length (uint8_t type) /**< type of statement */
{
- static const uint8_t statement_lengths[] =
- {
+ static const uint8_t statement_lengths[] = {
/* PARSER_STATEMENT_BLOCK */
1,
#if JERRY_ESNEXT
@@ -357,9 +355,7 @@ parser_push_block_context (parser_context_t *context_p, /**< context */
PARSER_PLUS_EQUAL_U16 (context_p->context_stack_depth, PARSER_BLOCK_CONTEXT_STACK_ALLOCATION);
#endif /* !JERRY_NDEBUG */
- parser_emit_cbc_forward_branch (context_p,
- CBC_BLOCK_CREATE_CONTEXT,
- &block_context.branch);
+ parser_emit_cbc_forward_branch (context_p, CBC_BLOCK_CREATE_CONTEXT, &block_context.branch);
parser_stack_push (context_p, &block_context, sizeof (parser_block_context_t));
is_context_needed = true;
}
@@ -427,8 +423,7 @@ parser_pop_block_context (parser_context_t *context_p) /**< context */
static void
parser_validate_lexical_context (parser_context_t *context_p) /**< context */
{
- JERRY_ASSERT (context_p->token.type == LEXER_KEYW_LET
- || context_p->token.type == LEXER_KEYW_CONST
+ JERRY_ASSERT (context_p->token.type == LEXER_KEYW_LET || context_p->token.type == LEXER_KEYW_CONST
|| context_p->token.type == LEXER_KEYW_CLASS);
if (parser_statement_flags[context_p->stack_top_uint8] & PARSER_STATM_SINGLE_STATM)
@@ -444,8 +439,7 @@ parser_validate_lexical_context (parser_context_t *context_p) /**< context */
static void
parser_parse_var_statement (parser_context_t *context_p) /**< context */
{
- JERRY_ASSERT (context_p->token.type == LEXER_KEYW_VAR
- || context_p->token.type == LEXER_KEYW_LET
+ JERRY_ASSERT (context_p->token.type == LEXER_KEYW_VAR || context_p->token.type == LEXER_KEYW_LET
|| context_p->token.type == LEXER_KEYW_CONST);
#if JERRY_ESNEXT
@@ -494,8 +488,7 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
#endif /* JERRY_MODULE_SYSTEM */
#if JERRY_ESNEXT
- if (declaration_type != LEXER_KEYW_VAR
- && context_p->token.keyword_type == LEXER_KEYW_LET)
+ if (declaration_type != LEXER_KEYW_VAR && context_p->token.keyword_type == LEXER_KEYW_LET)
{
parser_raise_error (context_p, PARSER_ERR_LEXICAL_LET_BINDING);
}
@@ -548,8 +541,7 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
parser_set_function_name (context_p, function_literal_index, index, 0);
}
- if (declaration_type != LEXER_KEYW_VAR
- && (index < PARSER_REGISTER_START))
+ if (declaration_type != LEXER_KEYW_VAR && (index < PARSER_REGISTER_START))
{
opcode = CBC_INIT_LET;
@@ -576,8 +568,7 @@ parser_parse_var_statement (parser_context_t *context_p) /**< context */
if (index < PARSER_REGISTER_START)
{
- opcode = (scanner_literal_is_created (context_p, index) ? CBC_ASSIGN_LET_CONST
- : CBC_INIT_LET);
+ opcode = (scanner_literal_is_created (context_p, index) ? CBC_ASSIGN_LET_CONST : CBC_INIT_LET);
}
parser_emit_cbc_literal (context_p, (uint16_t) opcode, index);
@@ -616,8 +607,7 @@ parser_parse_function_statement (parser_context_t *context_p) /**< context */
parser_raise_error (context_p, PARSER_ERR_LEXICAL_SINGLE_STATEMENT);
}
- if (context_p->stack_top_uint8 == PARSER_STATEMENT_IF
- || context_p->stack_top_uint8 == PARSER_STATEMENT_ELSE)
+ if (context_p->stack_top_uint8 == PARSER_STATEMENT_IF || context_p->stack_top_uint8 == PARSER_STATEMENT_ELSE)
{
/* There must be a parser error later if this check fails. */
if (context_p->next_scanner_info_p->source_p == context_p->source_p)
@@ -682,8 +672,7 @@ parser_parse_function_statement (parser_context_t *context_p) /**< context */
#endif /* JERRY_ESNEXT */
lexer_expect_identifier (context_p, LEXER_NEW_IDENT_LITERAL);
- JERRY_ASSERT (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
+ JERRY_ASSERT (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
#if JERRY_ESNEXT
if (context_p->next_scanner_info_p->source_p == context_p->source_p
@@ -758,8 +747,7 @@ parser_parse_function_statement (parser_context_t *context_p) /**< context */
while (stack_p < scope_stack_p)
{
- if (literal_index == stack_p->map_from
- && (stack_p->map_to & PARSER_SCOPE_STACK_NO_FUNCTION_COPY))
+ if (literal_index == stack_p->map_from && (stack_p->map_to & PARSER_SCOPE_STACK_NO_FUNCTION_COPY))
{
copy_value = false;
break;
@@ -778,13 +766,9 @@ parser_parse_function_statement (parser_context_t *context_p) /**< context */
JERRY_ASSERT (!(stack_p->map_to & PARSER_SCOPE_STACK_NO_FUNCTION_COPY));
uint16_t map_to = scanner_decode_map_to (stack_p);
- uint16_t opcode = ((map_to >= PARSER_REGISTER_START) ? CBC_ASSIGN_LITERAL_SET_IDENT
- : CBC_COPY_TO_GLOBAL);
+ uint16_t opcode = ((map_to >= PARSER_REGISTER_START) ? CBC_ASSIGN_LITERAL_SET_IDENT : CBC_COPY_TO_GLOBAL);
- parser_emit_cbc_literal_value (context_p,
- opcode,
- scanner_decode_map_to (scope_stack_p),
- map_to);
+ parser_emit_cbc_literal_value (context_p, opcode, scanner_decode_map_to (scope_stack_p), map_to);
break;
}
stack_p++;
@@ -833,9 +817,7 @@ parser_parse_if_statement_start (parser_context_t *context_p) /**< context */
parser_parse_enclosed_expr (context_p);
- parser_emit_cbc_forward_branch (context_p,
- CBC_BRANCH_IF_FALSE_FORWARD,
- &if_statement.branch);
+ parser_emit_cbc_forward_branch (context_p, CBC_BRANCH_IF_FALSE_FORWARD, &if_statement.branch);
parser_stack_push (context_p, &if_statement, sizeof (parser_if_else_statement_t));
parser_stack_push_uint8 (context_p, PARSER_STATEMENT_IF);
@@ -873,9 +855,7 @@ parser_parse_if_statement_end (parser_context_t *context_p) /**< context */
parser_stack_iterator_skip (&iterator, 1);
parser_stack_iterator_read (&iterator, &if_statement, sizeof (parser_if_else_statement_t));
- parser_emit_cbc_forward_branch (context_p,
- CBC_JUMP_FORWARD,
- &else_statement.branch);
+ parser_emit_cbc_forward_branch (context_p, CBC_JUMP_FORWARD, &else_statement.branch);
parser_set_branch_to_current_position (context_p, &if_statement.branch);
@@ -907,9 +887,7 @@ parser_parse_with_statement_start (parser_context_t *context_p) /**< context */
uint8_t inside_with = (context_p->status_flags & PARSER_INSIDE_WITH) != 0;
context_p->status_flags |= PARSER_INSIDE_WITH;
- parser_emit_cbc_ext_forward_branch (context_p,
- CBC_EXT_WITH_CREATE_CONTEXT,
- &with_statement.branch);
+ parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_WITH_CREATE_CONTEXT, &with_statement.branch);
parser_stack_push (context_p, &with_statement, sizeof (parser_with_statement_t));
parser_stack_push_uint8 (context_p, inside_with);
@@ -1128,8 +1106,7 @@ static uint16_t
parser_check_left_hand_side_expression (parser_context_t *context_p, /**< context */
uint16_t opcode) /**< opcode to check */
{
- if (opcode == CBC_PUSH_LITERAL
- && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL)
+ if (opcode == CBC_PUSH_LITERAL && context_p->last_cbc.literal_type == LEXER_IDENT_LITERAL)
{
context_p->last_cbc_opcode = PARSER_CBC_UNAVAILABLE;
return CBC_ASSIGN_SET_IDENT;
@@ -1197,8 +1174,7 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
if (context_p->token.type != LEXER_LEFT_PAREN)
{
#if JERRY_ESNEXT
- if (context_p->token.type == LEXER_LITERAL
- && context_p->token.keyword_type == LEXER_KEYW_AWAIT
+ if (context_p->token.type == LEXER_LITERAL && context_p->token.keyword_type == LEXER_KEYW_AWAIT
&& !(context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))
{
parser_raise_error (context_p, PARSER_ERR_FOR_AWAIT_NO_ASYNC);
@@ -1227,8 +1203,7 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
uint8_t token_type = LEXER_EOS;
bool has_context = false;
- if (context_p->token.type == LEXER_KEYW_VAR
- || context_p->token.type == LEXER_KEYW_LET
+ if (context_p->token.type == LEXER_KEYW_VAR || context_p->token.type == LEXER_KEYW_LET
|| context_p->token.type == LEXER_KEYW_CONST)
{
token_type = context_p->token.type;
@@ -1299,8 +1274,7 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
#ifndef JERRY_NDEBUG
PARSER_PLUS_EQUAL_U16 (context_p->context_stack_depth,
- is_for_in ? PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION
- : PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION);
+ is_for_in ? PARSER_FOR_IN_CONTEXT_STACK_ALLOCATION : PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION);
#endif /* !JERRY_NDEBUG */
cbc_ext_opcode_t init_opcode = CBC_EXT_FOR_IN_INIT;
@@ -1359,8 +1333,7 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
#if JERRY_ESNEXT
if (lexer_check_next_characters (context_p, LIT_CHAR_LEFT_SQUARE, LIT_CHAR_LEFT_BRACE))
{
- parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT
- : CBC_EXT_FOR_OF_GET_NEXT);
+ parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT : CBC_EXT_FOR_OF_GET_NEXT);
parser_pattern_flags_t flags = (PARSER_PATTERN_BINDING | PARSER_PATTERN_TARGET_ON_STACK);
@@ -1399,8 +1372,7 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
lexer_expect_identifier (context_p, LEXER_IDENT_LITERAL);
#if JERRY_ESNEXT
- if (context_p->token.keyword_type == LEXER_KEYW_LET
- && token_type != LEXER_KEYW_VAR)
+ if (context_p->token.keyword_type == LEXER_KEYW_LET && token_type != LEXER_KEYW_VAR)
{
parser_raise_error (context_p, PARSER_ERR_LEXICAL_LET_BINDING);
}
@@ -1429,12 +1401,10 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
parser_set_branch_to_current_position (context_p, &branch);
}
- parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT
- : CBC_EXT_FOR_OF_GET_NEXT);
+ parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT : CBC_EXT_FOR_OF_GET_NEXT);
#if JERRY_ESNEXT
#ifndef JERRY_NDEBUG
- if (literal_index < PARSER_REGISTER_START
- && has_context
+ if (literal_index < PARSER_REGISTER_START && has_context
&& !scanner_literal_is_created (context_p, literal_index))
{
context_p->global_status_flags |= ECMA_PARSE_INTERNAL_FOR_IN_OFF_CONTEXT_ERROR;
@@ -1456,8 +1426,7 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
&& context_p->next_scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS
&& (context_p->next_scanner_info_p->u8_arg & SCANNER_LITERAL_DESTRUCTURING_FOR))
{
- parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT
- : CBC_EXT_FOR_OF_GET_NEXT);
+ parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT : CBC_EXT_FOR_OF_GET_NEXT);
uint32_t flags = PARSER_PATTERN_TARGET_ON_STACK;
@@ -1484,13 +1453,11 @@ parser_parse_for_statement_start (parser_context_t *context_p) /**< context */
opcode = context_p->last_cbc_opcode;
/* The CBC_EXT_FOR_IN_CREATE_CONTEXT flushed the opcode combiner. */
- JERRY_ASSERT (opcode != CBC_PUSH_TWO_LITERALS
- && opcode != CBC_PUSH_THREE_LITERALS);
+ JERRY_ASSERT (opcode != CBC_PUSH_TWO_LITERALS && opcode != CBC_PUSH_THREE_LITERALS);
opcode = parser_check_left_hand_side_expression (context_p, opcode);
- parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT
- : CBC_EXT_FOR_OF_GET_NEXT);
+ parser_emit_cbc_ext (context_p, is_for_in ? CBC_EXT_FOR_IN_GET_NEXT : CBC_EXT_FOR_OF_GET_NEXT);
parser_flush_cbc (context_p);
context_p->last_cbc_opcode = opcode;
@@ -1690,7 +1657,7 @@ parser_parse_for_statement_end (parser_context_t *context_p) /**< context */
{
has_block_context = true;
}
-#endif
+#endif /* JERRY_ESNEXT */
scanner_get_location (&location, context_p);
current_token = context_p->token;
@@ -1706,7 +1673,7 @@ parser_parse_for_statement_end (parser_context_t *context_p) /**< context */
{
parser_emit_cbc_ext (context_p, CBC_EXT_CLONE_FULL_CONTEXT);
}
-#endif
+#endif /* JERRY_ESNEXT */
if (context_p->token.type != LEXER_RIGHT_PAREN)
{
@@ -1762,7 +1729,7 @@ parser_parse_for_statement_end (parser_context_t *context_p) /**< context */
{
parser_pop_block_context (context_p);
}
-#endif
+#endif /* JERRY_ESNEXT */
/* Calling scanner_seek is unnecessary because all
* info blocks inside the for statement should be processed. */
@@ -1853,8 +1820,7 @@ parser_parse_switch_statement_start (parser_context_t *context_p) /**< context *
case_info_p = case_info_p->next_p;
/* The last letter of case and default is 'e' and 't' respectively. */
- JERRY_ASSERT (context_p->source_p[-1] == LIT_CHAR_LOWERCASE_E
- || context_p->source_p[-1] == LIT_CHAR_LOWERCASE_T);
+ JERRY_ASSERT (context_p->source_p[-1] == LIT_CHAR_LOWERCASE_E || context_p->source_p[-1] == LIT_CHAR_LOWERCASE_T);
bool is_default = context_p->source_p[-1] == LIT_CHAR_LOWERCASE_T;
lexer_next_token (context_p);
@@ -1911,8 +1877,7 @@ parser_parse_switch_statement_start (parser_context_t *context_p) /**< context *
}
case_branches_p = new_case_p;
- }
- while (case_info_p != NULL);
+ } while (case_info_p != NULL);
JERRY_ASSERT (switch_case_was_found || default_case_was_found);
@@ -2001,8 +1966,7 @@ parser_parse_try_statement_end (parser_context_t *context_p) /**< context */
{
JERRY_ASSERT (try_statement.type == parser_try_block);
- if (context_p->token.type != LEXER_KEYW_CATCH
- && context_p->token.type != LEXER_KEYW_FINALLY)
+ if (context_p->token.type != LEXER_KEYW_CATCH && context_p->token.type != LEXER_KEYW_FINALLY)
{
parser_raise_error (context_p, PARSER_ERR_CATCH_FINALLY_EXPECTED);
}
@@ -2021,9 +1985,7 @@ parser_parse_try_statement_end (parser_context_t *context_p) /**< context */
lexer_next_token (context_p);
try_statement.type = parser_catch_block;
- parser_emit_cbc_ext_forward_branch (context_p,
- CBC_EXT_CATCH,
- &try_statement.branch);
+ parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_CATCH, &try_statement.branch);
try_statement.scope_stack_top = context_p->scope_stack_top;
try_statement.scope_stack_reg_top = context_p->scope_stack_reg_top;
@@ -2052,9 +2014,7 @@ parser_parse_try_statement_end (parser_context_t *context_p) /**< context */
#if JERRY_ESNEXT
if (lexer_check_next_characters (context_p, LIT_CHAR_LEFT_SQUARE, LIT_CHAR_LEFT_BRACE))
{
- parser_pattern_flags_t flags = (PARSER_PATTERN_BINDING
- | PARSER_PATTERN_TARGET_ON_STACK
- | PARSER_PATTERN_LET);
+ parser_pattern_flags_t flags = (PARSER_PATTERN_BINDING | PARSER_PATTERN_TARGET_ON_STACK | PARSER_PATTERN_LET);
parser_parse_initializer_by_next_char (context_p, flags);
}
@@ -2071,7 +2031,7 @@ parser_parse_try_statement_end (parser_context_t *context_p) /**< context */
(literal_index >= PARSER_REGISTER_START) ? CBC_ASSIGN_SET_IDENT : CBC_ASSIGN_LET_CONST,
literal_index);
#else /* !JERRY_ESNEXT */
- parser_emit_cbc_literal (context_p, CBC_ASSIGN_SET_IDENT, context_p->lit_object.index);
+ parser_emit_cbc_literal (context_p, CBC_ASSIGN_SET_IDENT, context_p->lit_object.index);
#endif /* JERRY_ESNEXT */
lexer_next_token (context_p);
@@ -2124,9 +2084,7 @@ parser_parse_try_statement_end (parser_context_t *context_p) /**< context */
#endif /* !JERRY_NDEBUG */
try_statement.type = parser_finally_block;
- parser_emit_cbc_ext_forward_branch (context_p,
- CBC_EXT_FINALLY,
- &try_statement.branch);
+ parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_FINALLY, &try_statement.branch);
#if JERRY_ESNEXT
if (context_p->next_scanner_info_p->source_p == context_p->source_p)
@@ -2234,8 +2192,7 @@ parser_parse_break_statement (parser_context_t *context_p) /**< context */
lexer_next_token (context_p);
parser_stack_iterator_init (context_p, &iterator);
- if (!(context_p->token.flags & LEXER_WAS_NEWLINE)
- && context_p->token.type == LEXER_LITERAL
+ if (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->token.type == LEXER_LITERAL
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
/* The label with the same name is searched on the stack. */
@@ -2261,9 +2218,8 @@ parser_parse_break_statement (parser_context_t *context_p) /**< context */
if (lexer_current_is_literal (context_p, &label_statement.label_ident))
{
- label_statement.break_list_p = parser_emit_cbc_forward_branch_item (context_p,
- (uint16_t) opcode,
- label_statement.break_list_p);
+ label_statement.break_list_p =
+ parser_emit_cbc_forward_branch_item (context_p, (uint16_t) opcode, label_statement.break_list_p);
parser_stack_iterator_write (&iterator, &label_statement, sizeof (parser_label_statement_t));
lexer_next_token (context_p);
return;
@@ -2297,9 +2253,7 @@ parser_parse_break_statement (parser_context_t *context_p) /**< context */
parser_stack_iterator_skip (&iterator, 1);
parser_stack_iterator_read (&iterator, &loop, sizeof (parser_loop_statement_t));
- loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p,
- (uint16_t) opcode,
- loop.branch_list_p);
+ loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p, (uint16_t) opcode, loop.branch_list_p);
parser_stack_iterator_write (&iterator, &loop, sizeof (parser_loop_statement_t));
return;
}
@@ -2320,8 +2274,7 @@ parser_parse_continue_statement (parser_context_t *context_p) /**< context */
lexer_next_token (context_p);
parser_stack_iterator_init (context_p, &iterator);
- if (!(context_p->token.flags & LEXER_WAS_NEWLINE)
- && context_p->token.type == LEXER_LITERAL
+ if (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->token.type == LEXER_LITERAL
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
parser_stack_iterator_t loop_iterator;
@@ -2352,9 +2305,7 @@ parser_parse_continue_statement (parser_context_t *context_p) /**< context */
parser_stack_iterator_skip (&loop_iterator, 1);
parser_stack_iterator_read (&loop_iterator, &loop, sizeof (parser_loop_statement_t));
- loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p,
- (uint16_t) opcode,
- loop.branch_list_p);
+ loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p, (uint16_t) opcode, loop.branch_list_p);
loop.branch_list_p->branch.offset |= CBC_HIGHEST_BIT_MASK;
parser_stack_iterator_write (&loop_iterator, &loop, sizeof (parser_loop_statement_t));
lexer_next_token (context_p);
@@ -2370,8 +2321,8 @@ parser_parse_continue_statement (parser_context_t *context_p) /**< context */
}
#if JERRY_ESNEXT
- const bool is_private_scope = (type == PARSER_STATEMENT_PRIVATE_SCOPE
- || type == PARSER_STATEMENT_PRIVATE_CONTEXT);
+ const bool is_private_scope =
+ (type == PARSER_STATEMENT_PRIVATE_SCOPE || type == PARSER_STATEMENT_PRIVATE_CONTEXT);
#else /* !JERRY_ESNEXT */
const bool is_private_scope = false;
#endif /* !JERRY_ESNEXT */
@@ -2404,9 +2355,7 @@ parser_parse_continue_statement (parser_context_t *context_p) /**< context */
parser_stack_iterator_skip (&iterator, 1);
parser_stack_iterator_read (&iterator, &loop, sizeof (parser_loop_statement_t));
- loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p,
- (uint16_t) opcode,
- loop.branch_list_p);
+ loop.branch_list_p = parser_emit_cbc_forward_branch_item (context_p, (uint16_t) opcode, loop.branch_list_p);
loop.branch_list_p->branch.offset |= CBC_HIGHEST_BIT_MASK;
parser_stack_iterator_write (&iterator, &loop, sizeof (parser_loop_statement_t));
return;
@@ -2448,11 +2397,9 @@ parser_parse_import_statement (parser_context_t *context_p) /**< parser context
lexer_next_token (context_p);
/* Check for a ModuleSpecifier*/
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_STRING_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_STRING_LITERAL)
{
- if (!(context_p->token.type == LEXER_LEFT_BRACE
- || context_p->token.type == LEXER_MULTIPLY
+ if (!(context_p->token.type == LEXER_LEFT_BRACE || context_p->token.type == LEXER_MULTIPLY
|| (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)))
{
parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_MULTIPLY_LITERAL_EXPECTED);
@@ -2482,8 +2429,7 @@ parser_parse_import_statement (parser_context_t *context_p) /**< parser context
if (context_p->token.type == LEXER_COMMA)
{
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_MULTIPLY
- && context_p->token.type != LEXER_LEFT_BRACE)
+ if (context_p->token.type != LEXER_MULTIPLY && context_p->token.type != LEXER_LEFT_BRACE)
{
parser_raise_error (context_p, PARSER_ERR_LEFT_BRACE_MULTIPLY_EXPECTED);
}
@@ -2571,8 +2517,7 @@ parser_parse_export_statement (parser_context_t *context_p) /**< context */
lexer_next_token (context_p);
- if (context_p->token.type == LEXER_LITERAL
- && lexer_token_is_async (context_p)
+ if (context_p->token.type == LEXER_LITERAL && lexer_token_is_async (context_p)
&& context_p->next_scanner_info_p->source_p == context_p->source_p
&& context_p->next_scanner_info_p->type == SCANNER_TYPE_FUNCTION)
{
@@ -2626,9 +2571,7 @@ parser_parse_export_statement (parser_context_t *context_p) /**< context */
parser_raise_error (context_p, PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER);
}
- parser_module_add_names_to_node (context_p,
- export_name_p,
- name_p);
+ parser_module_add_names_to_node (context_p, export_name_p, name_p);
ecma_deref_ecma_string (name_p);
ecma_deref_ecma_string (export_name_p);
break;
@@ -2645,8 +2588,7 @@ parser_parse_export_statement (parser_context_t *context_p) /**< context */
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
}
@@ -2799,8 +2741,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
}
#endif /* JERRY_DEBUGGER */
- while (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_STRING_LITERAL)
+ while (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL)
{
lexer_lit_location_t lit_location;
parser_strict_mode_type_t strict_mode = PARSER_USE_STRICT_NOT_FOUND;
@@ -2866,8 +2807,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
#if JERRY_ESNEXT
- if (strict_mode != PARSER_USE_STRICT_NOT_FOUND
- && (context_p->status_flags & PARSER_FUNCTION_HAS_COMPLEX_ARGUMENT))
+ if (strict_mode != PARSER_USE_STRICT_NOT_FOUND && (context_p->status_flags & PARSER_FUNCTION_HAS_COMPLEX_ARGUMENT))
{
parser_raise_error (context_p, PARSER_ERR_USE_STRICT_NOT_ALLOWED);
}
@@ -2880,8 +2820,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
/* The last directive prologue can be the result of the script. */
if (!(context_p->status_flags & PARSER_IS_FUNCTION)
- && (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_STRING_LITERAL))
+ && (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_STRING_LITERAL))
{
lexer_construct_literal_object (context_p, &lit_location, LEXER_STRING_LITERAL);
parser_emit_cbc_literal_from_token (context_p, CBC_PUSH_LITERAL);
@@ -2891,14 +2830,12 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
}
}
- if (context_p->status_flags & PARSER_IS_STRICT
- && context_p->status_flags & PARSER_HAS_NON_STRICT_ARG)
+ if (context_p->status_flags & PARSER_IS_STRICT && context_p->status_flags & PARSER_HAS_NON_STRICT_ARG)
{
parser_raise_error (context_p, PARSER_ERR_NON_STRICT_ARG_DEFINITION);
}
- while (context_p->token.type != LEXER_EOS
- || context_p->stack_top_uint8 != PARSER_STATEMENT_START)
+ while (context_p->token.type != LEXER_EOS || context_p->stack_top_uint8 != PARSER_STATEMENT_START)
{
#ifndef JERRY_NDEBUG
JERRY_ASSERT (context_p->stack_depth == context_p->context_stack_depth);
@@ -2911,16 +2848,11 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
#if JERRY_DEBUGGER
if (JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED
- && context_p->token.line != context_p->last_breakpoint_line
- && context_p->token.type != LEXER_SEMICOLON
- && context_p->token.type != LEXER_LEFT_BRACE
- && context_p->token.type != LEXER_RIGHT_BRACE
- && context_p->token.type != LEXER_KEYW_VAR
- && context_p->token.type != LEXER_KEYW_LET
- && context_p->token.type != LEXER_KEYW_CONST
- && context_p->token.type != LEXER_KEYW_FUNCTION
- && context_p->token.type != LEXER_KEYW_CASE
- && context_p->token.type != LEXER_KEYW_DEFAULT)
+ && context_p->token.line != context_p->last_breakpoint_line && context_p->token.type != LEXER_SEMICOLON
+ && context_p->token.type != LEXER_LEFT_BRACE && context_p->token.type != LEXER_RIGHT_BRACE
+ && context_p->token.type != LEXER_KEYW_VAR && context_p->token.type != LEXER_KEYW_LET
+ && context_p->token.type != LEXER_KEYW_CONST && context_p->token.type != LEXER_KEYW_FUNCTION
+ && context_p->token.type != LEXER_KEYW_CASE && context_p->token.type != LEXER_KEYW_DEFAULT)
{
parser_emit_cbc (context_p, CBC_BREAKPOINT_DISABLED);
parser_flush_cbc (context_p);
@@ -2932,14 +2864,10 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
#endif /* JERRY_DEBUGGER */
#if JERRY_LINE_INFO
- if (context_p->token.type != LEXER_SEMICOLON
- && context_p->token.type != LEXER_LEFT_BRACE
- && context_p->token.type != LEXER_RIGHT_BRACE
- && context_p->token.type != LEXER_KEYW_VAR
- && context_p->token.type != LEXER_KEYW_LET
- && context_p->token.type != LEXER_KEYW_CONST
- && context_p->token.type != LEXER_KEYW_FUNCTION
- && context_p->token.type != LEXER_KEYW_CASE
+ if (context_p->token.type != LEXER_SEMICOLON && context_p->token.type != LEXER_LEFT_BRACE
+ && context_p->token.type != LEXER_RIGHT_BRACE && context_p->token.type != LEXER_KEYW_VAR
+ && context_p->token.type != LEXER_KEYW_LET && context_p->token.type != LEXER_KEYW_CONST
+ && context_p->token.type != LEXER_KEYW_FUNCTION && context_p->token.type != LEXER_KEYW_CASE
&& context_p->token.type != LEXER_KEYW_DEFAULT)
{
parser_line_info_append (context_p, context_p->token.line, context_p->token.column);
@@ -3088,9 +3016,7 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
#endif /* !JERRY_NDEBUG */
try_statement.type = parser_try_block;
- parser_emit_cbc_ext_forward_branch (context_p,
- CBC_EXT_TRY_CREATE_CONTEXT,
- &try_statement.branch);
+ parser_emit_cbc_ext_forward_branch (context_p, CBC_EXT_TRY_CREATE_CONTEXT, &try_statement.branch);
#if JERRY_ESNEXT
try_statement.scope_stack_top = context_p->scope_stack_top;
@@ -3161,10 +3087,8 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
lexer_next_token (context_p);
- if ((context_p->token.flags & LEXER_WAS_NEWLINE)
- || context_p->token.type == LEXER_SEMICOLON
- || context_p->token.type == LEXER_EOS
- || context_p->token.type == LEXER_RIGHT_BRACE)
+ if ((context_p->token.flags & LEXER_WAS_NEWLINE) || context_p->token.type == LEXER_SEMICOLON
+ || context_p->token.type == LEXER_EOS || context_p->token.type == LEXER_RIGHT_BRACE)
{
#if JERRY_ESNEXT
if (context_p->status_flags & PARSER_IS_ASYNC_FUNCTION)
@@ -3382,13 +3306,12 @@ parser_parse_statements (parser_context_t *context_p) /**< context */
{
lexer_next_token (context_p);
}
- else if (context_p->token.type != LEXER_EOS
- && !(context_p->token.flags & LEXER_WAS_NEWLINE))
+ else if (context_p->token.type != LEXER_EOS && !(context_p->token.flags & LEXER_WAS_NEWLINE))
{
parser_raise_error (context_p, PARSER_ERR_SEMICOLON_EXPECTED);
}
-consume_last_statement:
+ consume_last_statement:
while (true)
{
switch (context_p->stack_top_uint8)
diff --git a/jerry-core/parser/js/js-parser-tagged-template-literal.c b/jerry-core/parser/js/js-parser-tagged-template-literal.c
index 560a3e58..24c4aa2f 100644
--- a/jerry-core/parser/js/js-parser-tagged-template-literal.c
+++ b/jerry-core/parser/js/js-parser-tagged-template-literal.c
@@ -14,13 +14,15 @@
*/
#include "js-parser-tagged-template-literal.h"
-#include "js-lexer.h"
+
#include "ecma-array-object.h"
#include "ecma-builtin-helpers.h"
#include "ecma-gc.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
+#include "js-lexer.h"
+
/* \addtogroup parser Parser
* @{
*
@@ -58,15 +60,13 @@ parser_tagged_template_literal_append_strings (parser_context_t *context_p, /**<
}
uint8_t local_byte_array[LEXER_MAX_LITERAL_LOCAL_BUFFER_SIZE];
- const uint8_t *source_p = lexer_convert_literal_to_chars (context_p,
- &context_p->token.lit_location,
- local_byte_array,
- LEXER_STRING_NO_OPTS);
+ const uint8_t *source_p =
+ lexer_convert_literal_to_chars (context_p, &context_p->token.lit_location, local_byte_array, LEXER_STRING_NO_OPTS);
ecma_string_t *raw_str_p;
- ecma_string_t *cooked_str_p = ((lit_loc_p->status_flags & LEXER_FLAG_ASCII)
- ? ecma_new_ecma_string_from_ascii (source_p, lit_loc_p->length)
- : ecma_new_ecma_string_from_utf8 (source_p, lit_loc_p->length));
+ ecma_string_t *cooked_str_p =
+ ((lit_loc_p->status_flags & LEXER_FLAG_ASCII) ? ecma_new_ecma_string_from_ascii (source_p, lit_loc_p->length)
+ : ecma_new_ecma_string_from_utf8 (source_p, lit_loc_p->length));
parser_free_allocated_buffer (context_p);
@@ -74,14 +74,12 @@ parser_tagged_template_literal_append_strings (parser_context_t *context_p, /**<
{
context_p->source_p = context_p->token.lit_location.char_p - 1;
lexer_parse_string (context_p, LEXER_STRING_RAW);
- source_p = lexer_convert_literal_to_chars (context_p,
- &context_p->token.lit_location,
- local_byte_array,
- LEXER_STRING_RAW);
-
- raw_str_p = ((lit_loc_p->status_flags & LEXER_FLAG_ASCII)
- ? ecma_new_ecma_string_from_ascii (source_p, lit_loc_p->length)
- : ecma_new_ecma_string_from_utf8 (source_p, lit_loc_p->length));
+ source_p =
+ lexer_convert_literal_to_chars (context_p, &context_p->token.lit_location, local_byte_array, LEXER_STRING_RAW);
+
+ raw_str_p =
+ ((lit_loc_p->status_flags & LEXER_FLAG_ASCII) ? ecma_new_ecma_string_from_ascii (source_p, lit_loc_p->length)
+ : ecma_new_ecma_string_from_utf8 (source_p, lit_loc_p->length));
parser_free_allocated_buffer (context_p);
}
diff --git a/jerry-core/parser/js/js-parser-tagged-template-literal.h b/jerry-core/parser/js/js-parser-tagged-template-literal.h
index 2149e523..338c209b 100644
--- a/jerry-core/parser/js/js-parser-tagged-template-literal.h
+++ b/jerry-core/parser/js/js-parser-tagged-template-literal.h
@@ -26,20 +26,20 @@
* @{
*/
-#include "common.h"
#include "ecma-globals.h"
+
+#include "common.h"
#include "js-parser-internal.h"
#if JERRY_ESNEXT
-ecma_object_t *
-parser_new_tagged_template_literal (ecma_object_t **raw_strings_p);
+ecma_object_t *parser_new_tagged_template_literal (ecma_object_t **raw_strings_p);
-void
-parser_tagged_template_literal_append_strings (parser_context_t *context_p, ecma_object_t *template_obj_p,
- ecma_object_t *raw_strings_p, uint32_t prop_index);
+void parser_tagged_template_literal_append_strings (parser_context_t *context_p,
+ ecma_object_t *template_obj_p,
+ ecma_object_t *raw_strings_p,
+ uint32_t prop_index);
-void
-parser_tagged_template_literal_finalize (ecma_object_t *template_obj_p, ecma_object_t *raw_strings_p);
+void parser_tagged_template_literal_finalize (ecma_object_t *template_obj_p, ecma_object_t *raw_strings_p);
#endif /* JERRY_ESNEXT */
#endif /* ECMA_TAGGED_TEMPLATE_LITERAL_H */
diff --git a/jerry-core/parser/js/js-parser-util.c b/jerry-core/parser/js/js-parser-util.c
index a019e046..8a65dae4 100644
--- a/jerry-core/parser/js/js-parser-util.c
+++ b/jerry-core/parser/js/js-parser-util.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "js-parser-internal.h"
#include "ecma-helpers.h"
+#include "js-parser-internal.h"
+
#if JERRY_PARSER
#if JERRY_LINE_INFO
@@ -79,11 +80,11 @@ parser_emit_two_bytes (parser_context_t *context_p, /**< context */
* @param context_p parser context
* @param byte byte
*/
-#define PARSER_APPEND_TO_BYTE_CODE(context_p, byte) \
+#define PARSER_APPEND_TO_BYTE_CODE(context_p, byte) \
if ((context_p)->byte_code.last_position >= PARSER_CBC_STREAM_PAGE_SIZE) \
- { \
- parser_cbc_stream_alloc_page ((context_p), &(context_p)->byte_code); \
- } \
+ { \
+ parser_cbc_stream_alloc_page ((context_p), &(context_p)->byte_code); \
+ } \
(context_p)->byte_code.last_p->bytes[(context_p)->byte_code.last_position++] = (uint8_t) (byte)
#if JERRY_PARSER_DUMP_BYTE_CODE
@@ -177,16 +178,14 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
}
JERRY_ASSERT ((flags >> CBC_STACK_ADJUST_SHIFT) >= CBC_STACK_ADJUST_BASE
- || (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
+ || (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
if (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))
{
uint16_t literal_index = context_p->last_cbc.literal_index;
- parser_emit_two_bytes (context_p,
- (uint8_t) (literal_index & 0xff),
- (uint8_t) (literal_index >> 8));
+ parser_emit_two_bytes (context_p, (uint8_t) (literal_index & 0xff), (uint8_t) (literal_index >> 8));
context_p->byte_code_size += 2;
}
@@ -194,18 +193,14 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
{
uint16_t literal_index = context_p->last_cbc.value;
- parser_emit_two_bytes (context_p,
- (uint8_t) (literal_index & 0xff),
- (uint8_t) (literal_index >> 8));
+ parser_emit_two_bytes (context_p, (uint8_t) (literal_index & 0xff), (uint8_t) (literal_index >> 8));
context_p->byte_code_size += 2;
if (!(flags & CBC_HAS_LITERAL_ARG))
{
literal_index = context_p->last_cbc.third_literal_index;
- parser_emit_two_bytes (context_p,
- (uint8_t) (literal_index & 0xff),
- (uint8_t) (literal_index >> 8));
+ parser_emit_two_bytes (context_p, (uint8_t) (literal_index & 0xff), (uint8_t) (literal_index >> 8));
context_p->byte_code_size += 2;
}
}
@@ -251,13 +246,11 @@ parser_flush_cbc (parser_context_t *context_p) /**< context */
if (flags & CBC_HAS_BYTE_ARG)
{
- if (last_opcode == CBC_PUSH_NUMBER_POS_BYTE
- || last_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE)
+ if (last_opcode == CBC_PUSH_NUMBER_POS_BYTE || last_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE)
{
JERRY_DEBUG_MSG (" number:%d", (int) context_p->last_cbc.value + 1);
}
- else if (last_opcode == CBC_PUSH_NUMBER_NEG_BYTE
- || last_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)
+ else if (last_opcode == CBC_PUSH_NUMBER_NEG_BYTE || last_opcode == CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE)
{
JERRY_DEBUG_MSG (" number:%d", -((int) context_p->last_cbc.value + 1));
}
@@ -434,15 +427,13 @@ parser_emit_cbc_push_number (parser_context_t *context_p, /**< context */
if (lit_value == PARSER_INVALID_LITERAL_INDEX)
{
- opcode = (is_negative_number ? CBC_PUSH_NUMBER_NEG_BYTE
- : CBC_PUSH_NUMBER_POS_BYTE);
+ opcode = (is_negative_number ? CBC_PUSH_NUMBER_NEG_BYTE : CBC_PUSH_NUMBER_POS_BYTE);
JERRY_ASSERT (CBC_STACK_ADJUST_VALUE (PARSER_GET_FLAGS (opcode)) == 1);
}
else
{
- opcode = (is_negative_number ? CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE
- : CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE);
+ opcode = (is_negative_number ? CBC_PUSH_LITERAL_PUSH_NUMBER_NEG_BYTE : CBC_PUSH_LITERAL_PUSH_NUMBER_POS_BYTE);
JERRY_ASSERT (CBC_STACK_ADJUST_VALUE (PARSER_GET_FLAGS (opcode)) == 2);
context_p->last_cbc.literal_index = lit_value;
@@ -494,7 +485,7 @@ parser_emit_cbc_forward_branch (parser_context_t *context_p, /**< context */
/* Branch opcodes never push anything onto the stack. */
JERRY_ASSERT ((flags >> CBC_STACK_ADJUST_SHIFT) >= CBC_STACK_ADJUST_BASE
- || (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
+ || (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
#if JERRY_PARSER_DUMP_BYTE_CODE
@@ -606,7 +597,7 @@ parser_emit_cbc_backward_branch (parser_context_t *context_p, /**< context */
/* Branch opcodes never push anything onto the stack. */
JERRY_ASSERT ((flags >> CBC_STACK_ADJUST_SHIFT) >= CBC_STACK_ADJUST_BASE
- || (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
+ || (CBC_STACK_ADJUST_BASE - (flags >> CBC_STACK_ADJUST_SHIFT)) <= context_p->stack_depth);
PARSER_PLUS_EQUAL_U16 (context_p->stack_depth, CBC_STACK_ADJUST_VALUE (flags));
#if JERRY_PARSER_DUMP_BYTE_CODE
@@ -673,7 +664,7 @@ parser_new_ecma_string_from_literal (lexer_literal_t *literal_p) /**< literal */
}
return new_string;
-} /* parser_new_ecma_string_from_literal */
+} /* parser_new_ecma_string_from_literal */
/**
* Set a branch to the current byte code position
@@ -815,8 +806,7 @@ parser_reverse_class_fields (parser_context_t *context_p, /**< context */
has_fields = true;
context_p->stack_top_uint8 = class_field_type;
}
- }
- while (current_p < data_end_p);
+ } while (current_p < data_end_p);
parser_stack_iterator_init (context_p, &iterator);
current_p = data_end_p;
@@ -845,8 +835,7 @@ parser_reverse_class_fields (parser_context_t *context_p, /**< context */
current_p[-1] |= PARSER_CLASS_FIELD_END;
}
current_p -= info_size;
- }
- while (current_p > data_p);
+ } while (current_p > data_p);
}
else
{
@@ -872,8 +861,7 @@ parser_reverse_class_fields (parser_context_t *context_p, /**< context */
parser_stack_iterator_write (&iterator, current_p, info_size);
parser_stack_iterator_skip (&iterator, info_size);
}
- }
- while (current_p > data_p);
+ } while (current_p > data_p);
}
parser_free (data_p, fields_size);
diff --git a/jerry-core/parser/js/js-parser.c b/jerry-core/parser/js/js-parser.c
index f29a1027..2ba45777 100644
--- a/jerry-core/parser/js/js-parser.c
+++ b/jerry-core/parser/js/js-parser.c
@@ -13,12 +13,13 @@
* limitations under the License.
*/
-#include "debugger.h"
#include "ecma-exceptions.h"
#include "ecma-extended-info.h"
#include "ecma-helpers.h"
#include "ecma-literal-storage.h"
#include "ecma-module.h"
+
+#include "debugger.h"
#include "jcontext.h"
#include "js-parser-internal.h"
@@ -28,8 +29,7 @@ JERRY_STATIC_ASSERT ((int) ECMA_PARSE_STRICT_MODE == (int) PARSER_IS_STRICT,
ecma_parse_strict_mode_must_be_equal_to_parser_is_strict);
#if JERRY_ESNEXT
-JERRY_STATIC_ASSERT (PARSER_SAVE_STATUS_FLAGS (PARSER_ALLOW_SUPER) == 0x1,
- incorrect_saving_of_ecma_parse_allow_super);
+JERRY_STATIC_ASSERT (PARSER_SAVE_STATUS_FLAGS (PARSER_ALLOW_SUPER) == 0x1, incorrect_saving_of_ecma_parse_allow_super);
JERRY_STATIC_ASSERT (PARSER_RESTORE_STATUS_FLAGS (ECMA_PARSE_ALLOW_SUPER) == PARSER_ALLOW_SUPER,
incorrect_restoring_of_ecma_parse_allow_super);
@@ -113,8 +113,7 @@ parser_compute_indicies (parser_context_t *context_p, /**< context */
const uint8_t *char_p = literal_p->u.char_p;
uint32_t status_flags = context_p->status_flags;
- if ((literal_p->status_flags & LEXER_FLAG_SOURCE_PTR)
- && literal_p->prop.length < 0xfff)
+ if ((literal_p->status_flags & LEXER_FLAG_SOURCE_PTR) && literal_p->prop.length < 0xfff)
{
size_t bytes_to_end = (size_t) (context_p->source_end_p - char_p);
@@ -243,8 +242,7 @@ parser_init_literal_pool (parser_context_t *context_p, /**< context */
{
JERRY_ASSERT (literal_p->prop.index >= context_p->register_count);
- ECMA_SET_INTERNAL_VALUE_POINTER (literal_pool_p[literal_p->prop.index],
- literal_p->u.bytecode_p);
+ ECMA_SET_INTERNAL_VALUE_POINTER (literal_pool_p[literal_p->prop.index], literal_p->u.bytecode_p);
break;
}
default:
@@ -417,17 +415,14 @@ parse_update_branches (parser_context_t *context_p, /**< context */
{
target_distance = (target_distance << 8) | *bytes_p;
bytes_p++;
- }
- while (--length > 0);
+ } while (--length > 0);
if (CBC_BRANCH_IS_FORWARD (flags))
{
/* Branch target was not set. */
JERRY_ASSERT (target_distance > 0);
- target_distance = parser_update_forward_branch (page_p,
- offset + target_distance,
- bytes_copied_before_jump);
+ target_distance = parser_update_forward_branch (page_p, offset + target_distance, bytes_copied_before_jump);
}
else
{
@@ -444,9 +439,8 @@ parse_update_branches (parser_context_t *context_p, /**< context */
}
else
{
- target_distance = parser_update_backward_branch (prev_page_p,
- target_distance - offset,
- bytes_copied_before_jump);
+ target_distance =
+ parser_update_backward_branch (prev_page_p, target_distance - offset, bytes_copied_before_jump);
}
}
@@ -456,8 +450,7 @@ parse_update_branches (parser_context_t *context_p, /**< context */
bytes_p--;
*bytes_p = (uint8_t) (target_distance & 0xff);
target_distance >>= 8;
- }
- while (--branch_argument_length > 0);
+ } while (--branch_argument_length > 0);
}
offset++;
@@ -541,13 +534,14 @@ parser_append_breakpoint_info (parser_context_t *context_p, /**< context */
* @param page_p page
* @param offset offset
*/
-#define PARSER_NEXT_BYTE(page_p, offset) \
- do { \
+#define PARSER_NEXT_BYTE(page_p, offset) \
+ do \
+ { \
if (++(offset) >= PARSER_CBC_STREAM_PAGE_SIZE) \
- { \
- offset = 0; \
- page_p = page_p->next_p; \
- } \
+ { \
+ offset = 0; \
+ page_p = page_p->next_p; \
+ } \
} while (0)
/**
@@ -558,14 +552,15 @@ parser_append_breakpoint_info (parser_context_t *context_p, /**< context */
* @param real_offset real offset
*/
#define PARSER_NEXT_BYTE_UPDATE(page_p, offset, real_offset) \
- do { \
- page_p->bytes[offset] = real_offset; \
- if (++(offset) >= PARSER_CBC_STREAM_PAGE_SIZE) \
- { \
- offset = 0; \
- real_offset = 0; \
- page_p = page_p->next_p; \
- } \
+ do \
+ { \
+ page_p->bytes[offset] = real_offset; \
+ if (++(offset) >= PARSER_CBC_STREAM_PAGE_SIZE) \
+ { \
+ offset = 0; \
+ real_offset = 0; \
+ page_p = page_p->next_p; \
+ } \
} while (0)
/**
@@ -672,8 +667,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
context_p->last_breakpoint_line = context_p->token.line;
}
- if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
- && context_p->breakpoint_info_count > 0)
+ if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) && context_p->breakpoint_info_count > 0)
{
parser_send_breakpoints (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST);
JERRY_ASSERT (context_p->breakpoint_info_count == 0);
@@ -847,8 +841,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
PARSER_NEXT_BYTE (page_p, offset);
}
- if (last_opcode == (cbc_opcode_t) (CBC_JUMP_FORWARD + PARSER_MAX_BRANCH_LENGTH - 1)
- && prefix_zero
+ if (last_opcode == (cbc_opcode_t) (CBC_JUMP_FORWARD + PARSER_MAX_BRANCH_LENGTH - 1) && prefix_zero
&& page_p->bytes[offset] == PARSER_MAX_BRANCH_LENGTH + 1)
{
/* Uncoditional jumps which jump right after the instruction
@@ -869,8 +862,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
}
}
- if (!(context_p->status_flags & PARSER_NO_END_LABEL)
- || !(PARSER_OPCODE_IS_RETURN (last_opcode)))
+ if (!(context_p->status_flags & PARSER_NO_END_LABEL) || !(PARSER_OPCODE_IS_RETURN (last_opcode)))
{
context_p->status_flags &= (uint32_t) ~PARSER_NO_END_LABEL;
@@ -887,8 +879,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
needs_uint16_arguments = false;
total_size = sizeof (cbc_uint8_arguments_t);
- if (context_p->stack_limit > CBC_MAXIMUM_BYTE_VALUE
- || context_p->register_count > CBC_MAXIMUM_BYTE_VALUE
+ if (context_p->stack_limit > CBC_MAXIMUM_BYTE_VALUE || context_p->register_count > CBC_MAXIMUM_BYTE_VALUE
|| context_p->literal_count > CBC_MAXIMUM_BYTE_VALUE)
{
needs_uint16_arguments = true;
@@ -943,8 +934,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
if (function_start_p < start_p || function_start_p >= start_p + context_p->source_size)
{
- JERRY_ASSERT (context_p->arguments_start_p != NULL
- && function_start_p >= context_p->arguments_start_p
+ JERRY_ASSERT (context_p->arguments_start_p != NULL && function_start_p >= context_p->arguments_start_p
&& function_start_p < context_p->arguments_start_p + context_p->arguments_size);
start_p = context_p->arguments_start_p;
@@ -1039,8 +1029,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
compiled_code_p->status_flags |= CBC_CODE_FLAGS_STRICT_MODE;
}
- if ((context_p->status_flags & PARSER_ARGUMENTS_NEEDED)
- && PARSER_NEEDS_MAPPED_ARGUMENTS (context_p->status_flags))
+ if ((context_p->status_flags & PARSER_ARGUMENTS_NEEDED) && PARSER_NEEDS_MAPPED_ARGUMENTS (context_p->status_flags))
{
compiled_code_p->status_flags |= CBC_CODE_FLAGS_MAPPED_ARGUMENTS_NEEDED;
}
@@ -1118,8 +1107,8 @@ parser_post_processing (parser_context_t *context_p) /**< context */
page_p = context_p->byte_code.first_p;
offset = 0;
real_offset = 0;
- uint8_t last_register_index = (uint8_t) JERRY_MIN (context_p->register_count,
- (PARSER_MAXIMUM_NUMBER_OF_REGISTERS - 1));
+ uint8_t last_register_index =
+ (uint8_t) JERRY_MIN (context_p->register_count, (PARSER_MAXIMUM_NUMBER_OF_REGISTERS - 1));
while (page_p != last_page_p || offset < last_position)
{
@@ -1142,8 +1131,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
do
{
PARSER_NEXT_BYTE_UPDATE (page_p, offset, real_offset);
- }
- while (--counter > 0);
+ } while (--counter > 0);
continue;
}
@@ -1178,8 +1166,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
}
/* Only literal and call arguments can be combined. */
- JERRY_ASSERT (!(flags & CBC_HAS_BRANCH_ARG)
- || !(flags & (CBC_HAS_BYTE_ARG | CBC_HAS_LITERAL_ARG)));
+ JERRY_ASSERT (!(flags & CBC_HAS_BRANCH_ARG) || !(flags & (CBC_HAS_BYTE_ARG | CBC_HAS_LITERAL_ARG)));
while (flags & (CBC_HAS_LITERAL_ARG | CBC_HAS_LITERAL_ARG2))
{
@@ -1267,8 +1254,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
}
#if JERRY_DEBUGGER
- if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
- && context_p->breakpoint_info_count > 0)
+ if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) && context_p->breakpoint_info_count > 0)
{
parser_send_breakpoints (context_p, JERRY_DEBUGGER_BREAKPOINT_OFFSET_LIST);
JERRY_ASSERT (context_p->breakpoint_info_count == 0);
@@ -1307,8 +1293,7 @@ parser_post_processing (parser_context_t *context_p) /**< context */
parser_list_iterator_init (&context_p->literal_pool, &literal_iterator);
while ((literal_p = (lexer_literal_t *) parser_list_iterator_next (&literal_iterator)))
{
- if ((literal_p->status_flags & LEXER_FLAG_LATE_INIT)
- && literal_p->prop.index >= register_count)
+ if ((literal_p->status_flags & LEXER_FLAG_LATE_INIT) && literal_p->prop.index >= register_count)
{
uint32_t source_data = literal_p->u.source_data;
const uint8_t *char_p = context_p->source_end_p - (source_data & 0xfffff);
@@ -1550,10 +1535,8 @@ parser_parse_function_arguments (parser_context_t *context_p, /**< context */
parser_emit_cbc_ext (context_p, CBC_EXT_PUSH_REST_OBJECT);
}
- uint32_t flags = (PARSER_PATTERN_BINDING
- | PARSER_PATTERN_TARGET_ON_STACK
- | PARSER_PATTERN_LOCAL
- | PARSER_PATTERN_ARGUMENTS);
+ uint32_t flags =
+ (PARSER_PATTERN_BINDING | PARSER_PATTERN_TARGET_ON_STACK | PARSER_PATTERN_LOCAL | PARSER_PATTERN_ARGUMENTS);
if (context_p->next_scanner_info_p->source_p == context_p->source_p)
{
@@ -1602,8 +1585,8 @@ parser_parse_function_arguments (parser_context_t *context_p, /**< context */
{
if (context_p->token.type != end_type)
{
- parser_error_t error = ((end_type == LEXER_RIGHT_PAREN) ? PARSER_ERR_RIGHT_PAREN_EXPECTED
- : PARSER_ERR_IDENTIFIER_EXPECTED);
+ parser_error_t error =
+ ((end_type == LEXER_RIGHT_PAREN) ? PARSER_ERR_RIGHT_PAREN_EXPECTED : PARSER_ERR_IDENTIFIER_EXPECTED);
parser_raise_error (context_p, error);
}
@@ -1620,15 +1603,12 @@ parser_parse_function_arguments (parser_context_t *context_p, /**< context */
}
#endif /* JERRY_ESNEXT */
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
parser_raise_error (context_p, PARSER_ERR_IDENTIFIER_EXPECTED);
}
- lexer_construct_literal_object (context_p,
- &context_p->token.lit_location,
- LEXER_IDENT_LITERAL);
+ lexer_construct_literal_object (context_p, &context_p->token.lit_location, LEXER_IDENT_LITERAL);
if (context_p->token.keyword_type >= LEXER_FIRST_NON_STRICT_ARGUMENTS)
{
@@ -1749,8 +1729,8 @@ parser_parse_function_arguments (parser_context_t *context_p, /**< context */
{
if (context_p->token.type != end_type)
{
- parser_error_t error = ((end_type == LEXER_RIGHT_PAREN) ? PARSER_ERR_RIGHT_PAREN_EXPECTED
- : PARSER_ERR_IDENTIFIER_EXPECTED);
+ parser_error_t error =
+ ((end_type == LEXER_RIGHT_PAREN) ? PARSER_ERR_RIGHT_PAREN_EXPECTED : PARSER_ERR_IDENTIFIER_EXPECTED);
parser_raise_error (context_p, error);
}
@@ -1863,8 +1843,7 @@ parser_parse_source (void *source_p, /**< source code */
context.argument_list = ECMA_VALUE_EMPTY;
- if (context.options_p != NULL
- && (context.options_p->options & JERRY_PARSE_HAS_ARGUMENT_LIST))
+ if (context.options_p != NULL && (context.options_p->options & JERRY_PARSE_HAS_ARGUMENT_LIST))
{
context.argument_list = context.options_p->argument_list;
}
@@ -1935,8 +1914,7 @@ parser_parse_source (void *source_p, /**< source code */
context.user_value = ECMA_VALUE_EMPTY;
- if ((context.global_status_flags & ECMA_PARSE_EVAL)
- && JERRY_CONTEXT (vm_top_context_p) != NULL)
+ if ((context.global_status_flags & ECMA_PARSE_EVAL) && JERRY_CONTEXT (vm_top_context_p) != NULL)
{
const ecma_compiled_code_t *bytecode_header_p = JERRY_CONTEXT (vm_top_context_p)->shared_p->bytecode_header_p;
@@ -1944,7 +1922,8 @@ parser_parse_source (void *source_p, /**< source code */
if (JERRY_LIKELY (!(bytecode_header_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)))
{
#endif /* JERRY_SNAPSHOT_EXEC */
- ecma_value_t parent_script_value = ((cbc_uint8_arguments_t *) bytecode_header_p)->script_value;;
+ ecma_value_t parent_script_value = ((cbc_uint8_arguments_t *) bytecode_header_p)->script_value;
+ ;
cbc_script_t *parent_script_p = ECMA_GET_INTERNAL_VALUE_POINTER (cbc_script_t, parent_script_value);
if (parent_script_p->refs_and_type & CBC_SCRIPT_HAS_USER_VALUE)
@@ -1955,8 +1934,7 @@ parser_parse_source (void *source_p, /**< source code */
}
#endif /* JERRY_SNAPSHOT_EXEC */
}
- else if (context.options_p != NULL
- && (context.options_p->options & JERRY_PARSE_HAS_USER_VALUE))
+ else if (context.options_p != NULL && (context.options_p->options & JERRY_PARSE_HAS_USER_VALUE))
{
context.user_value = context.options_p->user_value;
}
@@ -1964,8 +1942,7 @@ parser_parse_source (void *source_p, /**< source code */
#if JERRY_RESOURCE_NAME
ecma_value_t resource_name = ecma_make_magic_string_value (LIT_MAGIC_STRING_RESOURCE_ANON);
- if (context.options_p != NULL
- && (context.options_p->options & JERRY_PARSE_HAS_RESOURCE))
+ if (context.options_p != NULL && (context.options_p->options & JERRY_PARSE_HAS_RESOURCE))
{
JERRY_ASSERT (ecma_is_value_string (context.options_p->resource_name));
@@ -2034,9 +2011,7 @@ parser_parse_source (void *source_p, /**< source code */
if (context.is_show_opcodes)
{
- JERRY_DEBUG_MSG ("\n--- %s parsing start ---\n\n",
- (context.arguments_start_p == NULL) ? "Script"
- : "Function");
+ JERRY_DEBUG_MSG ("\n--- %s parsing start ---\n\n", (context.arguments_start_p == NULL) ? "Script" : "Function");
}
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
@@ -2195,10 +2170,8 @@ parser_parse_source (void *source_p, /**< source code */
parser_list_free (&context.literal_pool);
/* When parsing is successful, only the dummy value can be remained on the stack. */
- JERRY_ASSERT (context.stack_top_uint8 == CBC_MAXIMUM_BYTE_VALUE
- && context.stack.last_position == 1
- && context.stack.first_p != NULL
- && context.stack.first_p->next_p == NULL
+ JERRY_ASSERT (context.stack_top_uint8 == CBC_MAXIMUM_BYTE_VALUE && context.stack.last_position == 1
+ && context.stack.first_p != NULL && context.stack.first_p->next_p == NULL
&& context.stack.last_p == NULL);
JERRY_ASSERT (context.arguments_start_p != NULL || !(context.status_flags & PARSER_ARGUMENTS_NEEDED));
@@ -2260,8 +2233,7 @@ parser_parse_source (void *source_p, /**< source code */
if (context.is_show_opcodes)
{
JERRY_DEBUG_MSG ("\n%s parsing successfully completed. Total byte code size: %d bytes\n",
- (context.arguments_start_p == NULL) ? "Script"
- : "Function",
+ (context.arguments_start_p == NULL) ? "Script" : "Function",
(int) context.total_byte_code_size);
}
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
@@ -2282,7 +2254,7 @@ parser_parse_source (void *source_p, /**< source code */
{
ecma_module_release_module_names (context.module_names_p);
}
-#endif
+#endif /* JERRY_MODULE_SYSTEM */
compiled_code_p = NULL;
parser_free_literals (&context.literal_pool);
@@ -2312,9 +2284,7 @@ parser_parse_source (void *source_p, /**< source code */
#if JERRY_PARSER_DUMP_BYTE_CODE
if (context.is_show_opcodes)
{
- JERRY_DEBUG_MSG ("\n--- %s parsing end ---\n\n",
- (context.arguments_start_p == NULL) ? "Script"
- : "Function");
+ JERRY_DEBUG_MSG ("\n--- %s parsing end ---\n\n", (context.arguments_start_p == NULL) ? "Script" : "Function");
}
#endif /* JERRY_PARSER_DUMP_BYTE_CODE */
@@ -2356,8 +2326,8 @@ parser_parse_source (void *source_p, /**< source code */
if (context.error == PARSER_ERR_INVALID_REGEXP)
{
ecma_value_t error = jcontext_take_exception ();
- ecma_property_t *prop_p = ecma_find_named_property (ecma_get_object_from_value (error),
- ecma_get_magic_string (LIT_MAGIC_STRING_MESSAGE));
+ ecma_property_t *prop_p =
+ ecma_find_named_property (ecma_get_object_from_value (error), ecma_get_magic_string (LIT_MAGIC_STRING_MESSAGE));
ecma_free_value (error);
JERRY_ASSERT (prop_p);
err_str_p = ecma_get_string_from_value (ECMA_PROPERTY_VALUE_PTR (prop_p)->value);
@@ -2405,8 +2375,7 @@ parser_save_context (parser_context_t *context_p, /**< context */
JERRY_ASSERT (context_p->last_cbc_opcode == PARSER_CBC_UNAVAILABLE);
#if JERRY_DEBUGGER
- if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
- && context_p->breakpoint_info_count > 0)
+ if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED) && context_p->breakpoint_info_count > 0)
{
parser_send_breakpoints (context_p, JERRY_DEBUGGER_BREAKPOINT_LIST);
context_p->breakpoint_info_count = 0;
@@ -2575,8 +2544,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
{
#if JERRY_ESNEXT
JERRY_DEBUG_MSG ("\n--- %s parsing start ---\n\n",
- (context_p->status_flags & PARSER_CLASS_CONSTRUCTOR) ? "Class constructor"
- : "Function");
+ (context_p->status_flags & PARSER_CLASS_CONSTRUCTOR) ? "Class constructor" : "Function");
#else /* !JERRY_ESNEXT */
JERRY_DEBUG_MSG ("\n--- Function parsing start ---\n\n");
#endif /* JERRY_ESNEXT */
@@ -2602,14 +2570,12 @@ parser_parse_function (parser_context_t *context_p, /**< context */
parser_parse_function_arguments (context_p, LEXER_RIGHT_PAREN);
lexer_next_token (context_p);
- if ((context_p->status_flags & PARSER_IS_PROPERTY_GETTER)
- && context_p->argument_count != 0)
+ if ((context_p->status_flags & PARSER_IS_PROPERTY_GETTER) && context_p->argument_count != 0)
{
parser_raise_error (context_p, PARSER_ERR_NO_ARGUMENTS_EXPECTED);
}
- if ((context_p->status_flags & PARSER_IS_PROPERTY_SETTER)
- && context_p->argument_count != 1)
+ if ((context_p->status_flags & PARSER_IS_PROPERTY_SETTER) && context_p->argument_count != 1)
{
parser_raise_error (context_p, PARSER_ERR_ONE_ARGUMENT_EXPECTED);
}
@@ -2623,8 +2589,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
#endif /* JERRY_ESNEXT */
#if JERRY_PARSER_DUMP_BYTE_CODE
- if (context_p->is_show_opcodes
- && (context_p->status_flags & PARSER_HAS_NON_STRICT_ARG))
+ if (context_p->is_show_opcodes && (context_p->status_flags & PARSER_HAS_NON_STRICT_ARG))
{
JERRY_DEBUG_MSG (" Note: legacy (non-strict) argument definition\n\n");
}
@@ -2644,8 +2609,7 @@ parser_parse_function (parser_context_t *context_p, /**< context */
{
#if JERRY_ESNEXT
JERRY_DEBUG_MSG ("\n--- %s parsing end ---\n\n",
- (context_p->status_flags & PARSER_CLASS_CONSTRUCTOR) ? "Class constructor"
- : "Function");
+ (context_p->status_flags & PARSER_CLASS_CONSTRUCTOR) ? "Class constructor" : "Function");
#else /* !JERRY_ESNEXT */
JERRY_DEBUG_MSG ("\n--- Function parsing end ---\n\n");
#endif /* JERRY_ESNEXT */
@@ -2675,9 +2639,8 @@ parser_parse_arrow_function (parser_context_t *context_p, /**< context */
JERRY_ASSERT (status_flags & PARSER_IS_ARROW_FUNCTION);
parser_save_context (context_p, &saved_context);
context_p->status_flags |= status_flags;
- context_p->status_flags |= saved_context.status_flags & (PARSER_ALLOW_NEW_TARGET
- | PARSER_ALLOW_SUPER
- | PARSER_ALLOW_SUPER_CALL);
+ context_p->status_flags |=
+ saved_context.status_flags & (PARSER_ALLOW_NEW_TARGET | PARSER_ALLOW_SUPER | PARSER_ALLOW_SUPER_CALL);
#if JERRY_PARSER_DUMP_BYTE_CODE
if (context_p->is_show_opcodes)
@@ -2721,8 +2684,7 @@ parser_parse_arrow_function (parser_context_t *context_p, /**< context */
}
else
{
- if (context_p->status_flags & PARSER_IS_STRICT
- && context_p->status_flags & PARSER_HAS_NON_STRICT_ARG)
+ if (context_p->status_flags & PARSER_IS_STRICT && context_p->status_flags & PARSER_HAS_NON_STRICT_ARG)
{
parser_raise_error (context_p, PARSER_ERR_NON_STRICT_ARG_DEFINITION);
}
@@ -2774,11 +2736,8 @@ parser_parse_class_fields (parser_context_t *context_p) /**< context */
uint32_t extra_status_flags = context_p->status_flags & PARSER_INSIDE_WITH;
parser_save_context (context_p, &saved_context);
- context_p->status_flags |= (PARSER_IS_FUNCTION
- | PARSER_ALLOW_SUPER
- | PARSER_INSIDE_CLASS_FIELD
- | PARSER_ALLOW_NEW_TARGET
- | extra_status_flags);
+ context_p->status_flags |= (PARSER_IS_FUNCTION | PARSER_ALLOW_SUPER | PARSER_INSIDE_CLASS_FIELD
+ | PARSER_ALLOW_NEW_TARGET | extra_status_flags);
#if JERRY_PARSER_DUMP_BYTE_CODE
if (context_p->is_show_opcodes)
@@ -2804,7 +2763,7 @@ parser_parse_class_fields (parser_context_t *context_p) /**< context */
uint8_t class_field_type = context_p->stack_top_uint8;
parser_stack_pop_uint8 (context_p);
- scanner_range_t range = {0};
+ scanner_range_t range = { 0 };
if (class_field_type & PARSER_CLASS_FIELD_INITIALIZED)
{
@@ -2893,8 +2852,7 @@ parser_parse_class_fields (parser_context_t *context_p) /**< context */
parser_emit_cbc_ext (context_p, CBC_EXT_SET_NEXT_COMPUTED_FIELD);
}
- }
- while (!(context_p->stack_top_uint8 & PARSER_CLASS_FIELD_END));
+ } while (!(context_p->stack_top_uint8 & PARSER_CLASS_FIELD_END));
if (!first_computed_class_field)
{
@@ -2968,8 +2926,8 @@ parser_check_anonymous_function_declaration (parser_context_t *context_p) /**< c
const ecma_compiled_code_t *bytecode_p;
bytecode_p = (const ecma_compiled_code_t *) (PARSER_GET_LITERAL (literal_index)->u.bytecode_p);
- bool is_anon = ecma_is_value_magic_string (*ecma_compiled_code_resolve_function_name (bytecode_p),
- LIT_MAGIC_STRING__EMPTY);
+ bool is_anon =
+ ecma_is_value_magic_string (*ecma_compiled_code_resolve_function_name (bytecode_p), LIT_MAGIC_STRING__EMPTY);
return (is_anon ? literal_index : PARSER_NAMED_FUNCTION);
} /* parser_check_anonymous_function_declaration */
@@ -3015,8 +2973,7 @@ parser_compiled_code_set_function_name (parser_context_t *context_p, /**< contex
{
scope_stack_p--;
- if (scope_stack_p->map_from != PARSER_SCOPE_STACK_FUNC
- && scanner_decode_map_to (scope_stack_p) == name_index)
+ if (scope_stack_p->map_from != PARSER_SCOPE_STACK_FUNC && scanner_decode_map_to (scope_stack_p) == name_index)
{
name_index = scope_stack_p->map_from;
break;
@@ -3042,9 +2999,8 @@ parser_compiled_code_set_function_name (parser_context_t *context_p, /**< contex
memcpy (name_buffer_p + 4, name_lit_p->u.char_p, name_lit_p->prop.length);
}
- *func_name_start_p = ecma_find_or_create_literal_string (name_buffer_p,
- name_length,
- (status_flags & LEXER_FLAG_ASCII) != 0);
+ *func_name_start_p =
+ ecma_find_or_create_literal_string (name_buffer_p, name_length, (status_flags & LEXER_FLAG_ASCII) != 0);
if (name_buffer_p != name_lit_p->u.char_p)
{
@@ -3092,8 +3048,8 @@ parser_raise_error (parser_context_t *context_p, /**< context */
#if JERRY_ESNEXT
if (saved_context_p->tagged_template_literal_cp != JMEM_CP_NULL)
{
- ecma_collection_t *collection = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- saved_context_p->tagged_template_literal_cp);
+ ecma_collection_t *collection =
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, saved_context_p->tagged_template_literal_cp);
ecma_collection_free_template_literal (collection);
}
#endif /* JERRY_ESNEXT */
@@ -3108,8 +3064,8 @@ parser_raise_error (parser_context_t *context_p, /**< context */
#if JERRY_ESNEXT
if (context_p->tagged_template_literal_cp != JMEM_CP_NULL)
{
- ecma_collection_t *collection = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t,
- context_p->tagged_template_literal_cp);
+ ecma_collection_t *collection =
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_collection_t, context_p->tagged_template_literal_cp);
ecma_collection_free_template_literal (collection);
}
#endif /* JERRY_ESNEXT */
@@ -3138,9 +3094,7 @@ parser_parse_script (void *source_p, /**< source code */
const jerry_parse_options_t *options_p) /**< additional configuration options */
{
#if JERRY_PARSER
- ecma_compiled_code_t *bytecode_p = parser_parse_source (source_p,
- parse_opts,
- options_p);
+ ecma_compiled_code_t *bytecode_p = parser_parse_source (source_p, parse_opts, options_p);
if (JERRY_UNLIKELY (bytecode_p == NULL))
{
diff --git a/jerry-core/parser/js/js-parser.h b/jerry-core/parser/js/js-parser.h
index 0972b841..6274cb5f 100644
--- a/jerry-core/parser/js/js-parser.h
+++ b/jerry-core/parser/js/js-parser.h
@@ -33,179 +33,164 @@
*/
typedef enum
{
- PARSER_ERR_NO_ERROR, /**< no error */
+ PARSER_ERR_NO_ERROR, /**< no error */
- PARSER_ERR_OUT_OF_MEMORY, /**< out of memory */
- PARSER_ERR_LITERAL_LIMIT_REACHED, /**< maximum number of literals reached */
- PARSER_ERR_SCOPE_STACK_LIMIT_REACHED, /**< maximum depth of scope stack reached */
- PARSER_ERR_ARGUMENT_LIMIT_REACHED, /**< maximum number of function arguments reached */
- PARSER_ERR_STACK_LIMIT_REACHED, /**< maximum function stack size reached */
+ PARSER_ERR_OUT_OF_MEMORY, /**< out of memory */
+ PARSER_ERR_LITERAL_LIMIT_REACHED, /**< maximum number of literals reached */
+ PARSER_ERR_SCOPE_STACK_LIMIT_REACHED, /**< maximum depth of scope stack reached */
+ PARSER_ERR_ARGUMENT_LIMIT_REACHED, /**< maximum number of function arguments reached */
+ PARSER_ERR_STACK_LIMIT_REACHED, /**< maximum function stack size reached */
- PARSER_ERR_INVALID_CHARACTER, /**< unexpected character */
- PARSER_ERR_INVALID_OCTAL_DIGIT, /**< invalid octal digit */
- PARSER_ERR_INVALID_HEX_DIGIT, /**< invalid hexadecimal digit */
+ PARSER_ERR_INVALID_CHARACTER, /**< unexpected character */
+ PARSER_ERR_INVALID_OCTAL_DIGIT, /**< invalid octal digit */
+ PARSER_ERR_INVALID_HEX_DIGIT, /**< invalid hexadecimal digit */
#if JERRY_ESNEXT
- PARSER_ERR_INVALID_BIN_DIGIT, /**< invalid binary digit */
+ PARSER_ERR_INVALID_BIN_DIGIT, /**< invalid binary digit */
#endif /* JERRY_ESNEXT */
- PARSER_ERR_INVALID_ESCAPE_SEQUENCE, /**< invalid escape sequence */
- PARSER_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE, /**< invalid unicode escape sequence */
- PARSER_ERR_INVALID_IDENTIFIER_START, /**< character cannot be start of an identifier */
- PARSER_ERR_INVALID_IDENTIFIER_PART, /**< character cannot be part of an identifier */
- PARSER_ERR_INVALID_KEYWORD, /**< escape sequences are not allowed in keywords */
-
- PARSER_ERR_INVALID_NUMBER, /**< invalid number literal */
- PARSER_ERR_MISSING_EXPONENT, /**< missing exponent */
- PARSER_ERR_IDENTIFIER_AFTER_NUMBER, /**< identifier start after number */
- PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER, /**< invalid use of underscore in number */
+ PARSER_ERR_INVALID_ESCAPE_SEQUENCE, /**< invalid escape sequence */
+ PARSER_ERR_INVALID_UNICODE_ESCAPE_SEQUENCE, /**< invalid unicode escape sequence */
+ PARSER_ERR_INVALID_IDENTIFIER_START, /**< character cannot be start of an identifier */
+ PARSER_ERR_INVALID_IDENTIFIER_PART, /**< character cannot be part of an identifier */
+ PARSER_ERR_INVALID_KEYWORD, /**< escape sequences are not allowed in keywords */
+
+ PARSER_ERR_INVALID_NUMBER, /**< invalid number literal */
+ PARSER_ERR_MISSING_EXPONENT, /**< missing exponent */
+ PARSER_ERR_IDENTIFIER_AFTER_NUMBER, /**< identifier start after number */
+ PARSER_ERR_INVALID_UNDERSCORE_IN_NUMBER, /**< invalid use of underscore in number */
#if JERRY_BUILTIN_BIGINT
- PARSER_ERR_INVALID_BIGINT, /**< number is not a valid BigInt */
+ PARSER_ERR_INVALID_BIGINT, /**< number is not a valid BigInt */
#endif /* JERRY_BUILTIN_BIGINT */
- PARSER_ERR_INVALID_REGEXP, /**< invalid regular expression */
- PARSER_ERR_UNKNOWN_REGEXP_FLAG, /**< unknown regexp flag */
- PARSER_ERR_DUPLICATED_REGEXP_FLAG, /**< duplicated regexp flag */
- PARSER_ERR_UNSUPPORTED_REGEXP, /**< regular expression is not supported */
+ PARSER_ERR_INVALID_REGEXP, /**< invalid regular expression */
+ PARSER_ERR_UNKNOWN_REGEXP_FLAG, /**< unknown regexp flag */
+ PARSER_ERR_DUPLICATED_REGEXP_FLAG, /**< duplicated regexp flag */
+ PARSER_ERR_UNSUPPORTED_REGEXP, /**< regular expression is not supported */
- PARSER_ERR_IDENTIFIER_TOO_LONG, /**< too long identifier */
- PARSER_ERR_STRING_TOO_LONG, /**< too long string literal */
- PARSER_ERR_NUMBER_TOO_LONG, /**< too long number literal */
- PARSER_ERR_REGEXP_TOO_LONG, /**< too long regexp literal */
+ PARSER_ERR_IDENTIFIER_TOO_LONG, /**< too long identifier */
+ PARSER_ERR_STRING_TOO_LONG, /**< too long string literal */
+ PARSER_ERR_NUMBER_TOO_LONG, /**< too long number literal */
+ PARSER_ERR_REGEXP_TOO_LONG, /**< too long regexp literal */
- PARSER_ERR_UNTERMINATED_MULTILINE_COMMENT, /**< unterminated multiline comment */
- PARSER_ERR_UNTERMINATED_STRING, /**< unterminated string literal */
- PARSER_ERR_UNTERMINATED_REGEXP, /**< unterminated regexp literal */
+ PARSER_ERR_UNTERMINATED_MULTILINE_COMMENT, /**< unterminated multiline comment */
+ PARSER_ERR_UNTERMINATED_STRING, /**< unterminated string literal */
+ PARSER_ERR_UNTERMINATED_REGEXP, /**< unterminated regexp literal */
- PARSER_ERR_NEWLINE_NOT_ALLOWED, /**< newline is not allowed */
- PARSER_ERR_OCTAL_NUMBER_NOT_ALLOWED, /**< octal numbers are not allowed in strict mode */
- PARSER_ERR_OCTAL_ESCAPE_NOT_ALLOWED, /**< octal escape sequences are not allowed in strict mode */
+ PARSER_ERR_NEWLINE_NOT_ALLOWED, /**< newline is not allowed */
+ PARSER_ERR_OCTAL_NUMBER_NOT_ALLOWED, /**< octal numbers are not allowed in strict mode */
+ PARSER_ERR_OCTAL_ESCAPE_NOT_ALLOWED, /**< octal escape sequences are not allowed in strict mode */
#if JERRY_ESNEXT
- PARSER_ERR_TEMPLATE_STR_OCTAL_ESCAPE, /**< octal escape sequences are not allowed in template strings */
+ PARSER_ERR_TEMPLATE_STR_OCTAL_ESCAPE, /**< octal escape sequences are not allowed in template strings */
#endif /* JERRY_ESNEXT */
- PARSER_ERR_STRICT_IDENT_NOT_ALLOWED, /**< identifier name is reserved in strict mode */
- PARSER_ERR_EVAL_NOT_ALLOWED, /**< eval is not allowed here in strict mode */
- PARSER_ERR_ARGUMENTS_NOT_ALLOWED, /**< arguments is not allowed here in strict mode */
+ PARSER_ERR_STRICT_IDENT_NOT_ALLOWED, /**< identifier name is reserved in strict mode */
+ PARSER_ERR_EVAL_NOT_ALLOWED, /**< eval is not allowed here in strict mode */
+ PARSER_ERR_ARGUMENTS_NOT_ALLOWED, /**< arguments is not allowed here in strict mode */
#if JERRY_ESNEXT
- PARSER_ERR_USE_STRICT_NOT_ALLOWED, /**< use strict directive is not allowed */
- PARSER_ERR_YIELD_NOT_ALLOWED, /**< yield expression is not allowed */
- PARSER_ERR_AWAIT_NOT_ALLOWED, /**< await expression is not allowed */
- PARSER_ERR_FOR_IN_OF_DECLARATION, /**< variable declaration in for-in or for-of loop */
- PARSER_ERR_FOR_AWAIT_NO_ASYNC, /**< for-await-of is only allowed inside async functions */
- PARSER_ERR_FOR_AWAIT_NO_OF, /**< only 'of' form is allowed for for-await loops */
- PARSER_ERR_DUPLICATED_PROTO, /**< duplicated __proto__ fields are not allowed */
- PARSER_ERR_INVALID_LHS_ASSIGNMENT, /**< invalid LeftHandSide in assignment */
- PARSER_ERR_INVALID_LHS_POSTFIX_OP, /**< invalid LeftHandSide expression in postfix operation */
- PARSER_ERR_INVALID_LHS_PREFIX_OP, /**< invalid LeftHandSide expression in prefix operation */
- PARSER_ERR_INVALID_LHS_FOR_LOOP, /**< invalid LeftHandSide in for-loop */
+ PARSER_ERR_USE_STRICT_NOT_ALLOWED, /**< use strict directive is not allowed */
+ PARSER_ERR_YIELD_NOT_ALLOWED, /**< yield expression is not allowed */
+ PARSER_ERR_AWAIT_NOT_ALLOWED, /**< await expression is not allowed */
+ PARSER_ERR_FOR_IN_OF_DECLARATION, /**< variable declaration in for-in or for-of loop */
+ PARSER_ERR_FOR_AWAIT_NO_ASYNC, /**< for-await-of is only allowed inside async functions */
+ PARSER_ERR_FOR_AWAIT_NO_OF, /**< only 'of' form is allowed for for-await loops */
+ PARSER_ERR_DUPLICATED_PROTO, /**< duplicated __proto__ fields are not allowed */
+ PARSER_ERR_INVALID_LHS_ASSIGNMENT, /**< invalid LeftHandSide in assignment */
+ PARSER_ERR_INVALID_LHS_POSTFIX_OP, /**< invalid LeftHandSide expression in postfix operation */
+ PARSER_ERR_INVALID_LHS_PREFIX_OP, /**< invalid LeftHandSide expression in prefix operation */
+ PARSER_ERR_INVALID_LHS_FOR_LOOP, /**< invalid LeftHandSide in for-loop */
#endif /* JERRY_ESNEXT */
- PARSER_ERR_DELETE_IDENT_NOT_ALLOWED, /**< identifier delete is not allowed in strict mode */
- PARSER_ERR_EVAL_CANNOT_ASSIGNED, /**< eval cannot be assigned in strict mode */
- PARSER_ERR_ARGUMENTS_CANNOT_ASSIGNED, /**< arguments cannot be assigned in strict mode */
- PARSER_ERR_WITH_NOT_ALLOWED, /**< with statement is not allowed in strict mode */
- PARSER_ERR_MULTIPLE_DEFAULTS_NOT_ALLOWED, /**< multiple default cases are not allowed */
- PARSER_ERR_DEFAULT_NOT_IN_SWITCH, /**< default statement is not in switch block */
- PARSER_ERR_CASE_NOT_IN_SWITCH, /**< case statement is not in switch block */
-
- PARSER_ERR_LEFT_PAREN_EXPECTED, /**< left paren expected */
- PARSER_ERR_LEFT_BRACE_EXPECTED, /**< left brace expected */
- PARSER_ERR_RIGHT_PAREN_EXPECTED, /**< right paren expected */
- PARSER_ERR_RIGHT_SQUARE_EXPECTED, /**< right square expected */
-
- PARSER_ERR_UNEXPECTED_END, /**< unexpected end of input */
- PARSER_ERR_COLON_EXPECTED, /**< colon expected */
- PARSER_ERR_COLON_FOR_CONDITIONAL_EXPECTED, /**< colon expected for conditional expression */
- PARSER_ERR_SEMICOLON_EXPECTED, /**< semicolon expected */
- PARSER_ERR_IN_EXPECTED, /**< in keyword expected */
- PARSER_ERR_WHILE_EXPECTED, /**< while expected for do-while loop */
- PARSER_ERR_CATCH_FINALLY_EXPECTED, /**< catch or finally expected */
- PARSER_ERR_ARRAY_ITEM_SEPARATOR_EXPECTED, /**< array item separator expected */
- PARSER_ERR_OBJECT_ITEM_SEPARATOR_EXPECTED, /**< object item separator expected */
- PARSER_ERR_IDENTIFIER_EXPECTED, /**< identifier expected */
- PARSER_ERR_EXPRESSION_EXPECTED, /**< expression expected */
- PARSER_ERR_LEFT_HAND_SIDE_EXP_EXPECTED, /**< left-hand-side expression expected */
- PARSER_ERR_STATEMENT_EXPECTED, /**< statement expected */
- PARSER_ERR_PROPERTY_IDENTIFIER_EXPECTED, /**< property identifier expected */
- PARSER_ERR_ARGUMENT_LIST_EXPECTED, /**< argument list expected */
- PARSER_ERR_NO_ARGUMENTS_EXPECTED, /**< property getters must have no arguments */
- PARSER_ERR_ONE_ARGUMENT_EXPECTED, /**< property setters must have one argument */
-
- PARSER_ERR_INVALID_EXPRESSION, /**< invalid expression */
- PARSER_ERR_INVALID_SWITCH, /**< invalid switch body */
- PARSER_ERR_INVALID_BREAK, /**< break must be inside a loop or switch */
- PARSER_ERR_INVALID_BREAK_LABEL, /**< break target not found */
- PARSER_ERR_INVALID_CONTINUE, /**< continue must be inside a loop */
- PARSER_ERR_INVALID_CONTINUE_LABEL, /**< continue target not found */
- PARSER_ERR_INVALID_RETURN, /**< return must be inside a function */
- PARSER_ERR_INVALID_RIGHT_SQUARE, /**< right square must terminate a block */
- PARSER_ERR_DUPLICATED_LABEL, /**< duplicated label */
- PARSER_ERR_OBJECT_PROPERTY_REDEFINED, /**< property of object literal redefined */
+ PARSER_ERR_DELETE_IDENT_NOT_ALLOWED, /**< identifier delete is not allowed in strict mode */
+ PARSER_ERR_EVAL_CANNOT_ASSIGNED, /**< eval cannot be assigned in strict mode */
+ PARSER_ERR_ARGUMENTS_CANNOT_ASSIGNED, /**< arguments cannot be assigned in strict mode */
+ PARSER_ERR_WITH_NOT_ALLOWED, /**< with statement is not allowed in strict mode */
+ PARSER_ERR_MULTIPLE_DEFAULTS_NOT_ALLOWED, /**< multiple default cases are not allowed */
+ PARSER_ERR_DEFAULT_NOT_IN_SWITCH, /**< default statement is not in switch block */
+ PARSER_ERR_CASE_NOT_IN_SWITCH, /**< case statement is not in switch block */
+
+ PARSER_ERR_LEFT_PAREN_EXPECTED, /**< left paren expected */
+ PARSER_ERR_LEFT_BRACE_EXPECTED, /**< left brace expected */
+ PARSER_ERR_RIGHT_PAREN_EXPECTED, /**< right paren expected */
+ PARSER_ERR_RIGHT_SQUARE_EXPECTED, /**< right square expected */
+
+ PARSER_ERR_UNEXPECTED_END, /**< unexpected end of input */
+ PARSER_ERR_COLON_EXPECTED, /**< colon expected */
+ PARSER_ERR_COLON_FOR_CONDITIONAL_EXPECTED, /**< colon expected for conditional expression */
+ PARSER_ERR_SEMICOLON_EXPECTED, /**< semicolon expected */
+ PARSER_ERR_IN_EXPECTED, /**< in keyword expected */
+ PARSER_ERR_WHILE_EXPECTED, /**< while expected for do-while loop */
+ PARSER_ERR_CATCH_FINALLY_EXPECTED, /**< catch or finally expected */
+ PARSER_ERR_ARRAY_ITEM_SEPARATOR_EXPECTED, /**< array item separator expected */
+ PARSER_ERR_OBJECT_ITEM_SEPARATOR_EXPECTED, /**< object item separator expected */
+ PARSER_ERR_IDENTIFIER_EXPECTED, /**< identifier expected */
+ PARSER_ERR_EXPRESSION_EXPECTED, /**< expression expected */
+ PARSER_ERR_LEFT_HAND_SIDE_EXP_EXPECTED, /**< left-hand-side expression expected */
+ PARSER_ERR_STATEMENT_EXPECTED, /**< statement expected */
+ PARSER_ERR_PROPERTY_IDENTIFIER_EXPECTED, /**< property identifier expected */
+ PARSER_ERR_ARGUMENT_LIST_EXPECTED, /**< argument list expected */
+ PARSER_ERR_NO_ARGUMENTS_EXPECTED, /**< property getters must have no arguments */
+ PARSER_ERR_ONE_ARGUMENT_EXPECTED, /**< property setters must have one argument */
+
+ PARSER_ERR_INVALID_EXPRESSION, /**< invalid expression */
+ PARSER_ERR_INVALID_SWITCH, /**< invalid switch body */
+ PARSER_ERR_INVALID_BREAK, /**< break must be inside a loop or switch */
+ PARSER_ERR_INVALID_BREAK_LABEL, /**< break target not found */
+ PARSER_ERR_INVALID_CONTINUE, /**< continue must be inside a loop */
+ PARSER_ERR_INVALID_CONTINUE_LABEL, /**< continue target not found */
+ PARSER_ERR_INVALID_RETURN, /**< return must be inside a function */
+ PARSER_ERR_INVALID_RIGHT_SQUARE, /**< right square must terminate a block */
+ PARSER_ERR_DUPLICATED_LABEL, /**< duplicated label */
+ PARSER_ERR_OBJECT_PROPERTY_REDEFINED, /**< property of object literal redefined */
#if JERRY_ESNEXT
- PARSER_ERR_VARIABLE_REDECLARED, /**< a variable redeclared */
- PARSER_ERR_LEXICAL_SINGLE_STATEMENT, /**< lexical declaration in single statement context */
- PARSER_ERR_LABELLED_FUNC_NOT_IN_BLOCK, /**< labelled functions are only allowed inside blocks */
- PARSER_ERR_LEXICAL_LET_BINDING, /**< let binding cannot be declared in let/const */
- PARSER_ERR_MISSING_ASSIGN_AFTER_CONST, /**< an assignment is required after a const declaration */
-
- PARSER_ERR_MULTIPLE_CLASS_CONSTRUCTORS, /**< multiple class constructor */
- PARSER_ERR_CLASS_CONSTRUCTOR_AS_ACCESSOR, /**< class constructor cannot be an accessor */
- PARSER_ERR_INVALID_CLASS_CONSTRUCTOR, /**< class constructor cannot be a generator or async function */
- PARSER_ERR_CLASS_STATIC_PROTOTYPE, /**< static method name 'prototype' is not allowed */
- PARSER_ERR_UNEXPECTED_SUPER_KEYWORD, /**< unexpected super keyword */
- PARSER_ERR_TOO_MANY_CLASS_FIELDS, /**< too many computed class fields */
- PARSER_ERR_ARGUMENTS_IN_CLASS_FIELD, /**< arguments is not allowed in class fields */
-
- PARSER_ERR_RIGHT_BRACE_EXPECTED, /**< right brace expected */
- PARSER_ERR_OF_EXPECTED, /**< of keyword expected */
-
- PARSER_ERR_ASSIGNMENT_EXPECTED, /**< assignment expression expected */
- PARSER_ERR_FORMAL_PARAM_AFTER_REST_PARAMETER, /**< formal parameter after rest parameter */
- PARSER_ERR_SETTER_REST_PARAMETER, /**< setter rest parameter */
- PARSER_ERR_REST_PARAMETER_DEFAULT_INITIALIZER, /**< rest parameter default initializer */
- PARSER_ERR_DUPLICATED_ARGUMENT_NAMES, /**< duplicated argument names */
- PARSER_ERR_INVALID_DESTRUCTURING_PATTERN, /**< invalid destructuring pattern */
- PARSER_ERR_ILLEGAL_PROPERTY_IN_DECLARATION, /**< illegal property in declaration context */
- PARSER_ERR_INVALID_EXPONENTIATION, /**< left operand of ** operator cannot be unary expression */
- PARSER_ERR_INVALID_NULLISH_COALESCING, /**< Cannot chain nullish with logical AND or OR. */
- PARSER_ERR_NEW_TARGET_EXPECTED, /**< expected new.target expression */
- PARSER_ERR_NEW_TARGET_NOT_ALLOWED, /**< new.target is not allowed in the given context */
+ PARSER_ERR_VARIABLE_REDECLARED, /**< a variable redeclared */
+ PARSER_ERR_LEXICAL_SINGLE_STATEMENT, /**< lexical declaration in single statement context */
+ PARSER_ERR_LABELLED_FUNC_NOT_IN_BLOCK, /**< labelled functions are only allowed inside blocks */
+ PARSER_ERR_LEXICAL_LET_BINDING, /**< let binding cannot be declared in let/const */
+ PARSER_ERR_MISSING_ASSIGN_AFTER_CONST, /**< an assignment is required after a const declaration */
+
+ PARSER_ERR_MULTIPLE_CLASS_CONSTRUCTORS, /**< multiple class constructor */
+ PARSER_ERR_CLASS_CONSTRUCTOR_AS_ACCESSOR, /**< class constructor cannot be an accessor */
+ PARSER_ERR_INVALID_CLASS_CONSTRUCTOR, /**< class constructor cannot be a generator or async function */
+ PARSER_ERR_CLASS_STATIC_PROTOTYPE, /**< static method name 'prototype' is not allowed */
+ PARSER_ERR_UNEXPECTED_SUPER_KEYWORD, /**< unexpected super keyword */
+ PARSER_ERR_TOO_MANY_CLASS_FIELDS, /**< too many computed class fields */
+ PARSER_ERR_ARGUMENTS_IN_CLASS_FIELD, /**< arguments is not allowed in class fields */
+
+ PARSER_ERR_RIGHT_BRACE_EXPECTED, /**< right brace expected */
+ PARSER_ERR_OF_EXPECTED, /**< of keyword expected */
+
+ PARSER_ERR_ASSIGNMENT_EXPECTED, /**< assignment expression expected */
+ PARSER_ERR_FORMAL_PARAM_AFTER_REST_PARAMETER, /**< formal parameter after rest parameter */
+ PARSER_ERR_SETTER_REST_PARAMETER, /**< setter rest parameter */
+ PARSER_ERR_REST_PARAMETER_DEFAULT_INITIALIZER, /**< rest parameter default initializer */
+ PARSER_ERR_DUPLICATED_ARGUMENT_NAMES, /**< duplicated argument names */
+ PARSER_ERR_INVALID_DESTRUCTURING_PATTERN, /**< invalid destructuring pattern */
+ PARSER_ERR_ILLEGAL_PROPERTY_IN_DECLARATION, /**< illegal property in declaration context */
+ PARSER_ERR_INVALID_EXPONENTIATION, /**< left operand of ** operator cannot be unary expression */
+ PARSER_ERR_INVALID_NULLISH_COALESCING, /**< Cannot chain nullish with logical AND or OR. */
+ PARSER_ERR_NEW_TARGET_EXPECTED, /**< expected new.target expression */
+ PARSER_ERR_NEW_TARGET_NOT_ALLOWED, /**< new.target is not allowed in the given context */
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
- PARSER_ERR_FILE_NOT_FOUND, /**< file not found*/
- PARSER_ERR_FROM_EXPECTED, /**< from expected */
- PARSER_ERR_FROM_COMMA_EXPECTED, /**< from or comma expected */
- PARSER_ERR_AS_EXPECTED, /**< as expected */
- PARSER_ERR_STRING_EXPECTED, /**< string literal expected */
- PARSER_ERR_MODULE_UNEXPECTED, /**< unexpected import or export statement */
- PARSER_ERR_LEFT_BRACE_MULTIPLY_LITERAL_EXPECTED, /**< left brace or multiply or literal expected */
- PARSER_ERR_LEFT_BRACE_MULTIPLY_EXPECTED, /**< left brace or multiply expected */
- PARSER_ERR_RIGHT_BRACE_COMMA_EXPECTED, /**< right brace or comma expected */
- PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER, /**< duplicated export identifier name */
- PARSER_ERR_DUPLICATED_IMPORT_BINDING, /**< duplicated import binding name */
- PARSER_ERR_EXPORT_NOT_DEFINED, /**< export is not defined in module */
- PARSER_ERR_IMPORT_AFTER_NEW, /**< module import call is not allowed after new */
- PARSER_ERR_META_EXPECTED, /**< meta keyword expected */
- PARSER_ERR_IMPORT_META_REQUIRE_MODULE, /**< cannot use 'import.meta' outside a module */
+ PARSER_ERR_FILE_NOT_FOUND, /**< file not found*/
+ PARSER_ERR_FROM_EXPECTED, /**< from expected */
+ PARSER_ERR_FROM_COMMA_EXPECTED, /**< from or comma expected */
+ PARSER_ERR_AS_EXPECTED, /**< as expected */
+ PARSER_ERR_STRING_EXPECTED, /**< string literal expected */
+ PARSER_ERR_MODULE_UNEXPECTED, /**< unexpected import or export statement */
+ PARSER_ERR_LEFT_BRACE_MULTIPLY_LITERAL_EXPECTED, /**< left brace or multiply or literal expected */
+ PARSER_ERR_LEFT_BRACE_MULTIPLY_EXPECTED, /**< left brace or multiply expected */
+ PARSER_ERR_RIGHT_BRACE_COMMA_EXPECTED, /**< right brace or comma expected */
+ PARSER_ERR_DUPLICATED_EXPORT_IDENTIFIER, /**< duplicated export identifier name */
+ PARSER_ERR_DUPLICATED_IMPORT_BINDING, /**< duplicated import binding name */
+ PARSER_ERR_EXPORT_NOT_DEFINED, /**< export is not defined in module */
+ PARSER_ERR_IMPORT_AFTER_NEW, /**< module import call is not allowed after new */
+ PARSER_ERR_META_EXPECTED, /**< meta keyword expected */
+ PARSER_ERR_IMPORT_META_REQUIRE_MODULE, /**< cannot use 'import.meta' outside a module */
#endif /* JERRY_MODULE_SYSTEM */
- PARSER_ERR_NON_STRICT_ARG_DEFINITION /**< non-strict argument definition */
+ PARSER_ERR_NON_STRICT_ARG_DEFINITION /**< non-strict argument definition */
} parser_error_t;
-/**
- * Source code line counter type.
- */
-typedef uint32_t parser_line_counter_t;
-
-/**
- * Source code as character data.
- */
-typedef struct
-{
- const uint8_t *source_p; /**< valid UTF-8 source code */
- size_t source_size; /**< size of the source code */
-} parser_source_char_t;
-
/* Note: source must be a valid UTF-8 string */
-ecma_compiled_code_t *
-parser_parse_script (void *source_p, uint32_t parse_opts, const jerry_parse_options_t *options_p);
+ecma_compiled_code_t *parser_parse_script (void *source_p, uint32_t parse_opts, const jerry_parse_options_t *options_p);
#if JERRY_ERROR_MESSAGES
const char *parser_error_to_string (parser_error_t);
diff --git a/jerry-core/parser/js/js-scanner-internal.h b/jerry-core/parser/js/js-scanner-internal.h
index ba488857..d4117fbe 100644
--- a/jerry-core/parser/js/js-scanner-internal.h
+++ b/jerry-core/parser/js/js-scanner-internal.h
@@ -31,22 +31,22 @@
*/
typedef enum
{
- SCAN_MODE_PRIMARY_EXPRESSION, /**< scanning primary expression */
- SCAN_MODE_PRIMARY_EXPRESSION_AFTER_NEW, /**< scanning primary expression after new */
- SCAN_MODE_POST_PRIMARY_EXPRESSION, /**< scanning post primary expression */
- SCAN_MODE_PRIMARY_EXPRESSION_END, /**< scanning primary expression end */
- SCAN_MODE_STATEMENT, /**< scanning statement */
- SCAN_MODE_STATEMENT_OR_TERMINATOR, /**< scanning statement or statement end */
- SCAN_MODE_STATEMENT_END, /**< scanning statement end */
- SCAN_MODE_VAR_STATEMENT, /**< scanning var statement */
- SCAN_MODE_PROPERTY_NAME, /**< scanning property name */
- SCAN_MODE_FUNCTION_ARGUMENTS, /**< scanning function arguments */
+ SCAN_MODE_PRIMARY_EXPRESSION, /**< scanning primary expression */
+ SCAN_MODE_PRIMARY_EXPRESSION_AFTER_NEW, /**< scanning primary expression after new */
+ SCAN_MODE_POST_PRIMARY_EXPRESSION, /**< scanning post primary expression */
+ SCAN_MODE_PRIMARY_EXPRESSION_END, /**< scanning primary expression end */
+ SCAN_MODE_STATEMENT, /**< scanning statement */
+ SCAN_MODE_STATEMENT_OR_TERMINATOR, /**< scanning statement or statement end */
+ SCAN_MODE_STATEMENT_END, /**< scanning statement end */
+ SCAN_MODE_VAR_STATEMENT, /**< scanning var statement */
+ SCAN_MODE_PROPERTY_NAME, /**< scanning property name */
+ SCAN_MODE_FUNCTION_ARGUMENTS, /**< scanning function arguments */
#if JERRY_ESNEXT
- SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS, /**< continue scanning function arguments */
- SCAN_MODE_BINDING, /**< array or object binding */
- SCAN_MODE_CLASS_DECLARATION, /**< scanning class declaration */
- SCAN_MODE_CLASS_BODY, /**< scanning class body */
- SCAN_MODE_CLASS_BODY_NO_SCAN, /**< scanning class body without calling lexer_scan_identifier */
+ SCAN_MODE_CONTINUE_FUNCTION_ARGUMENTS, /**< continue scanning function arguments */
+ SCAN_MODE_BINDING, /**< array or object binding */
+ SCAN_MODE_CLASS_DECLARATION, /**< scanning class declaration */
+ SCAN_MODE_CLASS_BODY, /**< scanning class body */
+ SCAN_MODE_CLASS_BODY_NO_SCAN, /**< scanning class body without calling lexer_scan_identifier */
#endif /* JERRY_ESNEXT */
} scan_modes_t;
@@ -55,72 +55,72 @@ typedef enum
*/
typedef enum
{
- SCAN_STACK_SCRIPT, /**< script */
- SCAN_STACK_SCRIPT_FUNCTION, /**< script is a function body */
- SCAN_STACK_BLOCK_STATEMENT, /**< block statement group */
- SCAN_STACK_FUNCTION_STATEMENT, /**< function statement */
- SCAN_STACK_FUNCTION_EXPRESSION, /**< function expression */
- SCAN_STACK_FUNCTION_PROPERTY, /**< function expression in an object literal */
+ SCAN_STACK_SCRIPT, /**< script */
+ SCAN_STACK_SCRIPT_FUNCTION, /**< script is a function body */
+ SCAN_STACK_BLOCK_STATEMENT, /**< block statement group */
+ SCAN_STACK_FUNCTION_STATEMENT, /**< function statement */
+ SCAN_STACK_FUNCTION_EXPRESSION, /**< function expression */
+ SCAN_STACK_FUNCTION_PROPERTY, /**< function expression in an object literal */
#if JERRY_ESNEXT
- SCAN_STACK_FUNCTION_ARROW, /**< arrow function expression */
+ SCAN_STACK_FUNCTION_ARROW, /**< arrow function expression */
#endif /* JERRY_ESNEXT */
- SCAN_STACK_SWITCH_BLOCK, /**< block part of "switch" statement */
- SCAN_STACK_IF_STATEMENT, /**< statement part of "if" statements */
- SCAN_STACK_WITH_STATEMENT, /**< statement part of "with" statements */
- SCAN_STACK_WITH_EXPRESSION, /**< expression part of "with" statements */
- SCAN_STACK_DO_STATEMENT, /**< statement part of "do" statements */
- SCAN_STACK_DO_EXPRESSION, /**< expression part of "do" statements */
- SCAN_STACK_WHILE_EXPRESSION, /**< expression part of "while" iterator */
- SCAN_STACK_PAREN_EXPRESSION, /**< expression in brackets */
- SCAN_STACK_STATEMENT_WITH_EXPR, /**< statement which starts with expression enclosed in brackets */
+ SCAN_STACK_SWITCH_BLOCK, /**< block part of "switch" statement */
+ SCAN_STACK_IF_STATEMENT, /**< statement part of "if" statements */
+ SCAN_STACK_WITH_STATEMENT, /**< statement part of "with" statements */
+ SCAN_STACK_WITH_EXPRESSION, /**< expression part of "with" statements */
+ SCAN_STACK_DO_STATEMENT, /**< statement part of "do" statements */
+ SCAN_STACK_DO_EXPRESSION, /**< expression part of "do" statements */
+ SCAN_STACK_WHILE_EXPRESSION, /**< expression part of "while" iterator */
+ SCAN_STACK_PAREN_EXPRESSION, /**< expression in brackets */
+ SCAN_STACK_STATEMENT_WITH_EXPR, /**< statement which starts with expression enclosed in brackets */
#if JERRY_ESNEXT
- SCAN_STACK_BINDING_INIT, /**< post processing after a single initializer */
- SCAN_STACK_BINDING_LIST_INIT, /**< post processing after an initializer list */
- SCAN_STACK_LET, /**< let statement */
- SCAN_STACK_CONST, /**< const statement */
+ SCAN_STACK_BINDING_INIT, /**< post processing after a single initializer */
+ SCAN_STACK_BINDING_LIST_INIT, /**< post processing after an initializer list */
+ SCAN_STACK_LET, /**< let statement */
+ SCAN_STACK_CONST, /**< const statement */
#endif /* JERRY_ESNEXT */
/* The SCANNER_IS_FOR_START macro needs to be updated when the following constants are reordered. */
- SCAN_STACK_VAR, /**< var statement */
- SCAN_STACK_FOR_VAR_START, /**< start of "for" iterator with var statement */
+ SCAN_STACK_VAR, /**< var statement */
+ SCAN_STACK_FOR_VAR_START, /**< start of "for" iterator with var statement */
#if JERRY_ESNEXT
- SCAN_STACK_FOR_LET_START, /**< start of "for" iterator with let statement */
- SCAN_STACK_FOR_CONST_START, /**< start of "for" iterator with const statement */
+ SCAN_STACK_FOR_LET_START, /**< start of "for" iterator with let statement */
+ SCAN_STACK_FOR_CONST_START, /**< start of "for" iterator with const statement */
#endif /* JERRY_ESNEXT */
- SCAN_STACK_FOR_START, /**< start of "for" iterator */
- SCAN_STACK_FOR_CONDITION, /**< condition part of "for" iterator */
- SCAN_STACK_FOR_EXPRESSION, /**< expression part of "for" iterator */
- SCAN_STACK_SWITCH_EXPRESSION, /**< expression part of "switch" statement */
- SCAN_STACK_CASE_STATEMENT, /**< case statement inside a switch statement */
- SCAN_STACK_COLON_EXPRESSION, /**< expression between a question mark and colon */
- SCAN_STACK_TRY_STATEMENT, /**< try statement */
- SCAN_STACK_CATCH_STATEMENT, /**< catch statement */
- SCAN_STACK_ARRAY_LITERAL, /**< array literal or destructuring assignment or binding */
- SCAN_STACK_OBJECT_LITERAL, /**< object literal group */
- SCAN_STACK_PROPERTY_ACCESSOR, /**< property accessor in square brackets */
+ SCAN_STACK_FOR_START, /**< start of "for" iterator */
+ SCAN_STACK_FOR_CONDITION, /**< condition part of "for" iterator */
+ SCAN_STACK_FOR_EXPRESSION, /**< expression part of "for" iterator */
+ SCAN_STACK_SWITCH_EXPRESSION, /**< expression part of "switch" statement */
+ SCAN_STACK_CASE_STATEMENT, /**< case statement inside a switch statement */
+ SCAN_STACK_COLON_EXPRESSION, /**< expression between a question mark and colon */
+ SCAN_STACK_TRY_STATEMENT, /**< try statement */
+ SCAN_STACK_CATCH_STATEMENT, /**< catch statement */
+ SCAN_STACK_ARRAY_LITERAL, /**< array literal or destructuring assignment or binding */
+ SCAN_STACK_OBJECT_LITERAL, /**< object literal group */
+ SCAN_STACK_PROPERTY_ACCESSOR, /**< property accessor in square brackets */
#if JERRY_ESNEXT
/* These four must be in this order. */
- SCAN_STACK_COMPUTED_PROPERTY, /**< computed property name */
- SCAN_STACK_COMPUTED_GENERATOR, /**< computed generator function */
- SCAN_STACK_COMPUTED_ASYNC, /**< computed async function */
- SCAN_STACK_COMPUTED_ASYNC_GENERATOR, /**< computed async function */
- SCAN_STACK_TEMPLATE_STRING, /**< template string */
- SCAN_STACK_TAGGED_TEMPLATE_LITERAL, /**< tagged template literal */
- SCAN_STACK_PRIVATE_BLOCK_EARLY, /**< private block for single statements (force early declarations) */
- SCAN_STACK_PRIVATE_BLOCK, /**< private block for single statements */
- SCAN_STACK_ARROW_ARGUMENTS, /**< might be arguments of an arrow function */
- SCAN_STACK_ARROW_EXPRESSION, /**< expression body of an arrow function */
- SCAN_STACK_EXPLICIT_CLASS_CONSTRUCTOR, /**< explicit class constructor */
- SCAN_STACK_IMPLICIT_CLASS_CONSTRUCTOR, /**< implicit class constructor */
- SCAN_STACK_CLASS_STATEMENT, /**< class statement */
- SCAN_STACK_CLASS_EXPRESSION, /**< class expression */
- SCAN_STACK_CLASS_EXTENDS, /**< class extends expression */
- SCAN_STACK_CLASS_FIELD_INITIALIZER, /**< class field initializer */
- SCAN_STACK_FUNCTION_PARAMETERS, /**< function parameter initializer */
- SCAN_STACK_FOR_START_PATTERN, /**< possible assignment pattern for "for" iterator */
- SCAN_STACK_USE_ASYNC, /**< an "async" identifier is used */
+ SCAN_STACK_COMPUTED_PROPERTY, /**< computed property name */
+ SCAN_STACK_COMPUTED_GENERATOR, /**< computed generator function */
+ SCAN_STACK_COMPUTED_ASYNC, /**< computed async function */
+ SCAN_STACK_COMPUTED_ASYNC_GENERATOR, /**< computed async function */
+ SCAN_STACK_TEMPLATE_STRING, /**< template string */
+ SCAN_STACK_TAGGED_TEMPLATE_LITERAL, /**< tagged template literal */
+ SCAN_STACK_PRIVATE_BLOCK_EARLY, /**< private block for single statements (force early declarations) */
+ SCAN_STACK_PRIVATE_BLOCK, /**< private block for single statements */
+ SCAN_STACK_ARROW_ARGUMENTS, /**< might be arguments of an arrow function */
+ SCAN_STACK_ARROW_EXPRESSION, /**< expression body of an arrow function */
+ SCAN_STACK_EXPLICIT_CLASS_CONSTRUCTOR, /**< explicit class constructor */
+ SCAN_STACK_IMPLICIT_CLASS_CONSTRUCTOR, /**< implicit class constructor */
+ SCAN_STACK_CLASS_STATEMENT, /**< class statement */
+ SCAN_STACK_CLASS_EXPRESSION, /**< class expression */
+ SCAN_STACK_CLASS_EXTENDS, /**< class extends expression */
+ SCAN_STACK_CLASS_FIELD_INITIALIZER, /**< class field initializer */
+ SCAN_STACK_FUNCTION_PARAMETERS, /**< function parameter initializer */
+ SCAN_STACK_FOR_START_PATTERN, /**< possible assignment pattern for "for" iterator */
+ SCAN_STACK_USE_ASYNC, /**< an "async" identifier is used */
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
- SCAN_STACK_EXPORT_DEFAULT, /**< scan primary expression after export default */
+ SCAN_STACK_EXPORT_DEFAULT, /**< scan primary expression after export default */
#endif /* JERRY_MODULE_SYSTEM */
} scan_stack_modes_t;
@@ -141,8 +141,7 @@ typedef enum
/**
* Checks whether the stack top is a for statement start.
*/
-#define SCANNER_IS_FOR_START(stack_top) \
- ((stack_top) >= SCAN_STACK_FOR_VAR_START && (stack_top) <= SCAN_STACK_FOR_START)
+#define SCANNER_IS_FOR_START(stack_top) ((stack_top) >= SCAN_STACK_FOR_VAR_START && (stack_top) <= SCAN_STACK_FOR_START)
/**
* Generic descriptor which stores only the start position.
@@ -329,8 +328,7 @@ typedef enum
/**
* Setting the generator and async properties of literal pool status flags.
*/
-#define SCANNER_FROM_COMPUTED_TO_LITERAL_POOL(mode) \
- (((mode) - SCAN_STACK_COMPUTED_PROPERTY) << 10)
+#define SCANNER_FROM_COMPUTED_TO_LITERAL_POOL(mode) (((mode) -SCAN_STACK_COMPUTED_PROPERTY) << 10)
#if JERRY_ESNEXT
@@ -395,33 +393,39 @@ void scanner_free (void *ptr, size_t size);
size_t scanner_get_stream_size (scanner_info_t *info_p, size_t size);
scanner_info_t *scanner_insert_info (parser_context_t *context_p, const uint8_t *source_p, size_t size);
-scanner_info_t *scanner_insert_info_before (parser_context_t *context_p, const uint8_t *source_p,
- scanner_info_t *start_info_p, size_t size);
-scanner_literal_pool_t *scanner_push_literal_pool (parser_context_t *context_p, scanner_context_t *scanner_context_p,
- uint16_t status_flags);
+scanner_info_t *scanner_insert_info_before (parser_context_t *context_p,
+ const uint8_t *source_p,
+ scanner_info_t *start_info_p,
+ size_t size);
+scanner_literal_pool_t *
+scanner_push_literal_pool (parser_context_t *context_p, scanner_context_t *scanner_context_p, uint16_t status_flags);
void scanner_pop_literal_pool (parser_context_t *context_p, scanner_context_t *scanner_context_p);
#if JERRY_ESNEXT
void scanner_filter_arguments (parser_context_t *context_p, scanner_context_t *scanner_context_p);
void scanner_construct_global_block (parser_context_t *context_p, scanner_context_t *scanner_context_p);
#endif /* JERRY_ESNEXT */
-lexer_lit_location_t *scanner_add_custom_literal (parser_context_t *context_p, scanner_literal_pool_t *literal_pool_p,
+lexer_lit_location_t *scanner_add_custom_literal (parser_context_t *context_p,
+ scanner_literal_pool_t *literal_pool_p,
const lexer_lit_location_t *literal_location_p);
lexer_lit_location_t *scanner_add_literal (parser_context_t *context_p, scanner_context_t *scanner_context_p);
void scanner_add_reference (parser_context_t *context_p, scanner_context_t *scanner_context_p);
lexer_lit_location_t *scanner_append_argument (parser_context_t *context_p, scanner_context_t *scanner_context_p);
#if JERRY_ESNEXT
-void scanner_detect_invalid_var (parser_context_t *context_p, scanner_context_t *scanner_context_p,
+void scanner_detect_invalid_var (parser_context_t *context_p,
+ scanner_context_t *scanner_context_p,
lexer_lit_location_t *var_literal_p);
void scanner_detect_invalid_let (parser_context_t *context_p, lexer_lit_location_t *let_literal_p);
#endif /* JERRY_ESNEXT */
void scanner_detect_eval_call (parser_context_t *context_p, scanner_context_t *scanner_context_p);
#if JERRY_ESNEXT
-lexer_lit_location_t *scanner_push_class_declaration (parser_context_t *context_p,
- scanner_context_t *scanner_context_p, uint8_t stack_mode);
+lexer_lit_location_t *
+scanner_push_class_declaration (parser_context_t *context_p, scanner_context_t *scanner_context_p, uint8_t stack_mode);
void scanner_push_class_field_initializer (parser_context_t *context_p, scanner_context_t *scanner_context_p);
-void scanner_push_destructuring_pattern (parser_context_t *context_p, scanner_context_t *scanner_context_p,
- uint8_t binding_type, bool is_nested);
+void scanner_push_destructuring_pattern (parser_context_t *context_p,
+ scanner_context_t *scanner_context_p,
+ uint8_t binding_type,
+ bool is_nested);
void scanner_pop_binding_list (scanner_context_t *scanner_context_p);
void scanner_append_hole (parser_context_t *context_p, scanner_context_t *scanner_context_p);
#endif /* JERRY_ESNEXT */
@@ -431,8 +435,8 @@ void scanner_append_hole (parser_context_t *context_p, scanner_context_t *scanne
#if JERRY_ESNEXT
void scanner_add_async_literal (parser_context_t *context_p, scanner_context_t *scanner_context_p);
void scanner_check_arrow (parser_context_t *context_p, scanner_context_t *scanner_context_p);
-void scanner_scan_simple_arrow (parser_context_t *context_p, scanner_context_t *scanner_context_p,
- const uint8_t *source_p);
+void
+scanner_scan_simple_arrow (parser_context_t *context_p, scanner_context_t *scanner_context_p, const uint8_t *source_p);
void scanner_check_arrow_arg (parser_context_t *context_p, scanner_context_t *scanner_context_p);
bool scanner_check_async_function (parser_context_t *context_p, scanner_context_t *scanner_context_p);
void scanner_check_function_after_if (parser_context_t *context_p, scanner_context_t *scanner_context_p);
diff --git a/jerry-core/parser/js/js-scanner-ops.c b/jerry-core/parser/js/js-scanner-ops.c
index 2996e5bd..046ef011 100644
--- a/jerry-core/parser/js/js-scanner-ops.c
+++ b/jerry-core/parser/js/js-scanner-ops.c
@@ -45,9 +45,8 @@ scanner_add_async_literal (parser_context_t *context_p, /**< context */
parser_stack_pop_uint8 (context_p);
parser_stack_pop (context_p, &async_literal, sizeof (lexer_lit_location_t));
- lexer_lit_location_t *lit_location_p = scanner_add_custom_literal (context_p,
- scanner_context_p->active_literal_pool_p,
- &async_literal);
+ lexer_lit_location_t *lit_location_p =
+ scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p, &async_literal);
lit_location_p->type |= SCANNER_LITERAL_IS_USED;
@@ -91,8 +90,7 @@ scanner_check_arrow (parser_context_t *context_p, /**< context */
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_ARROW
- || (context_p->token.flags & LEXER_WAS_NEWLINE))
+ if (context_p->token.type != LEXER_ARROW || (context_p->token.flags & LEXER_WAS_NEWLINE))
{
if (context_p->stack_top_uint8 == SCAN_STACK_USE_ASYNC)
{
@@ -115,9 +113,8 @@ scanner_check_arrow (parser_context_t *context_p, /**< context */
bool is_async_arrow = (status_flags & SCANNER_LITERAL_POOL_MAY_ASYNC_ARROW) != 0;
status_flags |= SCANNER_LITERAL_POOL_ARROW_FLAGS;
- status_flags &= (uint16_t) ~(SCANNER_LITERAL_POOL_IN_WITH
- | SCANNER_LITERAL_POOL_GENERATOR
- | SCANNER_LITERAL_POOL_ASYNC);
+ status_flags &=
+ (uint16_t) ~(SCANNER_LITERAL_POOL_IN_WITH | SCANNER_LITERAL_POOL_GENERATOR | SCANNER_LITERAL_POOL_ASYNC);
context_p->status_flags &= (uint32_t) ~(PARSER_IS_GENERATOR_FUNCTION | PARSER_IS_ASYNC_FUNCTION);
@@ -301,8 +298,7 @@ scanner_check_async_function (parser_context_t *context_p, /**< context */
return true;
}
- if (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
+ if (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
if (!lexer_check_arrow (context_p))
{
@@ -322,9 +318,8 @@ scanner_check_async_function (parser_context_t *context_p, /**< context */
}
}
- lexer_lit_location_t *lit_location_p = scanner_add_custom_literal (context_p,
- scanner_context_p->active_literal_pool_p,
- &async_literal);
+ lexer_lit_location_t *lit_location_p =
+ scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p, &async_literal);
lit_location_p->type |= SCANNER_LITERAL_IS_USED;
if (scanner_context_p->active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_WITH)
@@ -369,8 +364,7 @@ scanner_check_import_meta (parser_context_t *context_p) /**< context */
{
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL
|| context_p->token.keyword_type != LEXER_KEYW_META
|| (context_p->token.lit_location.status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE))
{
@@ -421,8 +415,7 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
#endif /* JERRY_ESNEXT */
depth++;
lexer_next_token (context_p);
- }
- while (context_p->token.type == LEXER_LEFT_PAREN);
+ } while (context_p->token.type == LEXER_LEFT_PAREN);
scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;
@@ -526,8 +519,7 @@ scanner_scan_bracket (parser_context_t *context_p, /**< context */
}
#if JERRY_ESNEXT
- if (JERRY_UNLIKELY (scanner_context_p->async_source_p != NULL)
- && (arrow_source_p == NULL || depth > 0))
+ if (JERRY_UNLIKELY (scanner_context_p->async_source_p != NULL) && (arrow_source_p == NULL || depth > 0))
{
scanner_context_p->async_source_p = NULL;
}
@@ -599,13 +591,11 @@ scanner_check_directives (parser_context_t *context_p, /**< context */
{
scanner_context_p->mode = SCAN_MODE_STATEMENT_OR_TERMINATOR;
- while (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_STRING_LITERAL)
+ while (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL)
{
bool is_use_strict = false;
- if (lexer_string_is_use_strict (context_p)
- && !(context_p->status_flags & PARSER_IS_STRICT))
+ if (lexer_string_is_use_strict (context_p) && !(context_p->status_flags & PARSER_IS_STRICT))
{
is_use_strict = true;
context_p->status_flags |= PARSER_IS_STRICT;
diff --git a/jerry-core/parser/js/js-scanner-util.c b/jerry-core/parser/js/js-scanner-util.c
index ac2ecce5..bd501dae 100644
--- a/jerry-core/parser/js/js-scanner-util.c
+++ b/jerry-core/parser/js/js-scanner-util.c
@@ -15,6 +15,7 @@
#include "ecma-helpers.h"
#include "ecma-lex-env.h"
+
#include "jcontext.h"
#include "js-parser-internal.h"
#include "js-scanner-internal.h"
@@ -40,11 +41,9 @@ JERRY_STATIC_ASSERT (PARSER_MAXIMUM_NUMBER_OF_LITERALS + PARSER_MAXIMUM_NUMBER_O
JERRY_STATIC_ASSERT ((SCANNER_LITERAL_IS_ARROW_DESTRUCTURED_ARG & SCANNER_LITERAL_IS_LOCAL) == 0,
is_arrow_arg_binding_flag_must_not_use_local_flags);
-JERRY_STATIC_ASSERT ((SCANNER_LITERAL_IS_LET & SCANNER_LITERAL_IS_LOCAL) != 0,
- is_let_flag_must_use_local_flags);
+JERRY_STATIC_ASSERT ((SCANNER_LITERAL_IS_LET & SCANNER_LITERAL_IS_LOCAL) != 0, is_let_flag_must_use_local_flags);
-JERRY_STATIC_ASSERT ((SCANNER_LITERAL_IS_CONST & SCANNER_LITERAL_IS_LOCAL) != 0,
- is_const_flag_must_use_local_flags);
+JERRY_STATIC_ASSERT ((SCANNER_LITERAL_IS_CONST & SCANNER_LITERAL_IS_LOCAL) != 0, is_const_flag_must_use_local_flags);
JERRY_STATIC_ASSERT ((SCANNER_LITERAL_IS_FUNC_DECLARATION & SCANNER_LITERAL_IS_LOCAL) != 0,
is_func_declaration_flag_must_use_local_flags);
@@ -400,8 +399,7 @@ scanner_scope_find_lexical_declaration (parser_context_t *context_p, /**< contex
ecma_string_t *name_p;
uint32_t flags = context_p->global_status_flags;
- if (!(flags & ECMA_PARSE_EVAL)
- || (!(flags & ECMA_PARSE_DIRECT_EVAL) && (context_p->status_flags & PARSER_IS_STRICT)))
+ if (!(flags & ECMA_PARSE_EVAL) || (!(flags & ECMA_PARSE_DIRECT_EVAL) && (context_p->status_flags & PARSER_IS_STRICT)))
{
return false;
}
@@ -487,9 +485,8 @@ scanner_push_literal_pool (parser_context_t *context_p, /**< context */
status_flags |= SCANNER_LITERAL_POOL_NO_ARGUMENTS;
#if JERRY_ESNEXT
- const uint16_t copied_flags = (SCANNER_LITERAL_POOL_IN_WITH
- | SCANNER_LITERAL_POOL_GENERATOR
- | SCANNER_LITERAL_POOL_ASYNC);
+ const uint16_t copied_flags =
+ (SCANNER_LITERAL_POOL_IN_WITH | SCANNER_LITERAL_POOL_GENERATOR | SCANNER_LITERAL_POOL_ASYNC);
#else /* !JERRY_ESNEXT */
const uint16_t copied_flags = SCANNER_LITERAL_POOL_IN_WITH;
#endif /* JERRY_ESNEXT */
@@ -535,8 +532,7 @@ scanner_push_literal_pool (parser_context_t *context_p, /**< context */
return literal_pool_p;
} /* scanner_push_literal_pool */
-JERRY_STATIC_ASSERT (PARSER_MAXIMUM_IDENT_LENGTH <= UINT8_MAX,
- maximum_ident_length_must_fit_in_a_byte);
+JERRY_STATIC_ASSERT (PARSER_MAXIMUM_IDENT_LENGTH <= UINT8_MAX, maximum_ident_length_must_fit_in_a_byte);
/**
* Checks whether a literal is equal to "arguments".
@@ -782,8 +778,7 @@ scanner_pop_literal_pool (parser_context_t *context_p, /**< context */
|| ((type & (SCANNER_LITERAL_IS_VAR | SCANNER_LITERAL_IS_ARG))
&& (status_flags & SCANNER_LITERAL_POOL_FUNCTION)))
{
- JERRY_ASSERT ((status_flags & SCANNER_LITERAL_POOL_FUNCTION)
- || !(literal_p->type & SCANNER_LITERAL_IS_ARG));
+ JERRY_ASSERT ((status_flags & SCANNER_LITERAL_POOL_FUNCTION) || !(literal_p->type & SCANNER_LITERAL_IS_ARG));
if (literal_p->length == 0)
{
@@ -852,9 +847,7 @@ scanner_pop_literal_pool (parser_context_t *context_p, /**< context */
if (prev_literal_pool_p != NULL && literal_p->length > 0)
{
/* Propagate literal to upper level. */
- lexer_lit_location_t *literal_location_p = scanner_add_custom_literal (context_p,
- prev_literal_pool_p,
- literal_p);
+ lexer_lit_location_t *literal_location_p = scanner_add_custom_literal (context_p, prev_literal_pool_p, literal_p);
uint8_t extended_type = literal_location_p->type;
#if JERRY_ESNEXT
@@ -878,8 +871,7 @@ scanner_pop_literal_pool (parser_context_t *context_p, /**< context */
const uint8_t mask = (SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_LOCAL);
- if ((type & SCANNER_LITERAL_IS_ARG)
- || (literal_location_p->type & mask) == SCANNER_LITERAL_IS_LET
+ if ((type & SCANNER_LITERAL_IS_ARG) || (literal_location_p->type & mask) == SCANNER_LITERAL_IS_LET
|| (literal_location_p->type & mask) == SCANNER_LITERAL_IS_CONST)
{
/* Clears the SCANNER_LITERAL_IS_VAR and SCANNER_LITERAL_IS_FUNC flags
@@ -1071,8 +1063,7 @@ scanner_pop_literal_pool (parser_context_t *context_p, /**< context */
{
type = (uint8_t) (type + 1);
- JERRY_ASSERT (type == SCANNER_STREAM_TYPE_ARG_VAR
- || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR);
+ JERRY_ASSERT (type == SCANNER_STREAM_TYPE_ARG_VAR || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR);
}
#endif /* JERRY_ESNEXT */
}
@@ -1263,9 +1254,8 @@ scanner_filter_arguments (parser_context_t *context_p, /**< context */
}
uint8_t type = literal_p->type;
- const uint8_t mask = (SCANNER_LITERAL_IS_ARG
- | SCANNER_LITERAL_IS_DESTRUCTURED_ARG
- | SCANNER_LITERAL_IS_ARROW_DESTRUCTURED_ARG);
+ const uint8_t mask =
+ (SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_DESTRUCTURED_ARG | SCANNER_LITERAL_IS_ARROW_DESTRUCTURED_ARG);
if ((type & mask) != SCANNER_LITERAL_IS_ARG)
{
@@ -1333,9 +1323,7 @@ scanner_filter_arguments (parser_context_t *context_p, /**< context */
else if (prev_literal_pool_p != NULL)
{
/* Propagate literal to upper level. */
- lexer_lit_location_t *literal_location_p = scanner_add_custom_literal (context_p,
- prev_literal_pool_p,
- literal_p);
+ lexer_lit_location_t *literal_location_p = scanner_add_custom_literal (context_p, prev_literal_pool_p, literal_p);
type |= SCANNER_LITERAL_NO_REG | SCANNER_LITERAL_IS_USED;
literal_location_p->type |= type;
}
@@ -1441,7 +1429,7 @@ scanner_add_custom_literal (parser_context_t *context_p, /**< context */
*
* @return pointer to the literal
*/
-extern inline lexer_lit_location_t * JERRY_ATTR_ALWAYS_INLINE
+extern inline lexer_lit_location_t *JERRY_ATTR_ALWAYS_INLINE
scanner_add_literal (parser_context_t *context_p, /**< context */
scanner_context_t *scanner_context_p) /**< scanner context */
{
@@ -1460,9 +1448,8 @@ extern inline void JERRY_ATTR_ALWAYS_INLINE
scanner_add_reference (parser_context_t *context_p, /**< context */
scanner_context_t *scanner_context_p) /**< scanner context */
{
- lexer_lit_location_t *lit_location_p = scanner_add_custom_literal (context_p,
- scanner_context_p->active_literal_pool_p,
- &context_p->token.lit_location);
+ lexer_lit_location_t *lit_location_p =
+ scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p, &context_p->token.lit_location);
#if JERRY_ESNEXT
lit_location_p->type |= SCANNER_LITERAL_IS_USED;
#endif /* JERRY_ESNEXT */
@@ -1555,8 +1542,7 @@ void
scanner_detect_eval_call (parser_context_t *context_p, /**< context */
scanner_context_t *scanner_context_p) /**< scanner context */
{
- if (context_p->token.keyword_type == LEXER_KEYW_EVAL
- && lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))
+ if (context_p->token.keyword_type == LEXER_KEYW_EVAL && lexer_check_next_character (context_p, LIT_CHAR_LEFT_PAREN))
{
#if JERRY_ESNEXT
const uint16_t flags = (uint16_t) (SCANNER_LITERAL_POOL_CAN_EVAL | SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE);
@@ -1608,12 +1594,10 @@ scanner_detect_invalid_var (parser_context_t *context_p, /**< context */
{
while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)
{
- if ((literal_p->type & SCANNER_LITERAL_IS_LOCAL)
- && !(literal_p->type & SCANNER_LITERAL_IS_ARG)
+ if ((literal_p->type & SCANNER_LITERAL_IS_LOCAL) && !(literal_p->type & SCANNER_LITERAL_IS_ARG)
&& !((literal_p->type & SCANNER_LITERAL_IS_FUNC)
&& (literal_pool_p->status_flags & SCANNER_LITERAL_POOL_FUNCTION))
- && (literal_p->type & SCANNER_LITERAL_IS_LOCAL) != SCANNER_LITERAL_IS_LOCAL
- && literal_p->length == length)
+ && (literal_p->type & SCANNER_LITERAL_IS_LOCAL) != SCANNER_LITERAL_IS_LOCAL && literal_p->length == length)
{
if (JERRY_LIKELY (!(literal_p->status_flags & LEXER_LIT_LOCATION_HAS_ESCAPE)))
{
@@ -1635,8 +1619,7 @@ scanner_detect_invalid_var (parser_context_t *context_p, /**< context */
{
while ((literal_p = (lexer_lit_location_t *) parser_list_iterator_next (&literal_iterator)) != NULL)
{
- if ((literal_p->type & SCANNER_LITERAL_IS_LOCAL)
- && !(literal_p->type & SCANNER_LITERAL_IS_ARG)
+ if ((literal_p->type & SCANNER_LITERAL_IS_LOCAL) && !(literal_p->type & SCANNER_LITERAL_IS_ARG)
&& !((literal_p->type & SCANNER_LITERAL_IS_FUNC)
&& (literal_pool_p->status_flags & SCANNER_LITERAL_POOL_FUNCTION))
&& (literal_p->type & SCANNER_LITERAL_IS_LOCAL) != SCANNER_LITERAL_IS_LOCAL
@@ -1662,9 +1645,7 @@ void
scanner_detect_invalid_let (parser_context_t *context_p, /**< context */
lexer_lit_location_t *let_literal_p) /**< let literal */
{
- if (let_literal_p->type & (SCANNER_LITERAL_IS_ARG
- | SCANNER_LITERAL_IS_VAR
- | SCANNER_LITERAL_IS_LOCAL))
+ if (let_literal_p->type & (SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_VAR | SCANNER_LITERAL_IS_LOCAL))
{
scanner_raise_redeclaration_error (context_p);
}
@@ -1698,8 +1679,8 @@ scanner_push_class_declaration (parser_context_t *context_p, /**< context */
parser_stack_push_uint8 (context_p, stack_mode);
lexer_next_token (context_p);
- bool class_has_name = (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
+ bool class_has_name =
+ (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL);
if (class_has_name)
{
@@ -1737,9 +1718,8 @@ scanner_push_class_declaration (parser_context_t *context_p, /**< context */
else if (is_export_default)
{
lexer_lit_location_t *name_literal_p;
- name_literal_p = scanner_add_custom_literal (context_p,
- scanner_context_p->active_literal_pool_p->prev_p,
- &lexer_default_literal);
+ name_literal_p =
+ scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p->prev_p, &lexer_default_literal);
name_literal_p->type |= SCANNER_LITERAL_IS_LET | SCANNER_LITERAL_NO_REG;
scanner_context_p->active_literal_pool_p->no_declarations++;
@@ -1889,8 +1869,7 @@ scanner_reverse_info_list (parser_context_t *context_p) /**< context */
last_scanner_info_p = scanner_info_p;
scanner_info_p = next_scanner_info_p;
- }
- while (scanner_info_p->type != SCANNER_TYPE_END);
+ } while (scanner_info_p->type != SCANNER_TYPE_END);
context_p->next_scanner_info_p->next_p = scanner_info_p;
context_p->next_scanner_info_p = last_scanner_info_p;
@@ -1959,13 +1938,12 @@ scanner_cleanup (parser_context_t *context_p) /**< context */
default:
{
#if JERRY_ESNEXT
- JERRY_ASSERT (scanner_info_p->type == SCANNER_TYPE_END_ARGUMENTS
- || scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS
- || scanner_info_p->type == SCANNER_TYPE_CLASS_CONSTRUCTOR
- || scanner_info_p->type == SCANNER_TYPE_LET_EXPRESSION
- || scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED
- || scanner_info_p->type == SCANNER_TYPE_ERR_ASYNC_FUNCTION
- || scanner_info_p->type == SCANNER_TYPE_EXPORT_MODULE_SPECIFIER);
+ JERRY_ASSERT (
+ scanner_info_p->type == SCANNER_TYPE_END_ARGUMENTS || scanner_info_p->type == SCANNER_TYPE_LITERAL_FLAGS
+ || scanner_info_p->type == SCANNER_TYPE_CLASS_CONSTRUCTOR
+ || scanner_info_p->type == SCANNER_TYPE_LET_EXPRESSION || scanner_info_p->type == SCANNER_TYPE_ERR_REDECLARED
+ || scanner_info_p->type == SCANNER_TYPE_ERR_ASYNC_FUNCTION
+ || scanner_info_p->type == SCANNER_TYPE_EXPORT_MODULE_SPECIFIER);
#else /* !JERRY_ESNEXT */
JERRY_ASSERT (scanner_info_p->type == SCANNER_TYPE_END_ARGUMENTS);
#endif /* JERRY_ESNEXT */
@@ -2000,8 +1978,8 @@ scanner_is_context_needed (parser_context_t *context_p, /**< context */
JERRY_ASSERT ((check_type == PARSER_CHECK_BLOCK_CONTEXT ? info_p->type == SCANNER_TYPE_BLOCK
: info_p->type == SCANNER_TYPE_FUNCTION));
- uint32_t scope_stack_reg_top = (check_type != PARSER_CHECK_GLOBAL_CONTEXT ? context_p->scope_stack_reg_top
- : 1); /* block result */
+ uint32_t scope_stack_reg_top =
+ (check_type != PARSER_CHECK_GLOBAL_CONTEXT ? context_p->scope_stack_reg_top : 1); /* block result */
#else /* !JERRY_ESNEXT */
JERRY_ASSERT (check_type == PARSER_CHECK_BLOCK_CONTEXT);
JERRY_ASSERT (info_p->type == SCANNER_TYPE_BLOCK);
@@ -2026,8 +2004,7 @@ scanner_is_context_needed (parser_context_t *context_p, /**< context */
if (JERRY_UNLIKELY (SCANNER_STREAM_TYPE_IS_ARGUMENTS (type)))
{
- if ((data & SCANNER_STREAM_NO_REG)
- || scope_stack_reg_top >= PARSER_MAXIMUM_NUMBER_OF_REGISTERS)
+ if ((data & SCANNER_STREAM_NO_REG) || scope_stack_reg_top >= PARSER_MAXIMUM_NUMBER_OF_REGISTERS)
{
return true;
}
@@ -2041,48 +2018,37 @@ scanner_is_context_needed (parser_context_t *context_p, /**< context */
#ifndef JERRY_NDEBUG
if (check_type == PARSER_CHECK_BLOCK_CONTEXT)
{
- JERRY_ASSERT (type == SCANNER_STREAM_TYPE_VAR
- || type == SCANNER_STREAM_TYPE_LET
- || type == SCANNER_STREAM_TYPE_CONST
- || type == SCANNER_STREAM_TYPE_LOCAL
+ JERRY_ASSERT (type == SCANNER_STREAM_TYPE_VAR || type == SCANNER_STREAM_TYPE_LET
+ || type == SCANNER_STREAM_TYPE_CONST || type == SCANNER_STREAM_TYPE_LOCAL
|| type == SCANNER_STREAM_TYPE_FUNC);
}
else if (check_type == PARSER_CHECK_GLOBAL_CONTEXT)
{
#if JERRY_MODULE_SYSTEM
const bool is_import = (type == SCANNER_STREAM_TYPE_IMPORT);
-#else
+#else /* !JERRY_MODULE_SYSTEM */
const bool is_import = true;
#endif /* JERRY_MODULE_SYSTEM */
/* FIXME: a private declarative lexical environment should always be present
* for modules. Remove SCANNER_STREAM_TYPE_IMPORT after it is implemented. */
- JERRY_ASSERT (type == SCANNER_STREAM_TYPE_VAR
- || type == SCANNER_STREAM_TYPE_LET
- || type == SCANNER_STREAM_TYPE_CONST
- || type == SCANNER_STREAM_TYPE_FUNC
- || is_import);
+ JERRY_ASSERT (type == SCANNER_STREAM_TYPE_VAR || type == SCANNER_STREAM_TYPE_LET
+ || type == SCANNER_STREAM_TYPE_CONST || type == SCANNER_STREAM_TYPE_FUNC || is_import);
/* Only let/const can be stored in registers */
JERRY_ASSERT ((data & SCANNER_STREAM_NO_REG)
|| (type == SCANNER_STREAM_TYPE_FUNC && (context_p->global_status_flags & ECMA_PARSE_DIRECT_EVAL))
- || type == SCANNER_STREAM_TYPE_LET
- || type == SCANNER_STREAM_TYPE_CONST);
+ || type == SCANNER_STREAM_TYPE_LET || type == SCANNER_STREAM_TYPE_CONST);
}
else
{
JERRY_ASSERT (check_type == PARSER_CHECK_FUNCTION_CONTEXT);
- JERRY_ASSERT (type == SCANNER_STREAM_TYPE_VAR
- || type == SCANNER_STREAM_TYPE_LET
- || type == SCANNER_STREAM_TYPE_CONST
- || type == SCANNER_STREAM_TYPE_LOCAL
- || type == SCANNER_STREAM_TYPE_ARG
- || type == SCANNER_STREAM_TYPE_ARG_VAR
- || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG
- || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR
- || type == SCANNER_STREAM_TYPE_ARG_FUNC
- || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC
+ JERRY_ASSERT (type == SCANNER_STREAM_TYPE_VAR || type == SCANNER_STREAM_TYPE_LET
+ || type == SCANNER_STREAM_TYPE_CONST || type == SCANNER_STREAM_TYPE_LOCAL
+ || type == SCANNER_STREAM_TYPE_ARG || type == SCANNER_STREAM_TYPE_ARG_VAR
+ || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR
+ || type == SCANNER_STREAM_TYPE_ARG_FUNC || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC
|| type == SCANNER_STREAM_TYPE_FUNC);
}
#endif /* !JERRY_NDEBUG */
@@ -2116,24 +2082,21 @@ scanner_is_context_needed (parser_context_t *context_p, /**< context */
if (JERRY_UNLIKELY (check_type == PARSER_CHECK_GLOBAL_CONTEXT)
&& (type == SCANNER_STREAM_TYPE_VAR
- || (type == SCANNER_STREAM_TYPE_FUNC && !(context_p->global_status_flags & ECMA_PARSE_EVAL))
- || is_import))
+ || (type == SCANNER_STREAM_TYPE_FUNC && !(context_p->global_status_flags & ECMA_PARSE_EVAL)) || is_import))
{
continue;
}
if (JERRY_UNLIKELY (check_type == PARSER_CHECK_FUNCTION_CONTEXT))
{
- if (SCANNER_STREAM_TYPE_IS_ARG_FUNC (type)
- || type == SCANNER_STREAM_TYPE_ARG_VAR
+ if (SCANNER_STREAM_TYPE_IS_ARG_FUNC (type) || type == SCANNER_STREAM_TYPE_ARG_VAR
|| type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR)
{
/* The return value is true, if the variable is stored in the lexical environment
* or all registers have already been used for function arguments. This can be
* inprecise in the latter case, but this is a very rare corner case. A more
* sophisticated check would require to decode the literal. */
- if ((data & SCANNER_STREAM_NO_REG)
- || scope_stack_reg_top >= PARSER_MAXIMUM_NUMBER_OF_REGISTERS)
+ if ((data & SCANNER_STREAM_NO_REG) || scope_stack_reg_top >= PARSER_MAXIMUM_NUMBER_OF_REGISTERS)
{
return true;
}
@@ -2147,8 +2110,7 @@ scanner_is_context_needed (parser_context_t *context_p, /**< context */
}
#endif /* JERRY_ESNEXT */
- if ((data & SCANNER_STREAM_NO_REG)
- || scope_stack_reg_top >= PARSER_MAXIMUM_NUMBER_OF_REGISTERS)
+ if ((data & SCANNER_STREAM_NO_REG) || scope_stack_reg_top >= PARSER_MAXIMUM_NUMBER_OF_REGISTERS)
{
return true;
}
@@ -2202,10 +2164,10 @@ scanner_try_scan_new_target (parser_context_t *context_p) /**< parser/scanner co
/**
* Description of "arguments" literal string.
*/
-const lexer_lit_location_t lexer_arguments_literal =
-{
- (const uint8_t *) "arguments", 9, LEXER_IDENT_LITERAL, LEXER_LIT_LOCATION_IS_ASCII
-};
+const lexer_lit_location_t lexer_arguments_literal = { (const uint8_t *) "arguments",
+ 9,
+ LEXER_IDENT_LITERAL,
+ LEXER_LIT_LOCATION_IS_ASCII };
/**
* Create an unused literal.
@@ -2247,8 +2209,7 @@ scanner_check_variables (parser_context_t *context_p) /**< context */
uint32_t type = next_data_p[0] & SCANNER_STREAM_TYPE_MASK;
const uint8_t *data_p = next_data_p;
- JERRY_ASSERT (type != SCANNER_STREAM_TYPE_HOLE
- && !SCANNER_STREAM_TYPE_IS_ARG (type)
+ JERRY_ASSERT (type != SCANNER_STREAM_TYPE_HOLE && !SCANNER_STREAM_TYPE_IS_ARG (type)
&& !SCANNER_STREAM_TYPE_IS_ARG_FUNC (type));
JERRY_ASSERT (data_p[0] & SCANNER_STREAM_NO_REG);
@@ -2280,8 +2241,8 @@ scanner_check_variables (parser_context_t *context_p) /**< context */
literal.length = data_p[1];
literal.type = LEXER_IDENT_LITERAL;
- literal.status_flags = ((data_p[0] & SCANNER_STREAM_HAS_ESCAPE) ? LEXER_LIT_LOCATION_HAS_ESCAPE
- : LEXER_LIT_LOCATION_NO_OPTS);
+ literal.status_flags =
+ ((data_p[0] & SCANNER_STREAM_HAS_ESCAPE) ? LEXER_LIT_LOCATION_HAS_ESCAPE : LEXER_LIT_LOCATION_NO_OPTS);
lexer_construct_literal_object (context_p, &literal, LEXER_NEW_IDENT_LITERAL);
literal.char_p += data_p[1];
@@ -2374,8 +2335,7 @@ scanner_create_variables (parser_context_t *context_p, /**< context */
const uint8_t *data_p = next_data_p;
JERRY_ASSERT ((option_flags & (SCANNER_CREATE_VARS_IS_FUNCTION_BODY | SCANNER_CREATE_VARS_IS_FUNCTION_ARGS))
- || (type != SCANNER_STREAM_TYPE_HOLE
- && !SCANNER_STREAM_TYPE_IS_ARG (type)
+ || (type != SCANNER_STREAM_TYPE_HOLE && !SCANNER_STREAM_TYPE_IS_ARG (type)
&& !SCANNER_STREAM_TYPE_IS_ARG_FUNC (type)));
#if JERRY_MODULE_SYSTEM
@@ -2394,8 +2354,7 @@ scanner_create_variables (parser_context_t *context_p, /**< context */
uint8_t mask = SCANNER_FUNCTION_ARGUMENTS_NEEDED | SCANNER_FUNCTION_HAS_COMPLEX_ARGUMENT;
- if (!(context_p->status_flags & PARSER_IS_STRICT)
- && (info_u8_arg & mask) == SCANNER_FUNCTION_ARGUMENTS_NEEDED)
+ if (!(context_p->status_flags & PARSER_IS_STRICT) && (info_u8_arg & mask) == SCANNER_FUNCTION_ARGUMENTS_NEEDED)
{
scanner_create_unused_literal (context_p, LEXER_FLAG_FUNCTION_ARGUMENT);
}
@@ -2430,8 +2389,7 @@ scanner_create_variables (parser_context_t *context_p, /**< context */
uint16_t map_to;
- if (!(data_p[0] & SCANNER_STREAM_NO_REG)
- && scope_stack_reg_top < PARSER_MAXIMUM_NUMBER_OF_REGISTERS)
+ if (!(data_p[0] & SCANNER_STREAM_NO_REG) && scope_stack_reg_top < PARSER_MAXIMUM_NUMBER_OF_REGISTERS)
{
map_to = (uint16_t) (PARSER_REGISTER_START + scope_stack_reg_top);
@@ -2531,8 +2489,8 @@ scanner_create_variables (parser_context_t *context_p, /**< context */
{
literal.length = data_p[1];
literal.type = LEXER_IDENT_LITERAL;
- literal.status_flags = ((data_p[0] & SCANNER_STREAM_HAS_ESCAPE) ? LEXER_LIT_LOCATION_HAS_ESCAPE
- : LEXER_LIT_LOCATION_NO_OPTS);
+ literal.status_flags =
+ ((data_p[0] & SCANNER_STREAM_HAS_ESCAPE) ? LEXER_LIT_LOCATION_HAS_ESCAPE : LEXER_LIT_LOCATION_NO_OPTS);
/* Literal must be exists. */
lexer_construct_literal_object (context_p, &literal, LEXER_IDENT_LITERAL);
@@ -2548,8 +2506,7 @@ scanner_create_variables (parser_context_t *context_p, /**< context */
continue;
}
}
- else if ((option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_ARGS)
- && !SCANNER_STREAM_TYPE_IS_ARG_FUNC (type))
+ else if ((option_flags & SCANNER_CREATE_VARS_IS_FUNCTION_ARGS) && !SCANNER_STREAM_TYPE_IS_ARG_FUNC (type))
{
/* Function arguments must come first. */
break;
@@ -2557,8 +2514,8 @@ scanner_create_variables (parser_context_t *context_p, /**< context */
literal.length = data_p[1];
literal.type = LEXER_IDENT_LITERAL;
- literal.status_flags = ((data_p[0] & SCANNER_STREAM_HAS_ESCAPE) ? LEXER_LIT_LOCATION_HAS_ESCAPE
- : LEXER_LIT_LOCATION_NO_OPTS);
+ literal.status_flags =
+ ((data_p[0] & SCANNER_STREAM_HAS_ESCAPE) ? LEXER_LIT_LOCATION_HAS_ESCAPE : LEXER_LIT_LOCATION_NO_OPTS);
lexer_construct_literal_object (context_p, &literal, LEXER_NEW_IDENT_LITERAL);
literal.char_p += data_p[1];
@@ -2625,8 +2582,7 @@ scanner_create_variables (parser_context_t *context_p, /**< context */
uint16_t map_to;
uint16_t func_init_opcode = CBC_INIT_ARG_OR_FUNC;
- if (!(data_p[0] & SCANNER_STREAM_NO_REG)
- && scope_stack_reg_top < PARSER_MAXIMUM_NUMBER_OF_REGISTERS)
+ if (!(data_p[0] & SCANNER_STREAM_NO_REG) && scope_stack_reg_top < PARSER_MAXIMUM_NUMBER_OF_REGISTERS)
{
map_to = (uint16_t) (PARSER_REGISTER_START + scope_stack_reg_top);
@@ -2736,8 +2692,7 @@ scanner_create_variables (parser_context_t *context_p, /**< context */
}
default:
{
- JERRY_ASSERT (type == SCANNER_STREAM_TYPE_LOCAL
- || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG
+ JERRY_ASSERT (type == SCANNER_STREAM_TYPE_LOCAL || type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG
|| type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_VAR
|| type == SCANNER_STREAM_TYPE_DESTRUCTURED_ARG_FUNC);
@@ -2746,8 +2701,7 @@ scanner_create_variables (parser_context_t *context_p, /**< context */
}
}
#else /* !JERRY_ESNEXT */
- uint16_t opcode = ((option_flags & SCANNER_CREATE_VARS_IS_SCRIPT) ? CBC_CREATE_VAR_EVAL
- : CBC_CREATE_VAR);
+ uint16_t opcode = ((option_flags & SCANNER_CREATE_VARS_IS_SCRIPT) ? CBC_CREATE_VAR_EVAL : CBC_CREATE_VAR);
#endif /* JERRY_ESNEXT */
parser_emit_cbc_literal (context_p, opcode, map_to);
@@ -2932,9 +2886,8 @@ scanner_save_literal (parser_context_t *context_p, /**< context */
/* Registers must be found in the scope stack. */
JERRY_ASSERT (scope_stack_p > context_p->scope_stack_p);
scope_stack_p--;
- }
- while (scope_stack_p->map_from == PARSER_SCOPE_STACK_FUNC
- || literal_index != (scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK));
+ } while (scope_stack_p->map_from == PARSER_SCOPE_STACK_FUNC
+ || literal_index != (scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK));
literal_index = scope_stack_p->map_from;
PARSER_GET_LITERAL (literal_index)->status_flags |= LEXER_FLAG_USED;
@@ -2967,9 +2920,8 @@ scanner_literal_is_const_reg (parser_context_t *context_p, /**< context */
/* Registers must be found in the scope stack. */
JERRY_ASSERT (scope_stack_p > context_p->scope_stack_p);
scope_stack_p--;
- }
- while (scope_stack_p->map_from == PARSER_SCOPE_STACK_FUNC
- || literal_index != (scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK));
+ } while (scope_stack_p->map_from == PARSER_SCOPE_STACK_FUNC
+ || literal_index != (scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK));
return (scope_stack_p->map_to & PARSER_SCOPE_STACK_IS_CONST_REG) != 0;
} /* scanner_literal_is_const_reg */
@@ -2992,8 +2944,7 @@ scanner_literal_is_created (parser_context_t *context_p, /**< context */
/* These literals must be found in the scope stack. */
JERRY_ASSERT (scope_stack_p > context_p->scope_stack_p);
scope_stack_p--;
- }
- while (literal_index != scope_stack_p->map_from);
+ } while (literal_index != scope_stack_p->map_from);
JERRY_ASSERT ((scope_stack_p->map_to & PARSER_SCOPE_STACK_REGISTER_MASK) == 0);
@@ -3015,8 +2966,7 @@ scanner_literal_exists (parser_context_t *context_p, /**< context */
while (scope_stack_p-- > context_p->scope_stack_p)
{
- if (scope_stack_p->map_from != PARSER_SCOPE_STACK_FUNC
- && scanner_decode_map_to (scope_stack_p) == literal_index)
+ if (scope_stack_p->map_from != PARSER_SCOPE_STACK_FUNC && scanner_decode_map_to (scope_stack_p) == literal_index)
{
return true;
}
diff --git a/jerry-core/parser/js/js-scanner.c b/jerry-core/parser/js/js-scanner.c
index 0a552432..e1f14021 100644
--- a/jerry-core/parser/js/js-scanner.c
+++ b/jerry-core/parser/js/js-scanner.c
@@ -44,24 +44,22 @@ typedef enum
*/
#if JERRY_ESNEXT
#define SCANNER_IDENTIFIER_IS_OF() (lexer_token_is_identifier (context_p, "of", 2))
-#else
+#else /* !JERRY_ESNEXT */
#define SCANNER_IDENTIFIER_IS_OF() (false)
#endif /* JERRY_ESNEXT */
#if JERRY_ESNEXT
JERRY_STATIC_ASSERT (SCANNER_FROM_LITERAL_POOL_TO_COMPUTED (SCANNER_LITERAL_POOL_GENERATOR)
- == SCAN_STACK_COMPUTED_GENERATOR,
+ == SCAN_STACK_COMPUTED_GENERATOR,
scanner_invalid_conversion_from_literal_pool_generator_to_computed_generator);
-JERRY_STATIC_ASSERT (SCANNER_FROM_LITERAL_POOL_TO_COMPUTED (SCANNER_LITERAL_POOL_ASYNC)
- == SCAN_STACK_COMPUTED_ASYNC,
+JERRY_STATIC_ASSERT (SCANNER_FROM_LITERAL_POOL_TO_COMPUTED (SCANNER_LITERAL_POOL_ASYNC) == SCAN_STACK_COMPUTED_ASYNC,
scanner_invalid_conversion_from_literal_pool_async_to_computed_async);
JERRY_STATIC_ASSERT (SCANNER_FROM_COMPUTED_TO_LITERAL_POOL (SCAN_STACK_COMPUTED_GENERATOR)
- == SCANNER_LITERAL_POOL_GENERATOR,
+ == SCANNER_LITERAL_POOL_GENERATOR,
scanner_invalid_conversion_from_computed_generator_to_literal_pool_generator);
-JERRY_STATIC_ASSERT (SCANNER_FROM_COMPUTED_TO_LITERAL_POOL (SCAN_STACK_COMPUTED_ASYNC)
- == SCANNER_LITERAL_POOL_ASYNC,
+JERRY_STATIC_ASSERT (SCANNER_FROM_COMPUTED_TO_LITERAL_POOL (SCAN_STACK_COMPUTED_ASYNC) == SCANNER_LITERAL_POOL_ASYNC,
scanner_invalid_conversion_from_computed_async_to_literal_pool_async);
#endif /* JERRY_ESNEXT */
@@ -121,8 +119,7 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
lexer_next_token (context_p);
- if (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
+ if (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
#if JERRY_MODULE_SYSTEM
if (is_export_default)
@@ -198,8 +195,7 @@ scanner_scan_primary_expression (parser_context_t *context_p, /**< context */
#if JERRY_ESNEXT
const uint8_t *source_p = context_p->source_p;
- if (context_p->token.lit_location.type == LEXER_IDENT_LITERAL
- && lexer_check_arrow (context_p))
+ if (context_p->token.lit_location.type == LEXER_IDENT_LITERAL && lexer_check_arrow (context_p))
{
scanner_scan_simple_arrow (context_p, scanner_context_p, source_p);
return SCAN_KEEP_TOKEN;
@@ -372,8 +368,7 @@ scanner_scan_post_primary_expression (parser_context_t *context_p, /**< context
{
lexer_scan_identifier (context_p);
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -434,8 +429,7 @@ scanner_scan_post_primary_expression (parser_context_t *context_p, /**< context
}
}
- if (LEXER_IS_BINARY_OP_TOKEN (type)
- && (type != LEXER_KEYW_IN || !SCANNER_IS_FOR_START (stack_top)))
+ if (LEXER_IS_BINARY_OP_TOKEN (type) && (type != LEXER_KEYW_IN || !SCANNER_IS_FOR_START (stack_top)))
{
scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;
return true;
@@ -629,8 +623,7 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_ARRAY_LITERAL
|| context_p->stack_top_uint8 == SCAN_STACK_OBJECT_LITERAL
- || context_p->stack_top_uint8 == SCAN_STACK_LET
- || context_p->stack_top_uint8 == SCAN_STACK_CONST
+ || context_p->stack_top_uint8 == SCAN_STACK_LET || context_p->stack_top_uint8 == SCAN_STACK_CONST
|| context_p->stack_top_uint8 == SCAN_STACK_FOR_LET_START
|| context_p->stack_top_uint8 == SCAN_STACK_FOR_CONST_START
|| context_p->stack_top_uint8 == SCAN_STACK_FUNCTION_PARAMETERS
@@ -660,8 +653,7 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_ARRAY_LITERAL
|| context_p->stack_top_uint8 == SCAN_STACK_OBJECT_LITERAL
- || context_p->stack_top_uint8 == SCAN_STACK_LET
- || context_p->stack_top_uint8 == SCAN_STACK_CONST
+ || context_p->stack_top_uint8 == SCAN_STACK_LET || context_p->stack_top_uint8 == SCAN_STACK_CONST
|| context_p->stack_top_uint8 == SCAN_STACK_FOR_LET_START
|| context_p->stack_top_uint8 == SCAN_STACK_FOR_CONST_START
|| context_p->stack_top_uint8 == SCAN_STACK_FUNCTION_PARAMETERS
@@ -773,9 +765,8 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
parser_stack_pop (context_p, &for_statement, sizeof (scanner_for_statement_t));
scanner_for_info_t *for_info_p;
- for_info_p = (scanner_for_info_t *) scanner_insert_info (context_p,
- for_statement.u.source_p,
- sizeof (scanner_for_info_t));
+ for_info_p =
+ (scanner_for_info_t *) scanner_insert_info (context_p, for_statement.u.source_p, sizeof (scanner_for_info_t));
for_info_p->info.type = SCANNER_TYPE_FOR;
scanner_get_location (&for_info_p->expression_location, context_p);
@@ -841,17 +832,15 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
parser_stack_push_uint8 (context_p, SCAN_STACK_SWITCH_BLOCK);
scanner_switch_info_t *switch_info_p;
- switch_info_p = (scanner_switch_info_t *) scanner_insert_info (context_p,
- context_p->source_p,
- sizeof (scanner_switch_info_t));
+ switch_info_p =
+ (scanner_switch_info_t *) scanner_insert_info (context_p, context_p->source_p, sizeof (scanner_switch_info_t));
switch_info_p->info.type = SCANNER_TYPE_SWITCH;
switch_info_p->case_p = NULL;
scanner_context_p->active_switch_statement.last_case_p = &switch_info_p->case_p;
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_RIGHT_BRACE
- && context_p->token.type != LEXER_KEYW_CASE
+ if (context_p->token.type != LEXER_RIGHT_BRACE && context_p->token.type != LEXER_KEYW_CASE
&& context_p->token.type != LEXER_KEYW_DEFAULT)
{
break;
@@ -978,10 +967,8 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
#if JERRY_ESNEXT
if ((stack_top == SCAN_STACK_ARRAY_LITERAL || stack_top == SCAN_STACK_OBJECT_LITERAL)
&& (binding_type == SCANNER_BINDING_NONE || binding_type == SCANNER_BINDING_ARROW_ARG)
- && context_p->token.type != LEXER_EOS
- && context_p->token.type != LEXER_COMMA
- && context_p->token.type != LEXER_RIGHT_BRACE
- && context_p->token.type != LEXER_RIGHT_SQUARE)
+ && context_p->token.type != LEXER_EOS && context_p->token.type != LEXER_COMMA
+ && context_p->token.type != LEXER_RIGHT_BRACE && context_p->token.type != LEXER_RIGHT_SQUARE)
{
object_literal_flags |= SCANNER_LITERAL_NO_DESTRUCTURING;
}
@@ -1066,8 +1053,7 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
return SCAN_KEEP_TOKEN;
}
- if (stack_top == SCAN_STACK_EXPLICIT_CLASS_CONSTRUCTOR
- || stack_top == SCAN_STACK_IMPLICIT_CLASS_CONSTRUCTOR)
+ if (stack_top == SCAN_STACK_EXPLICIT_CLASS_CONSTRUCTOR || stack_top == SCAN_STACK_IMPLICIT_CLASS_CONSTRUCTOR)
{
JERRY_ASSERT (scanner_context_p->active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_CLASS_NAME);
@@ -1086,8 +1072,8 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
return SCAN_NEXT_TOKEN;
}
- scanner_context_p->mode = (context_p->token.type != LEXER_SEMICOLON ? SCAN_MODE_CLASS_BODY_NO_SCAN
- : SCAN_MODE_CLASS_BODY);
+ scanner_context_p->mode =
+ (context_p->token.type != LEXER_SEMICOLON ? SCAN_MODE_CLASS_BODY_NO_SCAN : SCAN_MODE_CLASS_BODY);
return SCAN_KEEP_TOKEN;
}
@@ -1130,8 +1116,7 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
JERRY_ASSERT (context_p->stack_top_uint8 == SCAN_STACK_OBJECT_LITERAL
|| context_p->stack_top_uint8 == SCAN_STACK_FUNCTION_PROPERTY);
- uint16_t status_flags = (uint16_t) (SCANNER_LITERAL_POOL_FUNCTION
- | SCANNER_LITERAL_POOL_GENERATOR
+ uint16_t status_flags = (uint16_t) (SCANNER_LITERAL_POOL_FUNCTION | SCANNER_LITERAL_POOL_GENERATOR
| SCANNER_FROM_COMPUTED_TO_LITERAL_POOL (stack_top));
scanner_push_literal_pool (context_p, scanner_context_p, status_flags);
@@ -1271,8 +1256,7 @@ scanner_scan_primary_expression_end (parser_context_t *context_p, /**< context *
{
parser_stack_pop_uint8 (context_p);
- if (type != LEXER_RIGHT_PAREN
- && (type != LEXER_EOS || context_p->stack_top_uint8 != SCAN_STACK_SCRIPT_FUNCTION))
+ if (type != LEXER_RIGHT_PAREN && (type != LEXER_EOS || context_p->stack_top_uint8 != SCAN_STACK_SCRIPT_FUNCTION))
{
break;
}
@@ -1471,8 +1455,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
type = (lexer_token_type_t) context_p->token.type;
- if (type != LEXER_LEFT_SQUARE
- && type != LEXER_LEFT_BRACE
+ if (type != LEXER_LEFT_SQUARE && type != LEXER_LEFT_BRACE
&& (type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL))
{
scanner_info_t *info_p = scanner_insert_info (context_p, source_p, sizeof (scanner_info_t));
@@ -1498,8 +1481,8 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
return_type = SCAN_NEXT_TOKEN;
}
- stack_mode = ((context_p->token.type == LEXER_KEYW_CONST) ? SCAN_STACK_FOR_CONST_START
- : SCAN_STACK_FOR_LET_START);
+ stack_mode =
+ ((context_p->token.type == LEXER_KEYW_CONST) ? SCAN_STACK_FOR_CONST_START : SCAN_STACK_FOR_LET_START);
break;
}
#endif /* JERRY_ESNEXT */
@@ -1538,10 +1521,8 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
{
lexer_next_token (context_p);
- if (!(context_p->token.flags & LEXER_WAS_NEWLINE)
- && context_p->token.type != LEXER_SEMICOLON
- && context_p->token.type != LEXER_EOS
- && context_p->token.type != LEXER_RIGHT_BRACE)
+ if (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->token.type != LEXER_SEMICOLON
+ && context_p->token.type != LEXER_EOS && context_p->token.type != LEXER_RIGHT_BRACE)
{
scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;
return SCAN_KEEP_TOKEN;
@@ -1556,8 +1537,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
lexer_next_token (context_p);
scanner_context_p->mode = SCAN_MODE_STATEMENT_END;
- if (!(context_p->token.flags & LEXER_WAS_NEWLINE)
- && context_p->token.type == LEXER_LITERAL
+ if (!(context_p->token.flags & LEXER_WAS_NEWLINE) && context_p->token.type == LEXER_LITERAL
&& context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
return SCAN_NEXT_TOKEN;
@@ -1625,8 +1605,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
}
#endif /* JERRY_ESNEXT */
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -1654,7 +1633,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
literal_p->type |= SCANNER_LITERAL_IS_LOCAL_FUNC;
scanner_context_p->status_flags &= (uint16_t) ~SCANNER_CONTEXT_THROW_ERR_ASYNC_FUNCTION;
-#else
+#else /* !JERRY_ESNEXT */
literal_p->type |= SCANNER_LITERAL_IS_VAR | SCANNER_LITERAL_IS_FUNC;
uint16_t status_flags = SCANNER_LITERAL_POOL_FUNCTION;
@@ -1721,16 +1700,14 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
scanner_context_p->mode = SCAN_MODE_STATEMENT_END;
- if (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_STRING_LITERAL)
+ if (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL)
{
return SCAN_NEXT_TOKEN;
}
bool parse_imports = true;
- if (context_p->token.type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
+ if (context_p->token.type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
lexer_lit_location_t *literal_p = scanner_add_literal (context_p, scanner_context_p);
@@ -1761,8 +1738,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -1780,8 +1756,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
while (context_p->token.type != LEXER_RIGHT_BRACE)
{
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -1799,8 +1774,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -1810,9 +1784,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
lexer_lit_location_t *literal_p = scanner_add_literal (context_p, scanner_context_p);
- if (literal_p->type & (SCANNER_LITERAL_IS_ARG
- | SCANNER_LITERAL_IS_VAR
- | SCANNER_LITERAL_IS_LOCAL))
+ if (literal_p->type & (SCANNER_LITERAL_IS_ARG | SCANNER_LITERAL_IS_VAR | SCANNER_LITERAL_IS_LOCAL))
{
context_p->source_p = source_p;
scanner_raise_redeclaration_error (context_p);
@@ -1853,8 +1825,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- && context_p->token.lit_location.type != LEXER_STRING_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type != LEXER_STRING_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -1888,8 +1859,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
{
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -1904,8 +1874,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_STRING_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -1922,8 +1891,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
while (context_p->token.type != LEXER_RIGHT_BRACE)
{
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -1934,8 +1902,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
{
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -1966,8 +1933,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
lexer_next_token (context_p);
- if (context_p->token.type != LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_STRING_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL && context_p->token.lit_location.type == LEXER_STRING_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -1999,8 +1965,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
scanner_context_p->mode = SCAN_MODE_PRIMARY_EXPRESSION;
- if (type == LEXER_LITERAL
- && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
+ if (type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL)
{
if (JERRY_UNLIKELY (lexer_check_next_character (context_p, LIT_CHAR_COLON)))
{
@@ -2029,8 +1994,7 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
type = (lexer_token_type_t) context_p->token.type;
- if (type == LEXER_LEFT_SQUARE
- || type == LEXER_LEFT_BRACE
+ if (type == LEXER_LEFT_SQUARE || type == LEXER_LEFT_BRACE
|| (type == LEXER_LITERAL && context_p->token.lit_location.type == LEXER_IDENT_LITERAL))
{
scanner_context_p->mode = SCAN_MODE_VAR_STATEMENT;
@@ -2041,9 +2005,8 @@ scanner_scan_statement (parser_context_t *context_p, /**< context */
scanner_info_t *info_p = scanner_insert_info (context_p, source_p, sizeof (scanner_info_t));
info_p->type = SCANNER_TYPE_LET_EXPRESSION;
- lexer_lit_location_t *lit_location_p = scanner_add_custom_literal (context_p,
- scanner_context_p->active_literal_pool_p,
- &let_literal);
+ lexer_lit_location_t *lit_location_p =
+ scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p, &let_literal);
lit_location_p->type |= SCANNER_LITERAL_IS_USED;
if (scanner_context_p->active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_WITH)
@@ -2180,8 +2143,8 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */
}
#if JERRY_ESNEXT
- bool has_super_reference = (scanner_context_p->active_literal_pool_p->status_flags
- & SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE) != 0;
+ bool has_super_reference =
+ (scanner_context_p->active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_HAS_SUPER_REFERENCE) != 0;
#endif /* JERRY_ESNEXT */
scanner_pop_literal_pool (context_p, scanner_context_p);
parser_stack_pop_uint8 (context_p);
@@ -2244,8 +2207,7 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */
{
parser_stack_pop_uint8 (context_p);
- if (type == LEXER_KEYW_ELSE
- && (terminator_found || (context_p->token.flags & LEXER_WAS_NEWLINE)))
+ if (type == LEXER_KEYW_ELSE && (terminator_found || (context_p->token.flags & LEXER_WAS_NEWLINE)))
{
#if JERRY_ESNEXT
scanner_check_function_after_if (context_p, scanner_context_p);
@@ -2277,8 +2239,7 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */
{
parser_stack_pop_uint8 (context_p);
- if (type != LEXER_KEYW_WHILE
- || (!terminator_found && !(context_p->token.flags & LEXER_WAS_NEWLINE)))
+ if (type != LEXER_KEYW_WHILE || (!terminator_found && !(context_p->token.flags & LEXER_WAS_NEWLINE)))
{
scanner_raise_error (context_p);
}
@@ -2328,9 +2289,8 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */
case SCAN_STACK_EXPORT_DEFAULT:
{
parser_stack_pop_uint8 (context_p);
- lexer_lit_location_t *location_p = scanner_add_custom_literal (context_p,
- scanner_context_p->active_literal_pool_p,
- &lexer_default_literal);
+ lexer_lit_location_t *location_p =
+ scanner_add_custom_literal (context_p, scanner_context_p->active_literal_pool_p, &lexer_default_literal);
location_p->type |= SCANNER_LITERAL_IS_VAR;
continue;
}
@@ -2432,8 +2392,7 @@ scanner_scan_statement_end (parser_context_t *context_p, /**< context */
}
#endif /* JERRY_ESNEXT */
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -2519,9 +2478,8 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
context_p->source_p = context_p->source_start_p;
context_p->source_end_p = context_p->source_start_p + context_p->source_size;
- uint16_t status_flags = (SCANNER_LITERAL_POOL_FUNCTION
- | SCANNER_LITERAL_POOL_NO_ARGUMENTS
- | SCANNER_LITERAL_POOL_CAN_EVAL);
+ uint16_t status_flags =
+ (SCANNER_LITERAL_POOL_FUNCTION | SCANNER_LITERAL_POOL_NO_ARGUMENTS | SCANNER_LITERAL_POOL_CAN_EVAL);
if (context_p->status_flags & PARSER_IS_STRICT)
{
@@ -2576,9 +2534,7 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
{
case SCAN_MODE_PRIMARY_EXPRESSION:
{
- if (type == LEXER_ADD
- || type == LEXER_SUBTRACT
- || LEXER_IS_UNARY_OP_TOKEN (type))
+ if (type == LEXER_ADD || type == LEXER_SUBTRACT || LEXER_IS_UNARY_OP_TOKEN (type))
{
break;
}
@@ -2654,8 +2610,7 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
bool identifier_found = false;
- if (context_p->token.type == LEXER_LITERAL
- && LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type)
+ if (context_p->token.type == LEXER_LITERAL && LEXER_IS_IDENT_OR_STRING (context_p->token.lit_location.type)
&& lexer_compare_literal_to_string (context_p, "constructor", 11))
{
if (stack_top == SCAN_STACK_IMPLICIT_CLASS_CONSTRUCTOR)
@@ -2677,8 +2632,7 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
uint16_t literal_pool_flags = SCANNER_LITERAL_POOL_FUNCTION;
- if (lexer_token_is_identifier (context_p, "get", 3)
- || lexer_token_is_identifier (context_p, "set", 3))
+ if (lexer_token_is_identifier (context_p, "get", 3) || lexer_token_is_identifier (context_p, "set", 3))
{
lexer_scan_identifier (context_p);
identifier_found = true;
@@ -2771,8 +2725,7 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
continue;
}
- if (context_p->token.type != LEXER_RIGHT_BRACE
- && !(context_p->token.flags & LEXER_WAS_NEWLINE))
+ if (context_p->token.type != LEXER_RIGHT_BRACE && !(context_p->token.flags & LEXER_WAS_NEWLINE))
{
scanner_raise_error (context_p);
}
@@ -2861,8 +2814,7 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
}
#endif /* JERRY_ESNEXT */
- if (type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -2952,8 +2904,7 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
JERRY_ASSERT (!(scanner_context.active_literal_pool_p->status_flags & SCANNER_LITERAL_POOL_IN_EXPORT));
#endif /* JERRY_MODULE_SYSTEM */
- if (context_p->token.type != LEXER_SEMICOLON
- && context_p->token.type != LEXER_KEYW_IN
+ if (context_p->token.type != LEXER_SEMICOLON && context_p->token.type != LEXER_KEYW_IN
&& !SCANNER_IDENTIFIER_IS_OF ())
{
scanner_raise_error (context_p);
@@ -2979,10 +2930,8 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
}
case SCAN_MODE_FUNCTION_ARGUMENTS:
{
- JERRY_ASSERT (stack_top == SCAN_STACK_SCRIPT_FUNCTION
- || stack_top == SCAN_STACK_FUNCTION_STATEMENT
- || stack_top == SCAN_STACK_FUNCTION_EXPRESSION
- || stack_top == SCAN_STACK_FUNCTION_PROPERTY);
+ JERRY_ASSERT (stack_top == SCAN_STACK_SCRIPT_FUNCTION || stack_top == SCAN_STACK_FUNCTION_STATEMENT
+ || stack_top == SCAN_STACK_FUNCTION_EXPRESSION || stack_top == SCAN_STACK_FUNCTION_PROPERTY);
scanner_literal_pool_t *literal_pool_p = scanner_context.active_literal_pool_p;
@@ -3028,8 +2977,7 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
break;
}
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -3043,8 +2991,7 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
}
lexer_next_token (context_p);
- }
- while (context_p->token.type != LEXER_RIGHT_PAREN && context_p->token.type != LEXER_EOS);
+ } while (context_p->token.type != LEXER_RIGHT_PAREN && context_p->token.type != LEXER_EOS);
if (argument_literal_p == NULL)
{
@@ -3093,8 +3040,7 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
{
while (true)
{
- if (context_p->token.type != LEXER_LITERAL
- || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
+ if (context_p->token.type != LEXER_LITERAL || context_p->token.lit_location.type != LEXER_IDENT_LITERAL)
{
scanner_raise_error (context_p);
}
@@ -3191,8 +3137,7 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
if (context_p->token.type == LEXER_PROPERTY_GETTER
#if JERRY_ESNEXT
- || context_p->token.type == LEXER_KEYW_ASYNC
- || context_p->token.type == LEXER_MULTIPLY
+ || context_p->token.type == LEXER_KEYW_ASYNC || context_p->token.type == LEXER_MULTIPLY
#endif /* JERRY_ESNEXT */
|| context_p->token.type == LEXER_PROPERTY_SETTER)
{
@@ -3260,8 +3205,7 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
}
if (is_ident
- && (context_p->token.type == LEXER_COMMA
- || context_p->token.type == LEXER_RIGHT_BRACE
+ && (context_p->token.type == LEXER_COMMA || context_p->token.type == LEXER_RIGHT_BRACE
|| context_p->token.type == LEXER_ASSIGN))
{
context_p->source_p = context_p->token.lit_location.char_p;
@@ -3444,9 +3388,8 @@ scanner_scan_all (parser_context_t *context_p) /**< context */
lexer_next_token (context_p);
}
-scan_completed:
- if (context_p->stack_top_uint8 != SCAN_STACK_SCRIPT
- && context_p->stack_top_uint8 != SCAN_STACK_SCRIPT_FUNCTION)
+ scan_completed:
+ if (context_p->stack_top_uint8 != SCAN_STACK_SCRIPT && context_p->stack_top_uint8 != SCAN_STACK_SCRIPT_FUNCTION)
{
scanner_raise_error (context_p);
}
@@ -3532,8 +3475,8 @@ scan_completed:
if (context_p->is_show_opcodes)
{
scanner_info_t *info_p = context_p->next_scanner_info_p;
- const uint8_t *source_start_p = (context_p->arguments_start_p == NULL ? context_p->source_start_p
- : context_p->arguments_start_p);
+ const uint8_t *source_start_p =
+ (context_p->arguments_start_p == NULL ? context_p->source_start_p : context_p->arguments_start_p);
while (info_p->type != SCANNER_TYPE_END)
{
@@ -3558,9 +3501,7 @@ scan_completed:
{
data_p = (const uint8_t *) (info_p + 1);
- JERRY_DEBUG_MSG (" FUNCTION: flags: 0x%x declarations: %d",
- (int) info_p->u8_arg,
- (int) info_p->u16_arg);
+ JERRY_DEBUG_MSG (" FUNCTION: flags: 0x%x declarations: %d", (int) info_p->u8_arg, (int) info_p->u16_arg);
}
else
{
@@ -3601,8 +3542,7 @@ scan_completed:
#else /* !JERRY_ESNEXT */
case SCANNER_STREAM_TYPE_ARGUMENTS:
{
- JERRY_DEBUG_MSG (" ARGUMENTS%s\n",
- (data_p[0] & SCANNER_STREAM_NO_REG) ? " *" : "");
+ JERRY_DEBUG_MSG (" ARGUMENTS%s\n", (data_p[0] & SCANNER_STREAM_NO_REG) ? " *" : "");
data_p++;
continue;
}
@@ -3765,8 +3705,7 @@ scan_completed:
#endif /* JERRY_ESNEXT */
case SCANNER_TYPE_SWITCH:
{
- JERRY_DEBUG_MSG (" SWITCH: source:%d\n",
- (int) (info_p->source_p - source_start_p));
+ JERRY_DEBUG_MSG (" SWITCH: source:%d\n", (int) (info_p->source_p - source_start_p));
scanner_case_info_t *current_case_p = ((scanner_switch_info_t *) info_p)->case_p;
@@ -3801,8 +3740,7 @@ scan_completed:
}
case SCANNER_TYPE_CLASS_CONSTRUCTOR:
{
- JERRY_DEBUG_MSG (" CLASS_CONSTRUCTOR: source:%d\n",
- (int) (info_p->source_p - source_start_p));
+ JERRY_DEBUG_MSG (" CLASS_CONSTRUCTOR: source:%d\n", (int) (info_p->source_p - source_start_p));
print_location = false;
break;
}
@@ -3814,20 +3752,17 @@ scan_completed:
}
case SCANNER_TYPE_LET_EXPRESSION:
{
- JERRY_DEBUG_MSG (" LET_EXPRESSION: source:%d\n",
- (int) (info_p->source_p - source_start_p));
+ JERRY_DEBUG_MSG (" LET_EXPRESSION: source:%d\n", (int) (info_p->source_p - source_start_p));
break;
}
case SCANNER_TYPE_ERR_REDECLARED:
{
- JERRY_DEBUG_MSG (" ERR_REDECLARED: source:%d\n",
- (int) (info_p->source_p - source_start_p));
+ JERRY_DEBUG_MSG (" ERR_REDECLARED: source:%d\n", (int) (info_p->source_p - source_start_p));
break;
}
case SCANNER_TYPE_ERR_ASYNC_FUNCTION:
{
- JERRY_DEBUG_MSG (" ERR_ASYNC_FUNCTION: source:%d\n",
- (int) (info_p->source_p - source_start_p));
+ JERRY_DEBUG_MSG (" ERR_ASYNC_FUNCTION: source:%d\n", (int) (info_p->source_p - source_start_p));
break;
}
case SCANNER_TYPE_LITERAL_FLAGS:
@@ -3840,8 +3775,7 @@ scan_completed:
}
case SCANNER_TYPE_EXPORT_MODULE_SPECIFIER:
{
- JERRY_DEBUG_MSG (" EXPORT_WITH_MODULE_SPECIFIER: source:%d\n",
- (int) (info_p->source_p - source_start_p));
+ JERRY_DEBUG_MSG (" EXPORT_WITH_MODULE_SPECIFIER: source:%d\n", (int) (info_p->source_p - source_start_p));
print_location = false;
break;
}
diff --git a/jerry-core/parser/js/js-scanner.h b/jerry-core/parser/js/js-scanner.h
index 4f538e63..9513d099 100644
--- a/jerry-core/parser/js/js-scanner.h
+++ b/jerry-core/parser/js/js-scanner.h
@@ -229,18 +229,17 @@ typedef enum
/**
* Checks whether the decoded type represents a function argument.
*/
-#define SCANNER_STREAM_TYPE_IS_ARG(type) ((type) == SCANNER_STREAM_TYPE_ARG)
+#define SCANNER_STREAM_TYPE_IS_ARG(type) ((type) == SCANNER_STREAM_TYPE_ARG)
/**
* Checks whether the decoded type represents both a function argument and a function declaration.
*/
-#define SCANNER_STREAM_TYPE_IS_ARG_FUNC(type) ((type) == SCANNER_STREAM_TYPE_ARG_FUNC)
+#define SCANNER_STREAM_TYPE_IS_ARG_FUNC(type) ((type) == SCANNER_STREAM_TYPE_ARG_FUNC)
/**
* Checks whether the decoded type represents an arguments declaration
*/
-#define SCANNER_STREAM_TYPE_IS_ARGUMENTS(type) \
- ((type) == SCANNER_STREAM_TYPE_ARGUMENTS)
+#define SCANNER_STREAM_TYPE_IS_ARGUMENTS(type) ((type) == SCANNER_STREAM_TYPE_ARGUMENTS)
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/parser/regexp/re-bytecode.c b/jerry-core/parser/regexp/re-bytecode.c
index fe30029f..82b62ee6 100644
--- a/jerry-core/parser/regexp/re-bytecode.c
+++ b/jerry-core/parser/regexp/re-bytecode.c
@@ -13,10 +13,12 @@
* limitations under the License.
*/
+#include "re-bytecode.h"
+
#include "ecma-globals.h"
#include "ecma-regexp-object.h"
+
#include "lit-strings.h"
-#include "re-bytecode.h"
#if JERRY_BUILTIN_REGEXP
@@ -155,7 +157,7 @@ re_encode_u16 (uint8_t *dest_p, /**< destination */
*/
static void
re_encode_u32 (uint8_t *dest_p, /**< destination */
- const uint32_t value) /**< value */
+ const uint32_t value) /**< value */
{
*dest_p++ = (uint8_t) ((value >> 24) & 0xFF);
*dest_p++ = (uint8_t) ((value >> 16) & 0xFF);
@@ -368,7 +370,7 @@ re_get_bytecode_offset (const uint8_t *start_p, /**< bytecode start pointer */
void
re_dump_bytecode (re_compiler_ctx_t *re_ctx_p) /**< RegExp bytecode context */
{
- static const char escape_chars[] = {'d', 'D', 'w', 'W', 's', 'S'};
+ static const char escape_chars[] = { 'd', 'D', 'w', 'W', 's', 'S' };
re_compiled_code_t *compiled_code_p = (re_compiled_code_t *) re_ctx_p->bytecode_start_p;
JERRY_DEBUG_MSG ("Flags: 0x%x ", compiled_code_p->header.status_flags);
diff --git a/jerry-core/parser/regexp/re-bytecode.h b/jerry-core/parser/regexp/re-bytecode.h
index 942f6fdc..07028d6d 100644
--- a/jerry-core/parser/regexp/re-bytecode.h
+++ b/jerry-core/parser/regexp/re-bytecode.h
@@ -16,11 +16,12 @@
#ifndef RE_BYTECODE_H
#define RE_BYTECODE_H
-#if JERRY_BUILTIN_REGEXP
-
#include "ecma-globals.h"
+
#include "re-compiler-context.h"
+#if JERRY_BUILTIN_REGEXP
+
/** \addtogroup parser Parser
* @{
*
@@ -32,8 +33,8 @@
*/
/**
- * Size of the RegExp bytecode cache
- */
+ * Size of the RegExp bytecode cache
+ */
#define RE_CACHE_SIZE 8u
/**
@@ -51,42 +52,42 @@
*/
typedef enum
{
- RE_OP_EOF, /**< end of pattern */
+ RE_OP_EOF, /**< end of pattern */
- RE_OP_ALTERNATIVE_START, /**< start of alternatives */
- RE_OP_ALTERNATIVE_NEXT, /**< next alternative */
- RE_OP_NO_ALTERNATIVE, /**< no alternative */
+ RE_OP_ALTERNATIVE_START, /**< start of alternatives */
+ RE_OP_ALTERNATIVE_NEXT, /**< next alternative */
+ RE_OP_NO_ALTERNATIVE, /**< no alternative */
- RE_OP_CAPTURING_GROUP_START, /**< start of a capturing group */
- RE_OP_NON_CAPTURING_GROUP_START, /**< start of a non-capturing group */
+ RE_OP_CAPTURING_GROUP_START, /**< start of a capturing group */
+ RE_OP_NON_CAPTURING_GROUP_START, /**< start of a non-capturing group */
- RE_OP_GREEDY_CAPTURING_GROUP_END, /**< end of a greedy capturing group */
- RE_OP_GREEDY_NON_CAPTURING_GROUP_END, /**< end of a greedy non-capturing group */
- RE_OP_LAZY_CAPTURING_GROUP_END, /**< end of a lazy capturing group */
- RE_OP_LAZY_NON_CAPTURING_GROUP_END, /**< end of a lazy non-capturing group */
+ RE_OP_GREEDY_CAPTURING_GROUP_END, /**< end of a greedy capturing group */
+ RE_OP_GREEDY_NON_CAPTURING_GROUP_END, /**< end of a greedy non-capturing group */
+ RE_OP_LAZY_CAPTURING_GROUP_END, /**< end of a lazy capturing group */
+ RE_OP_LAZY_NON_CAPTURING_GROUP_END, /**< end of a lazy non-capturing group */
- RE_OP_GREEDY_ITERATOR, /**< greedy iterator */
- RE_OP_LAZY_ITERATOR, /**< lazy iterator */
- RE_OP_ITERATOR_END, /*** end of an iterator */
+ RE_OP_GREEDY_ITERATOR, /**< greedy iterator */
+ RE_OP_LAZY_ITERATOR, /**< lazy iterator */
+ RE_OP_ITERATOR_END, /*** end of an iterator */
- RE_OP_BACKREFERENCE, /**< backreference */
+ RE_OP_BACKREFERENCE, /**< backreference */
- RE_OP_ASSERT_LINE_START, /**< line start assertion */
- RE_OP_ASSERT_LINE_END, /**< line end assertion */
- RE_OP_ASSERT_WORD_BOUNDARY, /**< word boundary assertion */
- RE_OP_ASSERT_NOT_WORD_BOUNDARY, /**< not word boundary assertion */
- RE_OP_ASSERT_LOOKAHEAD_POS, /**< positive lookahead assertion */
- RE_OP_ASSERT_LOOKAHEAD_NEG, /**< negative lookahead assertion */
- RE_OP_ASSERT_END, /**< end of an assertion */
+ RE_OP_ASSERT_LINE_START, /**< line start assertion */
+ RE_OP_ASSERT_LINE_END, /**< line end assertion */
+ RE_OP_ASSERT_WORD_BOUNDARY, /**< word boundary assertion */
+ RE_OP_ASSERT_NOT_WORD_BOUNDARY, /**< not word boundary assertion */
+ RE_OP_ASSERT_LOOKAHEAD_POS, /**< positive lookahead assertion */
+ RE_OP_ASSERT_LOOKAHEAD_NEG, /**< negative lookahead assertion */
+ RE_OP_ASSERT_END, /**< end of an assertion */
- RE_OP_CLASS_ESCAPE, /**< class escape */
- RE_OP_CHAR_CLASS, /**< character class */
+ RE_OP_CLASS_ESCAPE, /**< class escape */
+ RE_OP_CHAR_CLASS, /**< character class */
#if JERRY_ESNEXT
- RE_OP_UNICODE_PERIOD, /**< period in full unicode mode */
+ RE_OP_UNICODE_PERIOD, /**< period in full unicode mode */
#endif /* JERRY_ESNEXT */
- RE_OP_PERIOD, /**< period in non-unicode mode */
- RE_OP_CHAR, /**< any code point */
- RE_OP_BYTE, /**< 1-byte utf8 character */
+ RE_OP_PERIOD, /**< period in non-unicode mode */
+ RE_OP_CHAR, /**< any code point */
+ RE_OP_BYTE, /**< 1-byte utf8 character */
} re_opcode_t;
/**
@@ -94,10 +95,10 @@ typedef enum
*/
typedef struct
{
- ecma_compiled_code_t header; /**< compiled code header */
- uint32_t captures_count; /**< number of capturing groups */
- uint32_t non_captures_count; /**< number of non-capturing groups */
- ecma_value_t source; /**< original RegExp pattern */
+ ecma_compiled_code_t header; /**< compiled code header */
+ uint32_t captures_count; /**< number of capturing groups */
+ uint32_t non_captures_count; /**< number of non-capturing groups */
+ ecma_value_t source; /**< original RegExp pattern */
} re_compiled_code_t;
void re_initialize_regexp_bytecode (re_compiler_ctx_t *re_ctx_p);
@@ -110,7 +111,7 @@ void re_append_value (re_compiler_ctx_t *re_ctx_p, const uint32_t value);
void re_insert_opcode (re_compiler_ctx_t *re_ctx_p, const uint32_t offset, const re_opcode_t opcode);
void re_insert_byte (re_compiler_ctx_t *re_ctx_p, const uint32_t offset, const uint8_t byte);
-void re_insert_char (re_compiler_ctx_t *re_ctx_p, const uint32_t offset, const lit_code_point_t cp);
+void re_insert_char (re_compiler_ctx_t *re_ctx_p, const uint32_t offset, const lit_code_point_t cp);
void re_insert_value (re_compiler_ctx_t *re_ctx_p, const uint32_t offset, const uint32_t value);
re_opcode_t re_get_opcode (const uint8_t **bc_p);
diff --git a/jerry-core/parser/regexp/re-compiler-context.h b/jerry-core/parser/regexp/re-compiler-context.h
index 72089106..b7dbb029 100644
--- a/jerry-core/parser/regexp/re-compiler-context.h
+++ b/jerry-core/parser/regexp/re-compiler-context.h
@@ -16,10 +16,10 @@
#ifndef RE_COMPILER_CONTEXT_H
#define RE_COMPILER_CONTEXT_H
-#if JERRY_BUILTIN_REGEXP
-
#include "re-token.h"
+#if JERRY_BUILTIN_REGEXP
+
/** \addtogroup parser Parser
* @{
*
@@ -36,18 +36,18 @@
typedef struct
{
const lit_utf8_byte_t *input_start_p; /**< start of input pattern */
- const lit_utf8_byte_t *input_curr_p; /**< current position in input pattern */
- const lit_utf8_byte_t *input_end_p; /**< end of input pattern */
+ const lit_utf8_byte_t *input_curr_p; /**< current position in input pattern */
+ const lit_utf8_byte_t *input_end_p; /**< end of input pattern */
- uint8_t *bytecode_start_p; /**< start of bytecode block */
- size_t bytecode_size; /**< size of bytecode */
+ uint8_t *bytecode_start_p; /**< start of bytecode block */
+ size_t bytecode_size; /**< size of bytecode */
- uint32_t captures_count; /**< number of capture groups */
- uint32_t non_captures_count; /**< number of non-capture groups */
+ uint32_t captures_count; /**< number of capture groups */
+ uint32_t non_captures_count; /**< number of non-capture groups */
- int groups_count; /**< number of groups */
- uint16_t flags; /**< RegExp flags */
- re_token_t token; /**< current token */
+ int groups_count; /**< number of groups */
+ uint16_t flags; /**< RegExp flags */
+ re_token_t token; /**< current token */
} re_compiler_ctx_t;
/**
diff --git a/jerry-core/parser/regexp/re-compiler.c b/jerry-core/parser/regexp/re-compiler.c
index 4073e60c..a495616b 100644
--- a/jerry-core/parser/regexp/re-compiler.c
+++ b/jerry-core/parser/regexp/re-compiler.c
@@ -13,15 +13,17 @@
* limitations under the License.
*/
+#include "re-compiler.h"
+
#include "ecma-exceptions.h"
#include "ecma-helpers.h"
#include "ecma-regexp-object.h"
-#include "lit-char-helpers.h"
+
#include "jcontext.h"
-#include "jrt-libc-includes.h"
#include "jmem.h"
+#include "jrt-libc-includes.h"
+#include "lit-char-helpers.h"
#include "re-bytecode.h"
-#include "re-compiler.h"
#include "re-compiler-context.h"
#include "re-parser.h"
@@ -140,9 +142,8 @@ re_compile_bytecode (ecma_string_t *pattern_str_p, /**< pattern */
/* Align bytecode size to JMEM_ALIGNMENT so that it can be stored in the bytecode header. */
const uint32_t final_size = JERRY_ALIGNUP (re_ctx.bytecode_size, JMEM_ALIGNMENT);
- re_compiled_code_t *re_compiled_code_p = (re_compiled_code_t *) jmem_heap_realloc_block (re_ctx.bytecode_start_p,
- re_ctx.bytecode_size,
- final_size);
+ re_compiled_code_t *re_compiled_code_p =
+ (re_compiled_code_t *) jmem_heap_realloc_block (re_ctx.bytecode_start_p, re_ctx.bytecode_size, final_size);
/* Bytecoded will be inserted into the cache and returned to the caller, so refcount is implicitly set to 2. */
re_compiled_code_p->header.refs = 2;
diff --git a/jerry-core/parser/regexp/re-compiler.h b/jerry-core/parser/regexp/re-compiler.h
index 06602c59..ace781ef 100644
--- a/jerry-core/parser/regexp/re-compiler.h
+++ b/jerry-core/parser/regexp/re-compiler.h
@@ -16,11 +16,12 @@
#ifndef RE_COMPILER_H
#define RE_COMPILER_H
-#if JERRY_BUILTIN_REGEXP
-
#include "ecma-globals.h"
+
#include "re-bytecode.h"
+#if JERRY_BUILTIN_REGEXP
+
/** \addtogroup parser Parser
* @{
*
@@ -31,8 +32,7 @@
* @{
*/
-re_compiled_code_t *
-re_compile_bytecode (ecma_string_t *pattern_str_p, uint16_t flags);
+re_compiled_code_t *re_compile_bytecode (ecma_string_t *pattern_str_p, uint16_t flags);
void re_cache_gc (void);
diff --git a/jerry-core/parser/regexp/re-parser.c b/jerry-core/parser/regexp/re-parser.c
index ac362c19..cd12aa56 100644
--- a/jerry-core/parser/regexp/re-parser.c
+++ b/jerry-core/parser/regexp/re-parser.c
@@ -13,13 +13,15 @@
* limitations under the License.
*/
+#include "re-parser.h"
+
#include "ecma-exceptions.h"
#include "ecma-globals.h"
+
#include "jcontext.h"
#include "jrt-libc-includes.h"
#include "lit-char-helpers.h"
#include "re-compiler.h"
-#include "re-parser.h"
#if JERRY_BUILTIN_REGEXP
@@ -42,7 +44,7 @@ static re_opcode_t
re_get_group_start_opcode (bool is_capturing) /**< is capturing group */
{
return (is_capturing) ? RE_OP_CAPTURING_GROUP_START : RE_OP_NON_CAPTURING_GROUP_START;
-} /* re_get_group_start_opcode*/
+} /* re_get_group_start_opcode */
/**
* Get the end opcode for the current group.
@@ -91,9 +93,7 @@ re_insert_into_group (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
if (qmin == 0)
{
- re_insert_value (re_ctx_p,
- group_start_offset,
- re_bytecode_size (re_ctx_p) - group_start_offset);
+ re_insert_value (re_ctx_p, group_start_offset, re_bytecode_size (re_ctx_p) - group_start_offset);
}
re_insert_value (re_ctx_p, group_start_offset, qmin);
@@ -174,8 +174,7 @@ re_insert_assertion_lookahead (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler
static void
re_parse_lazy_char (re_compiler_ctx_t *re_ctx_p) /**< RegExp parser context */
{
- if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p
- && *re_ctx_p->input_curr_p == LIT_CHAR_QUESTION)
+ if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p && *re_ctx_p->input_curr_p == LIT_CHAR_QUESTION)
{
re_ctx_p->input_curr_p++;
re_ctx_p->token.greedy = false;
@@ -198,14 +197,12 @@ re_parse_octal (re_compiler_ctx_t *re_ctx_p) /**< RegExp parser context */
uint32_t value = (uint32_t) (*re_ctx_p->input_curr_p++) - LIT_CHAR_0;
- if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p
- && lit_char_is_octal_digit (*re_ctx_p->input_curr_p))
+ if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p && lit_char_is_octal_digit (*re_ctx_p->input_curr_p))
{
value = value * 8 + (*re_ctx_p->input_curr_p++) - LIT_CHAR_0;
}
- if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p
- && lit_char_is_octal_digit (*re_ctx_p->input_curr_p))
+ if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p && lit_char_is_octal_digit (*re_ctx_p->input_curr_p))
{
const uint32_t new_value = value * 8 + (*re_ctx_p->input_curr_p) - LIT_CHAR_0;
@@ -381,9 +378,7 @@ re_count_groups (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context */
}
case LIT_CHAR_LEFT_PAREN:
{
- if (curr_p < re_ctx_p->input_end_p
- && *curr_p != LIT_CHAR_QUESTION
- && !is_char_class)
+ if (curr_p < re_ctx_p->input_end_p && *curr_p != LIT_CHAR_QUESTION && !is_char_class)
{
re_ctx_p->groups_count++;
}
@@ -403,20 +398,10 @@ re_count_groups (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context */
static bool
re_is_syntax_char (lit_code_point_t cp) /**< code point */
{
- return (cp == LIT_CHAR_CIRCUMFLEX
- || cp == LIT_CHAR_DOLLAR_SIGN
- || cp == LIT_CHAR_BACKSLASH
- || cp == LIT_CHAR_DOT
- || cp == LIT_CHAR_ASTERISK
- || cp == LIT_CHAR_PLUS
- || cp == LIT_CHAR_QUESTION
- || cp == LIT_CHAR_LEFT_PAREN
- || cp == LIT_CHAR_RIGHT_PAREN
- || cp == LIT_CHAR_LEFT_SQUARE
- || cp == LIT_CHAR_RIGHT_SQUARE
- || cp == LIT_CHAR_LEFT_BRACE
- || cp == LIT_CHAR_RIGHT_BRACE
- || cp == LIT_CHAR_VLINE);
+ return (cp == LIT_CHAR_CIRCUMFLEX || cp == LIT_CHAR_DOLLAR_SIGN || cp == LIT_CHAR_BACKSLASH || cp == LIT_CHAR_DOT
+ || cp == LIT_CHAR_ASTERISK || cp == LIT_CHAR_PLUS || cp == LIT_CHAR_QUESTION || cp == LIT_CHAR_LEFT_PAREN
+ || cp == LIT_CHAR_RIGHT_PAREN || cp == LIT_CHAR_LEFT_SQUARE || cp == LIT_CHAR_RIGHT_SQUARE
+ || cp == LIT_CHAR_LEFT_BRACE || cp == LIT_CHAR_RIGHT_BRACE || cp == LIT_CHAR_VLINE);
} /* re_is_syntax_char */
#endif /* JERRY_ESNEXT */
@@ -589,17 +574,15 @@ re_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context
re_ctx_p->input_curr_p += 4;
#if JERRY_ESNEXT
- if (re_ctx_p->flags & RE_FLAG_UNICODE
- && lit_is_code_point_utf16_high_surrogate (re_ctx_p->token.value)
- && re_ctx_p->input_curr_p + 6 <= re_ctx_p->input_end_p
- && re_ctx_p->input_curr_p[0] == '\\'
+ if (re_ctx_p->flags & RE_FLAG_UNICODE && lit_is_code_point_utf16_high_surrogate (re_ctx_p->token.value)
+ && re_ctx_p->input_curr_p + 6 <= re_ctx_p->input_end_p && re_ctx_p->input_curr_p[0] == '\\'
&& re_ctx_p->input_curr_p[1] == 'u')
{
hex_value = lit_char_hex_lookup (re_ctx_p->input_curr_p + 2, re_ctx_p->input_end_p, 4);
if (lit_is_code_point_utf16_low_surrogate (hex_value))
{
- re_ctx_p->token.value = lit_convert_surrogate_pair_to_code_point ((ecma_char_t) re_ctx_p->token.value,
- (ecma_char_t) hex_value);
+ re_ctx_p->token.value =
+ lit_convert_surrogate_pair_to_code_point ((ecma_char_t) re_ctx_p->token.value, (ecma_char_t) hex_value);
re_ctx_p->input_curr_p += 6;
}
}
@@ -611,8 +594,7 @@ re_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context
#if JERRY_ESNEXT
if (re_ctx_p->flags & RE_FLAG_UNICODE)
{
- if (re_ctx_p->input_curr_p + 1 < re_ctx_p->input_end_p
- && re_ctx_p->input_curr_p[0] == LIT_CHAR_LEFT_BRACE
+ if (re_ctx_p->input_curr_p + 1 < re_ctx_p->input_end_p && re_ctx_p->input_curr_p[0] == LIT_CHAR_LEFT_BRACE
&& lit_char_is_hex_digit (re_ctx_p->input_curr_p[1]))
{
lit_code_point_t cp = lit_char_hex_to_int (re_ctx_p->input_curr_p[1]);
@@ -648,9 +630,7 @@ re_parse_char_escape (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context
{
#if JERRY_ESNEXT
/* Must be '/', or one of SyntaxCharacter */
- if (re_ctx_p->flags & RE_FLAG_UNICODE
- && ch != LIT_CHAR_SLASH
- && !re_is_syntax_char (ch))
+ if (re_ctx_p->flags & RE_FLAG_UNICODE && ch != LIT_CHAR_SLASH && !re_is_syntax_char (ch))
{
return ecma_raise_syntax_error (ECMA_ERR_MSG ("Invalid escape"));
}
@@ -863,8 +843,7 @@ re_parse_next_token (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context *
re_ctx_p->token.value = ch;
#if JERRY_ESNEXT
- if (re_ctx_p->flags & RE_FLAG_UNICODE
- && lit_is_code_point_utf16_high_surrogate (ch)
+ if (re_ctx_p->flags & RE_FLAG_UNICODE && lit_is_code_point_utf16_high_surrogate (ch)
&& re_ctx_p->input_curr_p < re_ctx_p->input_end_p)
{
const ecma_char_t next = lit_cesu8_peek_next (re_ctx_p->input_curr_p);
@@ -908,8 +887,8 @@ re_class_add_range (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context */
*/
static void
re_class_add_char (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context */
- uint32_t class_offset, /**< character class bytecode offset*/
- lit_code_point_t cp) /**< code point */
+ uint32_t class_offset, /**< character class bytecode offset*/
+ lit_code_point_t cp) /**< code point */
{
if (re_ctx_p->flags & RE_FLAG_IGNORE_CASE)
{
@@ -935,7 +914,7 @@ re_class_add_char (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context */
static ecma_value_t
re_parse_char_class (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context */
{
- static const uint8_t escape_flags[] = {0x01, 0x02, 0x04, 0x08, 0x10, 0x20};
+ static const uint8_t escape_flags[] = { 0x01, 0x02, 0x04, 0x08, 0x10, 0x20 };
const uint32_t class_offset = re_bytecode_size (re_ctx_p);
uint8_t found_escape_flags = 0;
@@ -1002,13 +981,12 @@ re_parse_char_class (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context *
current = LIT_CHAR_MINUS;
}
#endif /* JERRY_ESNEXT */
- else if ((re_ctx_p->flags & RE_FLAG_UNICODE) == 0
- && *re_ctx_p->input_curr_p == LIT_CHAR_LOWERCASE_C
+ else if ((re_ctx_p->flags & RE_FLAG_UNICODE) == 0 && *re_ctx_p->input_curr_p == LIT_CHAR_LOWERCASE_C
&& re_ctx_p->input_curr_p + 1 < re_ctx_p->input_end_p
&& (lit_char_is_decimal_digit (*(re_ctx_p->input_curr_p + 1))
|| *(re_ctx_p->input_curr_p + 1) == LIT_CHAR_UNDERSCORE))
{
- current = ((uint8_t) *(re_ctx_p->input_curr_p + 1) % 32);
+ current = ((uint8_t) * (re_ctx_p->input_curr_p + 1) % 32);
re_ctx_p->input_curr_p += 2;
}
else
@@ -1081,8 +1059,7 @@ re_parse_char_class (re_compiler_ctx_t *re_ctx_p) /**< RegExp compiler context *
continue;
}
- if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p
- && *re_ctx_p->input_curr_p == LIT_CHAR_MINUS)
+ if (re_ctx_p->input_curr_p < re_ctx_p->input_end_p && *re_ctx_p->input_curr_p == LIT_CHAR_MINUS)
{
re_ctx_p->input_curr_p++;
start = current;
@@ -1215,8 +1192,9 @@ re_parse_alternative (re_compiler_ctx_t *re_ctx_p, /**< RegExp compiler context
case RE_TOK_ALTERNATIVE:
{
re_insert_value (re_ctx_p, alternative_offset, re_bytecode_size (re_ctx_p) - alternative_offset);
- re_insert_opcode (re_ctx_p, alternative_offset, first_alternative ? RE_OP_ALTERNATIVE_START
- : RE_OP_ALTERNATIVE_NEXT);
+ re_insert_opcode (re_ctx_p,
+ alternative_offset,
+ first_alternative ? RE_OP_ALTERNATIVE_START : RE_OP_ALTERNATIVE_NEXT);
alternative_offset = re_bytecode_size (re_ctx_p);
first_alternative = false;
diff --git a/jerry-core/parser/regexp/re-parser.h b/jerry-core/parser/regexp/re-parser.h
index 0c0ccfc9..0c28edc3 100644
--- a/jerry-core/parser/regexp/re-parser.h
+++ b/jerry-core/parser/regexp/re-parser.h
@@ -16,10 +16,10 @@
#ifndef RE_PARSER_H
#define RE_PARSER_H
-#if JERRY_BUILTIN_REGEXP
-
#include "re-compiler-context.h"
+#if JERRY_BUILTIN_REGEXP
+
/** \addtogroup parser Parser
* @{
*
diff --git a/jerry-core/parser/regexp/re-token.h b/jerry-core/parser/regexp/re-token.h
index a1df1c33..ad3b5dfe 100644
--- a/jerry-core/parser/regexp/re-token.h
+++ b/jerry-core/parser/regexp/re-token.h
@@ -16,6 +16,8 @@
#ifndef RE_TOKEN_H
#define RE_TOKEN_H
+#include "ecma-globals.h"
+
#if JERRY_BUILTIN_REGEXP
/** \addtogroup parser Parser
@@ -33,21 +35,21 @@
*/
typedef enum
{
- RE_TOK_EOF, /**< EOF */
- RE_TOK_BACKREFERENCE, /**< "\[0..9]" */
- RE_TOK_ALTERNATIVE, /**< "|" */
- RE_TOK_ASSERT_START, /**< "^" */
- RE_TOK_ASSERT_END, /**< "$" */
- RE_TOK_PERIOD, /**< "." */
- RE_TOK_START_CAPTURE_GROUP, /**< "(" */
- RE_TOK_START_NON_CAPTURE_GROUP, /**< "(?:" */
- RE_TOK_END_GROUP, /**< ")" */
- RE_TOK_ASSERT_LOOKAHEAD, /**< "(?=" */
- RE_TOK_ASSERT_WORD_BOUNDARY, /**< "\b" */
- RE_TOK_ASSERT_NOT_WORD_BOUNDARY, /**< "\B" */
- RE_TOK_CLASS_ESCAPE, /**< "\d \D \w \W \s \S" */
- RE_TOK_CHAR_CLASS, /**< "[ ]" */
- RE_TOK_CHAR, /**< any character */
+ RE_TOK_EOF, /**< EOF */
+ RE_TOK_BACKREFERENCE, /**< "\[0..9]" */
+ RE_TOK_ALTERNATIVE, /**< "|" */
+ RE_TOK_ASSERT_START, /**< "^" */
+ RE_TOK_ASSERT_END, /**< "$" */
+ RE_TOK_PERIOD, /**< "." */
+ RE_TOK_START_CAPTURE_GROUP, /**< "(" */
+ RE_TOK_START_NON_CAPTURE_GROUP, /**< "(?:" */
+ RE_TOK_END_GROUP, /**< ")" */
+ RE_TOK_ASSERT_LOOKAHEAD, /**< "(?=" */
+ RE_TOK_ASSERT_WORD_BOUNDARY, /**< "\b" */
+ RE_TOK_ASSERT_NOT_WORD_BOUNDARY, /**< "\B" */
+ RE_TOK_CLASS_ESCAPE, /**< "\d \D \w \W \s \S" */
+ RE_TOK_CHAR_CLASS, /**< "[ ]" */
+ RE_TOK_CHAR, /**< any character */
} re_token_type_t;
/**
@@ -55,11 +57,11 @@ typedef enum
*/
typedef struct
{
- uint32_t value; /**< value of the token */
- uint32_t qmin; /**< minimum number of token iterations */
- uint32_t qmax; /**< maximum number of token iterations */
- re_token_type_t type; /**< type of the token */
- bool greedy; /**< type of iteration */
+ uint32_t value; /**< value of the token */
+ uint32_t qmin; /**< minimum number of token iterations */
+ uint32_t qmax; /**< maximum number of token iterations */
+ re_token_type_t type; /**< type of the token */
+ bool greedy; /**< type of iteration */
} re_token_t;
/**
diff --git a/jerry-core/vm/opcodes-ecma-arithmetics.c b/jerry-core/vm/opcodes-ecma-arithmetics.c
index 17cb1f39..a880b5cc 100644
--- a/jerry-core/vm/opcodes-ecma-arithmetics.c
+++ b/jerry-core/vm/opcodes-ecma-arithmetics.c
@@ -20,8 +20,9 @@
#include "ecma-helpers.h"
#include "ecma-number-arithmetic.h"
#include "ecma-objects.h"
-#include "opcodes.h"
+
#include "jrt-libc-includes.h"
+#include "opcodes.h"
/** \addtogroup vm Virtual machine
* @{
@@ -200,8 +201,7 @@ opfunc_addition (ecma_value_t left_value, /**< left value */
ecma_value_t ret_value = ECMA_VALUE_EMPTY;
- if (ecma_is_value_string (left_value)
- || ecma_is_value_string (right_value))
+ if (ecma_is_value_string (left_value) || ecma_is_value_string (right_value))
{
ecma_string_t *string1_p = ecma_op_to_string (left_value);
@@ -240,8 +240,7 @@ opfunc_addition (ecma_value_t left_value, /**< left value */
ecma_deref_ecma_string (string2_p);
}
#if JERRY_BUILTIN_BIGINT
- else if (JERRY_UNLIKELY (ecma_is_value_bigint (left_value))
- && JERRY_UNLIKELY (ecma_is_value_bigint (right_value)))
+ else if (JERRY_UNLIKELY (ecma_is_value_bigint (left_value)) && JERRY_UNLIKELY (ecma_is_value_bigint (right_value)))
{
ret_value = ecma_bigint_add_sub (left_value, right_value, true);
}
diff --git a/jerry-core/vm/opcodes-ecma-bitwise.c b/jerry-core/vm/opcodes-ecma-bitwise.c
index 90075655..16eeee86 100644
--- a/jerry-core/vm/opcodes-ecma-bitwise.c
+++ b/jerry-core/vm/opcodes-ecma-bitwise.c
@@ -19,6 +19,7 @@
#include "ecma-exceptions.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
+
#include "opcodes.h"
/** \addtogroup vm Virtual machine
@@ -44,8 +45,7 @@ do_number_bitwise_logic (number_bitwise_logic_op op, /**< number bitwise logic o
ecma_value_t left_value, /**< left value */
ecma_value_t right_value) /**< right value */
{
- JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value)
- && !ECMA_IS_VALUE_ERROR (right_value));
+ JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));
ecma_number_t left_number;
left_value = ecma_op_to_numeric (left_value, &left_number, ECMA_TO_NUMERIC_ALLOW_BIGINT);
diff --git a/jerry-core/vm/opcodes-ecma-relational-equality.c b/jerry-core/vm/opcodes-ecma-relational-equality.c
index 6391dfaf..9362cff1 100644
--- a/jerry-core/vm/opcodes-ecma-relational-equality.c
+++ b/jerry-core/vm/opcodes-ecma-relational-equality.c
@@ -19,6 +19,7 @@
#include "ecma-function-object.h"
#include "ecma-helpers.h"
#include "ecma-objects.h"
+
#include "opcodes.h"
/** \addtogroup vm Virtual machine
@@ -29,24 +30,22 @@
*/
/**
-* Equality opcode handler.
-*
-* See also: ECMA-262 v5, 11.9.1, 11.9.2
-*
-* @return ecma value
-* Returned value must be freed with ecma_free_value
-*/
+ * Equality opcode handler.
+ *
+ * See also: ECMA-262 v5, 11.9.1, 11.9.2
+ *
+ * @return ecma value
+ * Returned value must be freed with ecma_free_value
+ */
ecma_value_t
opfunc_equality (ecma_value_t left_value, /**< left value */
ecma_value_t right_value) /**< right value */
{
- JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value)
- && !ECMA_IS_VALUE_ERROR (right_value));
+ JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));
ecma_value_t compare_result = ecma_op_abstract_equality_compare (left_value, right_value);
- JERRY_ASSERT (ecma_is_value_boolean (compare_result)
- || ECMA_IS_VALUE_ERROR (compare_result));
+ JERRY_ASSERT (ecma_is_value_boolean (compare_result) || ECMA_IS_VALUE_ERROR (compare_result));
return compare_result;
} /* opfunc_equality */
@@ -65,8 +64,7 @@ opfunc_relation (ecma_value_t left_value, /**< left value */
bool left_first, /**< 'LeftFirst' flag */
bool is_invert) /**< is invert */
{
- JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value)
- && !ECMA_IS_VALUE_ERROR (right_value));
+ JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));
ecma_value_t ret_value = ecma_op_abstract_relational_compare (left_value, right_value, left_first);
diff --git a/jerry-core/vm/opcodes.c b/jerry-core/vm/opcodes.c
index 864c9671..25da7595 100644
--- a/jerry-core/vm/opcodes.c
+++ b/jerry-core/vm/opcodes.c
@@ -13,10 +13,12 @@
* limitations under the License.
*/
+#include "opcodes.h"
+
#include "ecma-alloc.h"
#include "ecma-array-object.h"
-#include "ecma-builtins.h"
#include "ecma-builtin-helpers.h"
+#include "ecma-builtins.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
@@ -28,8 +30,8 @@
#include "ecma-objects.h"
#include "ecma-promise-object.h"
#include "ecma-proxy-object.h"
+
#include "jcontext.h"
-#include "opcodes.h"
#include "vm-defines.h"
#include "vm-stack.h"
@@ -69,10 +71,8 @@ opfunc_set_data_property (ecma_object_t *object_p, /**< object */
if (property_p == NULL)
{
- prop_value_p = ecma_create_named_data_property (object_p,
- prop_name_p,
- ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE,
- NULL);
+ prop_value_p =
+ ecma_create_named_data_property (object_p, prop_name_p, ECMA_PROPERTY_CONFIGURABLE_ENUMERABLE_WRITABLE, NULL);
}
else
{
@@ -284,8 +284,7 @@ opfunc_for_in (ecma_value_t iterable_value, /**< ideally an iterable value */
ecma_value_t *result_obj_p) /**< expression object */
{
/* 3. */
- if (ecma_is_value_undefined (iterable_value)
- || ecma_is_value_null (iterable_value))
+ if (ecma_is_value_undefined (iterable_value) || ecma_is_value_null (iterable_value))
{
return NULL;
}
@@ -621,13 +620,10 @@ opfunc_create_executable_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context
}
JERRY_ASSERT (frame_ctx_p->shared_p->status_flags & VM_FRAME_CTX_SHARED_NON_ARROW_FUNC);
- proto_p = ecma_op_get_prototype_from_constructor (frame_ctx_p->shared_p->function_object_p,
- default_proto_id);
+ proto_p = ecma_op_get_prototype_from_constructor (frame_ctx_p->shared_p->function_object_p, default_proto_id);
}
- ecma_object_t *object_p = ecma_create_object (proto_p,
- total_size,
- ECMA_OBJECT_TYPE_CLASS);
+ ecma_object_t *object_p = ecma_create_object (proto_p, total_size, ECMA_OBJECT_TYPE_CLASS);
vm_executable_object_t *executable_object_p = (vm_executable_object_t *) object_p;
@@ -677,10 +673,7 @@ opfunc_create_executable_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context
ecma_deref_if_object (*new_registers_p++);
}
- vm_ref_lex_env_chain (frame_ctx_p->lex_env_p,
- frame_ctx_p->context_depth,
- new_registers_p,
- false);
+ vm_ref_lex_env_chain (frame_ctx_p->lex_env_p, frame_ctx_p->context_depth, new_registers_p, false);
new_registers_p += frame_ctx_p->context_depth;
@@ -704,18 +697,12 @@ opfunc_create_executable_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context
/**
* Byte code which resumes an executable object with throw
*/
-const uint8_t opfunc_resume_executable_object_with_throw[1] =
-{
- CBC_THROW
-};
+const uint8_t opfunc_resume_executable_object_with_throw[1] = { CBC_THROW };
/**
* Byte code which resumes an executable object with return
*/
-const uint8_t opfunc_resume_executable_object_with_return[2] =
-{
- CBC_EXT_OPCODE, CBC_EXT_RETURN
-};
+const uint8_t opfunc_resume_executable_object_with_return[2] = { CBC_EXT_OPCODE, CBC_EXT_RETURN };
/**
* Resume the execution of an inactive executable object
@@ -843,8 +830,7 @@ opfunc_async_generator_yield (ecma_extended_object_t *async_generator_object_p,
ecma_value_t value) /**< value (takes the reference) */
{
ecma_async_generator_task_t *task_p;
- task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t,
- async_generator_object_p->u.cls.u3.head);
+ task_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_async_generator_task_t, async_generator_object_p->u.cls.u3.head);
ecma_value_t iter_result = ecma_create_iter_result_object (value, ECMA_VALUE_FALSE);
ecma_fulfill_promise (task_p->promise, iter_result);
@@ -878,9 +864,9 @@ opfunc_async_create_and_await (vm_frame_ctx_t *frame_ctx_p, /**< frame context *
ecma_value_t value, /**< awaited value (takes reference) */
uint16_t extra_flags) /**< extra flags */
{
- JERRY_ASSERT (CBC_FUNCTION_GET_TYPE (frame_ctx_p->shared_p->bytecode_header_p->status_flags) == CBC_FUNCTION_ASYNC
- || (CBC_FUNCTION_GET_TYPE (frame_ctx_p->shared_p->bytecode_header_p->status_flags)
- == CBC_FUNCTION_ASYNC_ARROW));
+ JERRY_ASSERT (
+ CBC_FUNCTION_GET_TYPE (frame_ctx_p->shared_p->bytecode_header_p->status_flags) == CBC_FUNCTION_ASYNC
+ || (CBC_FUNCTION_GET_TYPE (frame_ctx_p->shared_p->bytecode_header_p->status_flags) == CBC_FUNCTION_ASYNC_ARROW));
ecma_object_t *promise_p = ecma_builtin_get (ECMA_BUILTIN_ID_PROMISE);
ecma_value_t result = ecma_promise_reject_or_resolve (ecma_make_object_value (promise_p), value, true);
@@ -949,8 +935,8 @@ opfunc_init_class_fields (ecma_object_t *class_object_p, /**< the function itsel
shared_class_fields.header.bytecode_header_p = ecma_op_function_get_compiled_code (ext_function_p);
shared_class_fields.header.function_object_p = &ext_function_p->object;
- ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- ext_function_p->u.function.scope_cp);
+ ecma_object_t *scope_p =
+ ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_function_p->u.function.scope_cp);
ecma_value_t result = vm_run (&shared_class_fields.header, this_val, scope_p);
@@ -989,8 +975,8 @@ opfunc_init_static_class_fields (ecma_value_t function_object, /**< the function
ecma_extended_object_t *ext_function_p = (ecma_extended_object_t *) function_object_p;
shared_class_fields.header.bytecode_header_p = ecma_op_function_get_compiled_code (ext_function_p);
- ecma_object_t *scope_p = ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t,
- ext_function_p->u.function.scope_cp);
+ ecma_object_t *scope_p =
+ ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_function_p->u.function.scope_cp);
ecma_value_t result = vm_run (&shared_class_fields.header, this_val, scope_p);
@@ -1297,8 +1283,7 @@ opfunc_set_class_attributes (ecma_object_t *obj_p, /**< object */
if (property & ECMA_PROPERTY_FLAG_DATA)
{
- if (ecma_is_value_object (property_pair_p->values[index].value)
- && ecma_is_property_enumerable (property))
+ if (ecma_is_value_object (property_pair_p->values[index].value) && ecma_is_property_enumerable (property))
{
property_pair_p->header.types[index] = (uint8_t) (property & ~ECMA_PROPERTY_FLAG_ENUMERABLE);
opfunc_set_home_object (ecma_get_object_from_value (property_pair_p->values[index].value), parent_env_p);
@@ -1497,11 +1482,8 @@ opfunc_assign_super_reference (ecma_value_t **vm_stack_top_p, /**< vm stack top
bool is_strict = (frame_ctx_p->status_flags & VM_FRAME_CTX_IS_STRICT) != 0;
- ecma_value_t result = ecma_op_object_put_with_receiver (base_obj_p,
- prop_name_p,
- stack_top_p[-1],
- frame_ctx_p->this_binding,
- is_strict);
+ ecma_value_t result =
+ ecma_op_object_put_with_receiver (base_obj_p, prop_name_p, stack_top_p[-1], frame_ctx_p->this_binding, is_strict);
ecma_deref_ecma_string (prop_name_p);
ecma_deref_object (base_obj_p);
@@ -1604,8 +1586,7 @@ opfunc_copy_data_properties (ecma_value_t target_object, /**< target object */
{
break;
}
- }
- while (++filter_p < filter_end_p);
+ } while (++filter_p < filter_end_p);
if (filter_p != filter_end_p)
{
@@ -1721,13 +1702,9 @@ opfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *frame_ctx_p, /**< f
}
#endif /* JERRY_BUILTIN_PROXY */
- ecma_property_t property = ecma_op_object_get_own_property (global_obj_p,
- name_p,
- NULL,
- ECMA_PROPERTY_GET_NO_OPTIONS);
+ ecma_property_t property = ecma_op_object_get_own_property (global_obj_p, name_p, NULL, ECMA_PROPERTY_GET_NO_OPTIONS);
- JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND
- || ECMA_PROPERTY_IS_FOUND (property));
+ JERRY_ASSERT (property == ECMA_PROPERTY_TYPE_NOT_FOUND || ECMA_PROPERTY_IS_FOUND (property));
return ecma_make_boolean_value (property != ECMA_PROPERTY_TYPE_NOT_FOUND
&& !ecma_is_property_configurable (property));
diff --git a/jerry-core/vm/opcodes.h b/jerry-core/vm/opcodes.h
index a4bfa3a9..7fdb26df 100644
--- a/jerry-core/vm/opcodes.h
+++ b/jerry-core/vm/opcodes.h
@@ -17,6 +17,7 @@
#define OPCODES_H
#include "ecma-globals.h"
+
#include "vm-defines.h"
/** \addtogroup vm Virtual machine
@@ -71,106 +72,78 @@ typedef enum
*/
#define OPFUNC_HAS_SPREAD_ELEMENT (1 << 8)
-ecma_value_t
-opfunc_equality (ecma_value_t left_value, ecma_value_t right_value);
+ecma_value_t opfunc_equality (ecma_value_t left_value, ecma_value_t right_value);
-ecma_value_t
-do_number_arithmetic (number_arithmetic_op op, ecma_value_t left_value, ecma_value_t right_value);
+ecma_value_t do_number_arithmetic (number_arithmetic_op op, ecma_value_t left_value, ecma_value_t right_value);
-ecma_value_t
-opfunc_unary_operation (ecma_value_t left_value, bool is_plus);
+ecma_value_t opfunc_unary_operation (ecma_value_t left_value, bool is_plus);
-ecma_value_t
-do_number_bitwise_logic (number_bitwise_logic_op op, ecma_value_t left_value, ecma_value_t right_value);
+ecma_value_t do_number_bitwise_logic (number_bitwise_logic_op op, ecma_value_t left_value, ecma_value_t right_value);
-ecma_value_t
-do_number_bitwise_not (ecma_value_t value);
+ecma_value_t do_number_bitwise_not (ecma_value_t value);
-ecma_value_t
-opfunc_addition (ecma_value_t left_value, ecma_value_t right_value);
+ecma_value_t opfunc_addition (ecma_value_t left_value, ecma_value_t right_value);
-ecma_value_t
-opfunc_relation (ecma_value_t left_value, ecma_value_t right_value, bool left_first, bool is_invert);
+ecma_value_t opfunc_relation (ecma_value_t left_value, ecma_value_t right_value, bool left_first, bool is_invert);
-ecma_value_t
-opfunc_in (ecma_value_t left_value, ecma_value_t right_value);
+ecma_value_t opfunc_in (ecma_value_t left_value, ecma_value_t right_value);
-ecma_value_t
-opfunc_instanceof (ecma_value_t left_value, ecma_value_t right_value);
+ecma_value_t opfunc_instanceof (ecma_value_t left_value, ecma_value_t right_value);
-ecma_value_t
-opfunc_typeof (ecma_value_t left_value);
+ecma_value_t opfunc_typeof (ecma_value_t left_value);
-void
-opfunc_set_data_property (ecma_object_t *object_p, ecma_string_t *prop_name_p, ecma_value_t value);
+void opfunc_set_data_property (ecma_object_t *object_p, ecma_string_t *prop_name_p, ecma_value_t value);
-void
-opfunc_set_accessor (bool is_getter, ecma_value_t object, ecma_string_t *accessor_name_p, ecma_value_t accessor);
+void opfunc_set_accessor (bool is_getter, ecma_value_t object, ecma_string_t *accessor_name_p, ecma_value_t accessor);
-ecma_value_t
-vm_op_delete_prop (ecma_value_t object, ecma_value_t property, bool is_strict);
+ecma_value_t vm_op_delete_prop (ecma_value_t object, ecma_value_t property, bool is_strict);
-ecma_value_t
-vm_op_delete_var (ecma_value_t name_literal, ecma_object_t *lex_env_p);
+ecma_value_t vm_op_delete_var (ecma_value_t name_literal, ecma_object_t *lex_env_p);
-ecma_collection_t *
-opfunc_for_in (ecma_value_t left_value, ecma_value_t *result_obj_p);
+ecma_collection_t *opfunc_for_in (ecma_value_t left_value, ecma_value_t *result_obj_p);
#if JERRY_ESNEXT
-ecma_collection_t *
-opfunc_spread_arguments (ecma_value_t *stack_top_p, uint8_t argument_list_len);
+ecma_collection_t *opfunc_spread_arguments (ecma_value_t *stack_top_p, uint8_t argument_list_len);
#endif /* JERRY_ESNEXT */
-ecma_value_t
-opfunc_append_array (ecma_value_t *stack_top_p, uint16_t values_length);
+ecma_value_t opfunc_append_array (ecma_value_t *stack_top_p, uint16_t values_length);
#if JERRY_ESNEXT
-vm_executable_object_t *
-opfunc_create_executable_object (vm_frame_ctx_t *frame_ctx_p, vm_create_executable_object_type_t type);
+vm_executable_object_t *opfunc_create_executable_object (vm_frame_ctx_t *frame_ctx_p,
+ vm_create_executable_object_type_t type);
extern const uint8_t opfunc_resume_executable_object_with_throw[];
extern const uint8_t opfunc_resume_executable_object_with_return[];
-ecma_value_t
-opfunc_resume_executable_object (vm_executable_object_t *executable_object_p, ecma_value_t value);
+ecma_value_t opfunc_resume_executable_object (vm_executable_object_t *executable_object_p, ecma_value_t value);
-void
-opfunc_async_generator_yield (ecma_extended_object_t *async_generator_object_p, ecma_value_t value);
+void opfunc_async_generator_yield (ecma_extended_object_t *async_generator_object_p, ecma_value_t value);
-ecma_value_t
-opfunc_async_create_and_await (vm_frame_ctx_t *frame_ctx_p, ecma_value_t value, uint16_t extra_flags);
+ecma_value_t opfunc_async_create_and_await (vm_frame_ctx_t *frame_ctx_p, ecma_value_t value, uint16_t extra_flags);
-ecma_value_t
-opfunc_init_class_fields (ecma_object_t *class_object_p, ecma_value_t this_val);
+ecma_value_t opfunc_init_class_fields (ecma_object_t *class_object_p, ecma_value_t this_val);
-ecma_value_t
-opfunc_init_static_class_fields (ecma_value_t function_object, ecma_value_t this_val);
+ecma_value_t opfunc_init_static_class_fields (ecma_value_t function_object, ecma_value_t this_val);
-ecma_value_t
-opfunc_add_computed_field (ecma_value_t class_object, ecma_value_t name);
+ecma_value_t opfunc_add_computed_field (ecma_value_t class_object, ecma_value_t name);
-ecma_value_t
-opfunc_create_implicit_class_constructor (uint8_t opcode, const ecma_compiled_code_t *bytecode_p);
+ecma_value_t opfunc_create_implicit_class_constructor (uint8_t opcode, const ecma_compiled_code_t *bytecode_p);
-void
-opfunc_set_home_object (ecma_object_t *func_p, ecma_object_t *parent_env_p);
+void opfunc_set_home_object (ecma_object_t *func_p, ecma_object_t *parent_env_p);
-void
-opfunc_push_class_environment (vm_frame_ctx_t *frame_ctx_p, ecma_value_t **vm_stack_top, ecma_value_t class_name);
+void opfunc_push_class_environment (vm_frame_ctx_t *frame_ctx_p, ecma_value_t **vm_stack_top, ecma_value_t class_name);
-ecma_value_t
-opfunc_init_class (vm_frame_ctx_t *frame_context_p, ecma_value_t *stack_top_p);
+ecma_value_t opfunc_init_class (vm_frame_ctx_t *frame_context_p, ecma_value_t *stack_top_p);
-void
-opfunc_pop_lexical_environment (vm_frame_ctx_t *frame_ctx_p);
+void opfunc_pop_lexical_environment (vm_frame_ctx_t *frame_ctx_p);
-void
-opfunc_finalize_class (vm_frame_ctx_t *frame_ctx_p, ecma_value_t **vm_stack_top_p, ecma_value_t class_name);
+void opfunc_finalize_class (vm_frame_ctx_t *frame_ctx_p, ecma_value_t **vm_stack_top_p, ecma_value_t class_name);
-ecma_value_t
-opfunc_form_super_reference (ecma_value_t **vm_stack_top_p, vm_frame_ctx_t *frame_ctx_p, ecma_value_t prop_name,
- uint8_t opcode);
+ecma_value_t opfunc_form_super_reference (ecma_value_t **vm_stack_top_p,
+ vm_frame_ctx_t *frame_ctx_p,
+ ecma_value_t prop_name,
+ uint8_t opcode);
ecma_value_t
opfunc_assign_super_reference (ecma_value_t **vm_stack_top_p, vm_frame_ctx_t *frame_ctx_p, uint32_t opcode_data);
@@ -178,8 +151,7 @@ opfunc_assign_super_reference (ecma_value_t **vm_stack_top_p, vm_frame_ctx_t *fr
ecma_value_t
opfunc_copy_data_properties (ecma_value_t target_object, ecma_value_t source_object, ecma_value_t filter_array);
-ecma_value_t
-opfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *vm_frame_ctx_p, ecma_string_t *name_p);
+ecma_value_t opfunc_lexical_scope_has_restricted_binding (vm_frame_ctx_t *vm_frame_ctx_p, ecma_string_t *name_p);
#endif /* JERRY_ESNEXT */
/**
diff --git a/jerry-core/vm/vm-defines.h b/jerry-core/vm/vm-defines.h
index 0034e6a8..f93f485c 100644
--- a/jerry-core/vm/vm-defines.h
+++ b/jerry-core/vm/vm-defines.h
@@ -15,9 +15,10 @@
#ifndef VM_DEFINES_H
#define VM_DEFINES_H
-#include "byte-code.h"
#include "ecma-globals.h"
+#include "byte-code.h"
+
/** \addtogroup vm Virtual machine
* @{
*
@@ -40,16 +41,16 @@
*/
typedef enum
{
- VM_FRAME_CTX_SHARED_HAS_ARG_LIST = (1 << 0), /**< has argument list */
- VM_FRAME_CTX_SHARED_DIRECT_EVAL = (1 << 1), /**< direct eval call */
- VM_FRAME_CTX_SHARED_FREE_THIS = (1 << 2), /**< free this binding */
- VM_FRAME_CTX_SHARED_FREE_LOCAL_ENV = (1 << 3), /**< free local environment */
+ VM_FRAME_CTX_SHARED_HAS_ARG_LIST = (1 << 0), /**< has argument list */
+ VM_FRAME_CTX_SHARED_DIRECT_EVAL = (1 << 1), /**< direct eval call */
+ VM_FRAME_CTX_SHARED_FREE_THIS = (1 << 2), /**< free this binding */
+ VM_FRAME_CTX_SHARED_FREE_LOCAL_ENV = (1 << 3), /**< free local environment */
#if JERRY_ESNEXT
- VM_FRAME_CTX_SHARED_NON_ARROW_FUNC = (1 << 4), /**< non-arrow function */
- VM_FRAME_CTX_SHARED_HERITAGE_PRESENT = (1 << 5), /**< class heritage present */
- VM_FRAME_CTX_SHARED_HAS_CLASS_FIELDS = (1 << 6), /**< has class fields */
- VM_FRAME_CTX_SHARED_EXECUTABLE = (1 << 7), /**< frame is an executable object constructed
- * with opfunc_create_executable_object */
+ VM_FRAME_CTX_SHARED_NON_ARROW_FUNC = (1 << 4), /**< non-arrow function */
+ VM_FRAME_CTX_SHARED_HERITAGE_PRESENT = (1 << 5), /**< class heritage present */
+ VM_FRAME_CTX_SHARED_HAS_CLASS_FIELDS = (1 << 6), /**< has class fields */
+ VM_FRAME_CTX_SHARED_EXECUTABLE = (1 << 7), /**< frame is an executable object constructed
+ * with opfunc_create_executable_object */
#endif /* JERRY_ESNEXT */
} vm_frame_ctx_shared_flags_t;
@@ -58,9 +59,9 @@ typedef enum
*/
typedef struct
{
- const ecma_compiled_code_t *bytecode_header_p; /**< currently executed byte-code data */
- ecma_object_t *function_object_p; /**< function obj */
- uint32_t status_flags; /**< combination of vm_frame_ctx_shared_flags_t bits */
+ const ecma_compiled_code_t *bytecode_header_p; /**< currently executed byte-code data */
+ ecma_object_t *function_object_p; /**< function obj */
+ uint32_t status_flags; /**< combination of vm_frame_ctx_shared_flags_t bits */
} vm_frame_ctx_shared_t;
/**
@@ -68,9 +69,9 @@ typedef struct
*/
typedef struct
{
- vm_frame_ctx_shared_t header; /**< shared data header */
- const ecma_value_t *arg_list_p; /**< arguments list */
- uint32_t arg_list_len; /**< arguments list length */
+ vm_frame_ctx_shared_t header; /**< shared data header */
+ const ecma_value_t *arg_list_p; /**< arguments list */
+ uint32_t arg_list_len; /**< arguments list length */
} vm_frame_ctx_shared_args_t;
#if JERRY_ESNEXT
@@ -80,8 +81,8 @@ typedef struct
*/
typedef struct
{
- vm_frame_ctx_shared_t header; /**< shared data header */
- ecma_value_t *computed_class_fields_p; /**< names of the computed class fields */
+ vm_frame_ctx_shared_t header; /**< shared data header */
+ ecma_value_t *computed_class_fields_p; /**< names of the computed class fields */
} vm_frame_ctx_shared_class_fields_t;
/**
@@ -97,8 +98,8 @@ typedef struct
*/
typedef enum
{
- VM_FRAME_CTX_DIRECT_EVAL = (1 << 1), /**< direct eval call */
- VM_FRAME_CTX_IS_STRICT = (1 << 2), /**< strict mode */
+ VM_FRAME_CTX_DIRECT_EVAL = (1 << 1), /**< direct eval call */
+ VM_FRAME_CTX_IS_STRICT = (1 << 2), /**< strict mode */
} vm_frame_ctx_flags_t;
/**
@@ -106,17 +107,17 @@ typedef enum
*/
typedef struct vm_frame_ctx_t
{
- vm_frame_ctx_shared_t *shared_p; /**< shared information */
- const uint8_t *byte_code_p; /**< current byte code pointer */
- const uint8_t *byte_code_start_p; /**< byte code start pointer */
- ecma_value_t *stack_top_p; /**< stack top pointer */
- ecma_value_t *literal_start_p; /**< literal list start pointer */
- ecma_object_t *lex_env_p; /**< current lexical environment */
- struct vm_frame_ctx_t *prev_context_p; /**< previous context */
- ecma_value_t this_binding; /**< this binding */
- uint16_t context_depth; /**< current context depth */
- uint8_t status_flags; /**< combination of vm_frame_ctx_flags_t bits */
- uint8_t call_operation; /**< perform a call or construct operation */
+ vm_frame_ctx_shared_t *shared_p; /**< shared information */
+ const uint8_t *byte_code_p; /**< current byte code pointer */
+ const uint8_t *byte_code_start_p; /**< byte code start pointer */
+ ecma_value_t *stack_top_p; /**< stack top pointer */
+ ecma_value_t *literal_start_p; /**< literal list start pointer */
+ ecma_object_t *lex_env_p; /**< current lexical environment */
+ struct vm_frame_ctx_t *prev_context_p; /**< previous context */
+ ecma_value_t this_binding; /**< this binding */
+ uint16_t context_depth; /**< current context depth */
+ uint8_t status_flags; /**< combination of vm_frame_ctx_flags_t bits */
+ uint8_t call_operation; /**< perform a call or construct operation */
/* Registers start immediately after the frame context. */
} vm_frame_ctx_t;
@@ -139,10 +140,9 @@ typedef struct vm_frame_ctx_t
/**
* Calculate the shared_part from a vm_executable_object frame context.
*/
-#define VM_GET_EXECUTABLE_ITERATOR(frame_ctx_p) \
- ((ecma_value_t *) ((uintptr_t) (frame_ctx_p) \
- - (uintptr_t) offsetof (vm_executable_object_t, frame_ctx) \
- + (uintptr_t) offsetof (vm_executable_object_t, iterator)))
+#define VM_GET_EXECUTABLE_ITERATOR(frame_ctx_p) \
+ ((ecma_value_t *) ((uintptr_t) (frame_ctx_p) - (uintptr_t) offsetof (vm_executable_object_t, frame_ctx) \
+ + (uintptr_t) offsetof (vm_executable_object_t, iterator)))
/**
* Generator frame context.
diff --git a/jerry-core/vm/vm-stack.c b/jerry-core/vm/vm-stack.c
index 3959af9f..e41e68c2 100644
--- a/jerry-core/vm/vm-stack.c
+++ b/jerry-core/vm/vm-stack.c
@@ -13,6 +13,8 @@
* limitations under the License.
*/
+#include "vm-stack.h"
+
#include "ecma-alloc.h"
#include "ecma-exceptions.h"
#include "ecma-function-object.h"
@@ -21,9 +23,9 @@
#include "ecma-iterator-object.h"
#include "ecma-objects.h"
#include "ecma-promise-object.h"
+
#include "jcontext.h"
#include "vm-defines.h"
-#include "vm-stack.h"
/** \addtogroup vm Virtual machine
* @{
@@ -204,10 +206,7 @@ vm_decode_branch_offset (const uint8_t *branch_offset_p, /**< start offset of by
/**
* Byte code which resumes an executable object with throw
*/
-static const uint8_t vm_stack_resume_executable_object_with_context_end[1] =
-{
- CBC_CONTEXT_END
-};
+static const uint8_t vm_stack_resume_executable_object_with_context_end[1] = { CBC_CONTEXT_END };
#endif /* JERRY_ESNEXT */
@@ -269,12 +268,10 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
{
JERRY_ASSERT (byte_code_p[0] == CBC_EXT_OPCODE);
- if (byte_code_p[1] >= CBC_EXT_CATCH
- && byte_code_p[1] <= CBC_EXT_CATCH_3)
+ if (byte_code_p[1] >= CBC_EXT_CATCH && byte_code_p[1] <= CBC_EXT_CATCH_3)
{
branch_offset_length = CBC_BRANCH_OFFSET_LENGTH (byte_code_p[1]);
- branch_offset = vm_decode_branch_offset (byte_code_p + 2,
- branch_offset_length);
+ branch_offset = vm_decode_branch_offset (byte_code_p + 2, branch_offset_length);
if (finally_type == VM_CONTEXT_FINALLY_THROW)
{
@@ -337,12 +334,10 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
}
#endif /* JERRY_ESNEXT */
- JERRY_ASSERT (byte_code_p[1] >= CBC_EXT_FINALLY
- && byte_code_p[1] <= CBC_EXT_FINALLY_3);
+ JERRY_ASSERT (byte_code_p[1] >= CBC_EXT_FINALLY && byte_code_p[1] <= CBC_EXT_FINALLY_3);
branch_offset_length = CBC_BRANCH_OFFSET_LENGTH (byte_code_p[1]);
- branch_offset = vm_decode_branch_offset (byte_code_p + 2,
- branch_offset_length);
+ branch_offset = vm_decode_branch_offset (byte_code_p + 2, branch_offset_length);
branch_offset += (uint32_t) (byte_code_p - frame_ctx_p->byte_code_start_p);
@@ -356,8 +351,7 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
#if JERRY_ESNEXT
else if (stack_top_p[-1] & VM_CONTEXT_CLOSE_ITERATOR)
{
- JERRY_ASSERT (context_type == VM_CONTEXT_FOR_OF
- || context_type == VM_CONTEXT_FOR_AWAIT_OF
+ JERRY_ASSERT (context_type == VM_CONTEXT_FOR_OF || context_type == VM_CONTEXT_FOR_AWAIT_OF
|| context_type == VM_CONTEXT_ITERATOR);
JERRY_ASSERT (finally_type == VM_CONTEXT_FINALLY_THROW || !jcontext_has_pending_exception ());
@@ -392,8 +386,8 @@ vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
if (!ECMA_IS_VALUE_ERROR (result))
{
- uint16_t extra_flags = (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD
- | (ECMA_AWAIT_FOR_CLOSE << ECMA_AWAIT_STATE_SHIFT));
+ uint16_t extra_flags =
+ (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD | (ECMA_AWAIT_FOR_CLOSE << ECMA_AWAIT_STATE_SHIFT));
async_generator_object_p->u.cls.u2.executable_obj_flags |= extra_flags;
stack_top_p = vm_stack_context_abort (frame_ctx_p, stack_top_p);
@@ -494,9 +488,7 @@ vm_get_context_value_offsets (ecma_value_t *context_item_p) /**< any item of a c
|| VM_GET_CONTEXT_TYPE (context_item_p[-1]) == VM_CONTEXT_FOR_AWAIT_OF);
return ((PARSER_FOR_OF_CONTEXT_STACK_ALLOCATION << (VM_CONTEXT_OFFSET_SHIFT * 3))
- | (4 << (VM_CONTEXT_OFFSET_SHIFT * 2))
- | (3 << VM_CONTEXT_OFFSET_SHIFT)
- | 2);
+ | (4 << (VM_CONTEXT_OFFSET_SHIFT * 2)) | (3 << VM_CONTEXT_OFFSET_SHIFT) | 2);
}
}
} /* vm_get_context_value_offsets */
@@ -548,8 +540,7 @@ vm_ref_lex_env_chain (ecma_object_t *lex_env_p, /**< top of lexical environment
{
ecma_deref_if_object (*(--context_top_p));
}
- }
- while (context_top_p > last_item_p);
+ } while (context_top_p > last_item_p);
continue;
}
@@ -574,8 +565,7 @@ vm_ref_lex_env_chain (ecma_object_t *lex_env_p, /**< top of lexical environment
JERRY_ASSERT (context_top_p >= context_end_p + offsets);
context_top_p -= offsets;
- }
- while (context_top_p > context_end_p);
+ } while (context_top_p > context_end_p);
} /* vm_ref_lex_env_chain */
#endif /* JERRY_ESNEXT */
diff --git a/jerry-core/vm/vm-stack.h b/jerry-core/vm/vm-stack.h
index 2fa54346..0797d16b 100644
--- a/jerry-core/vm/vm-stack.h
+++ b/jerry-core/vm/vm-stack.h
@@ -18,6 +18,8 @@
#include "ecma-globals.h"
+#include "vm-defines.h"
+
/** \addtogroup vm Virtual machine
* @{
*
@@ -33,13 +35,12 @@
/**
* Create context on the vm stack with environment.
*/
-#define VM_CREATE_CONTEXT_WITH_ENV(type, end_offset) \
- (VM_CREATE_CONTEXT ((type),(end_offset)) | VM_CONTEXT_HAS_LEX_ENV)
+#define VM_CREATE_CONTEXT_WITH_ENV(type, end_offset) (VM_CREATE_CONTEXT ((type), (end_offset)) | VM_CONTEXT_HAS_LEX_ENV)
/**
* Get type of a vm context.
*/
-#define VM_GET_CONTEXT_TYPE(value) ((vm_stack_context_type_t) ((value) & 0x1f))
+#define VM_GET_CONTEXT_TYPE(value) ((vm_stack_context_type_t) ((value) &0x1f))
/**
* Get the end position of a vm context.
@@ -62,24 +63,24 @@
typedef enum
{
/* Update VM_CONTEXT_IS_FINALLY macro if the following three values are changed. */
- VM_CONTEXT_FINALLY_JUMP, /**< finally context with a jump */
- VM_CONTEXT_FINALLY_THROW, /**< finally context with a throw */
- VM_CONTEXT_FINALLY_RETURN, /**< finally context with a return */
- VM_CONTEXT_TRY, /**< try context */
- VM_CONTEXT_CATCH, /**< catch context */
+ VM_CONTEXT_FINALLY_JUMP, /**< finally context with a jump */
+ VM_CONTEXT_FINALLY_THROW, /**< finally context with a throw */
+ VM_CONTEXT_FINALLY_RETURN, /**< finally context with a return */
+ VM_CONTEXT_TRY, /**< try context */
+ VM_CONTEXT_CATCH, /**< catch context */
#if JERRY_ESNEXT
- VM_CONTEXT_BLOCK, /**< block context */
+ VM_CONTEXT_BLOCK, /**< block context */
#endif /* JERRY_ESNEXT */
- VM_CONTEXT_WITH, /**< with context */
- VM_CONTEXT_FOR_IN, /**< for-in context */
+ VM_CONTEXT_WITH, /**< with context */
+ VM_CONTEXT_FOR_IN, /**< for-in context */
#if JERRY_ESNEXT
- VM_CONTEXT_FOR_OF, /**< for-of context */
- VM_CONTEXT_FOR_AWAIT_OF, /**< for-await-of context */
+ VM_CONTEXT_FOR_OF, /**< for-of context */
+ VM_CONTEXT_FOR_AWAIT_OF, /**< for-await-of context */
/* contexts with variable length */
- VM_CONTEXT_ITERATOR, /**< iterator context */
- VM_CONTEXT_OBJ_INIT, /**< object-initializer context */
- VM_CONTEXT_OBJ_INIT_REST, /**< object-initializer-rest context */
+ VM_CONTEXT_ITERATOR, /**< iterator context */
+ VM_CONTEXT_OBJ_INIT, /**< object-initializer context */
+ VM_CONTEXT_OBJ_INIT_REST, /**< object-initializer-rest context */
#endif /* JERRY_ESNEXT */
} vm_stack_context_type_t;
@@ -88,12 +89,12 @@ typedef enum
*/
typedef enum
{
- VM_CONTEXT_FOUND_FINALLY, /**< found finally */
+ VM_CONTEXT_FOUND_FINALLY, /**< found finally */
#if JERRY_ESNEXT
- VM_CONTEXT_FOUND_ERROR, /**< found an error */
- VM_CONTEXT_FOUND_AWAIT, /**< found an await operation */
+ VM_CONTEXT_FOUND_ERROR, /**< found an error */
+ VM_CONTEXT_FOUND_AWAIT, /**< found an await operation */
#endif /* JERRY_ESNEXT */
- VM_CONTEXT_FOUND_EXPECTED, /**< found the type specified in finally_type */
+ VM_CONTEXT_FOUND_EXPECTED, /**< found the type specified in finally_type */
} vm_stack_found_type;
/**
@@ -105,8 +106,7 @@ typedef enum
* - [previous JS values stored by the VM stack]
*/
#if JERRY_ESNEXT
-#define VM_CONTEXT_IS_VARIABLE_LENGTH(context_type) \
- ((context_type) >= VM_CONTEXT_ITERATOR)
+#define VM_CONTEXT_IS_VARIABLE_LENGTH(context_type) ((context_type) >= VM_CONTEXT_ITERATOR)
#else /* !JERRY_ESNEXT */
#define VM_CONTEXT_IS_VARIABLE_LENGTH(context_type) false
#endif /* JERRY_ESNEXT */
@@ -114,8 +114,7 @@ typedef enum
/**
* Checks whether the context type is a finally type.
*/
-#define VM_CONTEXT_IS_FINALLY(context_type) \
- ((context_type) <= VM_CONTEXT_FINALLY_RETURN)
+#define VM_CONTEXT_IS_FINALLY(context_type) ((context_type) <= VM_CONTEXT_FINALLY_RETURN)
/**
* Shift needs to be applied to get the next item of the offset array.
@@ -133,15 +132,17 @@ typedef enum
#define VM_CONTEXT_GET_NEXT_OFFSET(offsets) (-((int32_t) ((offsets) & ((1 << VM_CONTEXT_OFFSET_SHIFT) - 1))))
#if JERRY_ESNEXT
-ecma_value_t *vm_stack_context_abort_variable_length (vm_frame_ctx_t *frame_ctx_p, ecma_value_t *vm_stack_top_p,
+ecma_value_t *vm_stack_context_abort_variable_length (vm_frame_ctx_t *frame_ctx_p,
+ ecma_value_t *vm_stack_top_p,
uint32_t context_stack_allocation);
#endif /* JERRY_ESNEXT */
ecma_value_t *vm_stack_context_abort (vm_frame_ctx_t *frame_ctx_p, ecma_value_t *vm_stack_top_p);
-vm_stack_found_type vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p, ecma_value_t *stack_top_p,
- vm_stack_context_type_t finally_type, uint32_t search_limit);
+vm_stack_found_type vm_stack_find_finally (vm_frame_ctx_t *frame_ctx_p,
+ ecma_value_t *stack_top_p,
+ vm_stack_context_type_t finally_type,
+ uint32_t search_limit);
uint32_t vm_get_context_value_offsets (ecma_value_t *context_item_p);
-void vm_ref_lex_env_chain (ecma_object_t *lex_env_p, uint16_t context_depth,
- ecma_value_t *context_end_p, bool do_ref);
+void vm_ref_lex_env_chain (ecma_object_t *lex_env_p, uint16_t context_depth, ecma_value_t *context_end_p, bool do_ref);
/**
* @}
diff --git a/jerry-core/vm/vm-utils.c b/jerry-core/vm/vm-utils.c
index dc402288..e9cbb275 100644
--- a/jerry-core/vm/vm-utils.c
+++ b/jerry-core/vm/vm-utils.c
@@ -16,6 +16,7 @@
#include "ecma-array-object.h"
#include "ecma-helpers.h"
#include "ecma-line-info.h"
+
#include "jcontext.h"
#include "lit-char-helpers.h"
#include "vm.h"
@@ -83,7 +84,7 @@ vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimite
if (ecma_string_is_empty (str_p))
{
- ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *)"<unknown>:", 10);
+ ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) "<unknown>:", 10);
}
else
{
@@ -110,7 +111,7 @@ vm_get_backtrace (uint32_t max_depth) /**< maximum backtrace depth, 0 = unlimite
}
else
{
- ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *)"1:1", 3);
+ ecma_stringbuilder_append_raw (&builder, (const lit_utf8_byte_t *) "1:1", 3);
}
ecma_string_t *builder_str_p = ecma_stringbuilder_finalize (&builder);
diff --git a/jerry-core/vm/vm.c b/jerry-core/vm/vm.c
index d56ec561..38b9ab52 100644
--- a/jerry-core/vm/vm.c
+++ b/jerry-core/vm/vm.c
@@ -13,14 +13,14 @@
* limitations under the License.
*/
-#include "common.h"
+#include "vm.h"
#include "ecma-alloc.h"
#include "ecma-arguments-object.h"
#include "ecma-array-object.h"
#include "ecma-bigint.h"
-#include "ecma-builtins.h"
#include "ecma-builtin-object.h"
+#include "ecma-builtins.h"
#include "ecma-comparison.h"
#include "ecma-conversion.h"
#include "ecma-exceptions.h"
@@ -30,13 +30,14 @@
#include "ecma-iterator-object.h"
#include "ecma-lcache.h"
#include "ecma-lex-env.h"
-#include "ecma-objects.h"
#include "ecma-objects-general.h"
+#include "ecma-objects.h"
#include "ecma-promise-object.h"
#include "ecma-regexp-object.h"
+
+#include "common.h"
#include "jcontext.h"
#include "opcodes.h"
-#include "vm.h"
#include "vm-stack.h"
/** \addtogroup vm Virtual machine
@@ -85,8 +86,7 @@ vm_op_get_value (ecma_value_t object, /**< base object */
}
}
- property_name_p = (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_UINT,
- (uintptr_t) int_value);
+ property_name_p = (ecma_string_t *) ECMA_CREATE_DIRECT_STRING (ECMA_DIRECT_STRING_UINT, (uintptr_t) int_value);
}
}
else if (ecma_is_value_string (property))
@@ -121,10 +121,8 @@ vm_op_get_value (ecma_value_t object, /**< base object */
if (JERRY_UNLIKELY (ecma_is_value_undefined (object) || ecma_is_value_null (object)))
{
#if JERRY_ERROR_MESSAGES
- ecma_value_t error_value = ecma_raise_standard_error_with_format (JERRY_ERROR_TYPE,
- "Cannot read property '%' of %",
- property,
- object);
+ ecma_value_t error_value =
+ ecma_raise_standard_error_with_format (JERRY_ERROR_TYPE, "Cannot read property '%' of %", property, object);
#else /* !JERRY_ERROR_MESSAGES */
ecma_value_t error_value = ecma_raise_type_error (NULL);
#endif /* JERRY_ERROR_MESSAGES */
@@ -168,10 +166,7 @@ vm_op_set_value (ecma_value_t base, /**< base object */
if (JERRY_UNLIKELY (ecma_is_value_null (base) || ecma_is_value_undefined (base)))
{
#if JERRY_ERROR_MESSAGES
- result = ecma_raise_standard_error_with_format (JERRY_ERROR_TYPE,
- "Cannot set property '%' of %",
- property,
- base);
+ result = ecma_raise_standard_error_with_format (JERRY_ERROR_TYPE, "Cannot set property '%' of %", property, base);
#else /* !JERRY_ERROR_MESSAGES */
result = ecma_raise_type_error (NULL);
#endif /* JERRY_ERROR_MESSAGES */
@@ -201,11 +196,7 @@ vm_op_set_value (ecma_value_t base, /**< base object */
object_p = ecma_get_object_from_value (object);
ecma_op_ordinary_object_prevent_extensions (object_p);
- result = ecma_op_object_put_with_receiver (object_p,
- property_p,
- value,
- base,
- is_strict);
+ result = ecma_op_object_put_with_receiver (object_p, property_p, value, base, is_strict);
ecma_free_value (base);
}
@@ -231,18 +222,11 @@ vm_op_set_value (ecma_value_t base, /**< base object */
if (!ecma_is_lexical_environment (object_p))
{
- result = ecma_op_object_put_with_receiver (object_p,
- property_p,
- value,
- base,
- is_strict);
+ result = ecma_op_object_put_with_receiver (object_p, property_p, value, base, is_strict);
}
else
{
- result = ecma_op_set_mutable_binding (object_p,
- property_p,
- value,
- is_strict);
+ result = ecma_op_set_mutable_binding (object_p, property_p, value, is_strict);
}
}
@@ -257,11 +241,7 @@ vm_op_set_value (ecma_value_t base, /**< base object */
/**
* Decode table for both opcodes and extended opcodes.
*/
-static const uint16_t vm_decode_table[] JERRY_ATTR_CONST_DATA =
-{
- CBC_OPCODE_LIST
- CBC_EXT_OPCODE_LIST
-};
+static const uint16_t vm_decode_table[] JERRY_ATTR_CONST_DATA = { CBC_OPCODE_LIST CBC_EXT_OPCODE_LIST };
#undef CBC_OPCODE
@@ -456,8 +436,7 @@ vm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
if (JERRY_LIKELY (!(frame_ctx_p->shared_p->bytecode_header_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)))
{
#endif /* JERRY_SNAPSHOT_EXEC */
- bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- lit_value);
+ bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, lit_value);
#if JERRY_SNAPSHOT_EXEC
}
else
@@ -488,9 +467,7 @@ vm_construct_literal_object (vm_frame_ctx_t *frame_ctx_p, /**< frame context */
#if JERRY_ESNEXT
if (JERRY_UNLIKELY (CBC_FUNCTION_IS_ARROW (bytecode_p->status_flags)))
{
- func_obj_p = ecma_op_create_arrow_function_object (frame_ctx_p->lex_env_p,
- bytecode_p,
- frame_ctx_p->this_binding);
+ func_obj_p = ecma_op_create_arrow_function_object (frame_ctx_p->lex_env_p, bytecode_p, frame_ctx_p->this_binding);
}
else
{
@@ -533,10 +510,7 @@ vm_get_implicit_this_value (ecma_value_t *this_value_p) /**< [in,out] this value
* Special bytecode sequence for error handling while the vm_loop
* is preserved for an execute operation
*/
-static const uint8_t vm_error_byte_code_p[] =
-{
- CBC_EXT_OPCODE, CBC_EXT_ERROR
-};
+static const uint8_t vm_error_byte_code_p[] = { CBC_EXT_OPCODE, CBC_EXT_ERROR };
#if JERRY_ESNEXT
@@ -599,10 +573,8 @@ vm_super_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
else
{
ecma_object_t *func_obj_p = ecma_get_object_from_value (func_value);
- completion_value = ecma_op_function_construct (func_obj_p,
- JERRY_CONTEXT (current_new_target_p),
- arguments_p,
- arguments_list_len);
+ completion_value =
+ ecma_op_function_construct (func_obj_p, JERRY_CONTEXT (current_new_target_p), arguments_p, arguments_list_len);
if (!ECMA_IS_VALUE_ERROR (completion_value) && ecma_op_this_binding_is_initialized (environment_record_p))
{
@@ -706,8 +678,7 @@ vm_spread_operation (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
{
ecma_value_t this_value = is_call_prop ? frame_ctx_p->stack_top_p[-2] : ECMA_VALUE_UNDEFINED;
- if (!ecma_is_value_object (func_value)
- || !ecma_op_object_is_callable (ecma_get_object_from_value (func_value)))
+ if (!ecma_is_value_object (func_value) || !ecma_op_object_is_callable (ecma_get_object_from_value (func_value)))
{
completion_value = ecma_raise_type_error (ECMA_ERR_MSG (ecma_error_expected_a_function));
}
@@ -715,10 +686,8 @@ vm_spread_operation (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
{
ecma_object_t *func_obj_p = ecma_get_object_from_value (func_value);
- completion_value = ecma_op_function_call (func_obj_p,
- this_value,
- collection_p->buffer_p,
- collection_p->item_count);
+ completion_value =
+ ecma_op_function_call (func_obj_p, this_value, collection_p->buffer_p, collection_p->item_count);
}
if (is_call_prop)
@@ -789,10 +758,8 @@ opfunc_call (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
ecma_value_t this_value = is_call_prop ? stack_top_p[-3] : ECMA_VALUE_UNDEFINED;
ecma_value_t func_value = stack_top_p[-1];
- ecma_value_t completion_value = ecma_op_function_validated_call (func_value,
- this_value,
- stack_top_p,
- arguments_list_len);
+ ecma_value_t completion_value =
+ ecma_op_function_validated_call (func_value, this_value, stack_top_p, arguments_list_len);
JERRY_CONTEXT (status_flags) &= (uint32_t) ~ECMA_STATUS_DIRECT_EVAL;
@@ -873,10 +840,8 @@ opfunc_construct (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
{
ecma_object_t *constructor_obj_p = ecma_get_object_from_value (constructor_value);
- completion_value = ecma_op_function_construct (constructor_obj_p,
- constructor_obj_p,
- stack_top_p,
- arguments_list_len);
+ completion_value =
+ ecma_op_function_construct (constructor_obj_p, constructor_obj_p, stack_top_p, arguments_list_len);
}
/* Free registers. */
@@ -907,16 +872,15 @@ opfunc_construct (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
*
* @param destination destination
*/
-#define READ_LITERAL_INDEX(destination) \
- do \
- { \
- (destination) = *byte_code_p++; \
- if ((destination) >= encoding_limit) \
- { \
+#define READ_LITERAL_INDEX(destination) \
+ do \
+ { \
+ (destination) = *byte_code_p++; \
+ if ((destination) >= encoding_limit) \
+ { \
(destination) = (uint16_t) ((((destination) << 8) | *byte_code_p++) - encoding_delta); \
- } \
- } \
- while (0)
+ } \
+ } while (0)
/**
* Get literal value by literal index.
@@ -928,83 +892,77 @@ opfunc_construct (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
* When we are able to construct a function with similar speed,
* we can remove this macro.
*/
-#define READ_LITERAL(literal_index, target_value) \
- do \
- { \
- if ((literal_index) < ident_end) \
- { \
- if ((literal_index) < register_end) \
- { \
- /* Note: There should be no specialization for arguments. */ \
- (target_value) = ecma_fast_copy_value (VM_GET_REGISTER (frame_ctx_p, literal_index)); \
- } \
- else \
- { \
- ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]); \
- \
- result = ecma_op_resolve_reference_value (frame_ctx_p->lex_env_p, \
- name_p); \
- \
- if (ECMA_IS_VALUE_ERROR (result)) \
- { \
- goto error; \
- } \
- (target_value) = result; \
- } \
- } \
- else if (literal_index < const_literal_end) \
- { \
- (target_value) = ecma_fast_copy_value (literal_start_p[literal_index]); \
- } \
- else \
- { \
- /* Object construction. */ \
- (target_value) = vm_construct_literal_object (frame_ctx_p, \
- literal_start_p[literal_index]); \
- } \
- } \
- while (0)
+#define READ_LITERAL(literal_index, target_value) \
+ do \
+ { \
+ if ((literal_index) < ident_end) \
+ { \
+ if ((literal_index) < register_end) \
+ { \
+ /* Note: There should be no specialization for arguments. */ \
+ (target_value) = ecma_fast_copy_value (VM_GET_REGISTER (frame_ctx_p, literal_index)); \
+ } \
+ else \
+ { \
+ ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]); \
+ \
+ result = ecma_op_resolve_reference_value (frame_ctx_p->lex_env_p, name_p); \
+ \
+ if (ECMA_IS_VALUE_ERROR (result)) \
+ { \
+ goto error; \
+ } \
+ (target_value) = result; \
+ } \
+ } \
+ else if (literal_index < const_literal_end) \
+ { \
+ (target_value) = ecma_fast_copy_value (literal_start_p[literal_index]); \
+ } \
+ else \
+ { \
+ /* Object construction. */ \
+ (target_value) = vm_construct_literal_object (frame_ctx_p, literal_start_p[literal_index]); \
+ } \
+ } while (0)
/**
* Store the original value for post increase/decrease operators
*
* @param value original value
*/
-#define POST_INCREASE_DECREASE_PUT_RESULT(value) \
- if (opcode_data & VM_OC_PUT_STACK) \
- { \
- if (opcode_flags & VM_OC_IDENT_INCR_DECR_OPERATOR_FLAG) \
- { \
- JERRY_ASSERT (opcode == CBC_POST_INCR_IDENT_PUSH_RESULT \
- || opcode == CBC_POST_DECR_IDENT_PUSH_RESULT); \
- *stack_top_p++ = (value); \
- } \
- else \
- { \
- /* The parser ensures there is enough space for the \
- * extra value on the stack. See js-parser-expr.c. */ \
- JERRY_ASSERT (opcode == CBC_POST_INCR_PUSH_RESULT \
- || opcode == CBC_POST_DECR_PUSH_RESULT); \
- stack_top_p++; \
- stack_top_p[-1] = stack_top_p[-2]; \
- stack_top_p[-2] = stack_top_p[-3]; \
- stack_top_p[-3] = (value); \
- } \
- opcode_data &= (uint32_t) ~VM_OC_PUT_STACK; \
- } \
- else \
- { \
- JERRY_ASSERT (opcode_data & VM_OC_PUT_BLOCK); \
- ecma_free_value (VM_GET_REGISTER (frame_ctx_p, 0)); \
- VM_GET_REGISTERS (frame_ctx_p)[0] = (value); \
- opcode_data &= (uint32_t) ~VM_OC_PUT_BLOCK; \
+#define POST_INCREASE_DECREASE_PUT_RESULT(value) \
+ if (opcode_data & VM_OC_PUT_STACK) \
+ { \
+ if (opcode_flags & VM_OC_IDENT_INCR_DECR_OPERATOR_FLAG) \
+ { \
+ JERRY_ASSERT (opcode == CBC_POST_INCR_IDENT_PUSH_RESULT || opcode == CBC_POST_DECR_IDENT_PUSH_RESULT); \
+ *stack_top_p++ = (value); \
+ } \
+ else \
+ { \
+ /* The parser ensures there is enough space for the \
+ * extra value on the stack. See js-parser-expr.c. */ \
+ JERRY_ASSERT (opcode == CBC_POST_INCR_PUSH_RESULT || opcode == CBC_POST_DECR_PUSH_RESULT); \
+ stack_top_p++; \
+ stack_top_p[-1] = stack_top_p[-2]; \
+ stack_top_p[-2] = stack_top_p[-3]; \
+ stack_top_p[-3] = (value); \
+ } \
+ opcode_data &= (uint32_t) ~VM_OC_PUT_STACK; \
+ } \
+ else \
+ { \
+ JERRY_ASSERT (opcode_data &VM_OC_PUT_BLOCK); \
+ ecma_free_value (VM_GET_REGISTER (frame_ctx_p, 0)); \
+ VM_GET_REGISTERS (frame_ctx_p)[0] = (value); \
+ opcode_data &= (uint32_t) ~VM_OC_PUT_BLOCK; \
}
/**
* Get the end of the existing topmost context
*/
-#define VM_LAST_CONTEXT_END() \
- (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth)
+#define VM_LAST_CONTEXT_END() (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth)
/**
* Run generic byte code.
@@ -1120,8 +1078,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
else if (operands >= VM_OC_GET_STACK)
{
- JERRY_ASSERT (operands == VM_OC_GET_STACK
- || operands == VM_OC_GET_STACK_STACK);
+ JERRY_ASSERT (operands == VM_OC_GET_STACK || operands == VM_OC_GET_STACK_STACK);
JERRY_ASSERT (stack_top_p > VM_GET_REGISTERS (frame_ctx_p) + register_end);
left_value = *(--stack_top_p);
@@ -1155,8 +1112,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (opcode_data & VM_OC_BACKWARD_BRANCH)
{
#if JERRY_VM_EXEC_STOP
- if (JERRY_CONTEXT (vm_exec_stop_cb) != NULL
- && --JERRY_CONTEXT (vm_exec_stop_counter) == 0)
+ if (JERRY_CONTEXT (vm_exec_stop_cb) != NULL && --JERRY_CONTEXT (vm_exec_stop_counter) == 0)
{
result = JERRY_CONTEXT (vm_exec_stop_cb) (JERRY_CONTEXT (vm_exec_stop_user_p));
@@ -1295,9 +1251,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_PUSH_OBJECT:
{
- ecma_object_t *obj_p = ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE),
- 0,
- ECMA_OBJECT_TYPE_GENERAL);
+ ecma_object_t *obj_p =
+ ecma_create_object (ecma_builtin_get (ECMA_BUILTIN_ID_OBJECT_PROTOTYPE), 0, ECMA_OBJECT_TYPE_GENERAL);
*stack_top_p++ = ecma_make_object_value (obj_p);
continue;
@@ -1310,8 +1265,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
ecma_extended_object_t *ext_func_p = (ecma_extended_object_t *) func_p;
- JERRY_ASSERT (frame_ctx_p->lex_env_p ==
- ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_func_p->u.function.scope_cp));
+ JERRY_ASSERT (frame_ctx_p->lex_env_p
+ == ECMA_GET_NON_NULL_POINTER_FROM_POINTER_TAG (ecma_object_t, ext_func_p->u.function.scope_cp));
ecma_object_t *name_lex_env = ecma_create_decl_lex_env (frame_ctx_p->lex_env_p);
@@ -1375,8 +1330,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
READ_LITERAL_INDEX (value_index);
JERRY_ASSERT (value_index >= const_literal_end);
- lit_value = vm_construct_literal_object (frame_ctx_p,
- literal_start_p[value_index]);
+ lit_value = vm_construct_literal_object (frame_ctx_p, literal_start_p[value_index]);
}
READ_LITERAL_INDEX (literal_index);
@@ -1471,8 +1425,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
READ_LITERAL_INDEX (value_index);
JERRY_ASSERT (value_index >= const_literal_end);
- lit_value = vm_construct_literal_object (frame_ctx_p,
- literal_start_p[value_index]);
+ lit_value = vm_construct_literal_object (frame_ctx_p, literal_start_p[value_index]);
}
READ_LITERAL_INDEX (literal_index);
@@ -1507,10 +1460,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (property_p == NULL)
{
- property_value_p = ecma_create_named_data_property (prev_lex_env_p,
- name_p,
- ECMA_PROPERTY_CONFIGURABLE_WRITABLE,
- NULL);
+ property_value_p =
+ ecma_create_named_data_property (prev_lex_env_p, name_p, ECMA_PROPERTY_CONFIGURABLE_WRITABLE, NULL);
if (lit_value == ECMA_VALUE_UNDEFINED)
{
@@ -1586,8 +1537,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
else
{
- lit_value = vm_construct_literal_object (frame_ctx_p,
- literal_start_p[value_index]);
+ lit_value = vm_construct_literal_object (frame_ctx_p, literal_start_p[value_index]);
release = true;
}
@@ -1610,10 +1560,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
JERRY_ASSERT (ecma_find_named_property (frame_ctx_p->lex_env_p, name_p) == NULL);
ecma_property_value_t *property_value_p;
- property_value_p = ecma_create_named_data_property (frame_ctx_p->lex_env_p,
- name_p,
- ECMA_PROPERTY_FLAG_WRITABLE,
- NULL);
+ property_value_p =
+ ecma_create_named_data_property (frame_ctx_p->lex_env_p, name_p, ECMA_PROPERTY_FLAG_WRITABLE, NULL);
JERRY_ASSERT (property_value_p->value == ECMA_VALUE_UNDEFINED);
property_value_p->value = lit_value;
@@ -1708,8 +1656,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
ecma_string_t *name_p = ecma_get_string_from_value (literal_start_p[literal_index]);
ecma_property_t *property_p = ecma_find_named_property (frame_ctx_p->lex_env_p, name_p);
- JERRY_ASSERT (property_p != NULL
- && ECMA_PROPERTY_IS_RAW_DATA (*property_p)
+ JERRY_ASSERT (property_p != NULL && ECMA_PROPERTY_IS_RAW_DATA (*property_p)
&& (*property_p & ECMA_PROPERTY_FLAG_DATA));
JERRY_ASSERT (ECMA_PROPERTY_VALUE_PTR (property_p)->value == ECMA_VALUE_UNINITIALIZED);
@@ -1746,10 +1693,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
ecma_property_value_t *property_value_p;
- property_value_p = ecma_create_named_data_property (frame_ctx_p->lex_env_p,
- name_p,
- prop_attributes,
- NULL);
+ property_value_p = ecma_create_named_data_property (frame_ctx_p->lex_env_p, name_p, prop_attributes, NULL);
JERRY_ASSERT (property_value_p->value == ECMA_VALUE_UNDEFINED);
@@ -1794,10 +1738,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (property_p == NULL)
{
- prop_value_p = ecma_create_named_data_property (lex_env_p,
- name_p,
- ECMA_PROPERTY_FLAG_WRITABLE,
- NULL);
+ prop_value_p = ecma_create_named_data_property (lex_env_p, name_p, ECMA_PROPERTY_FLAG_WRITABLE, NULL);
}
else
{
@@ -1833,15 +1774,11 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
JERRY_ASSERT ((lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK)
&& ecma_get_lex_env_type (lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
- JERRY_ASSERT (arg_lex_env_p != NULL
- && !(arg_lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK)
+ JERRY_ASSERT (arg_lex_env_p != NULL && !(arg_lex_env_p->type_flags_refs & ECMA_OBJECT_FLAG_BLOCK)
&& ecma_get_lex_env_type (arg_lex_env_p) == ECMA_LEXICAL_ENVIRONMENT_DECLARATIVE);
ecma_property_value_t *property_value_p;
- property_value_p = ecma_create_named_data_property (lex_env_p,
- name_p,
- ECMA_PROPERTY_FLAG_WRITABLE,
- NULL);
+ property_value_p = ecma_create_named_data_property (lex_env_p, name_p, ECMA_PROPERTY_FLAG_WRITABLE, NULL);
ecma_property_t *property_p = ecma_find_named_property (arg_lex_env_p, name_p);
JERRY_ASSERT (property_p != NULL);
@@ -2057,8 +1994,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_PUSH_IMPLICIT_CTOR:
{
- *stack_top_p++ = opfunc_create_implicit_class_constructor (opcode,
- frame_ctx_p->shared_p->bytecode_header_p);
+ *stack_top_p++ = opfunc_create_implicit_class_constructor (opcode, frame_ctx_p->shared_p->bytecode_header_p);
continue;
}
case VM_OC_INIT_CLASS:
@@ -2090,10 +2026,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
ecma_string_t *property_name_p = ecma_get_magic_string (LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_INIT);
ecma_object_t *object_p = ecma_get_object_from_value (stack_top_p[-2]);
- ecma_property_value_t *property_value_p = ecma_create_named_data_property (object_p,
- property_name_p,
- ECMA_PROPERTY_FIXED,
- NULL);
+ ecma_property_value_t *property_value_p =
+ ecma_create_named_data_property (object_p, property_name_p, ECMA_PROPERTY_FIXED, NULL);
property_value_p->value = left_value;
property_name_p = ecma_get_internal_string (LIT_INTERNAL_MAGIC_STRING_CLASS_FIELD_COMPUTED);
@@ -2102,8 +2036,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (property_p != NULL)
{
property_value_p = ECMA_PROPERTY_VALUE_PTR (property_p);
- ecma_value_t *compact_collection_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t,
- property_value_p->value);
+ ecma_value_t *compact_collection_p =
+ ECMA_GET_INTERNAL_VALUE_POINTER (ecma_value_t, property_value_p->value);
compact_collection_p = ecma_compact_collection_shrink (compact_collection_p);
ECMA_SET_INTERNAL_VALUE_POINTER (property_value_p->value, compact_collection_p);
}
@@ -2276,9 +2210,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
ECMA_SET_SECOND_BIT_TO_POINTER_TAG (((ecma_extended_object_t *) func_obj_p)->u.function.scope_cp);
}
- value_p->value = ecma_op_function_form_name (ecma_get_prop_name_from_value (left_value),
- prefix_p,
- prefix_size);
+ value_p->value =
+ ecma_op_function_form_name (ecma_get_prop_name_from_value (left_value), prefix_p, prefix_size);
ecma_free_value (left_value);
continue;
}
@@ -2311,8 +2244,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
arg_list_len = argument_end;
}
- result = ecma_op_new_array_object_from_buffer (arg_list_p + argument_end,
- arg_list_len - argument_end);
+ result = ecma_op_new_array_object_from_buffer (arg_list_p + argument_end, arg_list_len - argument_end);
JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (result));
*stack_top_p++ = result;
@@ -2327,9 +2259,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
goto error;
}
- uint32_t context_size = (uint32_t) (stack_top_p
- + PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION
- - VM_LAST_CONTEXT_END ());
+ uint32_t context_size =
+ (uint32_t) (stack_top_p + PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION - VM_LAST_CONTEXT_END ());
stack_top_p += PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION;
VM_PLUS_EQUAL_U16 (frame_ctx_p->context_depth, context_size);
@@ -2391,9 +2322,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
}
- stack_top_p = vm_stack_context_abort_variable_length (frame_ctx_p,
- stack_top_p,
- PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION);
+ stack_top_p =
+ vm_stack_context_abort_variable_length (frame_ctx_p, stack_top_p, PARSER_ITERATOR_CONTEXT_STACK_ALLOCATION);
continue;
}
case VM_OC_DEFAULT_INITIALIZER:
@@ -2490,9 +2420,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
context_stack_allocation = PARSER_OBJ_INIT_REST_CONTEXT_STACK_ALLOCATION;
}
- stack_top_p = vm_stack_context_abort_variable_length (frame_ctx_p,
- stack_top_p,
- context_stack_allocation);
+ stack_top_p = vm_stack_context_abort_variable_length (frame_ctx_p, stack_top_p, context_stack_allocation);
continue;
}
case VM_OC_OBJ_INIT_PUSH_REST:
@@ -2626,8 +2554,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
{
ecma_extended_object_t *async_generator_object_p = VM_GET_EXECUTABLE_OBJECT (frame_ctx_p);
- JERRY_ASSERT (!(async_generator_object_p->u.cls.u2.executable_obj_flags
- & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD));
+ JERRY_ASSERT (
+ !(async_generator_object_p->u.cls.u2.executable_obj_flags & ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD));
/* Byte code is executed at the first time. */
left_value = stack_top_p[-1];
@@ -2868,9 +2796,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
ecma_object_t *ref_base_lex_env_p;
- result = ecma_op_get_value_lex_env_base (frame_ctx_p->lex_env_p,
- &ref_base_lex_env_p,
- name_p);
+ result = ecma_op_get_value_lex_env_base (frame_ctx_p->lex_env_p, &ref_base_lex_env_p, name_p);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -2926,8 +2852,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
case VM_OC_PROP_POST_INCR:
case VM_OC_PROP_POST_DECR:
{
- result = vm_op_get_value (left_value,
- right_value);
+ result = vm_op_get_value (left_value, right_value);
if (opcode < CBC_PRE_INCR)
{
@@ -3123,8 +3048,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_RETURN:
{
- JERRY_ASSERT (opcode == CBC_RETURN
- || opcode == CBC_RETURN_WITH_LITERAL);
+ JERRY_ASSERT (opcode == CBC_RETURN || opcode == CBC_RETURN_WITH_LITERAL);
result = left_value;
left_value = ECMA_VALUE_UNDEFINED;
@@ -3147,8 +3071,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
{
JERRY_CONTEXT (status_flags) |= ECMA_STATUS_DIRECT_EVAL;
JERRY_ASSERT ((*byte_code_p >= CBC_CALL && *byte_code_p <= CBC_CALL2_PROP_BLOCK)
- || (*byte_code_p == CBC_EXT_OPCODE
- && byte_code_p[1] >= CBC_EXT_SPREAD_CALL
+ || (*byte_code_p == CBC_EXT_OPCODE && byte_code_p[1] >= CBC_EXT_SPREAD_CALL
&& byte_code_p[1] <= CBC_EXT_SPREAD_CALL_PROP_BLOCK));
continue;
}
@@ -3220,8 +3143,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
- result = vm_op_delete_var (literal_start_p[literal_index],
- frame_ctx_p->lex_env_p);
+ result = vm_op_delete_var (literal_start_p[literal_index], frame_ctx_p->lex_env_p);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3358,9 +3280,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
ecma_object_t *ref_base_lex_env_p;
- result = ecma_op_get_value_lex_env_base (frame_ctx_p->lex_env_p,
- &ref_base_lex_env_p,
- name_p);
+ result = ecma_op_get_value_lex_env_base (frame_ctx_p->lex_env_p, &ref_base_lex_env_p, name_p);
if (ref_base_lex_env_p == NULL)
{
@@ -3398,22 +3318,20 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
- if (ecma_is_value_float_number (left_value)
- && ecma_is_value_number (right_value))
+ if (ecma_is_value_float_number (left_value) && ecma_is_value_number (right_value))
{
- ecma_number_t new_value = (ecma_get_float_from_value (left_value) +
- ecma_get_number_from_value (right_value));
+ ecma_number_t new_value =
+ (ecma_get_float_from_value (left_value) + ecma_get_number_from_value (right_value));
*stack_top_p++ = ecma_update_float_number (left_value, new_value);
ecma_free_number (right_value);
continue;
}
- if (ecma_is_value_float_number (right_value)
- && ecma_is_value_integer_number (left_value))
+ if (ecma_is_value_float_number (right_value) && ecma_is_value_integer_number (left_value))
{
- ecma_number_t new_value = ((ecma_number_t) ecma_get_integer_from_value (left_value) +
- ecma_get_float_from_value (right_value));
+ ecma_number_t new_value =
+ ((ecma_number_t) ecma_get_integer_from_value (left_value) + ecma_get_float_from_value (right_value));
*stack_top_p++ = ecma_update_float_number (right_value, new_value);
continue;
@@ -3431,12 +3349,10 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_SUB:
{
- JERRY_STATIC_ASSERT (ECMA_INTEGER_NUMBER_MAX * 2 <= INT32_MAX
- && ECMA_INTEGER_NUMBER_MIN * 2 >= INT32_MIN,
+ JERRY_STATIC_ASSERT (ECMA_INTEGER_NUMBER_MAX * 2 <= INT32_MAX && ECMA_INTEGER_NUMBER_MIN * 2 >= INT32_MIN,
doubled_ecma_numbers_must_fit_into_int32_range);
- JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value)
- && !ECMA_IS_VALUE_ERROR (right_value));
+ JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));
if (ecma_are_values_integer_numbers (left_value, right_value))
{
@@ -3446,30 +3362,26 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
- if (ecma_is_value_float_number (left_value)
- && ecma_is_value_number (right_value))
+ if (ecma_is_value_float_number (left_value) && ecma_is_value_number (right_value))
{
- ecma_number_t new_value = (ecma_get_float_from_value (left_value) -
- ecma_get_number_from_value (right_value));
+ ecma_number_t new_value =
+ (ecma_get_float_from_value (left_value) - ecma_get_number_from_value (right_value));
*stack_top_p++ = ecma_update_float_number (left_value, new_value);
ecma_free_number (right_value);
continue;
}
- if (ecma_is_value_float_number (right_value)
- && ecma_is_value_integer_number (left_value))
+ if (ecma_is_value_float_number (right_value) && ecma_is_value_integer_number (left_value))
{
- ecma_number_t new_value = ((ecma_number_t) ecma_get_integer_from_value (left_value) -
- ecma_get_float_from_value (right_value));
+ ecma_number_t new_value =
+ ((ecma_number_t) ecma_get_integer_from_value (left_value) - ecma_get_float_from_value (right_value));
*stack_top_p++ = ecma_update_float_number (right_value, new_value);
continue;
}
- result = do_number_arithmetic (NUMBER_ARITHMETIC_SUBTRACTION,
- left_value,
- right_value);
+ result = do_number_arithmetic (NUMBER_ARITHMETIC_SUBTRACTION, left_value, right_value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3481,11 +3393,10 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_MUL:
{
- JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value)
- && !ECMA_IS_VALUE_ERROR (right_value));
+ JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));
JERRY_STATIC_ASSERT (ECMA_INTEGER_MULTIPLY_MAX * ECMA_INTEGER_MULTIPLY_MAX <= ECMA_INTEGER_NUMBER_MAX
- && -(ECMA_INTEGER_MULTIPLY_MAX * ECMA_INTEGER_MULTIPLY_MAX) >= ECMA_INTEGER_NUMBER_MIN,
+ && -(ECMA_INTEGER_MULTIPLY_MAX * ECMA_INTEGER_MULTIPLY_MAX) >= ECMA_INTEGER_NUMBER_MIN,
square_of_integer_multiply_max_must_fit_into_integer_value_range);
if (ecma_are_values_integer_numbers (left_value, right_value))
@@ -3493,12 +3404,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
ecma_integer_value_t left_integer = ecma_get_integer_from_value (left_value);
ecma_integer_value_t right_integer = ecma_get_integer_from_value (right_value);
- if (-ECMA_INTEGER_MULTIPLY_MAX <= left_integer
- && left_integer <= ECMA_INTEGER_MULTIPLY_MAX
- && -ECMA_INTEGER_MULTIPLY_MAX <= right_integer
- && right_integer <= ECMA_INTEGER_MULTIPLY_MAX
- && left_integer != 0
- && right_integer != 0)
+ if (-ECMA_INTEGER_MULTIPLY_MAX <= left_integer && left_integer <= ECMA_INTEGER_MULTIPLY_MAX
+ && -ECMA_INTEGER_MULTIPLY_MAX <= right_integer && right_integer <= ECMA_INTEGER_MULTIPLY_MAX
+ && left_integer != 0 && right_integer != 0)
{
*stack_top_p++ = ecma_integer_multiply (left_integer, right_integer);
continue;
@@ -3509,30 +3417,26 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
- if (ecma_is_value_float_number (left_value)
- && ecma_is_value_number (right_value))
+ if (ecma_is_value_float_number (left_value) && ecma_is_value_number (right_value))
{
- ecma_number_t new_value = (ecma_get_float_from_value (left_value) *
- ecma_get_number_from_value (right_value));
+ ecma_number_t new_value =
+ (ecma_get_float_from_value (left_value) * ecma_get_number_from_value (right_value));
*stack_top_p++ = ecma_update_float_number (left_value, new_value);
ecma_free_number (right_value);
continue;
}
- if (ecma_is_value_float_number (right_value)
- && ecma_is_value_integer_number (left_value))
+ if (ecma_is_value_float_number (right_value) && ecma_is_value_integer_number (left_value))
{
- ecma_number_t new_value = ((ecma_number_t) ecma_get_integer_from_value (left_value) *
- ecma_get_float_from_value (right_value));
+ ecma_number_t new_value =
+ ((ecma_number_t) ecma_get_integer_from_value (left_value) * ecma_get_float_from_value (right_value));
*stack_top_p++ = ecma_update_float_number (right_value, new_value);
continue;
}
- result = do_number_arithmetic (NUMBER_ARITHMETIC_MULTIPLICATION,
- left_value,
- right_value);
+ result = do_number_arithmetic (NUMBER_ARITHMETIC_MULTIPLICATION, left_value, right_value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3544,12 +3448,9 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_DIV:
{
- JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value)
- && !ECMA_IS_VALUE_ERROR (right_value));
+ JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));
- result = do_number_arithmetic (NUMBER_ARITHMETIC_DIVISION,
- left_value,
- right_value);
+ result = do_number_arithmetic (NUMBER_ARITHMETIC_DIVISION, left_value, right_value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3561,8 +3462,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
case VM_OC_MOD:
{
- JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value)
- && !ECMA_IS_VALUE_ERROR (right_value));
+ JERRY_ASSERT (!ECMA_IS_VALUE_ERROR (left_value) && !ECMA_IS_VALUE_ERROR (right_value));
if (ecma_are_values_integer_numbers (left_value, right_value))
{
@@ -3581,9 +3481,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
}
- result = do_number_arithmetic (NUMBER_ARITHMETIC_REMAINDER,
- left_value,
- right_value);
+ result = do_number_arithmetic (NUMBER_ARITHMETIC_REMAINDER, left_value, right_value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3596,9 +3494,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
#if JERRY_ESNEXT
case VM_OC_EXP:
{
- result = do_number_arithmetic (NUMBER_ARITHMETIC_EXPONENTIATION,
- left_value,
- right_value);
+ result = do_number_arithmetic (NUMBER_ARITHMETIC_EXPONENTIATION, left_value, right_value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3662,9 +3558,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
- result = do_number_bitwise_logic (NUMBER_BITWISE_LOGIC_OR,
- left_value,
- right_value);
+ result = do_number_bitwise_logic (NUMBER_BITWISE_LOGIC_OR, left_value, right_value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3685,9 +3579,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
- result = do_number_bitwise_logic (NUMBER_BITWISE_LOGIC_XOR,
- left_value,
- right_value);
+ result = do_number_bitwise_logic (NUMBER_BITWISE_LOGIC_XOR, left_value, right_value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3708,9 +3600,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
- result = do_number_bitwise_logic (NUMBER_BITWISE_LOGIC_AND,
- left_value,
- right_value);
+ result = do_number_bitwise_logic (NUMBER_BITWISE_LOGIC_AND, left_value, right_value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3733,9 +3623,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
- result = do_number_bitwise_logic (NUMBER_BITWISE_SHIFT_LEFT,
- left_value,
- right_value);
+ result = do_number_bitwise_logic (NUMBER_BITWISE_SHIFT_LEFT, left_value, right_value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3758,9 +3646,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
- result = do_number_bitwise_logic (NUMBER_BITWISE_SHIFT_RIGHT,
- left_value,
- right_value);
+ result = do_number_bitwise_logic (NUMBER_BITWISE_SHIFT_RIGHT, left_value, right_value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3783,9 +3669,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
continue;
}
- result = do_number_bitwise_logic (NUMBER_BITWISE_SHIFT_URIGHT,
- left_value,
- right_value);
+ result = do_number_bitwise_logic (NUMBER_BITWISE_SHIFT_URIGHT, left_value, right_value);
if (ECMA_IS_VALUE_ERROR (result))
{
@@ -3986,7 +3870,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
if (stack_context_top_p != stack_top_p)
{
- /* Preserve the value of switch statement. */
+ /* Preserve the value of switch statement. */
stack_context_top_p[1] = stack_context_top_p[0];
}
@@ -4317,8 +4201,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
frame_ctx_p->byte_code_p = byte_code_p;
frame_ctx_p->stack_top_p = stack_top_p;
- uint16_t extra_flags = (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD
- | (ECMA_AWAIT_FOR_NEXT << ECMA_AWAIT_STATE_SHIFT));
+ uint16_t extra_flags =
+ (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD | (ECMA_AWAIT_FOR_NEXT << ECMA_AWAIT_STATE_SHIFT));
if (CBC_FUNCTION_GET_TYPE (bytecode_header_p->status_flags) == CBC_FUNCTION_ASYNC_GENERATOR
|| (frame_ctx_p->shared_p->status_flags & VM_FRAME_CTX_SHARED_EXECUTABLE))
@@ -4365,8 +4249,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
goto error;
}
- uint16_t extra_flags = (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD
- | (ECMA_AWAIT_FOR_NEXT << ECMA_AWAIT_STATE_SHIFT));
+ uint16_t extra_flags =
+ (ECMA_EXECUTABLE_OBJECT_DO_AWAIT_OR_YIELD | (ECMA_AWAIT_FOR_NEXT << ECMA_AWAIT_STATE_SHIFT));
executable_object_p->u.cls.u2.executable_obj_flags |= extra_flags;
frame_ctx_p->call_operation = VM_EXEC_RETURN;
@@ -4446,8 +4330,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
#endif /* JERRY_ESNEXT */
- VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth,
- PARSER_FINALLY_CONTEXT_STACK_ALLOCATION);
+ VM_MINUS_EQUAL_U16 (frame_ctx_p->context_depth, PARSER_FINALLY_CONTEXT_STACK_ALLOCATION);
stack_top_p -= PARSER_FINALLY_CONTEXT_STACK_ALLOCATION;
if (context_type == VM_CONTEXT_FINALLY_RETURN)
@@ -4474,10 +4357,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
uint32_t jump_target = *stack_top_p;
- vm_stack_found_type type = vm_stack_find_finally (frame_ctx_p,
- stack_top_p,
- VM_CONTEXT_FINALLY_JUMP,
- jump_target);
+ vm_stack_found_type type =
+ vm_stack_find_finally (frame_ctx_p, stack_top_p, VM_CONTEXT_FINALLY_JUMP, jump_target);
stack_top_p = frame_ctx_p->stack_top_p;
switch (type)
{
@@ -4520,10 +4401,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
branch_offset += (int32_t) (byte_code_start_p - frame_ctx_p->byte_code_start_p);
- vm_stack_found_type type = vm_stack_find_finally (frame_ctx_p,
- stack_top_p,
- VM_CONTEXT_FINALLY_JUMP,
- (uint32_t) branch_offset);
+ vm_stack_found_type type =
+ vm_stack_find_finally (frame_ctx_p, stack_top_p, VM_CONTEXT_FINALLY_JUMP, (uint32_t) branch_offset);
stack_top_p = frame_ctx_p->stack_top_p;
switch (type)
{
@@ -4733,10 +4612,8 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
{
ecma_string_t *var_name_str_p = ecma_get_string_from_value (literal_start_p[literal_index]);
- ecma_value_t put_value_result = ecma_op_put_value_lex_env_base (frame_ctx_p->lex_env_p,
- var_name_str_p,
- is_strict,
- result);
+ ecma_value_t put_value_result =
+ ecma_op_put_value_lex_env_base (frame_ctx_p->lex_env_p, var_name_str_p, is_strict, result);
if (ECMA_IS_VALUE_ERROR (put_value_result))
{
@@ -4770,10 +4647,7 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
}
else
{
- ecma_value_t set_value_result = vm_op_set_value (base,
- property,
- result,
- is_strict);
+ ecma_value_t set_value_result = vm_op_set_value (base, property, result, is_strict);
if (ECMA_IS_VALUE_ERROR (set_value_result))
{
@@ -4800,13 +4674,13 @@ vm_loop (vm_frame_ctx_t *frame_ctx_p) /**< frame context */
VM_GET_REGISTERS (frame_ctx_p)[0] = result;
}
-free_both_values:
+ free_both_values:
ecma_fast_free_value (right_value);
-free_left_value:
+ free_left_value:
ecma_fast_free_value (left_value);
}
-error:
+ error:
ecma_fast_free_value (left_value);
ecma_fast_free_value (right_value);
@@ -4843,9 +4717,8 @@ error:
#endif /* JERRY_VM_THROW */
#if JERRY_DEBUGGER
- const uint32_t dont_stop = (JERRY_DEBUGGER_VM_IGNORE_EXCEPTION
- | JERRY_DEBUGGER_VM_IGNORE
- | JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
+ const uint32_t dont_stop =
+ (JERRY_DEBUGGER_VM_IGNORE_EXCEPTION | JERRY_DEBUGGER_VM_IGNORE | JERRY_DEBUGGER_VM_EXCEPTION_THROWN);
if ((JERRY_CONTEXT (debugger_flags) & JERRY_DEBUGGER_CONNECTED)
&& !(frame_ctx_p->shared_p->bytecode_header_p->status_flags
@@ -4886,10 +4759,7 @@ error:
if (!ECMA_IS_VALUE_ERROR (result))
{
- switch (vm_stack_find_finally (frame_ctx_p,
- stack_top_p,
- VM_CONTEXT_FINALLY_RETURN,
- 0))
+ switch (vm_stack_find_finally (frame_ctx_p, stack_top_p, VM_CONTEXT_FINALLY_RETURN, 0))
{
case VM_CONTEXT_FOUND_FINALLY:
{
@@ -4931,10 +4801,7 @@ error:
if (!jcontext_has_pending_abort ())
{
- switch (vm_stack_find_finally (frame_ctx_p,
- stack_top_p,
- VM_CONTEXT_FINALLY_THROW,
- 0))
+ switch (vm_stack_find_finally (frame_ctx_p, stack_top_p, VM_CONTEXT_FINALLY_THROW, 0))
{
case VM_CONTEXT_FOUND_FINALLY:
{
@@ -4981,11 +4848,10 @@ error:
JERRY_ASSERT (VM_GET_REGISTERS (frame_ctx_p) + register_end + frame_ctx_p->context_depth == stack_top_p);
stack_top_p = vm_stack_context_abort (frame_ctx_p, stack_top_p);
- }
- while (frame_ctx_p->context_depth > 0);
+ } while (frame_ctx_p->context_depth > 0);
}
-finish:
+ finish:
frame_ctx_p->call_operation = VM_NO_EXEC_OP;
return result;
}
@@ -5104,8 +4970,7 @@ vm_init_module_scope (ecma_module_t *module_p) /**< module without scope */
if (JERRY_LIKELY (!(compiled_code_p->status_flags & CBC_CODE_FLAGS_STATIC_FUNCTION)))
{
#endif /* JERRY_SNAPSHOT_EXEC */
- function_bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t,
- literal_start_p[literal_index]);
+ function_bytecode_p = ECMA_GET_INTERNAL_VALUE_POINTER (ecma_compiled_code_t, literal_start_p[literal_index]);
#if JERRY_SNAPSHOT_EXEC
}
else
@@ -5121,9 +4986,7 @@ vm_init_module_scope (ecma_module_t *module_p) /**< module without scope */
if (JERRY_UNLIKELY (CBC_FUNCTION_IS_ARROW (function_bytecode_p->status_flags)))
{
- function_obj_p = ecma_op_create_arrow_function_object (scope_p,
- function_bytecode_p,
- ECMA_VALUE_UNDEFINED);
+ function_obj_p = ecma_op_create_arrow_function_object (scope_p, function_bytecode_p, ECMA_VALUE_UNDEFINED);
}
else
{
@@ -5136,10 +4999,7 @@ vm_init_module_scope (ecma_module_t *module_p) /**< module without scope */
JERRY_ASSERT (ecma_find_named_property (scope_p, name_p) == NULL);
ecma_property_value_t *property_value_p;
- property_value_p = ecma_create_named_data_property (scope_p,
- name_p,
- ECMA_PROPERTY_FLAG_WRITABLE,
- NULL);
+ property_value_p = ecma_create_named_data_property (scope_p, name_p, ECMA_PROPERTY_FLAG_WRITABLE, NULL);
JERRY_ASSERT (property_value_p->value == ECMA_VALUE_UNDEFINED);
property_value_p->value = ecma_make_object_value (function_obj_p);
diff --git a/jerry-core/vm/vm.h b/jerry-core/vm/vm.h
index bad33cfc..e4229626 100644
--- a/jerry-core/vm/vm.h
+++ b/jerry-core/vm/vm.h
@@ -18,6 +18,7 @@
#include "ecma-globals.h"
#include "ecma-module.h"
+
#include "jrt.h"
#include "vm-defines.h"
@@ -60,7 +61,7 @@
/**
* Generate the binary representation of a "get arguments" opcode.
*/
-#define VM_OC_GET_ARGS_CREATE_INDEX(V) (((V) & VM_OC_GET_ARGS_MASK) << VM_OC_GET_ARGS_SHIFT)
+#define VM_OC_GET_ARGS_CREATE_INDEX(V) (((V) &VM_OC_GET_ARGS_MASK) << VM_OC_GET_ARGS_SHIFT)
/**
* Extract the "get arguments" opcode.
@@ -77,16 +78,16 @@
*/
typedef enum
{
- VM_OC_GET_NONE = VM_OC_GET_ARGS_CREATE_INDEX (0), /**< do nothing */
- VM_OC_GET_BRANCH = VM_OC_GET_ARGS_CREATE_INDEX (1), /**< branch argument */
- VM_OC_GET_STACK = VM_OC_GET_ARGS_CREATE_INDEX (2), /**< pop one element from the stack */
- VM_OC_GET_STACK_STACK = VM_OC_GET_ARGS_CREATE_INDEX (3), /**< pop two elements from the stack */
-
- VM_OC_GET_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (4), /**< resolve literal */
- VM_OC_GET_LITERAL_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (5), /**< resolve two literals */
- VM_OC_GET_STACK_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (6), /**< pop one element from the stack
- * and resolve a literal */
- VM_OC_GET_THIS_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (7), /**< get this and resolve a literal */
+ VM_OC_GET_NONE = VM_OC_GET_ARGS_CREATE_INDEX (0), /**< do nothing */
+ VM_OC_GET_BRANCH = VM_OC_GET_ARGS_CREATE_INDEX (1), /**< branch argument */
+ VM_OC_GET_STACK = VM_OC_GET_ARGS_CREATE_INDEX (2), /**< pop one element from the stack */
+ VM_OC_GET_STACK_STACK = VM_OC_GET_ARGS_CREATE_INDEX (3), /**< pop two elements from the stack */
+
+ VM_OC_GET_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (4), /**< resolve literal */
+ VM_OC_GET_LITERAL_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (5), /**< resolve two literals */
+ VM_OC_GET_STACK_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (6), /**< pop one element from the stack
+ * and resolve a literal */
+ VM_OC_GET_THIS_LITERAL = VM_OC_GET_ARGS_CREATE_INDEX (7), /**< get this and resolve a literal */
} vm_oc_get_types;
/**
@@ -97,216 +98,216 @@ typedef enum
/**
* Extract the "group" opcode.
*/
-#define VM_OC_GROUP_GET_INDEX(O) ((O) & VM_OC_GROUP_MASK)
+#define VM_OC_GROUP_GET_INDEX(O) ((O) &VM_OC_GROUP_MASK)
/**
* Opcodes.
*/
typedef enum
{
- VM_OC_POP, /**< pop from stack */
- VM_OC_POP_BLOCK, /**< pop block */
- VM_OC_PUSH, /**< push one literal */
- VM_OC_PUSH_TWO, /**< push two literals */
- VM_OC_PUSH_THREE, /**< push three literals */
- VM_OC_PUSH_UNDEFINED, /**< push undefined value */
- VM_OC_PUSH_TRUE, /**< push true value */
- VM_OC_PUSH_FALSE, /**< push false value */
- VM_OC_PUSH_NULL, /**< push null value */
- VM_OC_PUSH_THIS, /**< push this */
- VM_OC_PUSH_0, /**< push number zero */
- VM_OC_PUSH_POS_BYTE, /**< push number between 1 and 256 */
- VM_OC_PUSH_NEG_BYTE, /**< push number between -1 and -256 */
- VM_OC_PUSH_LIT_0, /**< push literal and number zero */
- VM_OC_PUSH_LIT_POS_BYTE, /**< push literal and number between 1 and 256 */
- VM_OC_PUSH_LIT_NEG_BYTE, /**< push literal and number between -1 and -256 */
- VM_OC_PUSH_OBJECT, /**< push object */
- VM_OC_PUSH_NAMED_FUNC_EXPR, /**< push named function expression */
- VM_OC_SET_PROPERTY, /**< set property */
-
- VM_OC_SET_GETTER, /**< set getter */
- VM_OC_SET_SETTER, /**< set setter */
- VM_OC_PUSH_ARRAY, /**< push array */
- VM_OC_PUSH_ELISON, /**< push elison */
- VM_OC_APPEND_ARRAY, /**< append array */
- VM_OC_IDENT_REFERENCE, /**< ident reference */
- VM_OC_PROP_REFERENCE, /**< prop reference */
- VM_OC_PROP_GET, /**< prop get */
+ VM_OC_POP, /**< pop from stack */
+ VM_OC_POP_BLOCK, /**< pop block */
+ VM_OC_PUSH, /**< push one literal */
+ VM_OC_PUSH_TWO, /**< push two literals */
+ VM_OC_PUSH_THREE, /**< push three literals */
+ VM_OC_PUSH_UNDEFINED, /**< push undefined value */
+ VM_OC_PUSH_TRUE, /**< push true value */
+ VM_OC_PUSH_FALSE, /**< push false value */
+ VM_OC_PUSH_NULL, /**< push null value */
+ VM_OC_PUSH_THIS, /**< push this */
+ VM_OC_PUSH_0, /**< push number zero */
+ VM_OC_PUSH_POS_BYTE, /**< push number between 1 and 256 */
+ VM_OC_PUSH_NEG_BYTE, /**< push number between -1 and -256 */
+ VM_OC_PUSH_LIT_0, /**< push literal and number zero */
+ VM_OC_PUSH_LIT_POS_BYTE, /**< push literal and number between 1 and 256 */
+ VM_OC_PUSH_LIT_NEG_BYTE, /**< push literal and number between -1 and -256 */
+ VM_OC_PUSH_OBJECT, /**< push object */
+ VM_OC_PUSH_NAMED_FUNC_EXPR, /**< push named function expression */
+ VM_OC_SET_PROPERTY, /**< set property */
+
+ VM_OC_SET_GETTER, /**< set getter */
+ VM_OC_SET_SETTER, /**< set setter */
+ VM_OC_PUSH_ARRAY, /**< push array */
+ VM_OC_PUSH_ELISON, /**< push elison */
+ VM_OC_APPEND_ARRAY, /**< append array */
+ VM_OC_IDENT_REFERENCE, /**< ident reference */
+ VM_OC_PROP_REFERENCE, /**< prop reference */
+ VM_OC_PROP_GET, /**< prop get */
/* These eight opcodes must be in this order. */
- VM_OC_PROP_PRE_INCR, /**< prefix increment of a property */
- VM_OC_PROP_PRE_DECR, /**< prop prefix decrement of a property */
- VM_OC_PROP_POST_INCR, /**< prop postfix increment of a property */
- VM_OC_PROP_POST_DECR, /**< prop postfix decrement of a property */
- VM_OC_PRE_INCR, /**< prefix increment */
- VM_OC_PRE_DECR, /**< prefix decrement */
- VM_OC_POST_INCR, /**< postfix increment */
- VM_OC_POST_DECR, /**< postfix decrement */
-
- VM_OC_PROP_DELETE, /**< delete property */
- VM_OC_DELETE, /**< delete */
-
- VM_OC_MOV_IDENT, /**< move identifier register reference */
- VM_OC_ASSIGN, /**< assign */
- VM_OC_ASSIGN_PROP, /**< assign property */
- VM_OC_ASSIGN_PROP_THIS, /**< assign prop this */
-
- VM_OC_RETURN, /**< return */
- VM_OC_RETURN_FUNCTION_END, /**< return at the end of a function/script */
- VM_OC_THROW, /**< throw */
- VM_OC_THROW_REFERENCE_ERROR, /**< throw reference error */
-
- VM_OC_EVAL, /**< eval */
- VM_OC_CALL, /**< call */
- VM_OC_NEW, /**< new */
- VM_OC_RESOLVE_BASE_FOR_CALL, /**< resolve base value before call */
- VM_OC_ERROR, /**< error while the vm_loop is suspended */
-
- VM_OC_JUMP, /**< jump */
+ VM_OC_PROP_PRE_INCR, /**< prefix increment of a property */
+ VM_OC_PROP_PRE_DECR, /**< prop prefix decrement of a property */
+ VM_OC_PROP_POST_INCR, /**< prop postfix increment of a property */
+ VM_OC_PROP_POST_DECR, /**< prop postfix decrement of a property */
+ VM_OC_PRE_INCR, /**< prefix increment */
+ VM_OC_PRE_DECR, /**< prefix decrement */
+ VM_OC_POST_INCR, /**< postfix increment */
+ VM_OC_POST_DECR, /**< postfix decrement */
+
+ VM_OC_PROP_DELETE, /**< delete property */
+ VM_OC_DELETE, /**< delete */
+
+ VM_OC_MOV_IDENT, /**< move identifier register reference */
+ VM_OC_ASSIGN, /**< assign */
+ VM_OC_ASSIGN_PROP, /**< assign property */
+ VM_OC_ASSIGN_PROP_THIS, /**< assign prop this */
+
+ VM_OC_RETURN, /**< return */
+ VM_OC_RETURN_FUNCTION_END, /**< return at the end of a function/script */
+ VM_OC_THROW, /**< throw */
+ VM_OC_THROW_REFERENCE_ERROR, /**< throw reference error */
+
+ VM_OC_EVAL, /**< eval */
+ VM_OC_CALL, /**< call */
+ VM_OC_NEW, /**< new */
+ VM_OC_RESOLVE_BASE_FOR_CALL, /**< resolve base value before call */
+ VM_OC_ERROR, /**< error while the vm_loop is suspended */
+
+ VM_OC_JUMP, /**< jump */
#if JERRY_ESNEXT
- VM_OC_BRANCH_IF_NULLISH, /** branch if undefined or null */
+ VM_OC_BRANCH_IF_NULLISH, /** branch if undefined or null */
#endif /* JERRY_ESNEXT */
- VM_OC_BRANCH_IF_STRICT_EQUAL, /**< branch if strict equal */
+ VM_OC_BRANCH_IF_STRICT_EQUAL, /**< branch if strict equal */
/* These four opcodes must be in this order. */
- VM_OC_BRANCH_IF_TRUE, /**< branch if true */
- VM_OC_BRANCH_IF_FALSE, /**< branch if false */
- VM_OC_BRANCH_IF_LOGICAL_TRUE, /**< branch if logical true */
+ VM_OC_BRANCH_IF_TRUE, /**< branch if true */
+ VM_OC_BRANCH_IF_FALSE, /**< branch if false */
+ VM_OC_BRANCH_IF_LOGICAL_TRUE, /**< branch if logical true */
VM_OC_BRANCH_IF_LOGICAL_FALSE, /**< branch if logical false */
- VM_OC_PLUS, /**< unary plus */
- VM_OC_MINUS, /**< unary minus */
- VM_OC_NOT, /**< not */
- VM_OC_BIT_NOT, /**< bitwise not */
- VM_OC_VOID, /**< void */
- VM_OC_TYPEOF_IDENT, /**< typeof identifier */
- VM_OC_TYPEOF, /**< typeof */
-
- VM_OC_ADD, /**< binary add */
- VM_OC_SUB, /**< binary sub */
- VM_OC_MUL, /**< mul */
- VM_OC_DIV, /**< div */
- VM_OC_MOD, /**< mod */
+ VM_OC_PLUS, /**< unary plus */
+ VM_OC_MINUS, /**< unary minus */
+ VM_OC_NOT, /**< not */
+ VM_OC_BIT_NOT, /**< bitwise not */
+ VM_OC_VOID, /**< void */
+ VM_OC_TYPEOF_IDENT, /**< typeof identifier */
+ VM_OC_TYPEOF, /**< typeof */
+
+ VM_OC_ADD, /**< binary add */
+ VM_OC_SUB, /**< binary sub */
+ VM_OC_MUL, /**< mul */
+ VM_OC_DIV, /**< div */
+ VM_OC_MOD, /**< mod */
#if JERRY_ESNEXT
- VM_OC_EXP, /**< exponentiation */
+ VM_OC_EXP, /**< exponentiation */
#endif /* JERRY_ESNEXT */
- VM_OC_EQUAL, /**< equal */
- VM_OC_NOT_EQUAL, /**< not equal */
- VM_OC_STRICT_EQUAL, /**< strict equal */
- VM_OC_STRICT_NOT_EQUAL, /**< strict not equal */
- VM_OC_LESS, /**< less */
- VM_OC_GREATER, /**< greater */
- VM_OC_LESS_EQUAL, /**< less equal */
- VM_OC_GREATER_EQUAL, /**< greater equal */
- VM_OC_IN, /**< in */
- VM_OC_INSTANCEOF, /**< instanceof */
-
- VM_OC_BIT_OR, /**< bitwise or */
- VM_OC_BIT_XOR, /**< bitwise xor */
- VM_OC_BIT_AND, /**< bitwise and */
- VM_OC_LEFT_SHIFT, /**< left shift */
- VM_OC_RIGHT_SHIFT, /**< right shift */
- VM_OC_UNS_RIGHT_SHIFT, /**< unsigned right shift */
-
- VM_OC_BLOCK_CREATE_CONTEXT, /**< create lexical environment for blocks enclosed in braces */
- VM_OC_WITH, /**< with */
- VM_OC_FOR_IN_INIT, /**< for-in init context */
- VM_OC_FOR_IN_GET_NEXT, /**< get next */
- VM_OC_FOR_IN_HAS_NEXT, /**< has next */
-
- VM_OC_TRY, /**< try */
- VM_OC_CATCH, /**< catch */
- VM_OC_FINALLY, /**< finally */
- VM_OC_CONTEXT_END, /**< context end */
- VM_OC_JUMP_AND_EXIT_CONTEXT, /**< jump and exit context */
-
- VM_OC_CREATE_BINDING, /**< create variables */
- VM_OC_CREATE_ARGUMENTS, /**< create arguments object */
- VM_OC_SET_BYTECODE_PTR, /**< setting bytecode pointer */
- VM_OC_VAR_EVAL, /**< variable and function evaluation */
+ VM_OC_EQUAL, /**< equal */
+ VM_OC_NOT_EQUAL, /**< not equal */
+ VM_OC_STRICT_EQUAL, /**< strict equal */
+ VM_OC_STRICT_NOT_EQUAL, /**< strict not equal */
+ VM_OC_LESS, /**< less */
+ VM_OC_GREATER, /**< greater */
+ VM_OC_LESS_EQUAL, /**< less equal */
+ VM_OC_GREATER_EQUAL, /**< greater equal */
+ VM_OC_IN, /**< in */
+ VM_OC_INSTANCEOF, /**< instanceof */
+
+ VM_OC_BIT_OR, /**< bitwise or */
+ VM_OC_BIT_XOR, /**< bitwise xor */
+ VM_OC_BIT_AND, /**< bitwise and */
+ VM_OC_LEFT_SHIFT, /**< left shift */
+ VM_OC_RIGHT_SHIFT, /**< right shift */
+ VM_OC_UNS_RIGHT_SHIFT, /**< unsigned right shift */
+
+ VM_OC_BLOCK_CREATE_CONTEXT, /**< create lexical environment for blocks enclosed in braces */
+ VM_OC_WITH, /**< with */
+ VM_OC_FOR_IN_INIT, /**< for-in init context */
+ VM_OC_FOR_IN_GET_NEXT, /**< get next */
+ VM_OC_FOR_IN_HAS_NEXT, /**< has next */
+
+ VM_OC_TRY, /**< try */
+ VM_OC_CATCH, /**< catch */
+ VM_OC_FINALLY, /**< finally */
+ VM_OC_CONTEXT_END, /**< context end */
+ VM_OC_JUMP_AND_EXIT_CONTEXT, /**< jump and exit context */
+
+ VM_OC_CREATE_BINDING, /**< create variables */
+ VM_OC_CREATE_ARGUMENTS, /**< create arguments object */
+ VM_OC_SET_BYTECODE_PTR, /**< setting bytecode pointer */
+ VM_OC_VAR_EVAL, /**< variable and function evaluation */
#if JERRY_ESNEXT
- VM_OC_EXT_VAR_EVAL, /**< variable and function evaluation for
- * functions with separate argument context */
+ VM_OC_EXT_VAR_EVAL, /**< variable and function evaluation for
+ * functions with separate argument context */
#endif /* JERRY_ESNEXT */
- VM_OC_INIT_ARG_OR_FUNC, /**< create and init a function or argument binding */
+ VM_OC_INIT_ARG_OR_FUNC, /**< create and init a function or argument binding */
#if JERRY_DEBUGGER
- VM_OC_BREAKPOINT_ENABLED, /**< enabled breakpoint for debugger */
- VM_OC_BREAKPOINT_DISABLED, /**< disabled breakpoint for debugger */
+ VM_OC_BREAKPOINT_ENABLED, /**< enabled breakpoint for debugger */
+ VM_OC_BREAKPOINT_DISABLED, /**< disabled breakpoint for debugger */
#endif /* JERRY_DEBUGGER */
#if JERRY_ESNEXT
- VM_OC_CHECK_VAR, /**< check redeclared vars in the global scope */
- VM_OC_CHECK_LET, /**< check redeclared lets in the global scope */
- VM_OC_ASSIGN_LET_CONST, /**< assign values to let/const declarations */
- VM_OC_INIT_BINDING, /**< create and intialize a binding */
- VM_OC_THROW_CONST_ERROR, /**< throw invalid assignment to const variable error */
- VM_OC_COPY_TO_GLOBAL, /**< copy value to global lex env */
- VM_OC_COPY_FROM_ARG, /**< copy value from arg lex env */
- VM_OC_CLONE_CONTEXT, /**< clone lexical environment with let/const declarations */
- VM_OC_COPY_DATA_PROPERTIES, /**< copy data properties of an object */
- VM_OC_SET_COMPUTED_PROPERTY, /**< set computed property */
-
- VM_OC_FOR_OF_INIT, /**< for-of init context */
- VM_OC_FOR_OF_GET_NEXT, /**< for-of get next */
- VM_OC_FOR_OF_HAS_NEXT, /**< for-of has next */
- VM_OC_FOR_AWAIT_OF_INIT, /**< for-await-of init context */
- VM_OC_FOR_AWAIT_OF_HAS_NEXT, /**< for-await-of has next */
-
- VM_OC_LOCAL_EVAL, /**< eval in local context */
- VM_OC_SUPER_CALL, /**< call the 'super' constructor */
- VM_OC_PUSH_CLASS_ENVIRONMENT, /**< push class environment */
- VM_OC_PUSH_IMPLICIT_CTOR, /**< create implicit class constructor */
- VM_OC_INIT_CLASS, /**< initialize class */
- VM_OC_FINALIZE_CLASS, /**< finalize class */
- VM_OC_SET_FIELD_INIT, /**< store the class field initializer function */
- VM_OC_SET_STATIC_FIELD_INIT, /**< store the static class field initializer function */
- VM_OC_RUN_FIELD_INIT, /**< run the class field initializer function */
- VM_OC_RUN_STATIC_FIELD_INIT, /**< run the static class field initializer function */
+ VM_OC_CHECK_VAR, /**< check redeclared vars in the global scope */
+ VM_OC_CHECK_LET, /**< check redeclared lets in the global scope */
+ VM_OC_ASSIGN_LET_CONST, /**< assign values to let/const declarations */
+ VM_OC_INIT_BINDING, /**< create and intialize a binding */
+ VM_OC_THROW_CONST_ERROR, /**< throw invalid assignment to const variable error */
+ VM_OC_COPY_TO_GLOBAL, /**< copy value to global lex env */
+ VM_OC_COPY_FROM_ARG, /**< copy value from arg lex env */
+ VM_OC_CLONE_CONTEXT, /**< clone lexical environment with let/const declarations */
+ VM_OC_COPY_DATA_PROPERTIES, /**< copy data properties of an object */
+ VM_OC_SET_COMPUTED_PROPERTY, /**< set computed property */
+
+ VM_OC_FOR_OF_INIT, /**< for-of init context */
+ VM_OC_FOR_OF_GET_NEXT, /**< for-of get next */
+ VM_OC_FOR_OF_HAS_NEXT, /**< for-of has next */
+ VM_OC_FOR_AWAIT_OF_INIT, /**< for-await-of init context */
+ VM_OC_FOR_AWAIT_OF_HAS_NEXT, /**< for-await-of has next */
+
+ VM_OC_LOCAL_EVAL, /**< eval in local context */
+ VM_OC_SUPER_CALL, /**< call the 'super' constructor */
+ VM_OC_PUSH_CLASS_ENVIRONMENT, /**< push class environment */
+ VM_OC_PUSH_IMPLICIT_CTOR, /**< create implicit class constructor */
+ VM_OC_INIT_CLASS, /**< initialize class */
+ VM_OC_FINALIZE_CLASS, /**< finalize class */
+ VM_OC_SET_FIELD_INIT, /**< store the class field initializer function */
+ VM_OC_SET_STATIC_FIELD_INIT, /**< store the static class field initializer function */
+ VM_OC_RUN_FIELD_INIT, /**< run the class field initializer function */
+ VM_OC_RUN_STATIC_FIELD_INIT, /**< run the static class field initializer function */
VM_OC_SET_NEXT_COMPUTED_FIELD, /**< set the next computed field of a class */
- VM_OC_PUSH_SUPER_CONSTRUCTOR, /**< getSuperConstructor operation */
- VM_OC_RESOLVE_LEXICAL_THIS, /**< resolve this_binding from from the lexical environment */
- VM_OC_SUPER_REFERENCE, /**< push super reference */
- VM_OC_SET_HOME_OBJECT, /**< set the [[HomeObject]] environment in an object literal */
+ VM_OC_PUSH_SUPER_CONSTRUCTOR, /**< getSuperConstructor operation */
+ VM_OC_RESOLVE_LEXICAL_THIS, /**< resolve this_binding from from the lexical environment */
+ VM_OC_SUPER_REFERENCE, /**< push super reference */
+ VM_OC_SET_HOME_OBJECT, /**< set the [[HomeObject]] environment in an object literal */
VM_OC_OBJECT_LITERAL_HOME_ENV, /**< create/destroy [[HomeObject]] environment of an object literal */
- VM_OC_SET_FUNCTION_NAME, /**< set function name property */
+ VM_OC_SET_FUNCTION_NAME, /**< set function name property */
- VM_OC_PUSH_SPREAD_ELEMENT, /**< push spread element */
- VM_OC_PUSH_REST_OBJECT, /**< push rest object */
+ VM_OC_PUSH_SPREAD_ELEMENT, /**< push spread element */
+ VM_OC_PUSH_REST_OBJECT, /**< push rest object */
VM_OC_ITERATOR_CONTEXT_CREATE, /**< create iterator conext */
- VM_OC_ITERATOR_CONTEXT_END, /**< finalize iterator cotnext */
- VM_OC_ITERATOR_STEP, /**< IteratorStep abstract operation */
+ VM_OC_ITERATOR_CONTEXT_END, /**< finalize iterator cotnext */
+ VM_OC_ITERATOR_STEP, /**< IteratorStep abstract operation */
VM_OC_OBJ_INIT_CONTEXT_CREATE, /**< create object initializer context */
- VM_OC_OBJ_INIT_CONTEXT_END, /**< finalize object initializer context */
- VM_OC_OBJ_INIT_PUSH_REST, /**< push the object with the rest properties */
- VM_OC_INITIALIZER_PUSH_NAME, /**< append string to name list array and push the string */
- VM_OC_DEFAULT_INITIALIZER, /**< default initializer inside a pattern */
- VM_OC_REST_INITIALIZER, /**< create rest object inside an array pattern */
- VM_OC_INITIALIZER_PUSH_PROP, /**< push property for object initializer */
- VM_OC_SPREAD_ARGUMENTS, /**< perform function call/construct with spreaded arguments */
- VM_OC_CREATE_GENERATOR, /**< create a generator object */
- VM_OC_YIELD, /**< yield operation */
- VM_OC_ASYNC_YIELD, /**< async yield operation */
- VM_OC_ASYNC_YIELD_ITERATOR, /**< async yield iterator operation */
- VM_OC_AWAIT, /**< await operation */
- VM_OC_GENERATOR_AWAIT, /**< generator await operation */
- VM_OC_EXT_RETURN, /**< return which also clears the stack */
- VM_OC_ASYNC_EXIT, /**< return from async function */
- VM_OC_STRING_CONCAT, /**< string concatenation */
- VM_OC_GET_TEMPLATE_OBJECT, /**< GetTemplateObject operation */
- VM_OC_PUSH_NEW_TARGET, /**< push new.target onto the stack */
- VM_OC_REQUIRE_OBJECT_COERCIBLE,/**< RequireObjectCoercible opretaion */
- VM_OC_ASSIGN_SUPER, /**< assign super reference */
- VM_OC_SET__PROTO__, /**< set prototype when __proto__: form is used */
- VM_OC_PUSH_STATIC_FIELD_FUNC, /**< push static field initializer function */
- VM_OC_ADD_COMPUTED_FIELD, /**< add computed field name */
+ VM_OC_OBJ_INIT_CONTEXT_END, /**< finalize object initializer context */
+ VM_OC_OBJ_INIT_PUSH_REST, /**< push the object with the rest properties */
+ VM_OC_INITIALIZER_PUSH_NAME, /**< append string to name list array and push the string */
+ VM_OC_DEFAULT_INITIALIZER, /**< default initializer inside a pattern */
+ VM_OC_REST_INITIALIZER, /**< create rest object inside an array pattern */
+ VM_OC_INITIALIZER_PUSH_PROP, /**< push property for object initializer */
+ VM_OC_SPREAD_ARGUMENTS, /**< perform function call/construct with spreaded arguments */
+ VM_OC_CREATE_GENERATOR, /**< create a generator object */
+ VM_OC_YIELD, /**< yield operation */
+ VM_OC_ASYNC_YIELD, /**< async yield operation */
+ VM_OC_ASYNC_YIELD_ITERATOR, /**< async yield iterator operation */
+ VM_OC_AWAIT, /**< await operation */
+ VM_OC_GENERATOR_AWAIT, /**< generator await operation */
+ VM_OC_EXT_RETURN, /**< return which also clears the stack */
+ VM_OC_ASYNC_EXIT, /**< return from async function */
+ VM_OC_STRING_CONCAT, /**< string concatenation */
+ VM_OC_GET_TEMPLATE_OBJECT, /**< GetTemplateObject operation */
+ VM_OC_PUSH_NEW_TARGET, /**< push new.target onto the stack */
+ VM_OC_REQUIRE_OBJECT_COERCIBLE, /**< RequireObjectCoercible opretaion */
+ VM_OC_ASSIGN_SUPER, /**< assign super reference */
+ VM_OC_SET__PROTO__, /**< set prototype when __proto__: form is used */
+ VM_OC_PUSH_STATIC_FIELD_FUNC, /**< push static field initializer function */
+ VM_OC_ADD_COMPUTED_FIELD, /**< add computed field name */
#endif /* JERRY_ESNEXT */
#if JERRY_MODULE_SYSTEM
- VM_OC_MODULE_IMPORT, /**< module dynamic import */
- VM_OC_MODULE_IMPORT_META, /**< module import.meta */
+ VM_OC_MODULE_IMPORT, /**< module dynamic import */
+ VM_OC_MODULE_IMPORT_META, /**< module import.meta */
#endif /* JERRY_MODULE_SYSTEM */
- VM_OC_NONE, /**< a special opcode for unsupported byte codes */
+ VM_OC_NONE, /**< a special opcode for unsupported byte codes */
} vm_oc_types;
/**
@@ -315,87 +316,87 @@ typedef enum
typedef enum
{
#if !JERRY_ESNEXT
- VM_OC_EXP = VM_OC_NONE, /**< exponentiation */
- VM_OC_BRANCH_IF_NULLISH = VM_OC_NONE, /** branch if undefined or null */
+ VM_OC_EXP = VM_OC_NONE, /**< exponentiation */
+ VM_OC_BRANCH_IF_NULLISH = VM_OC_NONE, /** branch if undefined or null */
#endif /* !JERRY_ESNEXT */
#if !JERRY_DEBUGGER
- VM_OC_BREAKPOINT_ENABLED = VM_OC_NONE, /**< enabled breakpoint for debugger is unused */
- VM_OC_BREAKPOINT_DISABLED = VM_OC_NONE, /**< disabled breakpoint for debugger is unused */
+ VM_OC_BREAKPOINT_ENABLED = VM_OC_NONE, /**< enabled breakpoint for debugger is unused */
+ VM_OC_BREAKPOINT_DISABLED = VM_OC_NONE, /**< disabled breakpoint for debugger is unused */
#endif /* !JERRY_DEBUGGER */
#if !JERRY_ESNEXT
- VM_OC_EXT_VAR_EVAL = VM_OC_NONE, /**< variable and function evaluation for
- * functions with separate argument context */
- VM_OC_CHECK_VAR = VM_OC_NONE, /**< check redeclared vars in the global scope */
- VM_OC_CHECK_LET = VM_OC_NONE, /**< check redeclared lets in the global scope */
- VM_OC_ASSIGN_LET_CONST = VM_OC_NONE, /**< assign values to let/const declarations */
- VM_OC_INIT_BINDING = VM_OC_NONE, /**< create and intialize a binding */
- VM_OC_THROW_CONST_ERROR = VM_OC_NONE, /**< throw invalid assignment to const variable error */
- VM_OC_COPY_TO_GLOBAL = VM_OC_NONE, /**< copy value to global lex env */
- VM_OC_COPY_FROM_ARG = VM_OC_NONE, /**< copy value from arg lex env */
- VM_OC_CLONE_CONTEXT = VM_OC_NONE, /**< clone lexical environment with let/const declarations */
- VM_OC_COPY_DATA_PROPERTIES = VM_OC_NONE, /**< copy data properties of an object */
- VM_OC_SET_COMPUTED_PROPERTY = VM_OC_NONE, /**< set computed property is unused */
-
- VM_OC_FOR_OF_INIT = VM_OC_NONE, /**< for-of init context */
- VM_OC_FOR_OF_GET_NEXT = VM_OC_NONE, /**< for-of get next */
- VM_OC_FOR_OF_HAS_NEXT = VM_OC_NONE, /**< for-of has next */
- VM_OC_FOR_AWAIT_OF_INIT = VM_OC_NONE, /**< for-await-of init context */
- VM_OC_FOR_AWAIT_OF_HAS_NEXT = VM_OC_NONE, /**< for-await-of has next */
-
- VM_OC_LOCAL_EVAL = VM_OC_NONE, /**< eval in local context */
- VM_OC_SUPER_CALL = VM_OC_NONE, /**< call the 'super' constructor */
- VM_OC_PUSH_CLASS_ENVIRONMENT = VM_OC_NONE, /**< push class environment */
- VM_OC_PUSH_IMPLICIT_CTOR = VM_OC_NONE, /**< create implicit class constructor */
- VM_OC_INIT_CLASS = VM_OC_NONE, /**< initialize class */
- VM_OC_FINALIZE_CLASS = VM_OC_NONE, /**< finalize class */
- VM_OC_SET_FIELD_INIT = VM_OC_NONE, /**< store the class field initializer function */
- VM_OC_SET_STATIC_FIELD_INIT = VM_OC_NONE, /**< store the static class field initializer function */
- VM_OC_RUN_FIELD_INIT = VM_OC_NONE, /**< run the class field initializer function */
- VM_OC_RUN_STATIC_FIELD_INIT = VM_OC_NONE, /**< run the static class field initializer function */
+ VM_OC_EXT_VAR_EVAL = VM_OC_NONE, /**< variable and function evaluation for
+ * functions with separate argument context */
+ VM_OC_CHECK_VAR = VM_OC_NONE, /**< check redeclared vars in the global scope */
+ VM_OC_CHECK_LET = VM_OC_NONE, /**< check redeclared lets in the global scope */
+ VM_OC_ASSIGN_LET_CONST = VM_OC_NONE, /**< assign values to let/const declarations */
+ VM_OC_INIT_BINDING = VM_OC_NONE, /**< create and intialize a binding */
+ VM_OC_THROW_CONST_ERROR = VM_OC_NONE, /**< throw invalid assignment to const variable error */
+ VM_OC_COPY_TO_GLOBAL = VM_OC_NONE, /**< copy value to global lex env */
+ VM_OC_COPY_FROM_ARG = VM_OC_NONE, /**< copy value from arg lex env */
+ VM_OC_CLONE_CONTEXT = VM_OC_NONE, /**< clone lexical environment with let/const declarations */
+ VM_OC_COPY_DATA_PROPERTIES = VM_OC_NONE, /**< copy data properties of an object */
+ VM_OC_SET_COMPUTED_PROPERTY = VM_OC_NONE, /**< set computed property is unused */
+
+ VM_OC_FOR_OF_INIT = VM_OC_NONE, /**< for-of init context */
+ VM_OC_FOR_OF_GET_NEXT = VM_OC_NONE, /**< for-of get next */
+ VM_OC_FOR_OF_HAS_NEXT = VM_OC_NONE, /**< for-of has next */
+ VM_OC_FOR_AWAIT_OF_INIT = VM_OC_NONE, /**< for-await-of init context */
+ VM_OC_FOR_AWAIT_OF_HAS_NEXT = VM_OC_NONE, /**< for-await-of has next */
+
+ VM_OC_LOCAL_EVAL = VM_OC_NONE, /**< eval in local context */
+ VM_OC_SUPER_CALL = VM_OC_NONE, /**< call the 'super' constructor */
+ VM_OC_PUSH_CLASS_ENVIRONMENT = VM_OC_NONE, /**< push class environment */
+ VM_OC_PUSH_IMPLICIT_CTOR = VM_OC_NONE, /**< create implicit class constructor */
+ VM_OC_INIT_CLASS = VM_OC_NONE, /**< initialize class */
+ VM_OC_FINALIZE_CLASS = VM_OC_NONE, /**< finalize class */
+ VM_OC_SET_FIELD_INIT = VM_OC_NONE, /**< store the class field initializer function */
+ VM_OC_SET_STATIC_FIELD_INIT = VM_OC_NONE, /**< store the static class field initializer function */
+ VM_OC_RUN_FIELD_INIT = VM_OC_NONE, /**< run the class field initializer function */
+ VM_OC_RUN_STATIC_FIELD_INIT = VM_OC_NONE, /**< run the static class field initializer function */
VM_OC_SET_NEXT_COMPUTED_FIELD = VM_OC_NONE, /**< set the next computed field of a class */
- VM_OC_PUSH_SUPER_CONSTRUCTOR = VM_OC_NONE, /**< getSuperConstructor operation */
- VM_OC_RESOLVE_LEXICAL_THIS = VM_OC_NONE, /**< resolve this_binding from from the lexical environment */
- VM_OC_SUPER_REFERENCE = VM_OC_NONE, /**< push super reference */
- VM_OC_SET_HOME_OBJECT = VM_OC_NONE, /**< set the [[HomeObject]] internal property in an object literal */
+ VM_OC_PUSH_SUPER_CONSTRUCTOR = VM_OC_NONE, /**< getSuperConstructor operation */
+ VM_OC_RESOLVE_LEXICAL_THIS = VM_OC_NONE, /**< resolve this_binding from from the lexical environment */
+ VM_OC_SUPER_REFERENCE = VM_OC_NONE, /**< push super reference */
+ VM_OC_SET_HOME_OBJECT = VM_OC_NONE, /**< set the [[HomeObject]] internal property in an object literal */
VM_OC_OBJECT_LITERAL_HOME_ENV = VM_OC_NONE, /**< create/destroy [[HomeObject]] environment of an object literal */
- VM_OC_SET_FUNCTION_NAME = VM_OC_NONE, /**< set function name property */
+ VM_OC_SET_FUNCTION_NAME = VM_OC_NONE, /**< set function name property */
- VM_OC_PUSH_SPREAD_ELEMENT = VM_OC_NONE, /**< push spread element */
- VM_OC_PUSH_REST_OBJECT = VM_OC_NONE, /**< push rest object */
+ VM_OC_PUSH_SPREAD_ELEMENT = VM_OC_NONE, /**< push spread element */
+ VM_OC_PUSH_REST_OBJECT = VM_OC_NONE, /**< push rest object */
VM_OC_ITERATOR_CONTEXT_CREATE = VM_OC_NONE, /**< create iterator context */
- VM_OC_ITERATOR_STEP = VM_OC_NONE, /**< IteratorStep abstract operation */
- VM_OC_ITERATOR_CONTEXT_END = VM_OC_NONE, /**< finalize iterator cotnext */
+ VM_OC_ITERATOR_STEP = VM_OC_NONE, /**< IteratorStep abstract operation */
+ VM_OC_ITERATOR_CONTEXT_END = VM_OC_NONE, /**< finalize iterator cotnext */
VM_OC_OBJ_INIT_CONTEXT_CREATE = VM_OC_NONE, /**< create object initializer context */
- VM_OC_OBJ_INIT_CONTEXT_END = VM_OC_NONE, /**< finalize object initializer context */
- VM_OC_OBJ_INIT_PUSH_REST = VM_OC_NONE, /**< push the object with the rest properties */
- VM_OC_INITIALIZER_PUSH_NAME = VM_OC_NONE, /**< append string to name list array and push the string */
- VM_OC_DEFAULT_INITIALIZER = VM_OC_NONE, /**< default initializer inside a pattern */
- VM_OC_REST_INITIALIZER = VM_OC_NONE, /**< create rest object inside an array pattern */
- VM_OC_INITIALIZER_PUSH_PROP = VM_OC_NONE, /**< push property for object initializer */
- VM_OC_SPREAD_ARGUMENTS = VM_OC_NONE, /**< perform function call/construct with spreaded arguments */
- VM_OC_CREATE_GENERATOR = VM_OC_NONE, /**< create a generator object */
- VM_OC_YIELD = VM_OC_NONE, /**< yield operation */
- VM_OC_ASYNC_YIELD = VM_OC_NONE, /**< async yield operation */
- VM_OC_ASYNC_YIELD_ITERATOR = VM_OC_NONE, /**< async yield iterator operation */
- VM_OC_AWAIT = VM_OC_NONE, /**< await operation */
- VM_OC_GENERATOR_AWAIT = VM_OC_NONE, /**< generator await operation */
- VM_OC_EXT_RETURN = VM_OC_NONE, /**< return which also clears the stack */
- VM_OC_ASYNC_EXIT = VM_OC_NONE, /**< return from async function */
- VM_OC_STRING_CONCAT = VM_OC_NONE, /**< string concatenation */
- VM_OC_GET_TEMPLATE_OBJECT = VM_OC_NONE, /**< GetTemplateObject operation */
- VM_OC_PUSH_NEW_TARGET = VM_OC_NONE, /**< push new.target onto the stack */
- VM_OC_REQUIRE_OBJECT_COERCIBLE = VM_OC_NONE,/**< RequireObjectCoercible opretaion */
- VM_OC_ASSIGN_SUPER = VM_OC_NONE, /**< assign super reference */
- VM_OC_SET__PROTO__ = VM_OC_NONE, /**< set prototype when __proto__: form is used */
- VM_OC_PUSH_STATIC_FIELD_FUNC = VM_OC_NONE, /**< push static field initializer function */
- VM_OC_ADD_COMPUTED_FIELD = VM_OC_NONE, /**< add computed field name */
+ VM_OC_OBJ_INIT_CONTEXT_END = VM_OC_NONE, /**< finalize object initializer context */
+ VM_OC_OBJ_INIT_PUSH_REST = VM_OC_NONE, /**< push the object with the rest properties */
+ VM_OC_INITIALIZER_PUSH_NAME = VM_OC_NONE, /**< append string to name list array and push the string */
+ VM_OC_DEFAULT_INITIALIZER = VM_OC_NONE, /**< default initializer inside a pattern */
+ VM_OC_REST_INITIALIZER = VM_OC_NONE, /**< create rest object inside an array pattern */
+ VM_OC_INITIALIZER_PUSH_PROP = VM_OC_NONE, /**< push property for object initializer */
+ VM_OC_SPREAD_ARGUMENTS = VM_OC_NONE, /**< perform function call/construct with spreaded arguments */
+ VM_OC_CREATE_GENERATOR = VM_OC_NONE, /**< create a generator object */
+ VM_OC_YIELD = VM_OC_NONE, /**< yield operation */
+ VM_OC_ASYNC_YIELD = VM_OC_NONE, /**< async yield operation */
+ VM_OC_ASYNC_YIELD_ITERATOR = VM_OC_NONE, /**< async yield iterator operation */
+ VM_OC_AWAIT = VM_OC_NONE, /**< await operation */
+ VM_OC_GENERATOR_AWAIT = VM_OC_NONE, /**< generator await operation */
+ VM_OC_EXT_RETURN = VM_OC_NONE, /**< return which also clears the stack */
+ VM_OC_ASYNC_EXIT = VM_OC_NONE, /**< return from async function */
+ VM_OC_STRING_CONCAT = VM_OC_NONE, /**< string concatenation */
+ VM_OC_GET_TEMPLATE_OBJECT = VM_OC_NONE, /**< GetTemplateObject operation */
+ VM_OC_PUSH_NEW_TARGET = VM_OC_NONE, /**< push new.target onto the stack */
+ VM_OC_REQUIRE_OBJECT_COERCIBLE = VM_OC_NONE, /**< RequireObjectCoercible opretaion */
+ VM_OC_ASSIGN_SUPER = VM_OC_NONE, /**< assign super reference */
+ VM_OC_SET__PROTO__ = VM_OC_NONE, /**< set prototype when __proto__: form is used */
+ VM_OC_PUSH_STATIC_FIELD_FUNC = VM_OC_NONE, /**< push static field initializer function */
+ VM_OC_ADD_COMPUTED_FIELD = VM_OC_NONE, /**< add computed field name */
#endif /* !JERRY_ESNEXT */
#if !JERRY_MODULE_SYSTEM
- VM_OC_MODULE_IMPORT = VM_OC_NONE, /**< module dynamic import */
- VM_OC_MODULE_IMPORT_META = VM_OC_NONE, /**< module import.meta */
+ VM_OC_MODULE_IMPORT = VM_OC_NONE, /**< module dynamic import */
+ VM_OC_MODULE_IMPORT_META = VM_OC_NONE, /**< module import.meta */
#endif /* JERRY_MODULE_SYSTEM */
- VM_OC_UNUSED = VM_OC_NONE /**< placeholder if the list is empty */
+ VM_OC_UNUSED = VM_OC_NONE /**< placeholder if the list is empty */
} vm_oc_unused_types;
/**
@@ -446,7 +447,7 @@ typedef enum
/**
* Generate a "put result" opcode flag bit.
*/
-#define VM_OC_PUT_RESULT_CREATE_FLAG(V) (((V) & VM_OC_PUT_RESULT_MASK) << VM_OC_PUT_RESULT_SHIFT)
+#define VM_OC_PUT_RESULT_CREATE_FLAG(V) (((V) &VM_OC_PUT_RESULT_MASK) << VM_OC_PUT_RESULT_SHIFT)
/**
* Checks whether the result is stored somewhere.
@@ -472,12 +473,12 @@ typedef enum
*/
typedef enum
{
- VM_NO_EXEC_OP, /**< do nothing */
- VM_EXEC_CALL, /**< invoke a function */
- VM_EXEC_SUPER_CALL, /**< invoke a function through 'super' keyword */
- VM_EXEC_SPREAD_OP, /**< call/construct operation with spreaded argument list */
- VM_EXEC_RETURN, /**< return with the completion value without freeing registers */
- VM_EXEC_CONSTRUCT, /**< construct a new object */
+ VM_NO_EXEC_OP, /**< do nothing */
+ VM_EXEC_CALL, /**< invoke a function */
+ VM_EXEC_SUPER_CALL, /**< invoke a function through 'super' keyword */
+ VM_EXEC_SPREAD_OP, /**< call/construct operation with spreaded argument list */
+ VM_EXEC_RETURN, /**< return with the completion value without freeing registers */
+ VM_EXEC_CONSTRUCT, /**< construct a new object */
} vm_call_operation;
ecma_value_t vm_run_global (const ecma_compiled_code_t *bytecode_p, ecma_object_t *function_object_p);
diff --git a/jerry-ext/arg/arg-js-iterator-helper.c b/jerry-ext/arg/arg-js-iterator-helper.c
index ad8aa8db..c6ef2a4d 100644
--- a/jerry-ext/arg/arg-js-iterator-helper.c
+++ b/jerry-ext/arg/arg-js-iterator-helper.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
+#include "jerryscript.h"
+
#include "arg-internal.h"
#include "jerryscript-ext/arg.h"
-#include "jerryscript.h"
/**
* Pop the current JS argument from the iterator.
@@ -62,8 +63,7 @@ jerryx_arg_js_iterator_restore (jerryx_arg_js_iterator_t *js_arg_iter_p) /**< th
jerry_value_t
jerryx_arg_js_iterator_peek (jerryx_arg_js_iterator_t *js_arg_iter_p) /**< the JS arg iterator */
{
- return (js_arg_iter_p->js_arg_idx < js_arg_iter_p->js_arg_cnt ? *js_arg_iter_p->js_arg_p
- : jerry_create_undefined ());
+ return (js_arg_iter_p->js_arg_idx < js_arg_iter_p->js_arg_cnt ? *js_arg_iter_p->js_arg_p : jerry_create_undefined ());
} /* jerryx_arg_js_iterator_peek */
/**
diff --git a/jerry-ext/arg/arg-transform-functions.c b/jerry-ext/arg/arg-transform-functions.c
index b3b76e40..8ca7dd47 100644
--- a/jerry-ext/arg/arg-transform-functions.c
+++ b/jerry-ext/arg/arg-transform-functions.c
@@ -15,9 +15,10 @@
#include <math.h>
-#include "jerryscript-ext/arg.h"
#include "jerryscript.h"
+#include "jerryscript-ext/arg.h"
+
/**
* The common function to deal with optional arguments.
* The core transform function is provided by argument `func`.
@@ -55,8 +56,7 @@ jerryx_arg_transform_number_strict_common (jerryx_arg_js_iterator_t *js_arg_iter
if (!jerry_value_is_number (js_arg))
{
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "It is not a number.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "It is not a number.");
}
*number_p = jerry_get_number_value (js_arg);
@@ -83,8 +83,7 @@ jerryx_arg_transform_number_common (jerryx_arg_js_iterator_t *js_arg_iter_p, /**
{
jerry_release_value (to_number);
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "It can not be converted to a number.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "It can not be converted to a number.");
}
*number_p = jerry_get_number_value (to_number);
@@ -134,16 +133,14 @@ jerryx_arg_helper_process_double (double *d, /**< [in, out] the number to be pro
{
if (*d != *d) /* isnan (*d) triggers conversion warning on clang<9 */
{
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "The number is NaN.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "The number is NaN.");
}
if (option.clamp == JERRYX_ARG_NO_CLAMP)
{
if (*d > max || *d < min)
{
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "The number is out of range.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "The number is out of range.");
}
}
else
@@ -171,32 +168,32 @@ jerryx_arg_helper_process_double (double *d, /**< [in, out] the number to be pro
/**
* Use the macro to define thr transform functions for int type.
*/
-#define JERRYX_ARG_TRANSFORM_FUNC_FOR_INT_TEMPLATE(type, suffix, min, max) \
- jerry_value_t jerryx_arg_transform_ ## type ## suffix (jerryx_arg_js_iterator_t *js_arg_iter_p, \
- const jerryx_arg_t *c_arg_p) \
- { \
- double tmp = 0.0; \
- jerry_value_t rv = jerryx_arg_transform_number ## suffix ## _common (js_arg_iter_p, &tmp); \
- if (jerry_value_is_error (rv)) \
- { \
- return rv; \
- } \
- jerry_release_value (rv); \
- union \
- { \
- jerryx_arg_int_option_t int_option; \
- uintptr_t extra_info; \
- } u = { .extra_info = c_arg_p->extra_info }; \
- rv = jerryx_arg_helper_process_double (&tmp, min, max, u.int_option); \
- if (jerry_value_is_error (rv)) \
- { \
- return rv; \
- } \
- *(type ## _t *) c_arg_p->dest = (type ## _t) tmp; \
- return rv; \
+#define JERRYX_ARG_TRANSFORM_FUNC_FOR_INT_TEMPLATE(type, suffix, min, max) \
+ jerry_value_t jerryx_arg_transform_##type##suffix (jerryx_arg_js_iterator_t *js_arg_iter_p, \
+ const jerryx_arg_t *c_arg_p) \
+ { \
+ double tmp = 0.0; \
+ jerry_value_t rv = jerryx_arg_transform_number##suffix##_common (js_arg_iter_p, &tmp); \
+ if (jerry_value_is_error (rv)) \
+ { \
+ return rv; \
+ } \
+ jerry_release_value (rv); \
+ union \
+ { \
+ jerryx_arg_int_option_t int_option; \
+ uintptr_t extra_info; \
+ } u = { .extra_info = c_arg_p->extra_info }; \
+ rv = jerryx_arg_helper_process_double (&tmp, min, max, u.int_option); \
+ if (jerry_value_is_error (rv)) \
+ { \
+ return rv; \
+ } \
+ *(type##_t *) c_arg_p->dest = (type##_t) tmp; \
+ return rv; \
}
-#define JERRYX_ARG_TRANSFORM_FUNC_FOR_INT(type, min, max) \
+#define JERRYX_ARG_TRANSFORM_FUNC_FOR_INT(type, min, max) \
JERRYX_ARG_TRANSFORM_FUNC_FOR_INT_TEMPLATE (type, _strict, min, max) \
JERRYX_ARG_TRANSFORM_FUNC_FOR_INT_TEMPLATE (type, , min, max)
@@ -223,8 +220,7 @@ jerryx_arg_transform_boolean_strict (jerryx_arg_js_iterator_t *js_arg_iter_p, /*
if (!jerry_value_is_boolean (js_arg))
{
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "It is not a boolean.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "It is not a boolean.");
}
bool *dest = c_arg_p->dest;
@@ -272,23 +268,18 @@ jerryx_arg_string_to_buffer_common_routine (jerry_value_t js_arg, /**< JS arg */
if (!is_utf8)
{
- size = jerry_string_to_char_buffer (js_arg,
- target_p,
- target_buf_size);
+ size = jerry_string_to_char_buffer (js_arg, target_p, target_buf_size);
len = jerry_get_string_length (js_arg);
}
else
{
- size = jerry_string_to_utf8_char_buffer (js_arg,
- target_p,
- target_buf_size);
+ size = jerry_string_to_utf8_char_buffer (js_arg, target_p, target_buf_size);
len = jerry_get_utf8_string_length (js_arg);
}
if ((size == target_buf_size) || (size == 0 && len != 0))
{
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "Buffer size is not large enough.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "Buffer size is not large enough.");
}
target_p[size] = '\0';
@@ -311,8 +302,7 @@ jerryx_arg_transform_string_strict_common (jerryx_arg_js_iterator_t *js_arg_iter
if (!jerry_value_is_string (js_arg))
{
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "It is not a string.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "It is not a string.");
}
return jerryx_arg_string_to_buffer_common_routine (js_arg, c_arg_p, is_utf8);
@@ -337,8 +327,7 @@ jerryx_arg_transform_string_common (jerryx_arg_js_iterator_t *js_arg_iter_p, /**
{
jerry_release_value (to_string);
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "It can not be converted to a string.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "It can not be converted to a string.");
}
jerry_value_t ret = jerryx_arg_string_to_buffer_common_routine (to_string, c_arg_p, is_utf8);
@@ -425,8 +414,7 @@ jerryx_arg_transform_function (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< ava
if (!jerry_value_is_function (js_arg))
{
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "It is not a function.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "It is not a function.");
}
jerry_value_t *func_p = c_arg_p->dest;
@@ -450,8 +438,7 @@ jerryx_arg_transform_native_pointer (jerryx_arg_js_iterator_t *js_arg_iter_p, /*
if (!jerry_value_is_object (js_arg))
{
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "It is not an object.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "It is not an object.");
}
const jerry_object_native_info_t *expected_info_p;
@@ -503,20 +490,17 @@ jerryx_arg_transform_array_items (jerryx_arg_js_iterator_t *js_arg_iter_p, /**<
const jerryx_arg_array_items_t *array_items_p = (const jerryx_arg_array_items_t *) c_arg_p->extra_info;
- return jerryx_arg_transform_array (js_arg,
- array_items_p->c_arg_p,
- array_items_p->c_arg_cnt);
+ return jerryx_arg_transform_array (js_arg, array_items_p->c_arg_p, array_items_p->c_arg_cnt);
} /* jerryx_arg_transform_array_items */
/**
* Define transformer for optional argument.
*/
-#define JERRYX_ARG_TRANSFORM_OPTIONAL(type) \
- jerry_value_t \
- jerryx_arg_transform_ ## type ## _optional (jerryx_arg_js_iterator_t *js_arg_iter_p, \
- const jerryx_arg_t *c_arg_p) \
- { \
- return jerryx_arg_transform_optional (js_arg_iter_p, c_arg_p, jerryx_arg_transform_ ## type); \
+#define JERRYX_ARG_TRANSFORM_OPTIONAL(type) \
+ jerry_value_t jerryx_arg_transform_##type##_optional (jerryx_arg_js_iterator_t *js_arg_iter_p, \
+ const jerryx_arg_t *c_arg_p) \
+ { \
+ return jerryx_arg_transform_optional (js_arg_iter_p, c_arg_p, jerryx_arg_transform_##type); \
}
JERRYX_ARG_TRANSFORM_OPTIONAL (number)
diff --git a/jerry-ext/arg/arg.c b/jerry-ext/arg/arg.c
index 794970e0..018c335a 100644
--- a/jerry-ext/arg/arg.c
+++ b/jerry-ext/arg/arg.c
@@ -14,7 +14,9 @@
*/
#include "jerryscript-ext/arg.h"
+
#include "jerryscript.h"
+
#include "arg-internal.h"
#include "jext-common.h"
@@ -35,12 +37,7 @@ jerryx_arg_transform_args (const jerry_value_t *js_arg_p, /**< points to the arr
{
jerry_value_t ret = jerry_create_undefined ();
- jerryx_arg_js_iterator_t iterator =
- {
- .js_arg_p = js_arg_p,
- .js_arg_cnt = js_arg_cnt,
- .js_arg_idx = 0
- };
+ jerryx_arg_js_iterator_t iterator = { .js_arg_p = js_arg_p, .js_arg_cnt = js_arg_cnt, .js_arg_idx = 0 };
for (; c_arg_cnt != 0 && !jerry_value_is_error (ret); c_arg_cnt--, c_arg_p++)
{
@@ -72,12 +69,7 @@ jerryx_arg_transform_this_and_args (const jerry_value_t this_val, /**< the this_
return jerry_create_undefined ();
}
- jerryx_arg_js_iterator_t iterator =
- {
- .js_arg_p = &this_val,
- .js_arg_cnt = 1,
- .js_arg_idx = 0
- };
+ jerryx_arg_js_iterator_t iterator = { .js_arg_p = &this_val, .js_arg_cnt = 1, .js_arg_idx = 0 };
jerry_value_t ret = c_arg_p->func (&iterator, c_arg_p);
@@ -99,7 +91,7 @@ jerryx_arg_transform_this_and_args (const jerry_value_t this_val, /**< the this_
* jerry error: a validator failed.
*/
jerry_value_t
-jerryx_arg_transform_object_properties (const jerry_value_t obj_val,/**< the JS object */
+jerryx_arg_transform_object_properties (const jerry_value_t obj_val, /**< the JS object */
const jerry_char_t **name_p, /**< property name list of the JS object */
const jerry_length_t name_cnt, /**< count of the name list */
const jerryx_arg_t *c_arg_p, /**< points to the array of transformation steps */
diff --git a/jerry-ext/common/jext-common.h b/jerry-ext/common/jext-common.h
index 9c59e0b0..345f21f2 100644
--- a/jerry-ext/common/jext-common.h
+++ b/jerry-ext/common/jext-common.h
@@ -19,8 +19,8 @@
#include <stdio.h>
#include <string.h>
-#include "jerryscript.h"
#include "jerryscript-port.h"
+#include "jerryscript.h"
/*
* Make sure unused parameters, variables, or expressions trigger no compiler warning.
@@ -35,39 +35,43 @@
* __LINE__ may be the same for asserts in a header
* and in an implementation file.
*/
-#define JERRYX_STATIC_ASSERT_GLUE_(a, b, c) a ## b ## _ ## c
-#define JERRYX_STATIC_ASSERT_GLUE(a, b, c) JERRYX_STATIC_ASSERT_GLUE_ (a, b, c)
-#define JERRYX_STATIC_ASSERT(x, msg) \
- enum { JERRYX_STATIC_ASSERT_GLUE (static_assertion_failed_, __LINE__, msg) = 1 / (!!(x)) }
+#define JERRYX_STATIC_ASSERT_GLUE_(a, b, c) a##b##_##c
+#define JERRYX_STATIC_ASSERT_GLUE(a, b, c) JERRYX_STATIC_ASSERT_GLUE_ (a, b, c)
+#define JERRYX_STATIC_ASSERT(x, msg) \
+ enum \
+ { \
+ JERRYX_STATIC_ASSERT_GLUE (static_assertion_failed_, __LINE__, msg) = 1 / (!!(x)) \
+ }
#ifndef JERRY_NDEBUG
-void JERRY_ATTR_NORETURN
-jerry_assert_fail (const char *assertion, const char *file, const char *function, const uint32_t line);
-void JERRY_ATTR_NORETURN
-jerry_unreachable (const char *file, const char *function, const uint32_t line);
+void JERRY_ATTR_NORETURN jerry_assert_fail (const char *assertion,
+ const char *file,
+ const char *function,
+ const uint32_t line);
+void JERRY_ATTR_NORETURN jerry_unreachable (const char *file, const char *function, const uint32_t line);
-#define JERRYX_ASSERT(x) \
- do \
- { \
- if (JERRY_UNLIKELY (!(x))) \
- { \
+#define JERRYX_ASSERT(x) \
+ do \
+ { \
+ if (JERRY_UNLIKELY (!(x))) \
+ { \
jerry_assert_fail (#x, __FILE__, __func__, __LINE__); \
- } \
+ } \
} while (0)
-#define JERRYX_UNREACHABLE() \
- do \
- { \
+#define JERRYX_UNREACHABLE() \
+ do \
+ { \
jerry_unreachable (__FILE__, __func__, __LINE__); \
} while (0)
#else /* JERRY_NDEBUG */
#define JERRYX_ASSERT(x) \
- do \
- { \
- if (false) \
- { \
+ do \
+ { \
+ if (false) \
+ { \
JERRYX_UNUSED (x); \
- } \
+ } \
} while (0)
#ifdef __GNUC__
@@ -75,7 +79,7 @@ jerry_unreachable (const char *file, const char *function, const uint32_t line);
#endif /* __GNUC__ */
#ifdef _MSC_VER
-#define JERRYX_UNREACHABLE() _assume (0)
+#define JERRYX_UNREACHABLE() _assume (0)
#endif /* _MSC_VER */
#ifndef JERRYX_UNREACHABLE
@@ -87,9 +91,9 @@ jerry_unreachable (const char *file, const char *function, const uint32_t line);
/*
* Logging
*/
-#define JERRYX_ERROR_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_ERROR, __VA_ARGS__)
+#define JERRYX_ERROR_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_ERROR, __VA_ARGS__)
#define JERRYX_WARNING_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_WARNING, __VA_ARGS__)
-#define JERRYX_DEBUG_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__)
-#define JERRYX_TRACE_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_TRACE, __VA_ARGS__)
+#define JERRYX_DEBUG_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_DEBUG, __VA_ARGS__)
+#define JERRYX_TRACE_MSG(...) jerry_port_log (JERRY_LOG_LEVEL_TRACE, __VA_ARGS__)
#endif /* !JEXT_COMMON_H */
diff --git a/jerry-ext/debugger/debugger-common.c b/jerry-ext/debugger/debugger-common.c
index 31843862..f7856f8c 100644
--- a/jerry-ext/debugger/debugger-common.c
+++ b/jerry-ext/debugger/debugger-common.c
@@ -23,7 +23,7 @@ void
jerryx_debugger_after_connect (bool success) /**< tells whether the connection
* has been successfully established */
{
-#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
+#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
if (success)
{
jerry_debugger_transport_start ();
diff --git a/jerry-ext/debugger/debugger-rp.c b/jerry-ext/debugger/debugger-rp.c
index 96326f08..1f84a5a5 100644
--- a/jerry-ext/debugger/debugger-rp.c
+++ b/jerry-ext/debugger/debugger-rp.c
@@ -16,7 +16,7 @@
#include "jerryscript-ext/debugger.h"
#include "jext-common.h"
-#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
+#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
/* A simplified transmission layer. */
diff --git a/jerry-ext/debugger/debugger-serial.c b/jerry-ext/debugger/debugger-serial.c
index 32857bab..06d1fb45 100644
--- a/jerry-ext/debugger/debugger-serial.c
+++ b/jerry-ext/debugger/debugger-serial.c
@@ -14,16 +14,17 @@
*/
#include "jerryscript-debugger-transport.h"
+
#include "jerryscript-ext/debugger.h"
#include "jext-common.h"
-#if (defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) && !defined _WIN32
+#if (defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)) && !defined _WIN32
#include <errno.h>
#include <fcntl.h>
-#include <unistd.h>
-#include <termios.h>
#include <stdlib.h>
+#include <termios.h>
+#include <unistd.h>
/* Max size of configuration string */
#define CONFIG_SIZE (255)
@@ -208,7 +209,7 @@ jerryx_debugger_serial_configure_attributes (int fd, jerryx_debugger_transport_s
options.c_lflag = 0;
/* Read returns when at least one byte of data is available. */
- options.c_cc[VMIN] = 1; // read block
+ options.c_cc[VMIN] = 1; // read block
options.c_cc[VTIME] = 5; // 0.5 seconds read timeout
/* Set the parameters associated with the file descriptor */
@@ -279,8 +280,7 @@ jerryx_debugger_serial_send (jerry_debugger_transport_header_t *header_p, /**< s
message_p += sent_bytes;
message_length -= (size_t) sent_bytes;
- }
- while (message_length > 0);
+ } while (message_length > 0);
return true;
} /* jerryx_debugger_serial_send */
diff --git a/jerry-ext/debugger/debugger-sha1.c b/jerry-ext/debugger/debugger-sha1.c
index 4532093d..38cb4557 100644
--- a/jerry-ext/debugger/debugger-sha1.c
+++ b/jerry-ext/debugger/debugger-sha1.c
@@ -41,9 +41,10 @@
*/
#include "debugger-sha1.h"
+
#include "jext-common.h"
-#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
+#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
/**
* SHA-1 context structure.
@@ -57,21 +58,19 @@ typedef struct
/* 32-bit integer manipulation macros (big endian). */
-#define JERRYX_SHA1_GET_UINT32_BE(n, b, i) \
-{ \
- (n) = (((uint32_t) (b)[(i) + 0]) << 24) \
- | (((uint32_t) (b)[(i) + 1]) << 16) \
- | (((uint32_t) (b)[(i) + 2]) << 8) \
- | ((uint32_t) (b)[(i) + 3]); \
-}
+#define JERRYX_SHA1_GET_UINT32_BE(n, b, i) \
+ { \
+ (n) = (((uint32_t) (b)[(i) + 0]) << 24) | (((uint32_t) (b)[(i) + 1]) << 16) | (((uint32_t) (b)[(i) + 2]) << 8) \
+ | ((uint32_t) (b)[(i) + 3]); \
+ }
#define JERRYX_SHA1_PUT_UINT32_BE(n, b, i) \
-{ \
- (b)[(i) + 0] = (uint8_t) ((n) >> 24); \
- (b)[(i) + 1] = (uint8_t) ((n) >> 16); \
- (b)[(i) + 2] = (uint8_t) ((n) >> 8); \
- (b)[(i) + 3] = (uint8_t) ((n)); \
-}
+ { \
+ (b)[(i) + 0] = (uint8_t) ((n) >> 24); \
+ (b)[(i) + 1] = (uint8_t) ((n) >> 16); \
+ (b)[(i) + 2] = (uint8_t) ((n) >> 8); \
+ (b)[(i) + 3] = (uint8_t) ((n)); \
+ }
/**
* Initialize SHA-1 context.
@@ -91,11 +90,12 @@ jerryx_sha1_init (jerryx_sha1_context *sha1_context_p) /**< SHA-1 context */
sha1_context_p->state[4] = 0xC3D2E1F0;
} /* jerryx_sha1_init */
-#define JERRYX_SHA1_P(a, b, c, d, e, x) \
-do { \
- e += JERRYX_SHA1_SHIFT (a, 5) + JERRYX_SHA1_F (b, c, d) + K + x; \
- b = JERRYX_SHA1_SHIFT (b, 30); \
-} while (0)
+#define JERRYX_SHA1_P(a, b, c, d, e, x) \
+ do \
+ { \
+ e += JERRYX_SHA1_SHIFT (a, 5) + JERRYX_SHA1_F (b, c, d) + K + x; \
+ b = JERRYX_SHA1_SHIFT (b, 30); \
+ } while (0)
/**
* Update SHA-1 internal buffer status.
@@ -125,11 +125,9 @@ jerryx_sha1_process (jerryx_sha1_context *sha1_context_p, /**< SHA-1 context */
#define JERRYX_SHA1_SHIFT(x, n) ((x << n) | ((x & 0xFFFFFFFF) >> (32 - n)))
-#define JERRYX_SHA1_R(t) \
-( \
- temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ W[(t - 14) & 0x0F] ^ W[t & 0x0F], \
- W[t & 0x0F] = JERRYX_SHA1_SHIFT (temp, 1) \
-)
+#define JERRYX_SHA1_R(t) \
+ (temp = W[(t - 3) & 0x0F] ^ W[(t - 8) & 0x0F] ^ W[(t - 14) & 0x0F] ^ W[t & 0x0F], \
+ W[t & 0x0F] = JERRYX_SHA1_SHIFT (temp, 1))
A = sha1_context_p->state[0];
B = sha1_context_p->state[1];
diff --git a/jerry-ext/debugger/debugger-sha1.h b/jerry-ext/debugger/debugger-sha1.h
index 16fe5636..6032c23d 100644
--- a/jerry-ext/debugger/debugger-sha1.h
+++ b/jerry-ext/debugger/debugger-sha1.h
@@ -18,12 +18,14 @@
#include "jerryscript-debugger-transport.h"
-#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
+#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */
-void jerryx_debugger_compute_sha1 (const uint8_t *input1, size_t input1_len,
- const uint8_t *input2, size_t input2_len,
+void jerryx_debugger_compute_sha1 (const uint8_t *input1,
+ size_t input1_len,
+ const uint8_t *input2,
+ size_t input2_len,
uint8_t output[20]);
#endif /* defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1) */
diff --git a/jerry-ext/debugger/debugger-tcp.c b/jerry-ext/debugger/debugger-tcp.c
index 0aff1b85..7b8c4379 100644
--- a/jerry-ext/debugger/debugger-tcp.c
+++ b/jerry-ext/debugger/debugger-tcp.c
@@ -14,15 +14,17 @@
*/
#include "jerryscript-debugger-transport.h"
+
#include "jerryscript-ext/debugger.h"
#include "jext-common.h"
-#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
+#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
#include <errno.h>
#ifdef _WIN32
#include <BaseTsd.h>
+
#include <WS2tcpip.h>
#include <winsock2.h>
@@ -43,13 +45,14 @@ typedef SOCKET jerryx_socket_t;
typedef char jerryx_socket_void_t;
typedef int jerryx_socket_size_t;
#else /* !_WIN32 */
-#include <arpa/inet.h>
#include <fcntl.h>
-#include <sys/socket.h>
#include <unistd.h>
+#include <arpa/inet.h>
+#include <sys/socket.h>
+
/* On *nix the EWOULDBLOCK errno value can be returned for non-blocking operations */
-#define JERRYX_EWOULDBLOCK EWOULDBLOCK
+#define JERRYX_EWOULDBLOCK EWOULDBLOCK
/* On *nix the invalid socket has a value of -1 */
#define JERRYX_SOCKET_INVALID (-1)
@@ -181,10 +184,7 @@ jerryx_debugger_tcp_send (jerry_debugger_transport_header_t *header_p, /**< tcp
}
#endif /* __linux__ */
- jerryx_socket_ssize_t sent_bytes = send (tcp_p->tcp_socket,
- (jerryx_socket_void_t *) message_p,
- remaining_bytes,
- 0);
+ jerryx_socket_ssize_t sent_bytes = send (tcp_p->tcp_socket, (jerryx_socket_void_t *) message_p, remaining_bytes, 0);
if (sent_bytes < 0)
{
@@ -202,8 +202,7 @@ jerryx_debugger_tcp_send (jerry_debugger_transport_header_t *header_p, /**< tcp
message_p += sent_bytes;
remaining_bytes -= (jerryx_socket_size_t) sent_bytes;
- }
- while (remaining_bytes > 0);
+ } while (remaining_bytes > 0);
return true;
} /* jerryx_debugger_tcp_send */
@@ -217,10 +216,10 @@ jerryx_debugger_tcp_receive (jerry_debugger_transport_header_t *header_p, /**< t
{
jerryx_debugger_transport_tcp_t *tcp_p = (jerryx_debugger_transport_tcp_t *) header_p;
- jerryx_socket_void_t *buffer_p = (jerryx_socket_void_t *) (receive_context_p->buffer_p
- + receive_context_p->received_length);
- jerryx_socket_size_t buffer_size = (jerryx_socket_size_t) (JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE
- - receive_context_p->received_length);
+ jerryx_socket_void_t *buffer_p =
+ (jerryx_socket_void_t *) (receive_context_p->buffer_p + receive_context_p->received_length);
+ jerryx_socket_size_t buffer_size =
+ (jerryx_socket_size_t) (JERRY_DEBUGGER_TRANSPORT_MAX_BUFFER_SIZE - receive_context_p->received_length);
jerryx_socket_ssize_t length = recv (tcp_p->tcp_socket, buffer_p, buffer_size, 0);
@@ -271,10 +270,8 @@ jerryx_debugger_tcp_configure_socket (jerryx_socket_t server_socket, /** < socke
const int opt_value = 1;
- if (setsockopt (server_socket,
- SOL_SOCKET, SO_REUSEADDR,
- (const jerryx_socket_void_t *) &opt_value,
- sizeof (int)) != 0)
+ if (setsockopt (server_socket, SOL_SOCKET, SO_REUSEADDR, (const jerryx_socket_void_t *) &opt_value, sizeof (int))
+ != 0)
{
return false;
}
diff --git a/jerry-ext/debugger/debugger-ws.c b/jerry-ext/debugger/debugger-ws.c
index 0c76d589..e877312c 100644
--- a/jerry-ext/debugger/debugger-ws.c
+++ b/jerry-ext/debugger/debugger-ws.c
@@ -17,7 +17,7 @@
#include "jerryscript-ext/debugger.h"
#include "jext-common.h"
-#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
+#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
/* JerryScript debugger protocol is a simplified version of RFC-6455 (WebSockets). */
@@ -114,8 +114,8 @@ jerryx_to_base64_character (uint8_t value) /**< 6-bit value */
*/
static void
jerryx_to_base64 (const uint8_t *source_p, /**< source data */
- uint8_t *destination_p, /**< destination buffer */
- size_t length) /**< length of source, must be divisible by 3 */
+ uint8_t *destination_p, /**< destination buffer */
+ size_t length) /**< length of source, must be divisible by 3 */
{
while (length >= 3)
{
@@ -181,8 +181,7 @@ jerryx_process_handshake (uint8_t *request_buffer_p) /**< temporary buffer */
request_end_p += (size_t) context.message_length;
*request_end_p = 0;
- if (request_end_p > request_buffer_p + 4
- && memcmp (request_end_p - 4, "\r\n\r\n", 4) == 0)
+ if (request_end_p > request_buffer_p + 4 && memcmp (request_end_p - 4, "\r\n\r\n", 4) == 0)
{
break;
}
@@ -192,8 +191,7 @@ jerryx_process_handshake (uint8_t *request_buffer_p) /**< temporary buffer */
const char get_text[] = "GET /jerry-debugger";
size_t text_len = sizeof (get_text) - 1;
- if ((size_t) (request_end_p - request_buffer_p) < text_len
- || memcmp (request_buffer_p, get_text, text_len) != 0)
+ if ((size_t) (request_end_p - request_buffer_p) < text_len || memcmp (request_buffer_p, get_text, text_len) != 0)
{
JERRYX_ERROR_MSG ("Invalid handshake format.\n");
return false;
@@ -212,9 +210,7 @@ jerryx_process_handshake (uint8_t *request_buffer_p) /**< temporary buffer */
return false;
}
- if (websocket_key_p[0] == 'S'
- && websocket_key_p[-1] == '\n'
- && websocket_key_p[-2] == '\r'
+ if (websocket_key_p[0] == 'S' && websocket_key_p[-1] == '\n' && websocket_key_p[-2] == '\r'
&& memcmp (websocket_key_p, key_text, text_len) == 0)
{
websocket_key_p += text_len;
@@ -244,10 +240,10 @@ jerryx_process_handshake (uint8_t *request_buffer_p) /**< temporary buffer */
const size_t sha1_length = 20;
jerryx_debugger_compute_sha1 (websocket_key_p,
- (size_t) (websocket_key_end_p - websocket_key_p),
- (const uint8_t *) "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
- 36,
- request_buffer_p);
+ (size_t) (websocket_key_end_p - websocket_key_p),
+ (const uint8_t *) "258EAFA5-E914-47DA-95CA-C5AB0DC85B11",
+ 36,
+ request_buffer_p);
/* The SHA-1 key is 20 bytes long but jerryx_to_base64 expects
* a length divisible by 3 so an extra 0 is appended at the end. */
@@ -258,7 +254,7 @@ jerryx_process_handshake (uint8_t *request_buffer_p) /**< temporary buffer */
/* Last value must be replaced by equal sign. */
const uint8_t response_prefix[] =
- "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: ";
+ "HTTP/1.1 101 Switching Protocols\r\nUpgrade: websocket\r\nConnection: Upgrade\r\nSec-WebSocket-Accept: ";
if (!jerry_debugger_transport_send (response_prefix, sizeof (response_prefix) - 1)
|| !jerry_debugger_transport_send (request_buffer_p + sha1_length + 1, 27))
diff --git a/jerry-ext/handle-scope/handle-scope-allocator.c b/jerry-ext/handle-scope/handle-scope-allocator.c
index a3a0b2b9..d8c7b587 100644
--- a/jerry-ext/handle-scope/handle-scope-allocator.c
+++ b/jerry-ext/handle-scope/handle-scope-allocator.c
@@ -14,23 +14,21 @@
*/
#include <stdlib.h>
+
#include "handle-scope-internal.h"
#include "jext-common.h"
-static jerryx_handle_scope_t jerryx_handle_scope_root =
-{
+static jerryx_handle_scope_t jerryx_handle_scope_root = {
.prelist_handle_count = 0,
.handle_ptr = NULL,
};
static jerryx_handle_scope_t *jerryx_handle_scope_current = &jerryx_handle_scope_root;
-static jerryx_handle_scope_pool_t jerryx_handle_scope_pool =
-{
+static jerryx_handle_scope_pool_t jerryx_handle_scope_pool = {
.count = 0,
.start = NULL,
};
-#define JERRYX_HANDLE_SCOPE_POOL_PRELIST_LAST \
- jerryx_handle_scope_pool.prelist + JERRYX_SCOPE_PRELIST_SIZE - 1
+#define JERRYX_HANDLE_SCOPE_POOL_PRELIST_LAST jerryx_handle_scope_pool.prelist + JERRYX_SCOPE_PRELIST_SIZE - 1
#define JERRYX_HANDLE_SCOPE_PRELIST_IDX(scope) (scope - jerryx_handle_scope_pool.prelist)
@@ -61,8 +59,8 @@ static bool
jerryx_handle_scope_is_in_prelist (jerryx_handle_scope_t *scope)
{
return (jerryx_handle_scope_pool.prelist <= scope)
- && (scope <= (jerryx_handle_scope_pool.prelist + JERRYX_SCOPE_PRELIST_SIZE - 1));
-} /** jerryx_handle_scope_is_in_prelist */
+ && (scope <= (jerryx_handle_scope_pool.prelist + JERRYX_SCOPE_PRELIST_SIZE - 1));
+} /* jerryx_handle_scope_is_in_prelist */
/**
* Get the parent of given handle scope.
@@ -95,7 +93,7 @@ jerryx_handle_scope_get_parent (jerryx_handle_scope_t *scope)
return &jerryx_handle_scope_root;
}
return jerryx_handle_scope_pool.prelist + JERRYX_HANDLE_SCOPE_PRELIST_IDX (scope) - 1;
-} /** jerryx_handle_scope_get_parent */
+} /* jerryx_handle_scope_get_parent */
/**
* Get the child of given handle scope.
@@ -136,7 +134,7 @@ jerryx_handle_scope_get_child (jerryx_handle_scope_t *scope)
return NULL;
}
return jerryx_handle_scope_pool.prelist + idx + 1;
-} /** jerryx_handle_scope_get_child */
+} /* jerryx_handle_scope_get_child */
/**
* Claims a handle scope either from prelist or allocating a new memory block,
@@ -184,7 +182,7 @@ jerryx_handle_scope_alloc (void)
jerryx_handle_scope_current = scope;
++jerryx_handle_scope_pool.count;
return (jerryx_handle_scope_t *) scope;
-} /** jerryx_handle_scope_alloc */
+} /* jerryx_handle_scope_alloc */
/**
* Deannounce a previously claimed handle scope, return it to pool
@@ -223,4 +221,4 @@ jerryx_handle_scope_free (jerryx_handle_scope_t *scope)
/**
* Nothing to do with scopes in prelist
*/
-} /** jerryx_handle_scope_free */
+} /* jerryx_handle_scope_free */
diff --git a/jerry-ext/handle-scope/handle-scope-internal.h b/jerry-ext/handle-scope/handle-scope-internal.h
index 2c9b610a..3c7b4887 100644
--- a/jerry-ext/handle-scope/handle-scope-internal.h
+++ b/jerry-ext/handle-scope/handle-scope-internal.h
@@ -16,14 +16,12 @@
#ifndef JERRYX_HANDLE_SCOPE_INTERNAL_H
#define JERRYX_HANDLE_SCOPE_INTERNAL_H
-#include "jerryscript.h"
#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "jerryscript-ext/handle-scope.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
/** MARK: - handle-scope-allocator.c */
typedef struct jerryx_handle_scope_pool_s jerryx_handle_scope_pool_t;
@@ -38,37 +36,28 @@ struct jerryx_handle_scope_pool_s
jerryx_handle_scope_dynamic_t *start; /**< start address of dynamically allocated handle scope list */
};
-jerryx_handle_scope_t *
-jerryx_handle_scope_get_parent (jerryx_handle_scope_t *scope);
+jerryx_handle_scope_t *jerryx_handle_scope_get_parent (jerryx_handle_scope_t *scope);
-jerryx_handle_scope_t *
-jerryx_handle_scope_get_child (jerryx_handle_scope_t *scope);
+jerryx_handle_scope_t *jerryx_handle_scope_get_child (jerryx_handle_scope_t *scope);
-jerryx_handle_scope_t *
-jerryx_handle_scope_alloc (void);
+jerryx_handle_scope_t *jerryx_handle_scope_alloc (void);
-void
-jerryx_handle_scope_free (jerryx_handle_scope_t *scope);
+void jerryx_handle_scope_free (jerryx_handle_scope_t *scope);
/** MARK: - END handle-scope-allocator.c */
/** MARK: - handle-scope.c */
-void
-jerryx_handle_scope_release_handles (jerryx_handle_scope scope);
+void jerryx_handle_scope_release_handles (jerryx_handle_scope scope);
-jerry_value_t
-jerryx_hand_scope_escape_handle_from_prelist (jerryx_handle_scope scope, size_t idx);
+jerry_value_t jerryx_hand_scope_escape_handle_from_prelist (jerryx_handle_scope scope, size_t idx);
-jerry_value_t
-jerryx_handle_scope_add_handle_to (jerryx_handle_t *handle, jerryx_handle_scope scope);
+jerry_value_t jerryx_handle_scope_add_handle_to (jerryx_handle_t *handle, jerryx_handle_scope scope);
-jerryx_handle_scope_status
-jerryx_escape_handle_internal (jerryx_escapable_handle_scope scope,
- jerry_value_t escapee,
- jerry_value_t *result,
- bool should_promote);
+jerryx_handle_scope_status jerryx_escape_handle_internal (jerryx_escapable_handle_scope scope,
+ jerry_value_t escapee,
+ jerry_value_t *result,
+ bool should_promote);
/** MARK: - END handle-scope.c */
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYX_HANDLE_SCOPE_INTERNAL_H */
diff --git a/jerry-ext/handle-scope/handle-scope.c b/jerry-ext/handle-scope/handle-scope.c
index 984083c5..941c4593 100644
--- a/jerry-ext/handle-scope/handle-scope.c
+++ b/jerry-ext/handle-scope/handle-scope.c
@@ -14,6 +14,7 @@
*/
#include <stdlib.h>
+
#include "handle-scope-internal.h"
#include "jext-common.h"
@@ -30,7 +31,7 @@ jerryx_open_handle_scope (jerryx_handle_scope *result)
{
*result = jerryx_handle_scope_alloc ();
return jerryx_handle_scope_ok;
-} /** jerryx_open_handle_scope */
+} /* jerryx_open_handle_scope */
/**
* Release all jerry values attached to given scope
@@ -60,7 +61,7 @@ jerryx_handle_scope_release_handles (jerryx_handle_scope scope)
jerry_release_value (scope->handle_prelist[idx]);
}
scope->prelist_handle_count = 0;
-} /** jerryx_handle_scope_release_handles */
+} /* jerryx_handle_scope_release_handles */
/**
* Close the scope and its child scopes and release all jerry values that
@@ -83,11 +84,10 @@ jerryx_close_handle_scope (jerryx_handle_scope scope)
jerryx_handle_scope child = jerryx_handle_scope_get_child (a_scope);
jerryx_handle_scope_free (a_scope);
a_scope = child;
- }
- while (a_scope != NULL);
+ } while (a_scope != NULL);
return jerryx_handle_scope_ok;
-} /** jerryx_close_handle_scope */
+} /* jerryx_close_handle_scope */
/**
* Opens a new handle scope from which one object can be promoted to the outer scope
@@ -100,7 +100,7 @@ jerryx_handle_scope_status
jerryx_open_escapable_handle_scope (jerryx_handle_scope *result)
{
return jerryx_open_handle_scope (result);
-} /** jerryx_open_escapable_handle_scope */
+} /* jerryx_open_escapable_handle_scope */
/**
* Close the scope and its child scopes and release all jerry values that
@@ -114,7 +114,7 @@ jerryx_handle_scope_status
jerryx_close_escapable_handle_scope (jerryx_handle_scope scope)
{
return jerryx_close_handle_scope (scope);
-} /** jerryx_close_escapable_handle_scope */
+} /* jerryx_close_escapable_handle_scope */
/**
* Internal helper.
@@ -143,7 +143,7 @@ jerryx_hand_scope_escape_handle_from_prelist (jerryx_handle_scope scope, size_t
scope->handle_prelist[idx] = scope->handle_prelist[scope->prelist_handle_count - 1];
}
return jval;
-} /** jerryx_hand_scope_escape_handle_from_prelist */
+} /* jerryx_hand_scope_escape_handle_from_prelist */
/**
* Internal helper.
@@ -261,7 +261,7 @@ jerryx_escape_handle_internal (jerryx_escapable_handle_scope scope,
scope->escaped = true;
}
return jerryx_handle_scope_ok;
-} /** jerryx_escape_handle_internal */
+} /* jerryx_escape_handle_internal */
/**
* Promotes the handle to the JavaScript object so that it is valid for the lifetime of
@@ -274,12 +274,10 @@ jerryx_escape_handle_internal (jerryx_escapable_handle_scope scope,
* @return status code, jerryx_handle_scope_ok if success.
*/
jerryx_handle_scope_status
-jerryx_escape_handle (jerryx_escapable_handle_scope scope,
- jerry_value_t escapee,
- jerry_value_t *result)
+jerryx_escape_handle (jerryx_escapable_handle_scope scope, jerry_value_t escapee, jerry_value_t *result)
{
return jerryx_escape_handle_internal (scope, escapee, result, true);
-} /** jerryx_escape_handle */
+} /* jerryx_escape_handle */
/**
* Escape a handle from scope yet do not promote it to the outer scope.
@@ -291,12 +289,10 @@ jerryx_escape_handle (jerryx_escapable_handle_scope scope,
* @return status code, jerryx_handle_scope_ok if success.
*/
jerryx_handle_scope_status
-jerryx_remove_handle (jerryx_escapable_handle_scope scope,
- jerry_value_t escapee,
- jerry_value_t *result)
+jerryx_remove_handle (jerryx_escapable_handle_scope scope, jerry_value_t escapee, jerry_value_t *result)
{
return jerryx_escape_handle_internal (scope, escapee, result, false);
-} /** jerryx_remove_handle */
+} /* jerryx_remove_handle */
/**
* Try to reuse given handle if possible while adding to the scope.
@@ -321,7 +317,7 @@ jerryx_handle_scope_add_handle_to (jerryx_handle_t *handle, jerryx_handle_scope
handle->sibling = scope->handle_ptr;
scope->handle_ptr = handle;
return handle->jval;
-} /** jerryx_handle_scope_add_handle_to */
+} /* jerryx_handle_scope_add_handle_to */
/**
* Add given jerry value to the scope.
@@ -349,7 +345,7 @@ jerryx_create_handle_in_scope (jerry_value_t jval, jerryx_handle_scope scope)
scope->handle_ptr = handle;
return jval;
-} /** jerryx_create_handle_in_scope */
+} /* jerryx_create_handle_in_scope */
/**
* Add given jerry value to current top scope.
@@ -361,4 +357,4 @@ jerry_value_t
jerryx_create_handle (jerry_value_t jval)
{
return jerryx_create_handle_in_scope (jval, jerryx_handle_scope_get_current ());
-} /** jerryx_create_handle */
+} /* jerryx_create_handle */
diff --git a/jerry-ext/handler/handler-assert.c b/jerry-ext/handler/handler-assert.c
index 96d8d597..13c6e0c9 100644
--- a/jerry-ext/handler/handler-assert.c
+++ b/jerry-ext/handler/handler-assert.c
@@ -13,10 +13,11 @@
* limitations under the License.
*/
-#include "jerryscript-ext/handler.h"
+#include <inttypes.h>
+
#include "jerryscript-port.h"
-#include <inttypes.h>
+#include "jerryscript-ext/handler.h"
/**
* Hard assert for scripts. The routine calls jerry_port_fatal on assertion failure.
@@ -35,8 +36,7 @@ jerryx_handler_assert_fatal (const jerry_call_info_t *call_info_p, /**< call inf
{
(void) call_info_p; /* unused */
- if (args_cnt == 1
- && jerry_value_is_true (args_p[0]))
+ if (args_cnt == 1 && jerry_value_is_true (args_p[0]))
{
return jerry_create_boolean (true);
}
@@ -65,7 +65,7 @@ jerryx_handler_assert_fatal (const jerry_call_info_t *call_info_p, /**< call inf
* on some systems it can be printed. To avoid differences in the uint32_t typdef
* The "PRIu32" macro is used to correctly add the formatter.
*/
- jerry_port_log (JERRY_LOG_LEVEL_ERROR, " %"PRIu32": ", idx);
+ jerry_port_log (JERRY_LOG_LEVEL_ERROR, " %" PRIu32 ": ", idx);
do
{
jerry_size_t copied_bytes = jerry_substring_to_utf8_char_buffer (property,
@@ -77,8 +77,7 @@ jerryx_handler_assert_fatal (const jerry_call_info_t *call_info_p, /**< call inf
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "%s", string_buffer);
current_size += copied_bytes;
- }
- while (total_size != current_size);
+ } while (total_size != current_size);
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "\n");
jerry_release_value (property);
@@ -103,8 +102,7 @@ jerryx_handler_assert_throw (const jerry_call_info_t *call_info_p, /**< call inf
{
(void) call_info_p; /* unused */
- if (args_cnt == 1
- && jerry_value_is_true (args_p[0]))
+ if (args_cnt == 1 && jerry_value_is_true (args_p[0]))
{
return jerry_create_boolean (true);
}
diff --git a/jerry-ext/handler/handler-gc.c b/jerry-ext/handler/handler-gc.c
index b9feab5d..789d4914 100644
--- a/jerry-ext/handler/handler-gc.c
+++ b/jerry-ext/handler/handler-gc.c
@@ -27,8 +27,8 @@ jerryx_handler_gc (const jerry_call_info_t *call_info_p, /**< call information *
{
(void) call_info_p; /* unused */
- jerry_gc_mode_t mode = ((args_cnt > 0 && jerry_value_to_boolean (args_p[0])) ? JERRY_GC_PRESSURE_HIGH
- : JERRY_GC_PRESSURE_LOW);
+ jerry_gc_mode_t mode =
+ ((args_cnt > 0 && jerry_value_to_boolean (args_p[0])) ? JERRY_GC_PRESSURE_HIGH : JERRY_GC_PRESSURE_LOW);
jerry_gc (mode);
return jerry_create_undefined ();
diff --git a/jerry-ext/handler/handler-print.c b/jerry-ext/handler/handler-print.c
index 7c931605..f5f6f6e1 100644
--- a/jerry-ext/handler/handler-print.c
+++ b/jerry-ext/handler/handler-print.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript-ext/handler.h"
-#include "jerryscript-port.h"
#include "jerryscript-debugger.h"
+#include "jerryscript-port.h"
+
+#include "jerryscript-ext/handler.h"
/**
* Provide a 'print' implementation for scripts.
@@ -43,7 +44,7 @@ jerryx_handler_print (const jerry_call_info_t *call_info_p, /**< call informatio
{
(void) call_info_p; /* unused */
- const char * const null_str = "\\u0000";
+ const char *const null_str = "\\u0000";
jerry_value_t ret_val = jerry_create_undefined ();
@@ -73,11 +74,7 @@ jerryx_handler_print (const jerry_call_info_t *call_info_p, /**< call informatio
do
{
- jerry_size_t substr_size = jerry_substring_to_utf8_char_buffer (str_val,
- substr_pos,
- length,
- substr_buf,
- 256 - 1);
+ jerry_size_t substr_size = jerry_substring_to_utf8_char_buffer (str_val, substr_pos, length, substr_buf, 256 - 1);
jerry_char_t *buf_end_p = substr_buf + substr_size;
@@ -111,8 +108,7 @@ jerryx_handler_print (const jerry_call_info_t *call_info_p, /**< call informatio
jerry_port_print_char (null_str[null_index]);
}
}
- }
- while (substr_pos < length);
+ } while (substr_pos < length);
jerry_release_value (str_val);
}
diff --git a/jerry-ext/handler/handler-register.c b/jerry-ext/handler/handler-register.c
index caddf884..f4229b72 100644
--- a/jerry-ext/handler/handler-register.c
+++ b/jerry-ext/handler/handler-register.c
@@ -61,7 +61,7 @@ jerryx_register_result
jerryx_set_properties (const jerry_value_t target_object, /**< target object */
const jerryx_property_entry entries[]) /**< array of method entries */
{
-#define JERRYX_SET_PROPERTIES_RESULT(VALUE, IDX) ((jerryx_register_result) { VALUE, IDX })
+#define JERRYX_SET_PROPERTIES_RESULT(VALUE, IDX) ((jerryx_register_result){ VALUE, IDX })
uint32_t idx = 0;
if (entries == NULL)
diff --git a/jerry-ext/include/jerryscript-ext/arg.h b/jerry-ext/include/jerryscript-ext/arg.h
index 8171bcf3..3351d633 100644
--- a/jerry-ext/include/jerryscript-ext/arg.h
+++ b/jerry-ext/include/jerryscript-ext/arg.h
@@ -19,12 +19,10 @@
#include <stdbool.h>
#include <stddef.h>
#include <stdint.h>
+
#include "jerryscript.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
/**
* The forward declaration of jerryx_arg_t.
@@ -88,9 +86,8 @@ jerry_value_t jerryx_arg_transform_object_properties (const jerry_value_t obj_va
const jerry_length_t name_cnt,
const jerryx_arg_t *c_arg_p,
jerry_length_t c_arg_cnt);
-jerry_value_t jerryx_arg_transform_array (const jerry_value_t array_val,
- const jerryx_arg_t *c_arg_p,
- jerry_length_t c_arg_cnt);
+jerry_value_t
+jerryx_arg_transform_array (const jerry_value_t array_val, const jerryx_arg_t *c_arg_p, jerry_length_t c_arg_cnt);
/**
* Indicates whether an argument is allowed to be coerced into the expected JS type.
@@ -135,19 +132,18 @@ typedef enum
*/
typedef enum
{
- JERRYX_ARG_CLAMP,/**< clamp the number when it is out of range */
+ JERRYX_ARG_CLAMP, /**< clamp the number when it is out of range */
JERRYX_ARG_NO_CLAMP /**< throw a range error */
} jerryx_arg_clamp_t;
/* Inline functions for initializing jerryx_arg_t */
-#define JERRYX_ARG_INTEGER(type) \
- static inline jerryx_arg_t \
- jerryx_arg_ ## type (type ## _t *dest, \
- jerryx_arg_round_t round_flag, \
- jerryx_arg_clamp_t clamp_flag, \
- jerryx_arg_coerce_t coerce_flag, \
- jerryx_arg_optional_t opt_flag);
+#define JERRYX_ARG_INTEGER(type) \
+ static inline jerryx_arg_t jerryx_arg_##type (type##_t *dest, \
+ jerryx_arg_round_t round_flag, \
+ jerryx_arg_clamp_t clamp_flag, \
+ jerryx_arg_coerce_t coerce_flag, \
+ jerryx_arg_optional_t opt_flag);
JERRYX_ARG_INTEGER (uint8)
JERRYX_ARG_INTEGER (int8)
@@ -166,23 +162,19 @@ static inline jerryx_arg_t
jerryx_arg_string (char *dest, uint32_t size, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag);
static inline jerryx_arg_t
jerryx_arg_utf8_string (char *dest, uint32_t size, jerryx_arg_coerce_t coerce_flag, jerryx_arg_optional_t opt_flag);
-static inline jerryx_arg_t
-jerryx_arg_function (jerry_value_t *dest, jerryx_arg_optional_t opt_flag);
+static inline jerryx_arg_t jerryx_arg_function (jerry_value_t *dest, jerryx_arg_optional_t opt_flag);
static inline jerryx_arg_t
jerryx_arg_native_pointer (void **dest, const jerry_object_native_info_t *info_p, jerryx_arg_optional_t opt_flag);
-static inline jerryx_arg_t
-jerryx_arg_ignore (void);
-static inline jerryx_arg_t
-jerryx_arg_custom (void *dest, uintptr_t extra_info, jerryx_arg_transform_func_t func);
-static inline jerryx_arg_t
-jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props_p, jerryx_arg_optional_t opt_flag);
-static inline jerryx_arg_t
-jerryx_arg_array (const jerryx_arg_array_items_t *array_items_p, jerryx_arg_optional_t opt_flag);
+static inline jerryx_arg_t jerryx_arg_ignore (void);
+static inline jerryx_arg_t jerryx_arg_custom (void *dest, uintptr_t extra_info, jerryx_arg_transform_func_t func);
+static inline jerryx_arg_t jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props_p,
+ jerryx_arg_optional_t opt_flag);
+static inline jerryx_arg_t jerryx_arg_array (const jerryx_arg_array_items_t *array_items_p,
+ jerryx_arg_optional_t opt_flag);
-jerry_value_t
-jerryx_arg_transform_optional (jerryx_arg_js_iterator_t *js_arg_iter_p,
- const jerryx_arg_t *c_arg_p,
- jerryx_arg_transform_func_t func);
+jerry_value_t jerryx_arg_transform_optional (jerryx_arg_js_iterator_t *js_arg_iter_p,
+ const jerryx_arg_t *c_arg_p,
+ jerryx_arg_transform_func_t func);
/* Helper functions for transform functions. */
jerry_value_t jerryx_arg_js_iterator_pop (jerryx_arg_js_iterator_t *js_arg_iter_p);
@@ -192,7 +184,6 @@ jerry_length_t jerryx_arg_js_iterator_index (jerryx_arg_js_iterator_t *js_arg_it
#include "arg.impl.h"
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYX_ARG_H */
diff --git a/jerry-ext/include/jerryscript-ext/arg.impl.h b/jerry-ext/include/jerryscript-ext/arg.impl.h
index 1b3111e5..4fea620b 100644
--- a/jerry-ext/include/jerryscript-ext/arg.impl.h
+++ b/jerry-ext/include/jerryscript-ext/arg.impl.h
@@ -18,15 +18,14 @@
/* transform functions for each type. */
-#define JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL(type) \
- jerry_value_t jerryx_arg_transform_ ## type (jerryx_arg_js_iterator_t *js_arg_iter_p, \
- const jerryx_arg_t *c_arg_p); \
- jerry_value_t jerryx_arg_transform_ ## type ## _optional (jerryx_arg_js_iterator_t *js_arg_iter_p, \
- const jerryx_arg_t *c_arg_p);
+#define JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL(type) \
+ jerry_value_t jerryx_arg_transform_##type (jerryx_arg_js_iterator_t *js_arg_iter_p, const jerryx_arg_t *c_arg_p); \
+ jerry_value_t jerryx_arg_transform_##type##_optional (jerryx_arg_js_iterator_t *js_arg_iter_p, \
+ const jerryx_arg_t *c_arg_p);
#define JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT(type) \
- JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (type) \
- JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (type ## _strict)
+ JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (type) \
+ JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (type##_strict)
JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (uint8)
JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT (int8)
@@ -44,8 +43,7 @@ JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (native_pointer)
JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (object_props)
JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL (array_items)
-jerry_value_t jerryx_arg_transform_ignore (jerryx_arg_js_iterator_t *js_arg_iter_p,
- const jerryx_arg_t *c_arg_p);
+jerry_value_t jerryx_arg_transform_ignore (jerryx_arg_js_iterator_t *js_arg_iter_p, const jerryx_arg_t *c_arg_p);
#undef JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL
#undef JERRYX_ARG_TRANSFORM_FUNC_WITH_OPTIONAL_AND_STRICT
@@ -63,48 +61,42 @@ typedef struct
/**
* The macro used to generate jerryx_arg_xxx for int type.
*/
-#define JERRYX_ARG_INT(type) \
- static inline jerryx_arg_t \
- jerryx_arg_ ## type (type ## _t *dest, \
- jerryx_arg_round_t round_flag, \
- jerryx_arg_clamp_t clamp_flag, \
- jerryx_arg_coerce_t coerce_flag, \
- jerryx_arg_optional_t opt_flag) \
- { \
- jerryx_arg_transform_func_t func; \
- if (coerce_flag == JERRYX_ARG_NO_COERCE) \
- { \
- if (opt_flag == JERRYX_ARG_OPTIONAL) \
- { \
- func = jerryx_arg_transform_ ## type ## _strict_optional; \
- } \
- else \
- { \
- func = jerryx_arg_transform_ ## type ## _strict; \
- } \
- } \
- else \
- { \
- if (opt_flag == JERRYX_ARG_OPTIONAL) \
- { \
- func = jerryx_arg_transform_ ## type ## _optional; \
- } \
- else \
- { \
- func = jerryx_arg_transform_ ## type; \
- } \
- } \
- union \
- { \
- jerryx_arg_int_option_t int_option; \
- uintptr_t extra_info; \
+#define JERRYX_ARG_INT(type) \
+ static inline jerryx_arg_t jerryx_arg_##type (type##_t *dest, \
+ jerryx_arg_round_t round_flag, \
+ jerryx_arg_clamp_t clamp_flag, \
+ jerryx_arg_coerce_t coerce_flag, \
+ jerryx_arg_optional_t opt_flag) \
+ { \
+ jerryx_arg_transform_func_t func; \
+ if (coerce_flag == JERRYX_ARG_NO_COERCE) \
+ { \
+ if (opt_flag == JERRYX_ARG_OPTIONAL) \
+ { \
+ func = jerryx_arg_transform_##type##_strict_optional; \
+ } \
+ else \
+ { \
+ func = jerryx_arg_transform_##type##_strict; \
+ } \
+ } \
+ else \
+ { \
+ if (opt_flag == JERRYX_ARG_OPTIONAL) \
+ { \
+ func = jerryx_arg_transform_##type##_optional; \
+ } \
+ else \
+ { \
+ func = jerryx_arg_transform_##type; \
+ } \
+ } \
+ union \
+ { \
+ jerryx_arg_int_option_t int_option; \
+ uintptr_t extra_info; \
} u = { .int_option = { .round = (uint8_t) round_flag, .clamp = (uint8_t) clamp_flag } }; \
- return (jerryx_arg_t) \
- { \
- .func = func, \
- .dest = (void *) dest, \
- .extra_info = u.extra_info \
- }; \
+ return (jerryx_arg_t){ .func = func, .dest = (void *) dest, .extra_info = u.extra_info }; \
}
JERRYX_ARG_INT (uint8)
@@ -152,11 +144,7 @@ jerryx_arg_number (double *dest, /**< pointer to the double where the result sho
}
}
- return (jerryx_arg_t)
- {
- .func = func,
- .dest = (void *) dest
- };
+ return (jerryx_arg_t){ .func = func, .dest = (void *) dest };
} /* jerryx_arg_number */
/**
@@ -195,11 +183,7 @@ jerryx_arg_boolean (bool *dest, /**< points to the native bool */
}
}
- return (jerryx_arg_t)
- {
- .func = func,
- .dest = (void *) dest
- };
+ return (jerryx_arg_t){ .func = func, .dest = (void *) dest };
} /* jerryx_arg_boolean */
/**
@@ -239,12 +223,7 @@ jerryx_arg_string (char *dest, /**< pointer to the native char array where the r
}
}
- return (jerryx_arg_t)
- {
- .func = func,
- .dest = (void *) dest,
- .extra_info = (uintptr_t) size
- };
+ return (jerryx_arg_t){ .func = func, .dest = (void *) dest, .extra_info = (uintptr_t) size };
} /* jerryx_arg_string */
/**
@@ -284,12 +263,7 @@ jerryx_arg_utf8_string (char *dest, /**< [out] pointer to the native char array
}
}
- return (jerryx_arg_t)
- {
- .func = func,
- .dest = (void *) dest,
- .extra_info = (uintptr_t) size
- };
+ return (jerryx_arg_t){ .func = func, .dest = (void *) dest, .extra_info = (uintptr_t) size };
} /* jerryx_arg_utf8_string */
/**
@@ -313,11 +287,7 @@ jerryx_arg_function (jerry_value_t *dest, /**< pointer to the jerry_value_t wher
func = jerryx_arg_transform_function;
}
- return (jerryx_arg_t)
- {
- .func = func,
- .dest = (void *) dest
- };
+ return (jerryx_arg_t){ .func = func, .dest = (void *) dest };
} /* jerryx_arg_function */
/**
@@ -344,12 +314,7 @@ jerryx_arg_native_pointer (void **dest, /**< pointer to where the resulting nati
func = jerryx_arg_transform_native_pointer;
}
- return (jerryx_arg_t)
- {
- .func = func,
- .dest = (void *) dest,
- .extra_info = (uintptr_t) info_p
- };
+ return (jerryx_arg_t){ .func = func, .dest = (void *) dest, .extra_info = (uintptr_t) info_p };
} /* jerryx_arg_native_pointer */
/**
@@ -360,10 +325,7 @@ jerryx_arg_native_pointer (void **dest, /**< pointer to where the resulting nati
static inline jerryx_arg_t
jerryx_arg_ignore (void)
{
- return (jerryx_arg_t)
- {
- .func = jerryx_arg_transform_ignore
- };
+ return (jerryx_arg_t){ .func = jerryx_arg_transform_ignore };
} /* jerryx_arg_ignore */
/**
@@ -376,12 +338,7 @@ jerryx_arg_custom (void *dest, /**< pointer to the native argument where the res
uintptr_t extra_info, /**< the extra parameter, specific to the transform function */
jerryx_arg_transform_func_t func) /**< the custom transform function */
{
- return (jerryx_arg_t)
- {
- .func = func,
- .dest = dest,
- .extra_info = extra_info
- };
+ return (jerryx_arg_t){ .func = func, .dest = dest, .extra_info = extra_info };
} /* jerryx_arg_custom */
/**
@@ -404,12 +361,7 @@ jerryx_arg_object_properties (const jerryx_arg_object_props_t *object_props, /**
func = jerryx_arg_transform_object_props;
}
- return (jerryx_arg_t)
- {
- .func = func,
- .dest = NULL,
- .extra_info = (uintptr_t) object_props
- };
+ return (jerryx_arg_t){ .func = func, .dest = NULL, .extra_info = (uintptr_t) object_props };
} /* jerryx_arg_object_properties */
/**
@@ -432,12 +384,7 @@ jerryx_arg_array (const jerryx_arg_array_items_t *array_items_p, /**< pointer to
func = jerryx_arg_transform_array_items;
}
- return (jerryx_arg_t)
- {
- .func = func,
- .dest = NULL,
- .extra_info = (uintptr_t) array_items_p
- };
+ return (jerryx_arg_t){ .func = func, .dest = NULL, .extra_info = (uintptr_t) array_items_p };
} /* jerryx_arg_array */
#endif /* !JERRYX_ARG_IMPL_H */
diff --git a/jerry-ext/include/jerryscript-ext/autorelease.h b/jerry-ext/include/jerryscript-ext/autorelease.h
index f7cf7dea..be3e49ba 100644
--- a/jerry-ext/include/jerryscript-ext/autorelease.h
+++ b/jerry-ext/include/jerryscript-ext/autorelease.h
@@ -16,10 +16,7 @@
#ifndef JERRYX_AUTORELEASE_H
#define JERRYX_AUTORELEASE_H
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
#include "autorelease.impl.h"
@@ -48,7 +45,6 @@ extern "C"
*/
#define JERRYX_AR_VALUE_T __JERRYX_AR_VALUE_T_IMPL
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYX_AUTORELEASE_H */
diff --git a/jerry-ext/include/jerryscript-ext/autorelease.impl.h b/jerry-ext/include/jerryscript-ext/autorelease.impl.h
index 558b1709..06574206 100644
--- a/jerry-ext/include/jerryscript-ext/autorelease.impl.h
+++ b/jerry-ext/include/jerryscript-ext/autorelease.impl.h
@@ -31,7 +31,7 @@ jerryx_autorelease_cleanup (const jerry_value_t *value) /**< jerry value */
jerry_release_value (*value);
} /* jerryx_autorelease_cleanup */
-#define __JERRYX_AR_VALUE_T_IMPL const jerry_value_t __attribute__ ((__cleanup__(jerryx_autorelease_cleanup)))
+#define __JERRYX_AR_VALUE_T_IMPL const jerry_value_t __attribute__ ((__cleanup__ (jerryx_autorelease_cleanup)))
#else /* !__GNUC__ */
/* TODO: for other compilers */
#error "No autorelease implementation for your compiler!"
diff --git a/jerry-ext/include/jerryscript-ext/debugger.h b/jerry-ext/include/jerryscript-ext/debugger.h
index e229e25e..6ed847b9 100644
--- a/jerry-ext/include/jerryscript-ext/debugger.h
+++ b/jerry-ext/include/jerryscript-ext/debugger.h
@@ -16,13 +16,10 @@
#ifndef JERRYX_DEBUGGER_H
#define JERRYX_DEBUGGER_H
-#include "jerryscript.h"
#include "jerryscript-debugger-transport.h"
+#include "jerryscript.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
void jerryx_debugger_after_connect (bool success);
@@ -38,7 +35,6 @@ bool jerryx_debugger_serial_create (const char *config);
bool jerryx_debugger_ws_create (void);
bool jerryx_debugger_rp_create (void);
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYX_HANDLER_H */
diff --git a/jerry-ext/include/jerryscript-ext/handle-scope.h b/jerry-ext/include/jerryscript-ext/handle-scope.h
index 95505f7b..7fd6fcc4 100644
--- a/jerry-ext/include/jerryscript-ext/handle-scope.h
+++ b/jerry-ext/include/jerryscript-ext/handle-scope.h
@@ -18,18 +18,15 @@
#include "jerryscript.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
#ifndef JERRYX_HANDLE_PRELIST_SIZE
#define JERRYX_HANDLE_PRELIST_SIZE 20
-#endif
+#endif /* !defined(JERRYX_HANDLE_PRELIST_SIZE) */
#ifndef JERRYX_SCOPE_PRELIST_SIZE
#define JERRYX_SCOPE_PRELIST_SIZE 20
-#endif
+#endif /* !defined(JERRYX_SCOPE_PRELIST_SIZE) */
typedef struct jerryx_handle_t jerryx_handle_t;
/**
@@ -82,47 +79,34 @@ typedef enum
jerryx_handle_scope_mismatch,
} jerryx_handle_scope_status;
-jerryx_handle_scope_status
-jerryx_open_handle_scope (jerryx_handle_scope *result);
+jerryx_handle_scope_status jerryx_open_handle_scope (jerryx_handle_scope *result);
-jerryx_handle_scope_status
-jerryx_close_handle_scope (jerryx_handle_scope scope);
+jerryx_handle_scope_status jerryx_close_handle_scope (jerryx_handle_scope scope);
-jerryx_handle_scope_status
-jerryx_open_escapable_handle_scope (jerryx_handle_scope *result);
+jerryx_handle_scope_status jerryx_open_escapable_handle_scope (jerryx_handle_scope *result);
-jerryx_handle_scope_status
-jerryx_close_escapable_handle_scope (jerryx_handle_scope scope);
+jerryx_handle_scope_status jerryx_close_escapable_handle_scope (jerryx_handle_scope scope);
jerryx_handle_scope_status
-jerryx_escape_handle (jerryx_escapable_handle_scope scope,
- jerry_value_t escapee,
- jerry_value_t *result);
+jerryx_escape_handle (jerryx_escapable_handle_scope scope, jerry_value_t escapee, jerry_value_t *result);
/**
* Completely escape a handle from handle scope,
* leave life time management totally up to user.
*/
jerryx_handle_scope_status
-jerryx_remove_handle (jerryx_escapable_handle_scope scope,
- jerry_value_t escapee,
- jerry_value_t *result);
+jerryx_remove_handle (jerryx_escapable_handle_scope scope, jerry_value_t escapee, jerry_value_t *result);
-jerry_value_t
-jerryx_create_handle (jerry_value_t jval);
+jerry_value_t jerryx_create_handle (jerry_value_t jval);
-jerry_value_t
-jerryx_create_handle_in_scope (jerry_value_t jval, jerryx_handle_scope scope);
+jerry_value_t jerryx_create_handle_in_scope (jerry_value_t jval, jerryx_handle_scope scope);
/** MARK: - handle-scope-allocator.c */
-jerryx_handle_scope_t *
-jerryx_handle_scope_get_current (void);
+jerryx_handle_scope_t *jerryx_handle_scope_get_current (void);
-jerryx_handle_scope_t *
-jerryx_handle_scope_get_root (void);
+jerryx_handle_scope_t *jerryx_handle_scope_get_root (void);
/** MARK: - END handle-scope-allocator.c */
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYX_HANDLE_SCOPE_H */
diff --git a/jerry-ext/include/jerryscript-ext/handler.h b/jerry-ext/include/jerryscript-ext/handler.h
index c9bd72b5..dd926fcd 100644
--- a/jerry-ext/include/jerryscript-ext/handler.h
+++ b/jerry-ext/include/jerryscript-ext/handler.h
@@ -18,34 +18,35 @@
#include "jerryscript.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
/*
* Handler registration helper
*/
-jerry_value_t jerryx_handler_register_global (const jerry_char_t *name_p,
- jerry_external_handler_t handler_p);
+jerry_value_t jerryx_handler_register_global (const jerry_char_t *name_p, jerry_external_handler_t handler_p);
/*
* Common external function handlers
*/
jerry_value_t jerryx_handler_assert_fatal (const jerry_call_info_t *call_info_p,
- const jerry_value_t args_p[], const jerry_length_t args_cnt);
+ const jerry_value_t args_p[],
+ const jerry_length_t args_cnt);
jerry_value_t jerryx_handler_assert_throw (const jerry_call_info_t *call_info_p,
- const jerry_value_t args_p[], const jerry_length_t args_cnt);
+ const jerry_value_t args_p[],
+ const jerry_length_t args_cnt);
jerry_value_t jerryx_handler_assert (const jerry_call_info_t *call_info_p,
- const jerry_value_t args_p[], const jerry_length_t args_cnt);
-jerry_value_t jerryx_handler_gc (const jerry_call_info_t *call_info_p,
- const jerry_value_t args_p[], const jerry_length_t args_cnt);
+ const jerry_value_t args_p[],
+ const jerry_length_t args_cnt);
+jerry_value_t
+jerryx_handler_gc (const jerry_call_info_t *call_info_p, const jerry_value_t args_p[], const jerry_length_t args_cnt);
jerry_value_t jerryx_handler_print (const jerry_call_info_t *call_info_p,
- const jerry_value_t args_p[], const jerry_length_t args_cnt);
+ const jerry_value_t args_p[],
+ const jerry_length_t args_cnt);
jerry_value_t jerryx_handler_resource_name (const jerry_call_info_t *call_info_p,
- const jerry_value_t args_p[], const jerry_length_t args_cnt);
+ const jerry_value_t args_p[],
+ const jerry_length_t args_cnt);
/**
* Struct used by the `jerryx_set_functions` method to
@@ -57,15 +58,41 @@ typedef struct
jerry_value_t value; /**< value of the property */
} jerryx_property_entry;
-#define JERRYX_PROPERTY_NUMBER(NAME, NUMBER) (jerryx_property_entry) { NAME, jerry_create_number (NUMBER) }
-#define JERRYX_PROPERTY_STRING(NAME, STR) \
- (jerryx_property_entry) { NAME, jerry_create_string_from_utf8 ((const jerry_char_t *) STR) }
-#define JERRYX_PROPERTY_STRING_SZ(NAME, STR, SIZE) \
- (jerryx_property_entry) { NAME, jerry_create_string_sz_from_utf8 ((const jerry_char_t *) STR, SIZE) }
-#define JERRYX_PROPERTY_BOOLEAN(NAME, VALUE) (jerryx_property_entry) { NAME, jerry_create_boolean (VALUE) }
-#define JERRYX_PROPERTY_FUNCTION(NAME, FUNC) (jerryx_property_entry) { NAME, jerry_create_external_function (FUNC) }
-#define JERRYX_PROPERTY_UNDEFINED(NAME) (jerryx_property_entry) { NAME, jerry_create_undefined() }
-#define JERRYX_PROPERTY_LIST_END() (jerryx_property_entry) { NULL, 0 }
+#define JERRYX_PROPERTY_NUMBER(NAME, NUMBER) \
+ (jerryx_property_entry) \
+ { \
+ NAME, jerry_create_number (NUMBER) \
+ }
+#define JERRYX_PROPERTY_STRING(NAME, STR) \
+ (jerryx_property_entry) \
+ { \
+ NAME, jerry_create_string_from_utf8 ((const jerry_char_t *) STR) \
+ }
+#define JERRYX_PROPERTY_STRING_SZ(NAME, STR, SIZE) \
+ (jerryx_property_entry) \
+ { \
+ NAME, jerry_create_string_sz_from_utf8 ((const jerry_char_t *) STR, SIZE) \
+ }
+#define JERRYX_PROPERTY_BOOLEAN(NAME, VALUE) \
+ (jerryx_property_entry) \
+ { \
+ NAME, jerry_create_boolean (VALUE) \
+ }
+#define JERRYX_PROPERTY_FUNCTION(NAME, FUNC) \
+ (jerryx_property_entry) \
+ { \
+ NAME, jerry_create_external_function (FUNC) \
+ }
+#define JERRYX_PROPERTY_UNDEFINED(NAME) \
+ (jerryx_property_entry) \
+ { \
+ NAME, jerry_create_undefined () \
+ }
+#define JERRYX_PROPERTY_LIST_END() \
+ (jerryx_property_entry) \
+ { \
+ NULL, 0 \
+ }
/**
* Stores the result of property register operation.
@@ -76,28 +103,17 @@ typedef struct
uint32_t registered; /**< number of successfully registered methods */
} jerryx_register_result;
-jerryx_register_result
-jerryx_set_properties (const jerry_value_t target_object,
- const jerryx_property_entry entries[]);
+jerryx_register_result jerryx_set_properties (const jerry_value_t target_object, const jerryx_property_entry entries[]);
-void
-jerryx_release_property_entry (const jerryx_property_entry entries[],
- const jerryx_register_result register_result);
+void jerryx_release_property_entry (const jerryx_property_entry entries[],
+ const jerryx_register_result register_result);
-jerry_value_t
-jerryx_set_property_str (const jerry_value_t target_object,
- const char *name,
- const jerry_value_t value);
+jerry_value_t jerryx_set_property_str (const jerry_value_t target_object, const char *name, const jerry_value_t value);
-jerry_value_t
-jerryx_get_property_str (const jerry_value_t target_object,
- const char *name);
+jerry_value_t jerryx_get_property_str (const jerry_value_t target_object, const char *name);
+
+bool jerryx_has_property_str (const jerry_value_t target_object, const char *name);
-bool
-jerryx_has_property_str (const jerry_value_t target_object,
- const char *name);
+JERRY_C_API_END
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* !JERRYX_HANDLER_H */
diff --git a/jerry-ext/include/jerryscript-ext/module.h b/jerry-ext/include/jerryscript-ext/module.h
index 1c1025d5..681ac13b 100644
--- a/jerry-ext/include/jerryscript-ext/module.h
+++ b/jerry-ext/include/jerryscript-ext/module.h
@@ -18,10 +18,7 @@
#include "jerryscript.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
/**
* Declare the signature for the module initialization function.
@@ -47,9 +44,9 @@ typedef struct jerryx_native_module_t
#ifdef _MSC_VER
#error "`FEATURE_INIT_FINI` build flag isn't supported on Windows, because Microsoft Visual C/C++ Compiler \
doesn't support library constructors and destructors."
-#endif
-#define JERRYX_MODULE_CONSTRUCTOR_ATTRIBUTE __attribute__((constructor))
-#define JERRYX_MODULE_DESTRUCTOR_ATTRIBUTE __attribute__((destructor))
+#endif /* _MSC_VER */
+#define JERRYX_MODULE_CONSTRUCTOR_ATTRIBUTE __attribute__ ((constructor))
+#define JERRYX_MODULE_DESTRUCTOR_ATTRIBUTE __attribute__ ((destructor))
#define JERRYX_MODULE_REGISTRATION_QUALIFIER static
#else /* !ENABLE_INIT_FINI */
#define JERRYX_MODULE_CONSTRUCTOR_ATTRIBUTE
@@ -60,32 +57,23 @@ doesn't support library constructors and destructors."
/**
* Having two levels of macros allows strings to be used unquoted.
*/
-#define JERRYX_NATIVE_MODULE(module_name, on_resolve_cb) \
- JERRYX_NATIVE_MODULE_IMPLEM(module_name, on_resolve_cb)
-
-#define JERRYX_NATIVE_MODULE_IMPLEM(module_name, on_resolve_cb) \
- static jerryx_native_module_t _ ## module_name ## _definition = \
- { \
- .name_p = (jerry_char_t *) #module_name, \
- .on_resolve_p = (on_resolve_cb), \
- .next_p = NULL \
- }; \
- \
- JERRYX_MODULE_REGISTRATION_QUALIFIER void \
- module_name ## _register (void) JERRYX_MODULE_CONSTRUCTOR_ATTRIBUTE; \
- JERRYX_MODULE_REGISTRATION_QUALIFIER void \
- module_name ## _register (void) \
- { \
- jerryx_native_module_register(&_##module_name##_definition); \
- } \
- \
- JERRYX_MODULE_REGISTRATION_QUALIFIER void \
- module_name ## _unregister (void) \
- JERRYX_MODULE_DESTRUCTOR_ATTRIBUTE; \
- JERRYX_MODULE_REGISTRATION_QUALIFIER void \
- module_name ## _unregister (void) \
- { \
- jerryx_native_module_unregister(&_##module_name##_definition); \
+#define JERRYX_NATIVE_MODULE(module_name, on_resolve_cb) JERRYX_NATIVE_MODULE_IMPLEM (module_name, on_resolve_cb)
+
+#define JERRYX_NATIVE_MODULE_IMPLEM(module_name, on_resolve_cb) \
+ static jerryx_native_module_t _##module_name##_definition = { .name_p = (jerry_char_t *) #module_name, \
+ .on_resolve_p = (on_resolve_cb), \
+ .next_p = NULL }; \
+ \
+ JERRYX_MODULE_REGISTRATION_QUALIFIER void module_name##_register (void) JERRYX_MODULE_CONSTRUCTOR_ATTRIBUTE; \
+ JERRYX_MODULE_REGISTRATION_QUALIFIER void module_name##_register (void) \
+ { \
+ jerryx_native_module_register (&_##module_name##_definition); \
+ } \
+ \
+ JERRYX_MODULE_REGISTRATION_QUALIFIER void module_name##_unregister (void) JERRYX_MODULE_DESTRUCTOR_ATTRIBUTE; \
+ JERRYX_MODULE_REGISTRATION_QUALIFIER void module_name##_unregister (void) \
+ { \
+ jerryx_native_module_unregister (&_##module_name##_definition); \
}
/**
@@ -134,18 +122,14 @@ extern jerryx_module_resolver_t jerryx_module_native_resolver;
* Load a copy of a module into the current context using the provided module resolvers, or return one that was already
* loaded if it is found.
*/
-jerry_value_t jerryx_module_resolve (const jerry_value_t name,
- const jerryx_module_resolver_t **resolvers,
- size_t count);
+jerry_value_t
+jerryx_module_resolve (const jerry_value_t name, const jerryx_module_resolver_t **resolvers, size_t count);
/**
* Delete a module from the cache or, if name has the JavaScript value of undefined, clear the entire cache.
*/
-void jerryx_module_clear_cache (const jerry_value_t name,
- const jerryx_module_resolver_t **resolvers,
- size_t count);
+void jerryx_module_clear_cache (const jerry_value_t name, const jerryx_module_resolver_t **resolvers, size_t count);
+
+JERRY_C_API_END
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
#endif /* !JERRYX_MODULE_H */
diff --git a/jerry-ext/module/module.c b/jerry-ext/module/module.c
index 4a579fe0..6ca31c46 100644
--- a/jerry-ext/module/module.c
+++ b/jerry-ext/module/module.c
@@ -13,9 +13,11 @@
* limitations under the License.
*/
+#include "jerryscript-ext/module.h"
+
#include <string.h>
+
#include "jerryscript.h"
-#include "jerryscript-ext/module.h"
static const jerry_char_t *module_name_property_name = (jerry_char_t *) "moduleName";
static const jerry_char_t *module_not_found = (jerry_char_t *) "Module not found";
@@ -67,25 +69,24 @@ jerryx_module_manager_deinit (void *user_data_p) /**< context pointer to deiniti
/**
* Declare the context data manager for modules.
*/
-static const jerry_context_data_manager_t jerryx_module_manager =
-{
- .init_cb = jerryx_module_manager_init,
- .deinit_cb = jerryx_module_manager_deinit,
- .bytes_needed = sizeof (jerry_value_t)
-};
+static const jerry_context_data_manager_t jerryx_module_manager = { .init_cb = jerryx_module_manager_init,
+ .deinit_cb = jerryx_module_manager_deinit,
+ .bytes_needed = sizeof (jerry_value_t) };
/**
* Global static entry point to the linked list of available modules.
*/
static jerryx_native_module_t *first_module_p = NULL;
-void jerryx_native_module_register (jerryx_native_module_t *module_p)
+void
+jerryx_native_module_register (jerryx_native_module_t *module_p)
{
module_p->next_p = first_module_p;
first_module_p = module_p;
} /* jerryx_native_module_register */
-void jerryx_native_module_unregister (jerryx_native_module_t *module_p)
+void
+jerryx_native_module_unregister (jerryx_native_module_t *module_p)
{
jerryx_native_module_t *parent_p = NULL, *iter_p = NULL;
@@ -186,15 +187,13 @@ jerryx_resolve_native_module (const jerry_value_t canonical_name, /**< canonical
/* Look for the module by its name in the list of module definitions. */
for (module_p = first_module_p; module_p != NULL; module_p = module_p->next_p)
{
- if (module_p->name_p != NULL
- && strlen ((char *) module_p->name_p) == name_size
+ if (module_p->name_p != NULL && strlen ((char *) module_p->name_p) == name_size
&& !strncmp ((char *) module_p->name_p, (char *) name_string, name_size))
{
/* If we find the module by its name we load it and cache it if it has an on_resolve () and complain otherwise. */
- (*result) = ((module_p->on_resolve_p) ? module_p->on_resolve_p ()
- : jerryx_module_create_error (JERRY_ERROR_TYPE,
- on_resolve_absent,
- canonical_name));
+ (*result) =
+ ((module_p->on_resolve_p) ? module_p->on_resolve_p ()
+ : jerryx_module_create_error (JERRY_ERROR_TYPE, on_resolve_absent, canonical_name));
return true;
}
}
@@ -202,11 +201,8 @@ jerryx_resolve_native_module (const jerry_value_t canonical_name, /**< canonical
return false;
} /* jerryx_resolve_native_module */
-jerryx_module_resolver_t jerryx_module_native_resolver =
-{
- .get_canonical_name_p = NULL,
- .resolve_p = jerryx_resolve_native_module
-};
+jerryx_module_resolver_t jerryx_module_native_resolver = { .get_canonical_name_p = NULL,
+ .resolve_p = jerryx_resolve_native_module };
static void
jerryx_module_resolve_local (const jerry_value_t name, /**< name of the module to load */
@@ -219,8 +215,7 @@ jerryx_module_resolve_local (const jerry_value_t name, /**< name of the module t
jerry_value_t instances;
JERRY_VLA (jerry_value_t, canonical_names, resolver_count);
jerry_value_t (*get_canonical_name_p) (const jerry_value_t name);
- bool (*resolve_p) (const jerry_value_t canonical_name,
- jerry_value_t *result);
+ bool (*resolve_p) (const jerry_value_t canonical_name, jerry_value_t *result);
if (!jerry_value_is_string (name))
{
@@ -240,8 +235,8 @@ jerryx_module_resolve_local (const jerry_value_t name, /**< name of the module t
for (index = 0; index < resolver_count; index++)
{
get_canonical_name_p = (resolvers_p[index] == NULL ? NULL : resolvers_p[index]->get_canonical_name_p);
- canonical_names[index] = ((get_canonical_name_p == NULL) ? jerry_acquire_value (name)
- : get_canonical_name_p (name));
+ canonical_names[index] =
+ ((get_canonical_name_p == NULL) ? jerry_acquire_value (name) : get_canonical_name_p (name));
canonical_names_used++;
if (jerryx_module_check_cache (instances, canonical_names[index], result))
{
diff --git a/jerry-main/benchmarking.c b/jerry-main/benchmarking.c
index d4c1be5c..0040d86a 100644
--- a/jerry-main/benchmarking.c
+++ b/jerry-main/benchmarking.c
@@ -40,8 +40,8 @@ int gettimeofday (struct timeval *, void *);
* Useless but stable gettimeofday implementation. Returns Epoch. Ensures that
* test cases relying on "now" yield stable results.
*/
-int gettimeofday (struct timeval *tv,
- void *tz)
+int
+gettimeofday (struct timeval *tv, void *tz)
{
(void) tz;
tv->tv_sec = 0;
@@ -56,7 +56,8 @@ int rand (void);
* Useless but stable rand implementation. Returns 4. Ensures that test cases
* relying on randomness yield stable results.
*/
-int rand (void)
+int
+rand (void)
{
return 4; /* Chosen by fair dice roll. Guaranteed to be random. */
} /* rand */
diff --git a/jerry-main/cli.c b/jerry-main/cli.c
index cec01e81..006e26b1 100644
--- a/jerry-main/cli.c
+++ b/jerry-main/cli.c
@@ -13,11 +13,11 @@
* limitations under the License.
*/
+#include "cli.h"
+
#include <stdio.h>
#include <stdlib.h>
-#include "cli.h"
-
/*
* Fixed layout settings
*/
@@ -46,10 +46,10 @@
* @param PROGNAME string containing the name of the program.
* @param CMD string continaing the name of the sub-command.
*/
-#define CLI_CMD_NAME(CMDNAME, PROGNAME, CMD) \
+#define CLI_CMD_NAME(CMDNAME, PROGNAME, CMD) \
char CMDNAME[strlen ((PROGNAME)) + strlen ((CMD)) + 2]; \
- strncpy (CMDNAME, (PROGNAME), strlen ((PROGNAME))); \
- CMDNAME[strlen ((PROGNAME))] = ' '; \
+ strncpy (CMDNAME, (PROGNAME), strlen ((PROGNAME))); \
+ CMDNAME[strlen ((PROGNAME))] = ' '; \
strncpy (CMDNAME + strlen ((PROGNAME)) + 1, (CMD), strlen ((CMD)) + 1)
/*
@@ -66,15 +66,7 @@ cli_init (const cli_opt_t *options_p, /**< array of option definitions, terminat
int argc, /**< number of command line arguments */
char **argv) /**< array of command line arguments */
{
- return (cli_state_t)
- {
- .error = NULL,
- .arg = NULL,
- .index = 1,
- .argc = argc,
- .argv = argv,
- .opts = options_p
- };
+ return (cli_state_t){ .error = NULL, .arg = NULL, .index = 1, .argc = argc, .argv = argv, .opts = options_p };
} /* cli_init */
/**
diff --git a/jerry-main/cli.h b/jerry-main/cli.h
index 2e2e18a0..1eae2f59 100644
--- a/jerry-main/cli.h
+++ b/jerry-main/cli.h
@@ -16,8 +16,8 @@
#ifndef CLI_H
#define CLI_H
-#include <string.h>
#include <stdint.h>
+#include <string.h>
/**
* Command line option definition.
@@ -62,7 +62,10 @@ typedef struct
/**
* Macro for writing command line option definition struct literals.
*/
-#define CLI_OPT_DEF(...) /*(cli_opt_t)*/ { __VA_ARGS__ }
+#define CLI_OPT_DEF(...) /*(cli_opt_t)*/ \
+ { \
+ __VA_ARGS__ \
+ }
/*
* Functions for CLI.
@@ -71,7 +74,7 @@ typedef struct
cli_state_t cli_init (const cli_opt_t *options_p, int argc, char **argv);
void cli_change_opts (cli_state_t *state_p, const cli_opt_t *options_p);
int cli_consume_option (cli_state_t *state_p);
-const char * cli_consume_string (cli_state_t *state_p);
+const char *cli_consume_string (cli_state_t *state_p);
int cli_consume_int (cli_state_t *state_p);
uint32_t cli_consume_path (cli_state_t *state_p);
void cli_help (const char *prog_name_p, const char *command_name_p, const cli_opt_t *options_p);
diff --git a/jerry-main/libfuzzer.c b/jerry-main/libfuzzer.c
index 10de4506..7f9d8c9e 100644
--- a/jerry-main/libfuzzer.c
+++ b/jerry-main/libfuzzer.c
@@ -17,7 +17,8 @@
#include "jerryscript.h"
-int LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
+int
+LLVMFuzzerTestOneInput (const uint8_t *data, size_t size)
{
srand (0);
jerry_init (JERRY_INIT_EMPTY);
diff --git a/jerry-main/main-jerry-snapshot.c b/jerry-main/main-jerry-snapshot.c
index 5e9e230d..b36ff11e 100644
--- a/jerry-main/main-jerry-snapshot.c
+++ b/jerry-main/main-jerry-snapshot.c
@@ -17,9 +17,9 @@
#include <stdlib.h>
#include <string.h>
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
#include "cli.h"
@@ -46,13 +46,12 @@ static const char *output_file_name_p = "js.snapshot";
static jerry_length_t magic_string_lengths[JERRY_LITERAL_LENGTH];
static const jerry_char_t *magic_string_items[JERRY_LITERAL_LENGTH];
-#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
+#if defined(JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
/**
* The alloc function passed to jerry_create_context
*/
static void *
-context_alloc (size_t size,
- void *cb_data_p)
+context_alloc (size_t size, void *cb_data_p)
{
(void) cb_data_p; /* unused */
return malloc (size);
@@ -206,24 +205,24 @@ typedef enum
/**
* Generate command line options
*/
-static const cli_opt_t generate_opts[] =
-{
- CLI_OPT_DEF (.id = OPT_GENERATE_HELP, .opt = "h", .longopt = "help",
- .help = "print this help and exit"),
- CLI_OPT_DEF (.id = OPT_GENERATE_STATIC, .opt = "s", .longopt = "static",
- .help = "generate static snapshot"),
- CLI_OPT_DEF (.id = OPT_GENERATE_FUNCTION, .opt = "f", .longopt = "generate-function-snapshot",
+static const cli_opt_t generate_opts[] = {
+ CLI_OPT_DEF (.id = OPT_GENERATE_HELP, .opt = "h", .longopt = "help", .help = "print this help and exit"),
+ CLI_OPT_DEF (.id = OPT_GENERATE_STATIC, .opt = "s", .longopt = "static", .help = "generate static snapshot"),
+ CLI_OPT_DEF (.id = OPT_GENERATE_FUNCTION,
+ .opt = "f",
+ .longopt = "generate-function-snapshot",
.meta = "ARGUMENTS",
.help = "generate function snapshot with given arguments"),
- CLI_OPT_DEF (.id = OPT_IMPORT_LITERAL_LIST, .longopt = "load-literals-list-format",
+ CLI_OPT_DEF (.id = OPT_IMPORT_LITERAL_LIST,
+ .longopt = "load-literals-list-format",
.meta = "FILE",
.help = "import literals from list format (for static snapshots)"),
- CLI_OPT_DEF (.id = OPT_GENERATE_SHOW_OP, .longopt = "show-opcodes",
- .help = "print generated opcodes"),
- CLI_OPT_DEF (.id = OPT_GENERATE_OUT, .opt = "o", .meta="FILE",
+ CLI_OPT_DEF (.id = OPT_GENERATE_SHOW_OP, .longopt = "show-opcodes", .help = "print generated opcodes"),
+ CLI_OPT_DEF (.id = OPT_GENERATE_OUT,
+ .opt = "o",
+ .meta = "FILE",
.help = "specify output file name (default: js.snapshot)"),
- CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "FILE",
- .help = "input source file")
+ CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "FILE", .help = "input source file")
};
/**
@@ -328,7 +327,7 @@ process_generate (cli_state_t *cli_state_p, /**< cli state */
return JERRY_STANDALONE_EXIT_CODE_FAIL;
}
-#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
+#if defined(JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
context_init ();
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
@@ -363,13 +362,11 @@ process_generate (cli_state_t *cli_state_p, /**< cli state */
num_of_lit++;
}
sp_buffer_p = sp_buffer_end_p + mstr_size + 1;
- }
- while ((size_t) (sp_buffer_p - (char *) sp_buffer_start_p) < sp_buffer_size);
+ } while ((size_t) (sp_buffer_p - (char *) sp_buffer_start_p) < sp_buffer_size);
if (num_of_lit > 0)
{
- jerry_register_magic_strings (magic_string_items, num_of_lit,
- magic_string_lengths);
+ jerry_register_magic_strings (magic_string_items, num_of_lit, magic_string_lengths);
}
}
}
@@ -378,8 +375,8 @@ process_generate (cli_state_t *cli_state_p, /**< cli state */
parse_options.options = JERRY_PARSE_HAS_RESOURCE;
/* To avoid cppcheck warning. */
parse_options.argument_list = 0;
- parse_options.resource_name = jerry_create_string_sz ((const jerry_char_t *) file_name_p,
- (jerry_size_t) strlen (file_name_p));
+ parse_options.resource_name =
+ jerry_create_string_sz ((const jerry_char_t *) file_name_p, (jerry_size_t) strlen (file_name_p));
if (function_args_p != NULL)
{
@@ -387,17 +384,13 @@ process_generate (cli_state_t *cli_state_p, /**< cli state */
parse_options.argument_list = jerry_create_string_from_utf8 ((const jerry_char_t *) function_args_p);
}
- jerry_value_t snapshot_result = jerry_parse ((jerry_char_t *) source_p,
- source_length,
- &parse_options);
+ jerry_value_t snapshot_result = jerry_parse ((jerry_char_t *) source_p, source_length, &parse_options);
if (!jerry_value_is_error (snapshot_result))
{
jerry_value_t parse_result = snapshot_result;
- snapshot_result = jerry_generate_snapshot (parse_result,
- snapshot_flags,
- output_buffer,
- sizeof (output_buffer) / sizeof (uint32_t));
+ snapshot_result =
+ jerry_generate_snapshot (parse_result, snapshot_flags, output_buffer, sizeof (output_buffer) / sizeof (uint32_t));
jerry_release_value (parse_result);
}
@@ -454,17 +447,14 @@ typedef enum
/**
* Literal dump command line options
*/
-static const cli_opt_t literal_dump_opts[] =
-{
- CLI_OPT_DEF (.id = OPT_LITERAL_DUMP_HELP, .opt = "h", .longopt = "help",
- .help = "print this help and exit"),
- CLI_OPT_DEF (.id = OPT_LITERAL_DUMP_FORMAT, .longopt = "format",
+static const cli_opt_t literal_dump_opts[] = {
+ CLI_OPT_DEF (.id = OPT_LITERAL_DUMP_HELP, .opt = "h", .longopt = "help", .help = "print this help and exit"),
+ CLI_OPT_DEF (.id = OPT_LITERAL_DUMP_FORMAT,
+ .longopt = "format",
.meta = "[c|list]",
.help = "specify output format (default: list)"),
- CLI_OPT_DEF (.id = OPT_LITERAL_DUMP_OUT, .opt = "o",
- .help = "specify output file name (default: literals.[h|list])"),
- CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "FILE(S)",
- .help = "input snapshot files")
+ CLI_OPT_DEF (.id = OPT_LITERAL_DUMP_OUT, .opt = "o", .help = "specify output file name (default: literals.[h|list])"),
+ CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "FILE(S)", .help = "input snapshot files")
};
/**
@@ -560,7 +550,7 @@ process_literal_dump (cli_state_t *cli_state_p, /**< cli state */
return JERRY_STANDALONE_EXIT_CODE_FAIL;
}
-#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
+#if defined(JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
context_init ();
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
@@ -645,14 +635,10 @@ typedef enum
/**
* Merge command line options
*/
-static const cli_opt_t merge_opts[] =
-{
- CLI_OPT_DEF (.id = OPT_MERGE_HELP, .opt = "h", .longopt = "help",
- .help = "print this help and exit"),
- CLI_OPT_DEF (.id = OPT_MERGE_OUT, .opt = "o",
- .help = "specify output file name (default: js.snapshot)"),
- CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "FILE",
- .help = "input snapshot files, minimum two")
+static const cli_opt_t merge_opts[] = {
+ CLI_OPT_DEF (.id = OPT_MERGE_HELP, .opt = "h", .longopt = "help", .help = "print this help and exit"),
+ CLI_OPT_DEF (.id = OPT_MERGE_OUT, .opt = "o", .help = "specify output file name (default: js.snapshot)"),
+ CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "FILE", .help = "input snapshot files, minimum two")
};
/**
@@ -728,7 +714,7 @@ process_merge (cli_state_t *cli_state_p, /**< cli state */
return JERRY_STANDALONE_EXIT_CODE_FAIL;
}
-#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
+#if defined(JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
context_init ();
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
@@ -780,12 +766,9 @@ typedef enum
/**
* Command line options
*/
-static const cli_opt_t main_opts[] =
-{
- CLI_OPT_DEF (.id = OPT_HELP, .opt = "h", .longopt = "help",
- .help = "print this help and exit"),
- CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "COMMAND",
- .help = "specify the command")
+static const cli_opt_t main_opts[] = {
+ CLI_OPT_DEF (.id = OPT_HELP, .opt = "h", .longopt = "help", .help = "print this help and exit"),
+ CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "COMMAND", .help = "specify the command")
};
/**
diff --git a/jerry-main/main-jerry-test.c b/jerry-main/main-jerry-test.c
index 6aa6ec4c..640049b3 100644
--- a/jerry-main/main-jerry-test.c
+++ b/jerry-main/main-jerry-test.c
@@ -16,8 +16,8 @@
#include <stdlib.h>
#include <string.h>
-#include "jerryscript.h"
#include "jerryscript-port.h"
+#include "jerryscript.h"
/**
* Maximum size of source code / snapshots buffer
@@ -30,11 +30,10 @@
#define JERRY_STANDALONE_EXIT_CODE_OK (0)
#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)
-static uint8_t buffer[ JERRY_BUFFER_SIZE ];
+static uint8_t buffer[JERRY_BUFFER_SIZE];
static const uint8_t *
-read_file (const char *file_name,
- size_t *out_size_p)
+read_file (const char *file_name, size_t *out_size_p)
{
FILE *file = fopen (file_name, "rb");
if (file == NULL)
@@ -119,7 +118,7 @@ run (void)
return ret_code;
} /* run */
-#if defined (JERRY_TEST_STACK_MEASURE) && (JERRY_TEST_STACK_MEASURE)
+#if defined(JERRY_TEST_STACK_MEASURE) && (JERRY_TEST_STACK_MEASURE)
/**
* How this stack measuring works:
@@ -156,16 +155,25 @@ run (void)
*
*/
-#if !(defined (__linux__) && __linux__)
+#if !(defined(__linux__) && __linux__)
#error "Unsupported stack measurement platform!"
#endif /* !(defined ( __linux__) && __linux__) */
-#if defined (__x86_64__)
-#define STACK_SAVE(TARGET) { __asm volatile ("mov %%rsp, %0" : "=m" (TARGET)); }
-#elif defined (__i386__)
-#define STACK_SAVE(TARGET) { __asm volatile ("mov %%esp, %0" : "=m" (TARGET)); }
-#elif defined (__arm__)
-#define STACK_SAVE(TARGET) { __asm volatile ("mov %0, sp" : "=r" (TARGET)); }
+#if defined(__x86_64__)
+#define STACK_SAVE(TARGET) \
+ { \
+ __asm volatile("mov %%rsp, %0" : "=m"(TARGET)); \
+ }
+#elif defined(__i386__)
+#define STACK_SAVE(TARGET) \
+ { \
+ __asm volatile("mov %%esp, %0" : "=m"(TARGET)); \
+ }
+#elif defined(__arm__)
+#define STACK_SAVE(TARGET) \
+ { \
+ __asm volatile("mov %0, sp" : "=r"(TARGET)); \
+ }
#else /* !defined (__x86_64__) && !defined (__i386__) && !defined (__arm__) */
#error "Unsupported stack measurement target!"
#endif /* !defined (__x86_64__) && !defined (__i386__) && !defined (__arm__) */
@@ -173,16 +181,17 @@ run (void)
static void *g_stack_bottom = 0x0;
#define STACK_MEASURE_RANGE ((2 * 1024 * 1024))
-#define STACK_PATTERN (0xDEADBEEF)
-#define STACK_INIT(TARGET, SIZE) do \
+#define STACK_PATTERN (0xDEADBEEF)
+#define STACK_INIT(TARGET, SIZE) \
+ do \
{ \
for (size_t idx = 0; idx < (SIZE / sizeof (uint32_t)); idx++) \
{ \
- ((uint32_t*)(TARGET))[idx] = STACK_PATTERN; \
+ ((uint32_t *) (TARGET))[idx] = STACK_PATTERN; \
} \
} while (0)
-#define STACK_USAGE(TARGET, SIZE) stack_usage (TARGET, SIZE)
+#define STACK_USAGE(TARGET, SIZE) stack_usage (TARGET, SIZE)
#define STACK_TOP_PTR(TARGET, SIZE) (uint32_t *) (((uint8_t *) TARGET) - SIZE)
static void
@@ -209,8 +218,8 @@ stack_usage (uint32_t *stack_top_p, size_t length_in_bytes)
#define STACK_USAGE(TARGET, SIZE)
#endif /* #if defined (JERRY_TEST_STACK_MEASURE) && (JERRY_TEST_STACK_MEASURE) */
-int main (int main_argc,
- char **main_argv)
+int
+main (int main_argc, char **main_argv)
{
union
{
diff --git a/jerry-main/main-jerry.c b/jerry-main/main-jerry.c
index dbf76349..f5805325 100644
--- a/jerry-main/main-jerry.c
+++ b/jerry-main/main-jerry.c
@@ -18,27 +18,26 @@
#include <stdlib.h>
#include <string.h>
+#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
#include "jerryscript.h"
+
#include "jerryscript-ext/debugger.h"
#include "jerryscript-ext/handler.h"
-#include "jerryscript-port.h"
-#include "jerryscript-port-default.h"
-
-#include "main-utils.h"
#include "main-options.h"
+#include "main-utils.h"
/**
* Temporal buffer size.
*/
#define JERRY_BUFFER_SIZE 256u
-#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
+#if defined(JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
/**
* The alloc function passed to jerry_create_context
*/
static void *
-context_alloc (size_t size,
- void *cb_data_p)
+context_alloc (size_t size, void *cb_data_p)
{
(void) cb_data_p; /* unused */
return malloc (size);
@@ -46,8 +45,7 @@ context_alloc (size_t size,
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
int
-main (int argc,
- char **argv)
+main (int argc, char **argv)
{
union
{
@@ -63,7 +61,7 @@ main (int argc,
main_parse_args (argc, argv, &arguments);
-#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
+#if defined(JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
jerry_context_t *context_p = jerry_create_context (JERRY_GLOBAL_HEAP_SIZE * 1024, context_alloc, NULL);
jerry_port_default_set_current_context (context_p);
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
@@ -145,8 +143,7 @@ restart:
}
default:
{
- assert (source_file_p->type == SOURCE_SCRIPT
- || source_file_p->type == SOURCE_MODULE);
+ assert (source_file_p->type == SOURCE_SCRIPT || source_file_p->type == SOURCE_MODULE);
if (!jerry_is_valid_utf8_string ((jerry_char_t *) source_p, (jerry_size_t) source_size))
{
@@ -157,12 +154,10 @@ restart:
jerry_parse_options_t parse_options;
parse_options.options = JERRY_PARSE_HAS_RESOURCE;
- parse_options.resource_name = jerry_create_string_sz ((const jerry_char_t *) file_path_p,
- (jerry_size_t) strlen (file_path_p));
+ parse_options.resource_name =
+ jerry_create_string_sz ((const jerry_char_t *) file_path_p, (jerry_size_t) strlen (file_path_p));
- ret_value = jerry_parse (source_p,
- source_size,
- &parse_options);
+ ret_value = jerry_parse (source_p, source_size, &parse_options);
jerry_release_value (parse_options.resource_name);
jerry_port_release_source (source_p);
@@ -199,9 +194,7 @@ restart:
while (true)
{
jerry_debugger_wait_for_source_status_t receive_status;
- receive_status = jerry_debugger_wait_for_client_source (main_wait_for_source_callback,
- NULL,
- &ret_value);
+ receive_status = jerry_debugger_wait_for_client_source (main_wait_for_source_callback, NULL, &ret_value);
if (receive_status == JERRY_DEBUGGER_SOURCE_RECEIVE_FAILED)
{
@@ -218,8 +211,7 @@ restart:
assert (receive_status == JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED
|| receive_status == JERRY_DEBUGGER_SOURCE_RECEIVED);
- if (receive_status == JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED
- || main_is_value_reset (ret_value))
+ if (receive_status == JERRY_DEBUGGER_CONTEXT_RESET_RECEIVED || main_is_value_reset (ret_value))
{
jerry_cleanup ();
goto restart;
@@ -370,7 +362,7 @@ restart:
exit:
jerry_cleanup ();
-#if defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
+#if defined(JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1)
free (context_p);
#endif /* defined (JERRY_EXTERNAL_CONTEXT) && (JERRY_EXTERNAL_CONTEXT == 1) */
diff --git a/jerry-main/main-options.c b/jerry-main/main-options.c
index f373a035..a60ec1fb 100644
--- a/jerry-main/main-options.c
+++ b/jerry-main/main-options.c
@@ -13,16 +13,17 @@
* limitations under the License.
*/
+#include "main-options.h"
+
#include <stdbool.h>
#include <stdio.h>
#include <stdlib.h>
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
#include "cli.h"
#include "main-utils.h"
-#include "main-options.h"
/**
* Command line option IDs
@@ -54,49 +55,53 @@ typedef enum
/**
* Command line options
*/
-static const cli_opt_t main_opts[] =
-{
- CLI_OPT_DEF (.id = OPT_HELP, .opt = "h", .longopt = "help",
- .help = "print this help and exit"),
- CLI_OPT_DEF (.id = OPT_VERSION, .opt = "v", .longopt = "version",
- .help = "print tool and library version and exit"),
- CLI_OPT_DEF (.id = OPT_MEM_STATS, .longopt = "mem-stats",
- .help = "dump memory statistics"),
- CLI_OPT_DEF (.id = OPT_TEST262_OBJECT, .longopt = "test262-object",
- .help = "create test262 object"),
- CLI_OPT_DEF (.id = OPT_PARSE_ONLY, .longopt = "parse-only",
- .help = "don't execute JS input"),
- CLI_OPT_DEF (.id = OPT_SHOW_OP, .longopt = "show-opcodes",
- .help = "dump parser byte-code"),
- CLI_OPT_DEF (.id = OPT_SHOW_RE_OP, .longopt = "show-regexp-opcodes",
- .help = "dump regexp byte-code"),
- CLI_OPT_DEF (.id = OPT_DEBUG_SERVER, .longopt = "start-debug-server",
+static const cli_opt_t main_opts[] = {
+ CLI_OPT_DEF (.id = OPT_HELP, .opt = "h", .longopt = "help", .help = "print this help and exit"),
+ CLI_OPT_DEF (.id = OPT_VERSION, .opt = "v", .longopt = "version", .help = "print tool and library version and exit"),
+ CLI_OPT_DEF (.id = OPT_MEM_STATS, .longopt = "mem-stats", .help = "dump memory statistics"),
+ CLI_OPT_DEF (.id = OPT_TEST262_OBJECT, .longopt = "test262-object", .help = "create test262 object"),
+ CLI_OPT_DEF (.id = OPT_PARSE_ONLY, .longopt = "parse-only", .help = "don't execute JS input"),
+ CLI_OPT_DEF (.id = OPT_SHOW_OP, .longopt = "show-opcodes", .help = "dump parser byte-code"),
+ CLI_OPT_DEF (.id = OPT_SHOW_RE_OP, .longopt = "show-regexp-opcodes", .help = "dump regexp byte-code"),
+ CLI_OPT_DEF (.id = OPT_DEBUG_SERVER,
+ .longopt = "start-debug-server",
.help = "start debug server and wait for a connecting client"),
- CLI_OPT_DEF (.id = OPT_DEBUG_PORT, .longopt = "debug-port", .meta = "NUM",
+ CLI_OPT_DEF (.id = OPT_DEBUG_PORT,
+ .longopt = "debug-port",
+ .meta = "NUM",
.help = "debug server port (default: 5001)"),
- CLI_OPT_DEF (.id = OPT_DEBUG_CHANNEL, .longopt = "debug-channel", .meta = "[websocket|rawpacket]",
+ CLI_OPT_DEF (.id = OPT_DEBUG_CHANNEL,
+ .longopt = "debug-channel",
+ .meta = "[websocket|rawpacket]",
.help = "Specify the debugger transmission channel (default: websocket)"),
- CLI_OPT_DEF (.id = OPT_DEBUG_PROTOCOL, .longopt = "debug-protocol", .meta = "PROTOCOL",
+ CLI_OPT_DEF (.id = OPT_DEBUG_PROTOCOL,
+ .longopt = "debug-protocol",
+ .meta = "PROTOCOL",
.help = "Specify the transmission protocol over the communication channel (tcp|serial, default: tcp)"),
- CLI_OPT_DEF (.id = OPT_DEBUG_SERIAL_CONFIG, .longopt = "serial-config", .meta = "OPTIONS_STRING",
+ CLI_OPT_DEF (.id = OPT_DEBUG_SERIAL_CONFIG,
+ .longopt = "serial-config",
+ .meta = "OPTIONS_STRING",
.help = "Configure parameters for serial port (default: /dev/ttyS0,115200,8,N,1)"),
- CLI_OPT_DEF (.id = OPT_DEBUGGER_WAIT_SOURCE, .longopt = "debugger-wait-source",
+ CLI_OPT_DEF (.id = OPT_DEBUGGER_WAIT_SOURCE,
+ .longopt = "debugger-wait-source",
.help = "wait for an executable source from the client"),
- CLI_OPT_DEF (.id = OPT_EXEC_SNAP, .longopt = "exec-snapshot", .meta = "FILE",
+ CLI_OPT_DEF (.id = OPT_EXEC_SNAP,
+ .longopt = "exec-snapshot",
+ .meta = "FILE",
.help = "execute input snapshot file(s)"),
- CLI_OPT_DEF (.id = OPT_EXEC_SNAP_FUNC, .longopt = "exec-snapshot-func", .meta = "FILE NUM",
+ CLI_OPT_DEF (.id = OPT_EXEC_SNAP_FUNC,
+ .longopt = "exec-snapshot-func",
+ .meta = "FILE NUM",
.help = "execute specific function from input snapshot file(s)"),
- CLI_OPT_DEF (.id = OPT_MODULE, .opt = "m", .longopt = "module", .meta = "FILE",
- .help = "execute module file"),
- CLI_OPT_DEF (.id = OPT_LOG_LEVEL, .longopt = "log-level", .meta = "NUM",
- .help = "set log level (0-3)"),
- CLI_OPT_DEF (.id = OPT_NO_PROMPT, .longopt = "no-prompt",
- .help = "don't print prompt in REPL mode"),
- CLI_OPT_DEF (.id = OPT_CALL_ON_EXIT, .longopt = "call-on-exit", .meta = "STRING",
+ CLI_OPT_DEF (.id = OPT_MODULE, .opt = "m", .longopt = "module", .meta = "FILE", .help = "execute module file"),
+ CLI_OPT_DEF (.id = OPT_LOG_LEVEL, .longopt = "log-level", .meta = "NUM", .help = "set log level (0-3)"),
+ CLI_OPT_DEF (.id = OPT_NO_PROMPT, .longopt = "no-prompt", .help = "don't print prompt in REPL mode"),
+ CLI_OPT_DEF (.id = OPT_CALL_ON_EXIT,
+ .longopt = "call-on-exit",
+ .meta = "STRING",
.help = "invoke the specified function when the process is just about to exit"),
CLI_OPT_DEF (.id = OPT_USE_STDIN, .opt = "", .help = "read from standard input"),
- CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "FILE",
- .help = "input JS file(s)")
+ CLI_OPT_DEF (.id = CLI_OPT_DEFAULT, .meta = "FILE", .help = "input JS file(s)")
};
/**
@@ -241,7 +246,9 @@ main_parse_args (int argc, /**< argc */
{
const char *debug_channel = cli_consume_string (&cli_state);
check_usage (!strcmp (debug_channel, "websocket") || !strcmp (debug_channel, "rawpacket"),
- argv[0], "Error: invalid value for --debug-channel: ", cli_state.arg);
+ argv[0],
+ "Error: invalid value for --debug-channel: ",
+ cli_state.arg);
arguments_p->debug_channel = debug_channel;
}
@@ -253,7 +260,9 @@ main_parse_args (int argc, /**< argc */
{
const char *debug_protocol = cli_consume_string (&cli_state);
check_usage (!strcmp (debug_protocol, "tcp") || !strcmp (debug_protocol, "serial"),
- argv[0], "Error: invalid value for --debug-protocol: ", cli_state.arg);
+ argv[0],
+ "Error: invalid value for --debug-protocol: ",
+ cli_state.arg);
arguments_p->debug_protocol = debug_protocol;
}
@@ -327,7 +336,9 @@ main_parse_args (int argc, /**< argc */
{
long int log_level = cli_consume_int (&cli_state);
check_usage (log_level >= 0 && log_level <= 3,
- argv[0], "Error: invalid value for --log-level: ", cli_state.arg);
+ argv[0],
+ "Error: invalid value for --log-level: ",
+ cli_state.arg);
jerry_port_default_set_log_level ((jerry_log_level_t) log_level);
break;
diff --git a/jerry-main/main-options.h b/jerry-main/main-options.h
index 21afad35..5b0f13c6 100644
--- a/jerry-main/main-options.h
+++ b/jerry-main/main-options.h
@@ -23,12 +23,12 @@
*/
typedef enum
{
- OPT_FLAG_EMPTY = 0,
- OPT_FLAG_PARSE_ONLY = (1 << 0),
- OPT_FLAG_DEBUG_SERVER = (1 << 1),
- OPT_FLAG_WAIT_SOURCE = (1 << 2),
- OPT_FLAG_NO_PROMPT = (1 << 3),
- OPT_FLAG_USE_STDIN = (1 << 4),
+ OPT_FLAG_EMPTY = 0,
+ OPT_FLAG_PARSE_ONLY = (1 << 0),
+ OPT_FLAG_DEBUG_SERVER = (1 << 1),
+ OPT_FLAG_WAIT_SOURCE = (1 << 2),
+ OPT_FLAG_NO_PROMPT = (1 << 3),
+ OPT_FLAG_USE_STDIN = (1 << 4),
OPT_FLAG_TEST262_OBJECT = (1u << 5),
} main_option_flags_t;
@@ -71,7 +71,6 @@ typedef struct
uint16_t init_flags;
} main_args_t;
-void
-main_parse_args (int argc, char **argv, main_args_t *arguments_p);
+void main_parse_args (int argc, char **argv, main_args_t *arguments_p);
#endif /* !MAIN_OPTIONS_H */
diff --git a/jerry-main/main-utils.c b/jerry-main/main-utils.c
index 7fe59ce5..e66068d4 100644
--- a/jerry-main/main-utils.c
+++ b/jerry-main/main-utils.c
@@ -13,18 +13,19 @@
* limitations under the License.
*/
+#include "main-utils.h"
+
#include <assert.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
#include "jerryscript.h"
+
#include "jerryscript-ext/debugger.h"
#include "jerryscript-ext/handler.h"
-#include "jerryscript-port.h"
-#include "jerryscript-port-default.h"
-
-#include "main-utils.h"
#include "main-options.h"
/**
@@ -142,8 +143,7 @@ test262_eval_script (const jerry_call_info_t *call_info_p, /**< call information
return ret_value;
} /* test262_eval_script */
-static jerry_value_t
-create_test262 (jerry_value_t global_obj);
+static jerry_value_t create_test262 (jerry_value_t global_obj);
/**
* $262.createRealm
@@ -385,13 +385,13 @@ main_print_unhandled_exception (jerry_value_t error_value) /**< error value */
}
/* Print character if:
- * - The max line length is not reached.
- * - The current position is valid (it is not the end of the source).
- * - The current character is not a newline.
- **/
+ * - The max line length is not reached.
+ * - The current position is valid (it is not the end of the source).
+ * - The current character is not a newline.
+ **/
for (uint32_t char_count = 0;
- (char_count < SYNTAX_ERROR_MAX_LINE_LENGTH) && (pos < source_size) && (source_p[pos] != '\n');
- char_count++, pos++)
+ (char_count < SYNTAX_ERROR_MAX_LINE_LENGTH) && (pos < source_size) && (source_p[pos] != '\n');
+ char_count++, pos++)
{
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "%c", source_p[pos]);
}
@@ -479,9 +479,7 @@ main_wait_for_source_callback (const jerry_char_t *resource_name_p, /**< resourc
parse_options.options = JERRY_PARSE_HAS_RESOURCE;
parse_options.resource_name = jerry_create_string_sz (resource_name_p, (jerry_size_t) resource_name_size);
- jerry_value_t ret_val = jerry_parse (source_p,
- source_size,
- &parse_options);
+ jerry_value_t ret_val = jerry_parse (source_p, source_size, &parse_options);
jerry_release_value (parse_options.resource_name);
diff --git a/jerry-main/main-utils.h b/jerry-main/main-utils.h
index b3bad892..777dd46c 100644
--- a/jerry-main/main-utils.h
+++ b/jerry-main/main-utils.h
@@ -16,6 +16,8 @@
#ifndef MAIN_UTILS_H
#define MAIN_UTILS_H
+#include "jerryscript.h"
+
#include "main-options.h"
/**
@@ -24,19 +26,15 @@
#define JERRY_STANDALONE_EXIT_CODE_OK (0)
#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)
-void
-main_init_engine (main_args_t *arguments_p);
-void
-main_print_unhandled_exception (jerry_value_t error_value);
+void main_init_engine (main_args_t *arguments_p);
+void main_print_unhandled_exception (jerry_value_t error_value);
-jerry_value_t
-main_wait_for_source_callback (const jerry_char_t *resource_name_p,
- size_t resource_name_size,
- const jerry_char_t *source_p,
- size_t source_size,
- void *user_p);
+jerry_value_t main_wait_for_source_callback (const jerry_char_t *resource_name_p,
+ size_t resource_name_size,
+ const jerry_char_t *source_p,
+ size_t source_size,
+ void *user_p);
-bool
-main_is_value_reset (jerry_value_t value);
+bool main_is_value_reset (jerry_value_t value);
#endif /* !MAIN_UTILS_H */
diff --git a/jerry-math/acos.c b/jerry-math/acos.c
index 7a44b951..31f7fdbc 100644
--- a/jerry-math/acos.c
+++ b/jerry-math/acos.c
@@ -52,20 +52,20 @@
* Function needed: sqrt
*/
-#define one 1.00000000000000000000e+00 /* 0x3FF00000, 0x00000000 */
-#define pi 3.14159265358979311600e+00 /* 0x400921FB, 0x54442D18 */
-#define pio2_hi 1.57079632679489655800e+00 /* 0x3FF921FB, 0x54442D18 */
-#define pio2_lo 6.12323399573676603587e-17 /* 0x3C91A626, 0x33145C07 */
-#define pS0 1.66666666666666657415e-01 /* 0x3FC55555, 0x55555555 */
+#define one 1.00000000000000000000e+00 /* 0x3FF00000, 0x00000000 */
+#define pi 3.14159265358979311600e+00 /* 0x400921FB, 0x54442D18 */
+#define pio2_hi 1.57079632679489655800e+00 /* 0x3FF921FB, 0x54442D18 */
+#define pio2_lo 6.12323399573676603587e-17 /* 0x3C91A626, 0x33145C07 */
+#define pS0 1.66666666666666657415e-01 /* 0x3FC55555, 0x55555555 */
#define pS1 -3.25565818622400915405e-01 /* 0xBFD4D612, 0x03EB6F7D */
-#define pS2 2.01212532134862925881e-01 /* 0x3FC9C155, 0x0E884455 */
+#define pS2 2.01212532134862925881e-01 /* 0x3FC9C155, 0x0E884455 */
#define pS3 -4.00555345006794114027e-02 /* 0xBFA48228, 0xB5688F3B */
-#define pS4 7.91534994289814532176e-04 /* 0x3F49EFE0, 0x7501B288 */
-#define pS5 3.47933107596021167570e-05 /* 0x3F023DE1, 0x0DFDF709 */
+#define pS4 7.91534994289814532176e-04 /* 0x3F49EFE0, 0x7501B288 */
+#define pS5 3.47933107596021167570e-05 /* 0x3F023DE1, 0x0DFDF709 */
#define qS1 -2.40339491173441421878e+00 /* 0xC0033A27, 0x1C8A2D4B */
-#define qS2 2.02094576023350569471e+00 /* 0x40002AE5, 0x9C598AC8 */
+#define qS2 2.02094576023350569471e+00 /* 0x40002AE5, 0x9C598AC8 */
#define qS3 -6.88283971605453293030e-01 /* 0xBFE6066C, 0x1B8D0159 */
-#define qS4 7.70381505559019352791e-02 /* 0x3FB3B8C5, 0xB12E9282 */
+#define qS4 7.70381505559019352791e-02 /* 0x3FB3B8C5, 0xB12E9282 */
double
acos (double x)
diff --git a/jerry-math/asin.c b/jerry-math/asin.c
index 6edcb8dc..926992cc 100644
--- a/jerry-math/asin.c
+++ b/jerry-math/asin.c
@@ -57,22 +57,22 @@
* if |x|>1, return NaN with invalid signal.
*/
-#define one 1.00000000000000000000e+00 /* 0x3FF00000, 0x00000000 */
-#define huge 1.000e+300
-#define pio2_hi 1.57079632679489655800e+00 /* 0x3FF921FB, 0x54442D18 */
-#define pio2_lo 6.12323399573676603587e-17 /* 0x3C91A626, 0x33145C07 */
-#define pio4_hi 7.85398163397448278999e-01 /* 0x3FE921FB, 0x54442D18 */
+#define one 1.00000000000000000000e+00 /* 0x3FF00000, 0x00000000 */
+#define huge 1.000e+300
+#define pio2_hi 1.57079632679489655800e+00 /* 0x3FF921FB, 0x54442D18 */
+#define pio2_lo 6.12323399573676603587e-17 /* 0x3C91A626, 0x33145C07 */
+#define pio4_hi 7.85398163397448278999e-01 /* 0x3FE921FB, 0x54442D18 */
/* coefficient for R(x^2) */
-#define pS0 1.66666666666666657415e-01 /* 0x3FC55555, 0x55555555 */
-#define pS1 -3.25565818622400915405e-01 /* 0xBFD4D612, 0x03EB6F7D */
-#define pS2 2.01212532134862925881e-01 /* 0x3FC9C155, 0x0E884455 */
-#define pS3 -4.00555345006794114027e-02 /* 0xBFA48228, 0xB5688F3B */
-#define pS4 7.91534994289814532176e-04 /* 0x3F49EFE0, 0x7501B288 */
-#define pS5 3.47933107596021167570e-05 /* 0x3F023DE1, 0x0DFDF709 */
-#define qS1 -2.40339491173441421878e+00 /* 0xC0033A27, 0x1C8A2D4B */
-#define qS2 2.02094576023350569471e+00 /* 0x40002AE5, 0x9C598AC8 */
-#define qS3 -6.88283971605453293030e-01 /* 0xBFE6066C, 0x1B8D0159 */
-#define qS4 7.70381505559019352791e-02 /* 0x3FB3B8C5, 0xB12E9282 */
+#define pS0 1.66666666666666657415e-01 /* 0x3FC55555, 0x55555555 */
+#define pS1 -3.25565818622400915405e-01 /* 0xBFD4D612, 0x03EB6F7D */
+#define pS2 2.01212532134862925881e-01 /* 0x3FC9C155, 0x0E884455 */
+#define pS3 -4.00555345006794114027e-02 /* 0xBFA48228, 0xB5688F3B */
+#define pS4 7.91534994289814532176e-04 /* 0x3F49EFE0, 0x7501B288 */
+#define pS5 3.47933107596021167570e-05 /* 0x3F023DE1, 0x0DFDF709 */
+#define qS1 -2.40339491173441421878e+00 /* 0xC0033A27, 0x1C8A2D4B */
+#define qS2 2.02094576023350569471e+00 /* 0x40002AE5, 0x9C598AC8 */
+#define qS3 -6.88283971605453293030e-01 /* 0xBFE6066C, 0x1B8D0159 */
+#define qS4 7.70381505559019352791e-02 /* 0x3FB3B8C5, 0xB12E9282 */
double
asin (double x)
diff --git a/jerry-math/asinh.c b/jerry-math/asinh.c
index 67a8dd78..024c4ceb 100644
--- a/jerry-math/asinh.c
+++ b/jerry-math/asinh.c
@@ -38,8 +38,8 @@
* := sign(x) * log1p(|x| + x^2 / (1 + sqrt(1 + x^2)))
*/
-#define one 1.0
-#define ln2 6.93147180559945286227e-01 /* 0x3FE62E42, 0xFEFA39EF */
+#define one 1.0
+#define ln2 6.93147180559945286227e-01 /* 0x3FE62E42, 0xFEFA39EF */
#define huge 1.0e+300
double
diff --git a/jerry-math/atan.c b/jerry-math/atan.c
index 8662a539..d43dd5c8 100644
--- a/jerry-math/atan.c
+++ b/jerry-math/atan.c
@@ -48,33 +48,31 @@
* to produce the hexadecimal values shown.
*/
-static const double atanhi[] =
-{
+static const double atanhi[] = {
4.63647609000806093515e-01, /* atan(0.5)hi 0x3FDDAC67, 0x0561BB4F */
7.85398163397448278999e-01, /* atan(1.0)hi 0x3FE921FB, 0x54442D18 */
9.82793723247329054082e-01, /* atan(1.5)hi 0x3FEF730B, 0xD281F69B */
1.57079632679489655800e+00, /* atan(inf)hi 0x3FF921FB, 0x54442D18 */
};
-static const double atanlo[] =
-{
+static const double atanlo[] = {
2.26987774529616870924e-17, /* atan(0.5)lo 0x3C7A2B7F, 0x222F65E2 */
3.06161699786838301793e-17, /* atan(1.0)lo 0x3C81A626, 0x33145C07 */
1.39033110312309984516e-17, /* atan(1.5)lo 0x3C700788, 0x7AF0CBBD */
6.12323399573676603587e-17, /* atan(inf)lo 0x3C91A626, 0x33145C07 */
};
-#define aT0 3.33333333333329318027e-01 /* 0x3FD55555, 0x5555550D */
+#define aT0 3.33333333333329318027e-01 /* 0x3FD55555, 0x5555550D */
#define aT1 -1.99999999998764832476e-01 /* 0xBFC99999, 0x9998EBC4 */
-#define aT2 1.42857142725034663711e-01 /* 0x3FC24924, 0x920083FF */
+#define aT2 1.42857142725034663711e-01 /* 0x3FC24924, 0x920083FF */
#define aT3 -1.11111104054623557880e-01 /* 0xBFBC71C6, 0xFE231671 */
-#define aT4 9.09088713343650656196e-02 /* 0x3FB745CD, 0xC54C206E */
+#define aT4 9.09088713343650656196e-02 /* 0x3FB745CD, 0xC54C206E */
#define aT5 -7.69187620504482999495e-02 /* 0xBFB3B0F2, 0xAF749A6D */
-#define aT6 6.66107313738753120669e-02 /* 0x3FB10D66, 0xA0D03D51 */
+#define aT6 6.66107313738753120669e-02 /* 0x3FB10D66, 0xA0D03D51 */
#define aT7 -5.83357013379057348645e-02 /* 0xBFADDE2D, 0x52DEFD9A */
-#define aT8 4.97687799461593236017e-02 /* 0x3FA97B4B, 0x24760DEB */
+#define aT8 4.97687799461593236017e-02 /* 0x3FA97B4B, 0x24760DEB */
#define aT9 -3.65315727442169155270e-02 /* 0xBFA2B444, 0x2C6A6C2F */
-#define aT10 1.62858201153657823623e-02 /* 0x3F90AD3A, 0xE322DA11 */
+#define aT10 1.62858201153657823623e-02 /* 0x3F90AD3A, 0xE322DA11 */
#define one 1.0
#define huge 1.0e300
diff --git a/jerry-math/atanh.c b/jerry-math/atanh.c
index 76289daa..01f50c3c 100644
--- a/jerry-math/atanh.c
+++ b/jerry-math/atanh.c
@@ -36,7 +36,7 @@
* 2 1 - x 1 - x
*
* For x < 0.5
-* atanh(x) = 0.5 * log1p(2x + 2x * x / (1 - x))
+ * atanh(x) = 0.5 * log1p(2x + 2x * x / (1 - x))
*
* Special cases:
* atanh(x) is NaN if |x| > 1 with signal;
@@ -46,7 +46,7 @@
*/
#define zero 0.0
-#define one 1.0
+#define one 1.0
#define huge 1.0e+300
double
diff --git a/jerry-math/cbrt.c b/jerry-math/cbrt.c
index 9d6e5ced..718b3917 100644
--- a/jerry-math/cbrt.c
+++ b/jerry-math/cbrt.c
@@ -33,11 +33,11 @@
#define B1 715094163 /* B1 = (682 - 0.03306235651) * 2**20 */
#define B2 696219795 /* B2 = (664 - 0.03306235651) * 2**20 */
-#define C 5.42857142857142815906e-01 /* 19/35 = 0x3FE15F15, 0xF15F15F1 */
-#define D -7.05306122448979611050e-01 /* -864/1225 = 0xBFE691DE, 0x2532C834 */
-#define E 1.41428571428571436819e+00 /* 99/70 = 0x3FF6A0EA, 0x0EA0EA0F */
-#define F 1.60714285714285720630e+00 /* 45/28 = 0x3FF9B6DB, 0x6DB6DB6E */
-#define G 3.57142857142857150787e-01 /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */
+#define C 5.42857142857142815906e-01 /* 19/35 = 0x3FE15F15, 0xF15F15F1 */
+#define D -7.05306122448979611050e-01 /* -864/1225 = 0xBFE691DE, 0x2532C834 */
+#define E 1.41428571428571436819e+00 /* 99/70 = 0x3FF6A0EA, 0x0EA0EA0F */
+#define F 1.60714285714285720630e+00 /* 45/28 = 0x3FF9B6DB, 0x6DB6DB6E */
+#define G 3.57142857142857150787e-01 /* 5/14 = 0x3FD6DB6D, 0xB6DB6DB7 */
double
cbrt (double x)
diff --git a/jerry-math/cosh.c b/jerry-math/cosh.c
index 82723129..c9c8faf3 100644
--- a/jerry-math/cosh.c
+++ b/jerry-math/cosh.c
@@ -49,7 +49,7 @@
* only cosh(0) = 1 is exact for finite x.
*/
-#define one 1.0
+#define one 1.0
#define half 0.5
#define huge 1.0e300
@@ -96,8 +96,7 @@ cosh (double x)
}
/* |x| in [log(maxdouble), overflowthresold] */
lx = ((1 >> 29) + (unsigned int) x);
- if ((ix < 0x408633CE) ||
- ((ix == 0x408633ce) && (lx <= (unsigned) 0x8fb9f87d)))
+ if ((ix < 0x408633CE) || ((ix == 0x408633ce) && (lx <= (unsigned) 0x8fb9f87d)))
{
w = exp (half * fabs (x));
t = half * w;
diff --git a/jerry-math/exp.c b/jerry-math/exp.c
index 5c4c28df..dd96c62c 100644
--- a/jerry-math/exp.c
+++ b/jerry-math/exp.c
@@ -89,33 +89,30 @@
* to produce the hexadecimal values shown.
*/
-static const double halF[2] =
-{
+static const double halF[2] = {
0.5,
-0.5,
};
-static const double ln2HI[2] =
-{
+static const double ln2HI[2] = {
6.93147180369123816490e-01, /* 0x3fe62e42, 0xfee00000 */
-6.93147180369123816490e-01, /* 0xbfe62e42, 0xfee00000 */
};
-static const double ln2LO[2] =
-{
+static const double ln2LO[2] = {
1.90821492927058770002e-10, /* 0x3dea39ef, 0x35793c76 */
-1.90821492927058770002e-10, /* 0xbdea39ef, 0x35793c76 */
};
-#define one 1.0
-#define huge 1.0e+300
-#define twom1000 9.33263618503218878990e-302 /* 2**-1000=0x01700000,0 */
-#define o_threshold 7.09782712893383973096e+02 /* 0x40862E42, 0xFEFA39EF */
+#define one 1.0
+#define huge 1.0e+300
+#define twom1000 9.33263618503218878990e-302 /* 2**-1000=0x01700000,0 */
+#define o_threshold 7.09782712893383973096e+02 /* 0x40862E42, 0xFEFA39EF */
#define u_threshold -7.45133219101941108420e+02 /* 0xc0874910, 0xD52D3051 */
-#define invln2 1.44269504088896338700e+00 /* 0x3ff71547, 0x652b82fe */
-#define P1 1.66666666666666019037e-01 /* 0x3FC55555, 0x5555553E */
+#define invln2 1.44269504088896338700e+00 /* 0x3ff71547, 0x652b82fe */
+#define P1 1.66666666666666019037e-01 /* 0x3FC55555, 0x5555553E */
#define P2 -2.77777777770155933842e-03 /* 0xBF66C16C, 0x16BEBD93 */
-#define P3 6.61375632143793436117e-05 /* 0x3F11566A, 0xAF25DE2C */
+#define P3 6.61375632143793436117e-05 /* 0x3F11566A, 0xAF25DE2C */
#define P4 -1.65339022054652515390e-06 /* 0xBEBBBD41, 0xC5D26BF1 */
-#define P5 4.13813679705723846039e-08 /* 0x3E663769, 0x72BEA4D0 */
+#define P5 4.13813679705723846039e-08 /* 0x3E663769, 0x72BEA4D0 */
double
exp (double x) /* default IEEE double exp */
diff --git a/jerry-math/expm1.c b/jerry-math/expm1.c
index 127817c0..f686b37b 100644
--- a/jerry-math/expm1.c
+++ b/jerry-math/expm1.c
@@ -121,19 +121,19 @@
* to produce the hexadecimal values shown.
*/
-#define one 1.0
-#define huge 1.0e+300
-#define tiny 1.0e-300
+#define one 1.0
+#define huge 1.0e+300
+#define tiny 1.0e-300
#define o_threshold 7.09782712893383973096e+02 /* 0x40862E42, 0xFEFA39EF */
-#define ln2_hi 6.93147180369123816490e-01 /* 0x3fe62e42, 0xfee00000 */
-#define ln2_lo 1.90821492927058770002e-10 /* 0x3dea39ef, 0x35793c76 */
-#define invln2 1.44269504088896338700e+00 /* 0x3ff71547, 0x652b82fe */
+#define ln2_hi 6.93147180369123816490e-01 /* 0x3fe62e42, 0xfee00000 */
+#define ln2_lo 1.90821492927058770002e-10 /* 0x3dea39ef, 0x35793c76 */
+#define invln2 1.44269504088896338700e+00 /* 0x3ff71547, 0x652b82fe */
/* Scaled Q's: Qn_here = 2**n * Qn_above, for R(2*z) where z = hxs = x*x/2: */
#define Q1 -3.33333333333331316428e-02 /* BFA11111 111110F4 */
-#define Q2 1.58730158725481460165e-03 /* 3F5A01A0 19FE5585 */
+#define Q2 1.58730158725481460165e-03 /* 3F5A01A0 19FE5585 */
#define Q3 -7.93650757867487942473e-05 /* BF14CE19 9EAADBB7 */
-#define Q4 4.00821782732936239552e-06 /* 3ED0CFCA 86E65239 */
+#define Q4 4.00821782732936239552e-06 /* 3ED0CFCA 86E65239 */
#define Q5 -2.01099218183624371326e-07 /* BE8AFDB7 6E09C32D */
double
@@ -146,7 +146,7 @@ expm1 (double x)
hx = __HI (x);
xsb = hx & 0x80000000; /* sign bit of x */
- hx &= 0x7fffffff; /* high word of |x| */
+ hx &= 0x7fffffff; /* high word of |x| */
/* filter out huge and non-finite argument */
if (hx >= 0x4043687A)
@@ -265,11 +265,7 @@ expm1 (double x)
y = one - (e - x);
if (k == 1024)
{
- const double twop1023 = ((double_accessor)
- {
- .as_int = { .hi = 0x7fe00000, .lo = 0 }
- }
- ).dbl; /* 0x1p1023 */
+ const double twop1023 = ((double_accessor){ .as_int = { .hi = 0x7fe00000, .lo = 0 } }).dbl; /* 0x1p1023 */
y = y * 2.0 * twop1023;
}
else
diff --git a/jerry-math/fmod.c b/jerry-math/fmod.c
index f1375301..d37b0ab4 100644
--- a/jerry-math/fmod.c
+++ b/jerry-math/fmod.c
@@ -33,7 +33,10 @@
* Method: shift and subtract
*/
-static const double Zero[] = { 0.0, -0.0, };
+static const double Zero[] = {
+ 0.0,
+ -0.0,
+};
double
fmod (double x, double y)
diff --git a/jerry-math/include/math.h b/jerry-math/include/math.h
index f639734b..23b5148d 100644
--- a/jerry-math/include/math.h
+++ b/jerry-math/include/math.h
@@ -17,32 +17,31 @@
#define JERRY_MATH_H
#ifdef __cplusplus
-extern "C"
-{
+extern "C" {
#endif /* __cplusplus */
/* General Constants. */
#ifdef _MSC_VER
-#define INFINITY ((float) (1e+300 * 1e+300)) /* 1e+300*1e+300 must overflow */
-#define NAN ((float) (INFINITY * 0.0f))
+#define INFINITY ((float) (1e+300 * 1e+300)) /* 1e+300*1e+300 must overflow */
+#define NAN ((float) (INFINITY * 0.0f))
#else /* !_MSC_VER */
-#define INFINITY ((float) (1.0 / 0.0))
-#define NAN ((float) (0.0 / 0.0))
+#define INFINITY ((float) (1.0 / 0.0))
+#define NAN ((float) (0.0 / 0.0))
#endif /* _MSC_VER */
-#define HUGE_VAL ((double) INFINITY)
+#define HUGE_VAL ((double) INFINITY)
#define isnan(x) ((x) != (x))
#define isinf(x) ((x) == INFINITY ? 1 : (x) == -INFINITY ? -1 : 0)
-#define isfinite(x) (!isinf(x) && !isnan(x))
+#define isfinite(x) (!isinf (x) && !isnan (x))
/* Exponential and Logarithmic constants. */
-#define M_E 2.7182818284590452353602874713526625
-#define M_SQRT2 1.4142135623730950488016887242096981
-#define M_SQRT1_2 0.7071067811865475244008443621048490
-#define M_LOG2E 1.4426950408889634073599246810018921
-#define M_LOG10E 0.4342944819032518276511289189166051
-#define M_LN2 0.6931471805599453094172321214581765
-#define M_LN10 2.3025850929940456840179914546843642
+#define M_E 2.7182818284590452353602874713526625
+#define M_SQRT2 1.4142135623730950488016887242096981
+#define M_SQRT1_2 0.7071067811865475244008443621048490
+#define M_LOG2E 1.4426950408889634073599246810018921
+#define M_LOG10E 0.4342944819032518276511289189166051
+#define M_LN2 0.6931471805599453094172321214581765
+#define M_LN10 2.3025850929940456840179914546843642
/* Trigonometric Constants. */
#define M_PI 3.1415926535897932384626433832795029
@@ -95,6 +94,6 @@ double fmod (double, double);
double nextafter (double, double);
#ifdef __cplusplus
-}
+} /* __cplusplus_extern_C */
#endif /* __cplusplus */
#endif /* !JERRY_MATH_H */
diff --git a/jerry-math/jerry-math-internal.h b/jerry-math/jerry-math-internal.h
index 767c490f..b08f7332 100644
--- a/jerry-math/jerry-math-internal.h
+++ b/jerry-math/jerry-math-internal.h
@@ -35,17 +35,13 @@
* If byte order is supported and set to little or target is among common
* cases checked define __LITTLE_ENDIAN.
*/
-#if (defined (i386) || defined (__i386) || defined (__i386__) || \
- defined (i486) || defined (__i486) || defined (__i486__) || \
- defined (intel) || defined (x86) || defined (i86pc) || \
- defined (_M_IX86) || defined (_M_AMD64) || defined (_M_X64) || \
- defined (__alpha) || defined (__osf__) || \
- defined (__x86_64__) || defined (__arm__) || defined (__aarch64__) || \
- defined (_M_ARM) || defined (_M_ARM64) || \
- defined (__xtensa__) || defined (__MIPSEL)) || \
-(defined (__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
+#if (defined(i386) || defined(__i386) || defined(__i386__) || defined(i486) || defined(__i486) || defined(__i486__) \
+ || defined(intel) || defined(x86) || defined(i86pc) || defined(_M_IX86) || defined(_M_AMD64) || defined(_M_X64) \
+ || defined(__alpha) || defined(__osf__) || defined(__x86_64__) || defined(__arm__) || defined(__aarch64__) \
+ || defined(_M_ARM) || defined(_M_ARM64) || defined(__xtensa__) || defined(__MIPSEL)) \
+ || (defined(__BYTE_ORDER__) && (__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__))
#define __LITTLE_ENDIAN
-#endif
+#endif /* platform defines */
#endif /* !__LITTLE_ENDIAN */
#ifdef __LITTLE_ENDIAN
@@ -77,11 +73,11 @@ typedef union
#ifndef NAN
#ifdef _MSC_VER
-#define INFINITY ((float) (1e+300 * 1e+300)) /* 1e+300*1e+300 must overflow */
-#define NAN ((float) (INFINITY * 0.0f))
+#define INFINITY ((float) (1e+300 * 1e+300)) /* 1e+300*1e+300 must overflow */
+#define NAN ((float) (INFINITY * 0.0f))
#else /* !_MSC_VER */
-#define INFINITY ((float) (1.0 / 0.0))
-#define NAN ((float) (0.0 / 0.0))
+#define INFINITY ((float) (1.0 / 0.0))
+#define NAN ((float) (0.0 / 0.0))
#endif /* _MSC_VER */
#endif /* !NAN */
diff --git a/jerry-math/log10.c b/jerry-math/log10.c
index 1ea2a54b..368beaa9 100644
--- a/jerry-math/log10.c
+++ b/jerry-math/log10.c
@@ -60,9 +60,9 @@
* shown.
*/
-#define zero 0.0
-#define two54 1.80143985094819840000e+16 /* 0x43500000, 0x00000000 */
-#define ivln10 4.34294481903251816668e-01 /* 0x3FDBCB7B, 0x1526E50E */
+#define zero 0.0
+#define two54 1.80143985094819840000e+16 /* 0x43500000, 0x00000000 */
+#define ivln10 4.34294481903251816668e-01 /* 0x3FDBCB7B, 0x1526E50E */
#define log10_2hi 3.01029995663611771306e-01 /* 0x3FD34413, 0x509F6000 */
#define log10_2lo 3.69423907715893078616e-13 /* 0x3D59FEF3, 0x11F12B36 */
@@ -92,7 +92,7 @@ log10 (double x)
return NAN;
}
k -= 54;
- x *= two54; /* subnormal number, scale up x */
+ x *= two54; /* subnormal number, scale up x */
hx = __HI (x); /* high word of x */
}
if (hx >= 0x7ff00000)
diff --git a/jerry-math/log1p.c b/jerry-math/log1p.c
index cd3da621..976482e6 100644
--- a/jerry-math/log1p.c
+++ b/jerry-math/log1p.c
@@ -90,17 +90,17 @@
* See HP-15C Advanced Functions Handbook, p.193.
*/
-#define zero 0.0
+#define zero 0.0
#define ln2_hi 6.93147180369123816490e-01 /* 3fe62e42 fee00000 */
#define ln2_lo 1.90821492927058770002e-10 /* 3dea39ef 35793c76 */
-#define two54 1.80143985094819840000e+16 /* 43500000 00000000 */
-#define Lp1 6.666666666666735130e-01 /* 3FE55555 55555593 */
-#define Lp2 3.999999999940941908e-01 /* 3FD99999 9997FA04 */
-#define Lp3 2.857142874366239149e-01 /* 3FD24924 94229359 */
-#define Lp4 2.222219843214978396e-01 /* 3FCC71C5 1D8E78AF */
-#define Lp5 1.818357216161805012e-01 /* 3FC74664 96CB03DE */
-#define Lp6 1.531383769920937332e-01 /* 3FC39A09 D078C69F */
-#define Lp7 1.479819860511658591e-01 /* 3FC2F112 DF3E5244 */
+#define two54 1.80143985094819840000e+16 /* 43500000 00000000 */
+#define Lp1 6.666666666666735130e-01 /* 3FE55555 55555593 */
+#define Lp2 3.999999999940941908e-01 /* 3FD99999 9997FA04 */
+#define Lp3 2.857142874366239149e-01 /* 3FD24924 94229359 */
+#define Lp4 2.222219843214978396e-01 /* 3FCC71C5 1D8E78AF */
+#define Lp5 1.818357216161805012e-01 /* 3FC74664 96CB03DE */
+#define Lp6 1.531383769920937332e-01 /* 3FC39A09 D078C69F */
+#define Lp7 1.479819860511658591e-01 /* 3FC2F112 DF3E5244 */
double
log1p (double x)
@@ -131,8 +131,8 @@ log1p (double x)
}
}
if (ax < 0x3e200000)
- { /* |x| < 2**-29 */
- if ((two54 + x > zero) /* raise inexact */
+ { /* |x| < 2**-29 */
+ if ((two54 + x > zero) /* raise inexact */
&& (ax < 0x3c900000)) /* |x| < 2**-54 */
{
return x;
@@ -220,8 +220,7 @@ log1p (double x)
}
s = f / (2.0 + f);
z = s * s;
- R = z * (Lp1 +
- z * (Lp2 + z * (Lp3 + z * (Lp4 + z * (Lp5 + z * (Lp6 + z * Lp7))))));
+ R = z * (Lp1 + z * (Lp2 + z * (Lp3 + z * (Lp4 + z * (Lp5 + z * (Lp6 + z * Lp7))))));
if (k == 0)
{
return f - (hfsq - s * (hfsq + R));
diff --git a/jerry-math/log2.c b/jerry-math/log2.c
index 0db7d1df..6ed213d5 100644
--- a/jerry-math/log2.c
+++ b/jerry-math/log2.c
@@ -37,17 +37,17 @@
* in not-quite-routine extra precision.
*/
-#define zero 0.0
-#define two54 1.80143985094819840000e+16 /* 0x43500000, 0x00000000 */
+#define zero 0.0
+#define two54 1.80143985094819840000e+16 /* 0x43500000, 0x00000000 */
#define ivln2hi 1.44269504072144627571e+00 /* 0x3FF71547, 0x65200000 */
#define ivln2lo 1.67517131648865118353e-10 /* 0x3DE705FC, 0x2EEFA200 */
-#define Lg1 6.666666666666735130e-01 /* 0x3FE55555, 0x55555593 */
-#define Lg2 3.999999999940941908e-01 /* 0x3FD99999, 0x9997FA04 */
-#define Lg3 2.857142874366239149e-01 /* 0x3FD24924, 0x94229359 */
-#define Lg4 2.222219843214978396e-01 /* 0x3FCC71C5, 0x1D8E78AF */
-#define Lg5 1.818357216161805012e-01 /* 0x3FC74664, 0x96CB03DE */
-#define Lg6 1.531383769920937332e-01 /* 0x3FC39A09, 0xD078C69F */
-#define Lg7 1.479819860511658591e-01 /* 0x3FC2F112, 0xDF3E5244 */
+#define Lg1 6.666666666666735130e-01 /* 0x3FE55555, 0x55555593 */
+#define Lg2 3.999999999940941908e-01 /* 0x3FD99999, 0x9997FA04 */
+#define Lg3 2.857142874366239149e-01 /* 0x3FD24924, 0x94229359 */
+#define Lg4 2.222219843214978396e-01 /* 0x3FCC71C5, 0x1D8E78AF */
+#define Lg5 1.818357216161805012e-01 /* 0x3FC74664, 0x96CB03DE */
+#define Lg6 1.531383769920937332e-01 /* 0x3FC39A09, 0xD078C69F */
+#define Lg7 1.479819860511658591e-01 /* 0x3FC2F112, 0xDF3E5244 */
double
log2 (double x)
@@ -72,7 +72,7 @@ log2 (double x)
return NAN; /* log(-#) = NaN */
}
k -= 54;
- x *= two54; /* subnormal number, scale up x */
+ x *= two54; /* subnormal number, scale up x */
hx = __HI (x); /* high word of x */
}
if (hx >= 0x7ff00000)
diff --git a/jerry-math/nextafter.c b/jerry-math/nextafter.c
index cd11c2e3..95756508 100644
--- a/jerry-math/nextafter.c
+++ b/jerry-math/nextafter.c
@@ -28,8 +28,7 @@
#include "jerry-math-internal.h"
double
-nextafter (double x,
- double y)
+nextafter (double x, double y)
{
int hx, hy, ix, iy;
unsigned lx, ly;
@@ -42,7 +41,7 @@ nextafter (double x,
ix = hx & 0x7fffffff; /* |x| */
iy = hy & 0x7fffffff; /* |y| */
- if (((ix >= 0x7ff00000) && ((ix - 0x7ff00000) | lx) != 0) /* x is nan */
+ if (((ix >= 0x7ff00000) && ((ix - 0x7ff00000) | lx) != 0) /* x is nan */
|| ((iy >= 0x7ff00000) && ((iy - 0x7ff00000) | ly) != 0)) /* y is nan */
{
return x + y;
diff --git a/jerry-math/pow.c b/jerry-math/pow.c
index 7865d2b5..343c2fc6 100644
--- a/jerry-math/pow.c
+++ b/jerry-math/pow.c
@@ -72,50 +72,47 @@
* to produce the hexadecimal values shown.
*/
-static const double bp[] =
-{
+static const double bp[] = {
1.0,
1.5,
};
-static const double dp_h[] =
-{
+static const double dp_h[] = {
0.0,
5.84962487220764160156e-01, /* 0x3FE2B803, 0x40000000 */
};
-static const double dp_l[] =
-{
+static const double dp_l[] = {
0.0,
1.35003920212974897128e-08, /* 0x3E4CFDEB, 0x43CFD006 */
};
-#define zero 0.0
-#define one 1.0
-#define two 2.0
-#define two53 9007199254740992.0 /* 0x43400000, 0x00000000 */
-#define huge 1.0e300
-#define tiny 1.0e-300
+#define zero 0.0
+#define one 1.0
+#define two 2.0
+#define two53 9007199254740992.0 /* 0x43400000, 0x00000000 */
+#define huge 1.0e300
+#define tiny 1.0e-300
/* poly coefs for (3/2) * (log(x) - 2s - 2/3 * s**3 */
-#define L1 5.99999999999994648725e-01 /* 0x3FE33333, 0x33333303 */
-#define L2 4.28571428578550184252e-01 /* 0x3FDB6DB6, 0xDB6FABFF */
-#define L3 3.33333329818377432918e-01 /* 0x3FD55555, 0x518F264D */
-#define L4 2.72728123808534006489e-01 /* 0x3FD17460, 0xA91D4101 */
-#define L5 2.30660745775561754067e-01 /* 0x3FCD864A, 0x93C9DB65 */
-#define L6 2.06975017800338417784e-01 /* 0x3FCA7E28, 0x4A454EEF */
-#define P1 1.66666666666666019037e-01 /* 0x3FC55555, 0x5555553E */
+#define L1 5.99999999999994648725e-01 /* 0x3FE33333, 0x33333303 */
+#define L2 4.28571428578550184252e-01 /* 0x3FDB6DB6, 0xDB6FABFF */
+#define L3 3.33333329818377432918e-01 /* 0x3FD55555, 0x518F264D */
+#define L4 2.72728123808534006489e-01 /* 0x3FD17460, 0xA91D4101 */
+#define L5 2.30660745775561754067e-01 /* 0x3FCD864A, 0x93C9DB65 */
+#define L6 2.06975017800338417784e-01 /* 0x3FCA7E28, 0x4A454EEF */
+#define P1 1.66666666666666019037e-01 /* 0x3FC55555, 0x5555553E */
#define P2 -2.77777777770155933842e-03 /* 0xBF66C16C, 0x16BEBD93 */
-#define P3 6.61375632143793436117e-05 /* 0x3F11566A, 0xAF25DE2C */
+#define P3 6.61375632143793436117e-05 /* 0x3F11566A, 0xAF25DE2C */
#define P4 -1.65339022054652515390e-06 /* 0xBEBBBD41, 0xC5D26BF1 */
-#define P5 4.13813679705723846039e-08 /* 0x3E663769, 0x72BEA4D0 */
-#define lg2 6.93147180559945286227e-01 /* 0x3FE62E42, 0xFEFA39EF */
-#define lg2_h 6.93147182464599609375e-01 /* 0x3FE62E43, 0x00000000 */
+#define P5 4.13813679705723846039e-08 /* 0x3E663769, 0x72BEA4D0 */
+#define lg2 6.93147180559945286227e-01 /* 0x3FE62E42, 0xFEFA39EF */
+#define lg2_h 6.93147182464599609375e-01 /* 0x3FE62E43, 0x00000000 */
#define lg2_l -1.90465429995776804525e-09 /* 0xBE205C61, 0x0CA86C39 */
-#define ovt 8.0085662595372944372e-0017 /* -(1024-log2(ovfl+.5ulp)) */
-#define cp 9.61796693925975554329e-01 /* 0x3FEEC709, 0xDC3A03FD = 2 / (3 ln2) */
-#define cp_h 9.61796700954437255859e-01 /* 0x3FEEC709, 0xE0000000 = (float) cp */
+#define ovt 8.0085662595372944372e-0017 /* -(1024-log2(ovfl+.5ulp)) */
+#define cp 9.61796693925975554329e-01 /* 0x3FEEC709, 0xDC3A03FD = 2 / (3 ln2) */
+#define cp_h 9.61796700954437255859e-01 /* 0x3FEEC709, 0xE0000000 = (float) cp */
#define cp_l -7.02846165095275826516e-09 /* 0xBE3E2FE0, 0x145B01F5 = tail of cp_h */
-#define ivln2 1.44269504088896338700e+00 /* 0x3FF71547, 0x652B82FE = 1 / ln2 */
-#define ivln2_h 1.44269502162933349609e+00 /* 0x3FF71547, 0x60000000 = 24b 1 / ln2 */
-#define ivln2_l 1.92596299112661746887e-08 /* 0x3E54AE0B, 0xF85DDF44 = 1 / ln2 tail */
+#define ivln2 1.44269504088896338700e+00 /* 0x3FF71547, 0x652B82FE = 1 / ln2 */
+#define ivln2_h 1.44269502162933349609e+00 /* 0x3FF71547, 0x60000000 = 24b 1 / ln2 */
+#define ivln2_l 1.92596299112661746887e-08 /* 0x3E54AE0B, 0xF85DDF44 = 1 / ln2 tail */
double
pow (double x, double y)
diff --git a/jerry-math/sinh.c b/jerry-math/sinh.c
index a3ca3981..67bb1ba3 100644
--- a/jerry-math/sinh.c
+++ b/jerry-math/sinh.c
@@ -45,8 +45,8 @@
* only sinh(0) = 0 is exact for finite x.
*/
-#define one 1.0
-#define half 0.5
+#define one 1.0
+#define half 0.5
#define shuge 1.0e307
double
diff --git a/jerry-math/tanh.c b/jerry-math/tanh.c
index 7f5d3ea7..fa5fcf50 100644
--- a/jerry-math/tanh.c
+++ b/jerry-math/tanh.c
@@ -54,8 +54,8 @@
* tanh(NaN) is NaN;
* only tanh(0) = 0 is exact for finite x.
*/
-#define one 1.0
-#define two 2.0
+#define one 1.0
+#define two 2.0
#define tiny 1.0e-300
double
diff --git a/jerry-math/trig.c b/jerry-math/trig.c
index 63d63bac..3d6a3549 100644
--- a/jerry-math/trig.c
+++ b/jerry-math/trig.c
@@ -34,11 +34,11 @@
#include "jerry-math-internal.h"
-#define zero 0.00000000000000000000e+00 /* 0x00000000, 0x00000000 */
-#define half 5.00000000000000000000e-01 /* 0x3FE00000, 0x00000000 */
-#define one 1.00000000000000000000e+00 /* 0x3FF00000, 0x00000000 */
-#define two24 1.67772160000000000000e+07 /* 0x41700000, 0x00000000 */
-#define twon24 5.96046447753906250000e-08 /* 0x3E700000, 0x00000000 */
+#define zero 0.00000000000000000000e+00 /* 0x00000000, 0x00000000 */
+#define half 5.00000000000000000000e-01 /* 0x3FE00000, 0x00000000 */
+#define one 1.00000000000000000000e+00 /* 0x3FF00000, 0x00000000 */
+#define two24 1.67772160000000000000e+07 /* 0x41700000, 0x00000000 */
+#define twon24 5.96046447753906250000e-08 /* 0x3E700000, 0x00000000 */
/* __kernel_rem_pio2(x,y,e0,nx,prec)
* double x[],y[]; int e0,nx,prec;
@@ -151,13 +151,9 @@
*/
/* initial value for jk */
-static const int init_jk[] =
-{
- 2, 3, 4, 6
-};
+static const int init_jk[] = { 2, 3, 4, 6 };
-static const double PIo2[] =
-{
+static const double PIo2[] = {
1.57079625129699707031e+00, /* 0x3FF921FB, 0x40000000 */
7.54978941586159635335e-08, /* 0x3E74442D, 0x00000000 */
5.39030252995776476554e-15, /* 0x3CF84698, 0x80000000 */
@@ -171,19 +167,13 @@ static const double PIo2[] =
/*
* Table of constants for 2/pi, 396 Hex digits (476 decimal) of 2/pi
*/
-static const int ipio2[] =
-{
- 0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62,
- 0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7, 0x246E3A,
- 0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129,
- 0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C, 0x7026B4, 0x5F7E41,
- 0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8,
- 0x97FFDE, 0x05980F, 0xEF2F11, 0x8B5A0A, 0x6D1F6D, 0x367ECF,
- 0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5,
- 0xF17B3D, 0x0739F7, 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08,
- 0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3,
- 0x91615E, 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880,
- 0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B,
+static const int ipio2[] = {
+ 0xA2F983, 0x6E4E44, 0x1529FC, 0x2757D1, 0xF534DD, 0xC0DB62, 0x95993C, 0x439041, 0xFE5163, 0xABDEBB, 0xC561B7,
+ 0x246E3A, 0x424DD2, 0xE00649, 0x2EEA09, 0xD1921C, 0xFE1DEB, 0x1CB129, 0xA73EE8, 0x8235F5, 0x2EBB44, 0x84E99C,
+ 0x7026B4, 0x5F7E41, 0x3991D6, 0x398353, 0x39F49C, 0x845F8B, 0xBDF928, 0x3B1FF8, 0x97FFDE, 0x05980F, 0xEF2F11,
+ 0x8B5A0A, 0x6D1F6D, 0x367ECF, 0x27CB09, 0xB74F46, 0x3F669E, 0x5FEA2D, 0x7527BA, 0xC7EBE5, 0xF17B3D, 0x0739F7,
+ 0x8A5292, 0xEA6BFB, 0x5FB11F, 0x8D5D08, 0x560330, 0x46FC7B, 0x6BABF0, 0xCFBC20, 0x9AF436, 0x1DA9E3, 0x91615E,
+ 0xE61B08, 0x659985, 0x5F14A0, 0x68408D, 0xFFD880, 0x4D7327, 0x310606, 0x1556CA, 0x73A8C9, 0x60E27B, 0xC08C6B,
};
static int
@@ -445,14 +435,11 @@ recompute:
* use __kernel_rem_pio2()
*/
-static const int npio2_hw[] =
-{
- 0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C,
- 0x4025FDBB, 0x402921FB, 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C,
- 0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB, 0x403AB41B, 0x403C463A,
- 0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C,
- 0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB,
- 0x404858EB, 0x404921FB,
+static const int npio2_hw[] = {
+ 0x3FF921FB, 0x400921FB, 0x4012D97C, 0x401921FB, 0x401F6A7A, 0x4022D97C, 0x4025FDBB, 0x402921FB,
+ 0x402C463A, 0x402F6A7A, 0x4031475C, 0x4032D97C, 0x40346B9C, 0x4035FDBB, 0x40378FDB, 0x403921FB,
+ 0x403AB41B, 0x403C463A, 0x403DD85A, 0x403F6A7A, 0x40407E4C, 0x4041475C, 0x4042106C, 0x4042D97C,
+ 0x4043A28C, 0x40446B9C, 0x404534AC, 0x4045FDBB, 0x4046C6CB, 0x40478FDB, 0x404858EB, 0x404921FB,
};
/*
@@ -630,12 +617,12 @@ __ieee754_rem_pio2 (double x, double *y)
* sin(x) = x + (S1*x + (x *(r-y/2)+y))
*/
-#define S1 -1.66666666666666324348e-01 /* 0xBFC55555, 0x55555549 */
-#define S2 8.33333333332248946124e-03 /* 0x3F811111, 0x1110F8A6 */
-#define S3 -1.98412698298579493134e-04 /* 0xBF2A01A0, 0x19C161D5 */
-#define S4 2.75573137070700676789e-06 /* 0x3EC71DE3, 0x57B1FE7D */
-#define S5 -2.50507602534068634195e-08 /* 0xBE5AE5E6, 0x8A2B9CEB */
-#define S6 1.58969099521155010221e-10 /* 0x3DE5D93A, 0x5ACFD57C */
+#define S1 -1.66666666666666324348e-01 /* 0xBFC55555, 0x55555549 */
+#define S2 8.33333333332248946124e-03 /* 0x3F811111, 0x1110F8A6 */
+#define S3 -1.98412698298579493134e-04 /* 0xBF2A01A0, 0x19C161D5 */
+#define S4 2.75573137070700676789e-06 /* 0x3EC71DE3, 0x57B1FE7D */
+#define S5 -2.50507602534068634195e-08 /* 0xBE5AE5E6, 0x8A2B9CEB */
+#define S6 1.58969099521155010221e-10 /* 0x3DE5D93A, 0x5ACFD57C */
static double
__kernel_sin (double x, double y, int iy)
@@ -699,12 +686,12 @@ __kernel_sin (double x, double y, int iy)
* thus, reducing the rounding error in the subtraction.
*/
-#define C1 4.16666666666666019037e-02 /* 0x3FA55555, 0x5555554C */
-#define C2 -1.38888888888741095749e-03 /* 0xBF56C16C, 0x16C15177 */
-#define C3 2.48015872894767294178e-05 /* 0x3EFA01A0, 0x19CB1590 */
-#define C4 -2.75573143513906633035e-07 /* 0xBE927E4F, 0x809C52AD */
-#define C5 2.08757232129817482790e-09 /* 0x3E21EE9E, 0xBDB4B1C4 */
-#define C6 -1.13596475577881948265e-11 /* 0xBDA8FAE9, 0xBE8838D4 */
+#define C1 4.16666666666666019037e-02 /* 0x3FA55555, 0x5555554C */
+#define C2 -1.38888888888741095749e-03 /* 0xBF56C16C, 0x16C15177 */
+#define C3 2.48015872894767294178e-05 /* 0x3EFA01A0, 0x19CB1590 */
+#define C4 -2.75573143513906633035e-07 /* 0xBE927E4F, 0x809C52AD */
+#define C5 2.08757232129817482790e-09 /* 0x3E21EE9E, 0xBDB4B1C4 */
+#define C6 -1.13596475577881948265e-11 /* 0xBDA8FAE9, 0xBE8838D4 */
static double
__kernel_cos (double x, double y)
@@ -777,21 +764,21 @@ __kernel_cos (double x, double y)
* = 1 - 2*(tan(y) - (tan(y)^2)/(1+tan(y)))
*/
-#define T0 3.33333333333334091986e-01 /* 3FD55555, 55555563 */
-#define T1 1.33333333333201242699e-01 /* 3FC11111, 1110FE7A */
-#define T2 5.39682539762260521377e-02 /* 3FABA1BA, 1BB341FE */
-#define T3 2.18694882948595424599e-02 /* 3F9664F4, 8406D637 */
-#define T4 8.86323982359930005737e-03 /* 3F8226E3, E96E8493 */
-#define T5 3.59207910759131235356e-03 /* 3F6D6D22, C9560328 */
-#define T6 1.45620945432529025516e-03 /* 3F57DBC8, FEE08315 */
-#define T7 5.88041240820264096874e-04 /* 3F4344D8, F2F26501 */
-#define T8 2.46463134818469906812e-04 /* 3F3026F7, 1A8D1068 */
-#define T9 7.81794442939557092300e-05 /* 3F147E88, A03792A6 */
-#define T10 7.14072491382608190305e-05 /* 3F12B80F, 32F0A7E9 */
+#define T0 3.33333333333334091986e-01 /* 3FD55555, 55555563 */
+#define T1 1.33333333333201242699e-01 /* 3FC11111, 1110FE7A */
+#define T2 5.39682539762260521377e-02 /* 3FABA1BA, 1BB341FE */
+#define T3 2.18694882948595424599e-02 /* 3F9664F4, 8406D637 */
+#define T4 8.86323982359930005737e-03 /* 3F8226E3, E96E8493 */
+#define T5 3.59207910759131235356e-03 /* 3F6D6D22, C9560328 */
+#define T6 1.45620945432529025516e-03 /* 3F57DBC8, FEE08315 */
+#define T7 5.88041240820264096874e-04 /* 3F4344D8, F2F26501 */
+#define T8 2.46463134818469906812e-04 /* 3F3026F7, 1A8D1068 */
+#define T9 7.81794442939557092300e-05 /* 3F147E88, A03792A6 */
+#define T10 7.14072491382608190305e-05 /* 3F12B80F, 32F0A7E9 */
#define T11 -1.85586374855275456654e-05 /* BEF375CB, DB605373 */
-#define T12 2.59073051863633712884e-05 /* 3EFB2A70, 74BF7AD4 */
-#define pio4 7.85398163397448278999e-01 /* 3FE921FB, 54442D18 */
-#define pio4lo 3.06161699786838301793e-17 /* 3C81A626, 33145C07 */
+#define T12 2.59073051863633712884e-05 /* 3EFB2A70, 74BF7AD4 */
+#define pio4 7.85398163397448278999e-01 /* 3FE921FB, 54442D18 */
+#define pio4lo 3.06161699786838301793e-17 /* 3C81A626, 33145C07 */
static double
__kernel_tan (double x, double y, int iy)
diff --git a/jerry-port/default/default-date.c b/jerry-port/default/default-date.c
index 77baec75..09dfb5be 100644
--- a/jerry-port/default/default-date.c
+++ b/jerry-port/default/default-date.c
@@ -17,30 +17,33 @@
#ifdef _WIN32
#include <windows.h>
+
#include <winbase.h>
#include <winnt.h>
#endif /* _WIN32 */
-#if defined (__GNUC__) || defined (__clang__)
+#if defined(__GNUC__) || defined(__clang__)
#include <sys/time.h>
#endif /* __GNUC__ || __clang__ */
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
#ifdef _WIN32
static const LONGLONG UnixEpochInTicks = 116444736000000000; /* difference between 1970 and 1601 */
static const LONGLONG TicksPerMs = 10000; /* 1 tick is 100 nanoseconds */
/* https://support.microsoft.com/en-us/help/167296/how-to-convert-a-unix-time-t-to-a-win32-filetime-or-systemtime */
-static void UnixTimeMsToFileTime (double t, LPFILETIME pft)
+static void
+UnixTimeMsToFileTime (double t, LPFILETIME pft)
{
LONGLONG ll = (LONGLONG) t * TicksPerMs + UnixEpochInTicks;
pft->dwLowDateTime = (DWORD) ll;
pft->dwHighDateTime = (DWORD) (ll >> 32);
} /* UnixTimeMsToFileTime */
-static double FileTimeToUnixTimeMs (FILETIME ft)
+static double
+FileTimeToUnixTimeMs (FILETIME ft)
{
ULARGE_INTEGER date;
date.HighPart = ft.dwHighDateTime;
@@ -56,10 +59,11 @@ static double FileTimeToUnixTimeMs (FILETIME ft)
* @return offset between UTC and local time at the given unix timestamp, if
* available. Otherwise, returns 0, assuming UTC time.
*/
-double jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since unix epoch */
- bool is_utc) /**< is the time above in UTC? */
+double
+jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since unix epoch */
+ bool is_utc) /**< is the time above in UTC? */
{
-#if defined (HAVE_TM_GMTOFF)
+#if defined(HAVE_TM_GMTOFF)
struct tm tm;
time_t now = (time_t) (unix_ms / 1000);
localtime_r (&now, &tm);
@@ -71,7 +75,7 @@ double jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since
}
return ((double) tm.tm_gmtoff) * 1000;
-#elif defined (_WIN32)
+#elif defined(_WIN32)
FILETIME fileTime, localFileTime;
SYSTEMTIME systemTime, localSystemTime;
ULARGE_INTEGER time, localTime;
@@ -95,7 +99,7 @@ double jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since
return (double) (((LONGLONG) localTime.QuadPart - (LONGLONG) time.QuadPart) / TicksPerMs);
}
return 0.0;
-#elif defined (__GNUC__) || defined (__clang__)
+#elif defined(__GNUC__) || defined(__clang__)
time_t now_time = (time_t) (unix_ms / 1000);
double tza_s = 0.0;
@@ -138,13 +142,14 @@ double jerry_port_get_local_time_zone_adjustment (double unix_ms, /**< ms since
* executed successfully,
* 0 - otherwise.
*/
-double jerry_port_get_current_time (void)
+double
+jerry_port_get_current_time (void)
{
#ifdef _WIN32
FILETIME ft;
GetSystemTimeAsFileTime (&ft);
return FileTimeToUnixTimeMs (ft);
-#elif defined (__GNUC__) || defined (__clang__)
+#elif defined(__GNUC__) || defined(__clang__)
struct timeval tv;
if (gettimeofday (&tv, NULL) == 0)
diff --git a/jerry-port/default/default-debugger.c b/jerry-port/default/default-debugger.c
index 7131e426..ed3afe5e 100644
--- a/jerry-port/default/default-debugger.c
+++ b/jerry-port/default/default-debugger.c
@@ -13,11 +13,11 @@
* limitations under the License.
*/
-#if !defined (_XOPEN_SOURCE) || _XOPEN_SOURCE < 500
+#if !defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 500
#undef _XOPEN_SOURCE
/* Required macro for sleep functions (nanosleep or usleep) */
#define _XOPEN_SOURCE 500
-#endif
+#endif /* !(defined(_XOPEN_SOURCE) || _XOPEN_SOURCE < 500) */
#ifdef _WIN32
#include <windows.h>
@@ -25,14 +25,15 @@
#include <unistd.h>
#endif /* _WIN32 */
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
/**
* Default implementation of jerry_port_sleep. Uses 'usleep' if available on the
* system, does nothing otherwise.
*/
-void jerry_port_sleep (uint32_t sleep_time) /**< milliseconds to sleep */
+void
+jerry_port_sleep (uint32_t sleep_time) /**< milliseconds to sleep */
{
#ifdef _WIN32
Sleep (sleep_time);
diff --git a/jerry-port/default/default-external-context.c b/jerry-port/default/default-external-context.c
index 1d537716..012cb3e1 100644
--- a/jerry-port/default/default-external-context.c
+++ b/jerry-port/default/default-external-context.c
@@ -13,8 +13,8 @@
* limitations under the License.
*/
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
/**
* Pointer to the current context.
diff --git a/jerry-port/default/default-fatal.c b/jerry-port/default/default-fatal.c
index c35a7b19..329f253c 100644
--- a/jerry-port/default/default-fatal.c
+++ b/jerry-port/default/default-fatal.c
@@ -15,17 +15,17 @@
#include <stdlib.h>
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
/**
* Default implementation of jerry_port_fatal. Calls 'abort' if exit code is
* non-zero, 'exit' otherwise.
*/
-void jerry_port_fatal (jerry_fatal_code_t code) /**< cause of error */
+void
+jerry_port_fatal (jerry_fatal_code_t code) /**< cause of error */
{
- if (code != 0
- && code != ERR_OUT_OF_MEMORY)
+ if (code != 0 && code != ERR_OUT_OF_MEMORY)
{
abort ();
}
diff --git a/jerry-port/default/default-io.c b/jerry-port/default/default-io.c
index 44dbabbb..05788d59 100644
--- a/jerry-port/default/default-io.c
+++ b/jerry-port/default/default-io.c
@@ -17,9 +17,9 @@
#include <stdlib.h>
#include <string.h>
-#include "jerryscript-port.h"
-#include "jerryscript-port-default.h"
#include "jerryscript-debugger.h"
+#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
/**
* Actual log level
@@ -57,13 +57,13 @@ jerry_port_default_set_log_level (jerry_log_level_t level) /**< log level */
void
jerry_port_log (jerry_log_level_t level, /**< message log level */
const char *format, /**< format string */
- ...) /**< parameters */
+ ...) /**< parameters */
{
if (level <= jerry_port_default_log_level)
{
va_list args;
va_start (args, format);
-#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
+#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
int length = vsnprintf (NULL, 0, format, args);
va_end (args);
va_start (args, format);
@@ -80,7 +80,7 @@ jerry_port_log (jerry_log_level_t level, /**< message log level */
}
} /* jerry_port_log */
-#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
+#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
#define DEBUG_BUFFER_SIZE (256)
static char debug_buffer[DEBUG_BUFFER_SIZE];
@@ -97,7 +97,7 @@ jerry_port_print_char (char c) /**< the character to print */
{
putchar (c);
-#if defined (JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
+#if defined(JERRY_DEBUGGER) && (JERRY_DEBUGGER == 1)
debug_buffer[debug_buffer_index++] = c;
if ((debug_buffer_index == DEBUG_BUFFER_SIZE) || (c == '\n'))
diff --git a/jerry-port/default/default-module.c b/jerry-port/default/default-module.c
index 3583eacc..1cc0d55d 100644
--- a/jerry-port/default/default-module.c
+++ b/jerry-port/default/default-module.c
@@ -17,14 +17,15 @@
#include <stdarg.h>
#include <stdlib.h>
#include <string.h>
-#include <sys/stat.h>
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+
+#include <sys/stat.h>
#ifndef S_ISDIR
-#define S_ISDIR(mode) (((mode) & S_IFMT) == S_IFDIR)
-#endif
+#define S_ISDIR(mode) (((mode) &S_IFMT) == S_IFDIR)
+#endif /* !defined(S_ISDIR) */
/**
* Determines the size of the given file.
@@ -112,7 +113,7 @@ jerry_port_get_directory_end (const jerry_char_t *path_p) /**< path */
while (end_p > path_p)
{
-#if defined (_WIN32)
+#if defined(_WIN32)
if (end_p[-1] == '/' || end_p[-1] == '\\')
{
return (size_t) (end_p - path_p);
@@ -170,7 +171,7 @@ jerry_port_normalize_path (const jerry_char_t *in_path_p, /**< path to the refer
path_p[in_path_length] = '\0';
}
-#if defined (_WIN32)
+#if defined(_WIN32)
char full_path[_MAX_PATH];
if (_fullpath (full_path, path_p, _MAX_PATH) != NULL)
@@ -188,7 +189,7 @@ jerry_port_normalize_path (const jerry_char_t *in_path_p, /**< path to the refer
memcpy (path_p, full_path, full_path_len + 1);
}
-#elif defined (__unix__) || defined (__APPLE__)
+#elif defined(__unix__) || defined(__APPLE__)
char *norm_p = realpath (path_p, NULL);
if (norm_p != NULL)
@@ -216,8 +217,7 @@ typedef struct jerry_port_module_t
/**
* Native info descriptor for modules.
*/
-static const jerry_object_native_info_t jerry_port_module_native_info =
-{
+static const jerry_object_native_info_t jerry_port_module_native_info = {
.free_cb = NULL,
};
@@ -296,12 +296,10 @@ jerry_port_module_manager_deinit (void *user_data_p) /**< context pointer to dei
/**
* Declare the context data manager for modules.
*/
-static const jerry_context_data_manager_t jerry_port_module_manager =
-{
- .init_cb = jerry_port_module_manager_init,
- .deinit_cb = jerry_port_module_manager_deinit,
- .bytes_needed = sizeof (jerry_port_module_manager_t)
-};
+static const jerry_context_data_manager_t jerry_port_module_manager = { .init_cb = jerry_port_module_manager_init,
+ .deinit_cb = jerry_port_module_manager_deinit,
+ .bytes_needed =
+ sizeof (jerry_port_module_manager_t) };
/**
* Default module resolver.
@@ -346,8 +344,7 @@ jerry_port_module_resolve (const jerry_value_t specifier, /**< module specifier
while (module_p != NULL)
{
- if (module_p->realm == realm
- && strcmp ((const char *) module_p->path_p, (const char *) path_p) == 0)
+ if (module_p->realm == realm && strcmp ((const char *) module_p->path_p, (const char *) path_p) == 0)
{
free (path_p);
free (in_path_p);
@@ -375,9 +372,7 @@ jerry_port_module_resolve (const jerry_value_t specifier, /**< module specifier
parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_RESOURCE;
parse_options.resource_name = jerry_create_string_sz ((const jerry_char_t *) in_path_p, in_path_length);
- jerry_value_t ret_value = jerry_parse (source_p,
- source_size,
- &parse_options);
+ jerry_value_t ret_value = jerry_parse (source_p, source_size, &parse_options);
jerry_release_value (parse_options.resource_name);
jerry_port_release_source (source_p);
@@ -411,6 +406,5 @@ void
jerry_port_module_release (const jerry_value_t realm) /**< if this argument is object, release only those modules,
* which realm value is equal to this argument. */
{
- jerry_port_module_free ((jerry_port_module_manager_t *) jerry_get_context_data (&jerry_port_module_manager),
- realm);
+ jerry_port_module_free ((jerry_port_module_manager_t *) jerry_get_context_data (&jerry_port_module_manager), realm);
} /* jerry_port_module_release */
diff --git a/jerry-port/default/include/jerryscript-port-default.h b/jerry-port/default/include/jerryscript-port-default.h
index c869b9b4..4966f6b3 100644
--- a/jerry-port/default/include/jerryscript-port-default.h
+++ b/jerry-port/default/include/jerryscript-port-default.h
@@ -18,13 +18,10 @@
#include <stdbool.h>
-#include "jerryscript.h"
#include "jerryscript-port.h"
+#include "jerryscript.h"
-#ifdef __cplusplus
-extern "C"
-{
-#endif /* __cplusplus */
+JERRY_C_API_BEGIN
/** \addtogroup jerry_port_default Default Jerry engine port API
* These functions are only available if the default port of Jerry is used.
@@ -40,7 +37,6 @@ void jerry_port_default_set_current_context (jerry_context_t *context_p);
* @}
*/
-#ifdef __cplusplus
-}
-#endif /* __cplusplus */
+JERRY_C_API_END
+
#endif /* !JERRYSCRIPT_PORT_DEFAULT_H */
diff --git a/targets/esp8266/include/jerry_extapi.h b/targets/esp8266/include/jerry_extapi.h
index 3127d4bb..5c0c4e5b 100644
--- a/targets/esp8266/include/jerry_extapi.h
+++ b/targets/esp8266/include/jerry_extapi.h
@@ -19,17 +19,12 @@
#define JERRY_STANDALONE_EXIT_CODE_OK (0)
#define JERRY_STANDALONE_EXIT_CODE_FAIL (1)
+#include "jerryscript.h"
-#ifdef __cplusplus
-extern "C" {
-#endif
-
+JERRY_C_API_BEGIN
void js_register_functions (void);
+JERRY_C_API_END
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+#endif /* __JERRY_EXTAPI_H__ */
diff --git a/targets/esp8266/include/jerry_run.h b/targets/esp8266/include/jerry_run.h
index 36abb7f2..51bc136c 100644
--- a/targets/esp8266/include/jerry_run.h
+++ b/targets/esp8266/include/jerry_run.h
@@ -18,19 +18,15 @@
#include <stdint.h>
-#ifdef __cplusplus
-extern "C" {
-#endif
+#include "jerryscript.h"
+JERRY_C_API_BEGIN
void js_entry (void);
int js_eval (const char *source_p, const size_t source_size);
int js_loop (uint32_t ticknow);
void js_exit (void);
+JERRY_C_API_END
-#ifdef __cplusplus
-}
-#endif
-
-#endif
+#endif /* __JERRY_RUN_H__ */
diff --git a/targets/esp8266/include/user_config.h b/targets/esp8266/include/user_config.h
index 253786ec..dd948fe5 100644
--- a/targets/esp8266/include/user_config.h
+++ b/targets/esp8266/include/user_config.h
@@ -21,4 +21,4 @@
#define JERRY_STACK_SIZE 2000
-#endif
+#endif /* __USER_CONFIG_H__ */
diff --git a/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-util/logging.h b/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-util/logging.h
index 12803e34..e6e76470 100644
--- a/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-util/logging.h
+++ b/targets/mbedos5/jerryscript-mbed/jerryscript-mbed-util/logging.h
@@ -19,9 +19,9 @@
#ifdef DEBUG_WRAPPER
#define LOG_PRINT(...) printf(__VA_ARGS__)
-#else
+#else /* !defined(DEBUG_WRAPPER) */
#define LOG_PRINT(...) while(0) { }
-#endif
+#endif /* defined(DEBUG_WRAPPER) */
#define LOG_PRINT_ALWAYS(...) printf(__VA_ARGS__)
diff --git a/targets/nuttx-stm32f4/jerry_main.c b/targets/nuttx-stm32f4/jerry_main.c
index 8b8624ba..90b31fe5 100644
--- a/targets/nuttx-stm32f4/jerry_main.c
+++ b/targets/nuttx-stm32f4/jerry_main.c
@@ -301,9 +301,9 @@ register_js_function (const char *name_p, /**< name of the function */
*/
#ifdef CONFIG_BUILD_KERNEL
int main (int argc, FAR char *argv[])
-#else
+#else /* !defined(CONFIG_BUILD_KERNEL) */
int jerry_main (int argc, char *argv[])
-#endif
+#endif /* defined(CONFIG_BUILD_KERNEL) */
{
if (argc > JERRY_MAX_COMMAND_LINE_ARGS)
{
diff --git a/tests/unit-core/test-abort.c b/tests/unit-core/test-abort.c
index 6105feec..6d50b213 100644
--- a/tests/unit-core/test-abort.c
+++ b/tests/unit-core/test-abort.c
@@ -13,15 +13,13 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+#include "config.h"
#include "test-common.h"
static jerry_value_t
-callback_func (const jerry_call_info_t *call_info_p,
- const jerry_value_t args_p[],
- const jerry_length_t args_count)
+callback_func (const jerry_call_info_t *call_info_p, const jerry_value_t args_p[], const jerry_length_t args_count)
{
JERRY_UNUSED (call_info_p);
JERRY_UNUSED (args_p);
@@ -50,21 +48,17 @@ main (void)
jerry_release_value (callback_name);
jerry_release_value (global);
- const jerry_char_t inf_loop_code_src1[] = TEST_STRING_LITERAL (
- "while(true) {\n"
- " with ({}) {\n"
- " try {\n"
- " callback();\n"
- " } catch (e) {\n"
- " } finally {\n"
- " }\n"
- " }\n"
- "}"
- );
-
- jerry_value_t parsed_code_val = jerry_parse (inf_loop_code_src1,
- sizeof (inf_loop_code_src1) - 1,
- NULL);
+ const jerry_char_t inf_loop_code_src1[] = TEST_STRING_LITERAL ("while(true) {\n"
+ " with ({}) {\n"
+ " try {\n"
+ " callback();\n"
+ " } catch (e) {\n"
+ " } finally {\n"
+ " }\n"
+ " }\n"
+ "}");
+
+ jerry_value_t parsed_code_val = jerry_parse (inf_loop_code_src1, sizeof (inf_loop_code_src1) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
res = jerry_run (parsed_code_val);
@@ -74,30 +68,26 @@ main (void)
jerry_release_value (res);
jerry_release_value (parsed_code_val);
- const jerry_char_t inf_loop_code_src2[] = TEST_STRING_LITERAL (
- "function f() {"
- " while(true) {\n"
- " with ({}) {\n"
- " try {\n"
- " callback();\n"
- " } catch (e) {\n"
- " } finally {\n"
- " }\n"
- " }\n"
- " }"
- "}\n"
- "function g() {\n"
- " for (a in { x:5 })\n"
- " f();\n"
- "}\n"
- "\n"
- "with({})\n"
- " f();\n"
- );
-
- parsed_code_val = jerry_parse (inf_loop_code_src2,
- sizeof (inf_loop_code_src2) - 1,
- NULL);
+ const jerry_char_t inf_loop_code_src2[] = TEST_STRING_LITERAL ("function f() {"
+ " while(true) {\n"
+ " with ({}) {\n"
+ " try {\n"
+ " callback();\n"
+ " } catch (e) {\n"
+ " } finally {\n"
+ " }\n"
+ " }\n"
+ " }"
+ "}\n"
+ "function g() {\n"
+ " for (a in { x:5 })\n"
+ " f();\n"
+ "}\n"
+ "\n"
+ "with({})\n"
+ " f();\n");
+
+ parsed_code_val = jerry_parse (inf_loop_code_src2, sizeof (inf_loop_code_src2) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
res = jerry_run (parsed_code_val);
diff --git a/tests/unit-core/test-api-binary-operations-arithmetics.c b/tests/unit-core/test-api-binary-operations-arithmetics.c
index a41206ec..cd695aaa 100644
--- a/tests/unit-core/test-api-binary-operations-arithmetics.c
+++ b/tests/unit-core/test-api-binary-operations-arithmetics.c
@@ -18,19 +18,20 @@
#include "test-common.h"
#define T(op, lhs, rhs, res) \
- { op, lhs, rhs, res }
+ { \
+ op, lhs, rhs, res \
+ }
#define T_NAN(op, lhs, rhs) \
- { op, lhs, rhs }
+ { \
+ op, lhs, rhs \
+ }
-#define T_ERR(op, lsh, rhs) \
- T_NAN (op, lsh, rhs)
+#define T_ERR(op, lsh, rhs) T_NAN (op, lsh, rhs)
-#define T_ARI(lhs, rhs) \
- T_NAN (JERRY_BIN_OP_SUB, lhs, rhs), \
- T_NAN (JERRY_BIN_OP_MUL, lhs, rhs), \
- T_NAN (JERRY_BIN_OP_DIV, lhs, rhs), \
- T_NAN (JERRY_BIN_OP_REM, lhs, rhs)
+#define T_ARI(lhs, rhs) \
+ T_NAN (JERRY_BIN_OP_SUB, lhs, rhs), T_NAN (JERRY_BIN_OP_MUL, lhs, rhs), T_NAN (JERRY_BIN_OP_DIV, lhs, rhs), \
+ T_NAN (JERRY_BIN_OP_REM, lhs, rhs)
typedef struct
{
@@ -60,8 +61,7 @@ main (void)
jerry_value_t obj2 = jerry_eval ((const jerry_char_t *) "o={x:1};o", 9, JERRY_PARSE_NO_OPTS);
jerry_value_t err1 = jerry_create_error (JERRY_ERROR_SYNTAX, (const jerry_char_t *) "error");
- test_nan_entry_t test_nans[] =
- {
+ test_nan_entry_t test_nans[] = {
/* Testing addition (+) */
T_NAN (JERRY_BIN_OP_ADD, jerry_create_number (3.1), jerry_create_undefined ()),
T_NAN (JERRY_BIN_OP_ADD, jerry_create_undefined (), jerry_create_undefined ()),
@@ -115,8 +115,7 @@ main (void)
jerry_release_value (result);
}
- test_entry_t tests[] =
- {
+ test_entry_t tests[] = {
/* Testing addition (+) */
T (JERRY_BIN_OP_ADD, jerry_create_number (5.0), jerry_create_number (5.0), jerry_create_number (10.0)),
T (JERRY_BIN_OP_ADD, jerry_create_number (3.1), jerry_create_number (10), jerry_create_number (13.1)),
@@ -241,8 +240,7 @@ main (void)
jerry_value_t obj3 = jerry_eval ((const jerry_char_t *) "o={valueOf:function(){throw 5}};o", 33, JERRY_PARSE_NO_OPTS);
- test_error_entry_t error_tests[] =
- {
+ test_error_entry_t error_tests[] = {
/* Testing addition (+) */
T_ERR (JERRY_BIN_OP_ADD, jerry_acquire_value (err1), jerry_acquire_value (err1)),
T_ERR (JERRY_BIN_OP_ADD, jerry_acquire_value (err1), jerry_create_undefined ()),
diff --git a/tests/unit-core/test-api-binary-operations-comparisons.c b/tests/unit-core/test-api-binary-operations-comparisons.c
index 50881e19..0a2698c1 100644
--- a/tests/unit-core/test-api-binary-operations-comparisons.c
+++ b/tests/unit-core/test-api-binary-operations-comparisons.c
@@ -18,7 +18,9 @@
#include "test-common.h"
#define T(op, lhs, rhs, res) \
- { op, lhs, rhs, res }
+ { \
+ op, lhs, rhs, res \
+ }
typedef struct
{
@@ -39,8 +41,7 @@ main (void)
jerry_value_t obj2 = jerry_eval ((const jerry_char_t *) "o={x:1};o", 9, JERRY_PARSE_NO_OPTS);
jerry_value_t err1 = jerry_create_error (JERRY_ERROR_SYNTAX, (const jerry_char_t *) "error");
- test_entry_t tests[] =
- {
+ test_entry_t tests[] = {
/* Testing strict equal comparison */
T (JERRY_BIN_OP_STRICT_EQUAL, jerry_create_number (5.0), jerry_create_number (5.0), true),
T (JERRY_BIN_OP_STRICT_EQUAL, jerry_create_number (3.1), jerry_create_number (10), false),
@@ -95,10 +96,7 @@ main (void)
jerry_create_string ((const jerry_char_t *) "example string"),
jerry_create_undefined (),
false),
- T (JERRY_BIN_OP_EQUAL,
- jerry_create_string ((const jerry_char_t *) "example string"),
- jerry_create_null (),
- false),
+ T (JERRY_BIN_OP_EQUAL, jerry_create_string ((const jerry_char_t *) "example string"), jerry_create_null (), false),
T (JERRY_BIN_OP_EQUAL,
jerry_create_string ((const jerry_char_t *) "example string"),
jerry_create_number (5.0),
@@ -132,18 +130,9 @@ main (void)
jerry_create_string ((const jerry_char_t *) "1"),
jerry_create_string ((const jerry_char_t *) "2"),
true),
- T (JERRY_BIN_OP_LESS,
- jerry_create_string ((const jerry_char_t *) "1"),
- jerry_create_undefined (),
- false),
- T (JERRY_BIN_OP_LESS,
- jerry_create_string ((const jerry_char_t *) "1"),
- jerry_create_null (),
- false),
- T (JERRY_BIN_OP_LESS,
- jerry_create_string ((const jerry_char_t *) "1"),
- jerry_create_number (5.0),
- true),
+ T (JERRY_BIN_OP_LESS, jerry_create_string ((const jerry_char_t *) "1"), jerry_create_undefined (), false),
+ T (JERRY_BIN_OP_LESS, jerry_create_string ((const jerry_char_t *) "1"), jerry_create_null (), false),
+ T (JERRY_BIN_OP_LESS, jerry_create_string ((const jerry_char_t *) "1"), jerry_create_number (5.0), true),
T (JERRY_BIN_OP_LESS, jerry_create_undefined (), jerry_create_undefined (), false),
T (JERRY_BIN_OP_LESS, jerry_create_undefined (), jerry_create_null (), false),
T (JERRY_BIN_OP_LESS, jerry_create_null (), jerry_create_null (), false),
@@ -166,22 +155,10 @@ main (void)
jerry_create_string ((const jerry_char_t *) "1"),
jerry_create_string ((const jerry_char_t *) "1"),
true),
- T (JERRY_BIN_OP_LESS_EQUAL,
- jerry_create_string ((const jerry_char_t *) "1"),
- jerry_create_undefined (),
- false),
- T (JERRY_BIN_OP_LESS_EQUAL,
- jerry_create_string ((const jerry_char_t *) "1"),
- jerry_create_null (),
- false),
- T (JERRY_BIN_OP_LESS_EQUAL,
- jerry_create_string ((const jerry_char_t *) "1"),
- jerry_create_number (5.0),
- true),
- T (JERRY_BIN_OP_LESS_EQUAL,
- jerry_create_string ((const jerry_char_t *) "5.0"),
- jerry_create_number (5.0),
- true),
+ T (JERRY_BIN_OP_LESS_EQUAL, jerry_create_string ((const jerry_char_t *) "1"), jerry_create_undefined (), false),
+ T (JERRY_BIN_OP_LESS_EQUAL, jerry_create_string ((const jerry_char_t *) "1"), jerry_create_null (), false),
+ T (JERRY_BIN_OP_LESS_EQUAL, jerry_create_string ((const jerry_char_t *) "1"), jerry_create_number (5.0), true),
+ T (JERRY_BIN_OP_LESS_EQUAL, jerry_create_string ((const jerry_char_t *) "5.0"), jerry_create_number (5.0), true),
T (JERRY_BIN_OP_LESS_EQUAL, jerry_create_undefined (), jerry_create_undefined (), false),
T (JERRY_BIN_OP_LESS_EQUAL, jerry_create_undefined (), jerry_create_null (), false),
T (JERRY_BIN_OP_LESS_EQUAL, jerry_create_null (), jerry_create_null (), true),
@@ -203,18 +180,9 @@ main (void)
jerry_create_string ((const jerry_char_t *) "1"),
jerry_create_string ((const jerry_char_t *) "2"),
false),
- T (JERRY_BIN_OP_GREATER,
- jerry_create_string ((const jerry_char_t *) "1"),
- jerry_create_undefined (),
- false),
- T (JERRY_BIN_OP_GREATER,
- jerry_create_string ((const jerry_char_t *) "1"),
- jerry_create_null (),
- true),
- T (JERRY_BIN_OP_GREATER,
- jerry_create_number (5.0),
- jerry_create_string ((const jerry_char_t *) "1"),
- true),
+ T (JERRY_BIN_OP_GREATER, jerry_create_string ((const jerry_char_t *) "1"), jerry_create_undefined (), false),
+ T (JERRY_BIN_OP_GREATER, jerry_create_string ((const jerry_char_t *) "1"), jerry_create_null (), true),
+ T (JERRY_BIN_OP_GREATER, jerry_create_number (5.0), jerry_create_string ((const jerry_char_t *) "1"), true),
T (JERRY_BIN_OP_GREATER, jerry_create_undefined (), jerry_create_undefined (), false),
T (JERRY_BIN_OP_GREATER, jerry_create_undefined (), jerry_create_null (), false),
T (JERRY_BIN_OP_GREATER, jerry_create_null (), jerry_create_null (), false),
@@ -237,22 +205,10 @@ main (void)
jerry_create_string ((const jerry_char_t *) "1"),
jerry_create_string ((const jerry_char_t *) "1"),
true),
- T (JERRY_BIN_OP_GREATER_EQUAL,
- jerry_create_string ((const jerry_char_t *) "1"),
- jerry_create_undefined (),
- false),
- T (JERRY_BIN_OP_GREATER_EQUAL,
- jerry_create_string ((const jerry_char_t *) "1"),
- jerry_create_null (),
- true),
- T (JERRY_BIN_OP_GREATER_EQUAL,
- jerry_create_number (5.0),
- jerry_create_string ((const jerry_char_t *) "1"),
- true),
- T (JERRY_BIN_OP_GREATER_EQUAL,
- jerry_create_string ((const jerry_char_t *) "5.0"),
- jerry_create_number (5.0),
- true),
+ T (JERRY_BIN_OP_GREATER_EQUAL, jerry_create_string ((const jerry_char_t *) "1"), jerry_create_undefined (), false),
+ T (JERRY_BIN_OP_GREATER_EQUAL, jerry_create_string ((const jerry_char_t *) "1"), jerry_create_null (), true),
+ T (JERRY_BIN_OP_GREATER_EQUAL, jerry_create_number (5.0), jerry_create_string ((const jerry_char_t *) "1"), true),
+ T (JERRY_BIN_OP_GREATER_EQUAL, jerry_create_string ((const jerry_char_t *) "5.0"), jerry_create_number (5.0), true),
T (JERRY_BIN_OP_GREATER_EQUAL, jerry_create_undefined (), jerry_create_undefined (), false),
T (JERRY_BIN_OP_GREATER_EQUAL, jerry_create_undefined (), jerry_create_null (), false),
T (JERRY_BIN_OP_GREATER_EQUAL, jerry_create_null (), jerry_create_null (), true),
@@ -272,8 +228,7 @@ main (void)
jerry_release_value (result);
}
- test_entry_t error_tests[] =
- {
+ test_entry_t error_tests[] = {
T (JERRY_BIN_OP_STRICT_EQUAL, jerry_acquire_value (err1), jerry_acquire_value (err1), true),
T (JERRY_BIN_OP_STRICT_EQUAL, jerry_acquire_value (err1), jerry_create_undefined (), true),
T (JERRY_BIN_OP_STRICT_EQUAL, jerry_create_undefined (), jerry_acquire_value (err1), true),
diff --git a/tests/unit-core/test-api-binary-operations-instanceof.c b/tests/unit-core/test-api-binary-operations-instanceof.c
index 7765484e..5c268cfa 100644
--- a/tests/unit-core/test-api-binary-operations-instanceof.c
+++ b/tests/unit-core/test-api-binary-operations-instanceof.c
@@ -18,7 +18,9 @@
#include "test-common.h"
#define T(lhs, rhs, res) \
- { lhs, rhs, res }
+ { \
+ lhs, rhs, res \
+ }
typedef struct
{
@@ -60,8 +62,7 @@ main (void)
jerry_value_t error = jerry_create_error_from_value (base_obj, false);
- test_entry_t bool_tests[] =
- {
+ test_entry_t bool_tests[] = {
T (jerry_acquire_value (instance_val), jerry_acquire_value (constructor), true),
T (jerry_acquire_value (no_proto_instance_val), jerry_acquire_value (constructor), false),
T (jerry_acquire_value (base_obj), jerry_acquire_value (constructor), false)
@@ -69,9 +70,7 @@ main (void)
for (uint32_t idx = 0; idx < sizeof (bool_tests) / sizeof (test_entry_t); idx++)
{
- jerry_value_t result = jerry_binary_operation (JERRY_BIN_OP_INSTANCEOF,
- bool_tests[idx].lhs,
- bool_tests[idx].rhs);
+ jerry_value_t result = jerry_binary_operation (JERRY_BIN_OP_INSTANCEOF, bool_tests[idx].lhs, bool_tests[idx].rhs);
TEST_ASSERT (!jerry_value_is_error (result));
TEST_ASSERT (jerry_value_is_true (result) == bool_tests[idx].expected);
jerry_release_value (bool_tests[idx].lhs);
@@ -79,8 +78,7 @@ main (void)
jerry_release_value (result);
}
- test_entry_t error_tests[] =
- {
+ test_entry_t error_tests[] = {
T (jerry_acquire_value (constructor), jerry_acquire_value (instance_val), true),
T (jerry_create_undefined (), jerry_acquire_value (constructor), true),
T (jerry_acquire_value (instance_val), jerry_create_undefined (), true),
@@ -99,9 +97,7 @@ main (void)
for (uint32_t idx = 0; idx < sizeof (error_tests) / sizeof (test_entry_t); idx++)
{
- jerry_value_t result = jerry_binary_operation (JERRY_BIN_OP_INSTANCEOF,
- error_tests[idx].lhs,
- error_tests[idx].rhs);
+ jerry_value_t result = jerry_binary_operation (JERRY_BIN_OP_INSTANCEOF, error_tests[idx].lhs, error_tests[idx].rhs);
TEST_ASSERT (jerry_value_is_error (result) == error_tests[idx].expected);
jerry_release_value (error_tests[idx].lhs);
jerry_release_value (error_tests[idx].rhs);
diff --git a/tests/unit-core/test-api-errortype.c b/tests/unit-core/test-api-errortype.c
index 2e0d9700..645f1806 100644
--- a/tests/unit-core/test-api-errortype.c
+++ b/tests/unit-core/test-api-errortype.c
@@ -14,6 +14,7 @@
*/
#include "jerryscript.h"
+
#include "test-common.h"
int
@@ -23,20 +24,12 @@ main (void)
jerry_init (JERRY_INIT_EMPTY);
- jerry_error_t errors[] =
- {
- JERRY_ERROR_COMMON,
- JERRY_ERROR_EVAL,
- JERRY_ERROR_RANGE,
- JERRY_ERROR_REFERENCE,
- JERRY_ERROR_SYNTAX,
- JERRY_ERROR_TYPE,
- JERRY_ERROR_URI
- };
+ jerry_error_t errors[] = { JERRY_ERROR_COMMON, JERRY_ERROR_EVAL, JERRY_ERROR_RANGE, JERRY_ERROR_REFERENCE,
+ JERRY_ERROR_SYNTAX, JERRY_ERROR_TYPE, JERRY_ERROR_URI };
for (size_t idx = 0; idx < sizeof (errors) / sizeof (errors[0]); idx++)
{
- jerry_value_t error_obj = jerry_create_error (errors[idx], (const jerry_char_t *)"test");
+ jerry_value_t error_obj = jerry_create_error (errors[idx], (const jerry_char_t *) "test");
TEST_ASSERT (jerry_value_is_error (error_obj));
TEST_ASSERT (jerry_get_error_type (error_obj) == errors[idx]);
@@ -47,8 +40,7 @@ main (void)
jerry_release_value (error_obj);
}
- jerry_value_t test_values[] =
- {
+ jerry_value_t test_values[] = {
jerry_create_number (11),
jerry_create_string ((const jerry_char_t *) "message"),
jerry_create_boolean (true),
@@ -64,18 +56,14 @@ main (void)
char test_source[] = "\xF0\x9D\x84\x9E";
- jerry_value_t result = jerry_parse ((const jerry_char_t *) test_source,
- sizeof (test_source) - 1,
- NULL);
+ jerry_value_t result = jerry_parse ((const jerry_char_t *) test_source, sizeof (test_source) - 1, NULL);
TEST_ASSERT (jerry_value_is_error (result));
TEST_ASSERT (jerry_get_error_type (result) == JERRY_ERROR_SYNTAX);
jerry_release_value (result);
char test_invalid_error[] = "Object.create(Error.prototype)";
- result = jerry_eval ((const jerry_char_t *) test_invalid_error,
- sizeof (test_invalid_error) - 1,
- JERRY_PARSE_NO_OPTS);
+ result = jerry_eval ((const jerry_char_t *) test_invalid_error, sizeof (test_invalid_error) - 1, JERRY_PARSE_NO_OPTS);
TEST_ASSERT (!jerry_value_is_error (result) && jerry_value_is_object (result));
TEST_ASSERT (jerry_get_error_type (result) == JERRY_ERROR_NONE);
diff --git a/tests/unit-core/test-api-functiontype.c b/tests/unit-core/test-api-functiontype.c
index c3c05954..0437a566 100644
--- a/tests/unit-core/test-api-functiontype.c
+++ b/tests/unit-core/test-api-functiontype.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
typedef struct
@@ -26,8 +27,14 @@ typedef struct
bool is_async;
} test_entry_t;
-#define ENTRY(TYPE, VALUE) { TYPE, VALUE, true, false }
-#define ENTRY_IF(TYPE, VALUE, FEATURE, ASYNC) { TYPE, VALUE, jerry_is_feature_enabled (FEATURE), ASYNC }
+#define ENTRY(TYPE, VALUE) \
+ { \
+ TYPE, VALUE, true, false \
+ }
+#define ENTRY_IF(TYPE, VALUE, FEATURE, ASYNC) \
+ { \
+ TYPE, VALUE, jerry_is_feature_enabled (FEATURE), ASYNC \
+ }
#define EVALUATE(BUFF) (jerry_eval ((BUFF), sizeof ((BUFF)) - 1, JERRY_PARSE_NO_OPTS))
static jerry_value_t
test_ext_function (const jerry_call_info_t *call_info_p, /**< call information */
@@ -59,8 +66,7 @@ main (void)
const jerry_char_t simple_function[] = "function f() {}; f";
const jerry_char_t bound_function[] = "function f() {}; f.bind(1,2)";
- test_entry_t entries[] =
- {
+ test_entry_t entries[] = {
ENTRY (JERRY_FUNCTION_TYPE_NONE, jerry_create_number (-33.0)),
ENTRY (JERRY_FUNCTION_TYPE_NONE, jerry_create_boolean (true)),
ENTRY (JERRY_FUNCTION_TYPE_NONE, jerry_create_undefined ()),
diff --git a/tests/unit-core/test-api-iteratortype.c b/tests/unit-core/test-api-iteratortype.c
index e7ec98a2..7f0d9a40 100644
--- a/tests/unit-core/test-api-iteratortype.c
+++ b/tests/unit-core/test-api-iteratortype.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
typedef struct
@@ -25,8 +26,14 @@ typedef struct
bool active;
} test_entry_t;
-#define ENTRY(TYPE, VALUE) { TYPE, VALUE, true }
-#define ENTRY_IF(TYPE, VALUE, FEATURE) { TYPE, VALUE, jerry_is_feature_enabled (FEATURE) }
+#define ENTRY(TYPE, VALUE) \
+ { \
+ TYPE, VALUE, true \
+ }
+#define ENTRY_IF(TYPE, VALUE, FEATURE) \
+ { \
+ TYPE, VALUE, jerry_is_feature_enabled (FEATURE) \
+ }
#define EVALUATE(BUFF) (jerry_eval ((BUFF), sizeof ((BUFF)) - 1, JERRY_PARSE_NO_OPTS))
int
@@ -58,8 +65,7 @@ main (void)
const jerry_char_t set_iterator_entries[] = "new Set([1, 2, 3]).entries()";
const jerry_char_t set_iterator_symbol_iterator[] = "new Set([1, 2, 3])[Symbol.iterator]()";
- test_entry_t entries[] =
- {
+ test_entry_t entries[] = {
ENTRY (JERRY_ITERATOR_TYPE_NONE, jerry_create_number (-33.0)),
ENTRY (JERRY_ITERATOR_TYPE_NONE, jerry_create_boolean (true)),
ENTRY (JERRY_ITERATOR_TYPE_NONE, jerry_create_undefined ()),
diff --git a/tests/unit-core/test-api-object-property-names.c b/tests/unit-core/test-api-object-property-names.c
index 0f9a98f3..9934801f 100644
--- a/tests/unit-core/test-api-object-property-names.c
+++ b/tests/unit-core/test-api-object-property-names.c
@@ -13,25 +13,18 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
-static const char *prop_names[] =
-{
- "val1",
- "val2",
- "val3",
- "val4",
- "val5",
- "37",
- "symbol"
-};
+static const char *prop_names[] = { "val1", "val2", "val3", "val4", "val5", "37", "symbol" };
static jerry_char_t buffer[256] = { 0 };
-static void create_and_set_property (const jerry_value_t object, const char *prop_name)
+static void
+create_and_set_property (const jerry_value_t object, const char *prop_name)
{
jerry_value_t jprop_name = jerry_create_string ((const jerry_char_t *) prop_name);
jerry_value_t ret_val = jerry_set_property (object, jprop_name, jerry_create_undefined ());
@@ -40,7 +33,8 @@ static void create_and_set_property (const jerry_value_t object, const char *pro
jerry_release_value (ret_val);
} /* create_and_set_property */
-static void compare_prop_name (const jerry_value_t object, const char *prop_name, uint32_t idx)
+static void
+compare_prop_name (const jerry_value_t object, const char *prop_name, uint32_t idx)
{
jerry_value_t name = jerry_get_property_by_index (object, idx);
TEST_ASSERT (jerry_value_is_string (name) || jerry_value_is_number (name));
@@ -61,10 +55,11 @@ static void compare_prop_name (const jerry_value_t object, const char *prop_name
jerry_release_value (name);
} /* compare_prop_name */
-static void define_property (const jerry_value_t object,
- const char *prop_name,
- jerry_property_descriptor_t *prop_desc_p,
- bool is_symbol)
+static void
+define_property (const jerry_value_t object,
+ const char *prop_name,
+ jerry_property_descriptor_t *prop_desc_p,
+ bool is_symbol)
{
jerry_value_t jname = jerry_create_string ((const jerry_char_t *) prop_name);
jerry_value_t ret_val;
@@ -105,11 +100,8 @@ main (void)
jerry_value_t names;
jerry_property_descriptor_t prop_desc = jerry_property_descriptor_create ();
- prop_desc.flags |= (JERRY_PROP_IS_CONFIGURABLE_DEFINED
- | JERRY_PROP_IS_CONFIGURABLE
- | JERRY_PROP_IS_WRITABLE_DEFINED
- | JERRY_PROP_IS_WRITABLE
- | JERRY_PROP_IS_ENUMERABLE_DEFINED);
+ prop_desc.flags |= (JERRY_PROP_IS_CONFIGURABLE_DEFINED | JERRY_PROP_IS_CONFIGURABLE | JERRY_PROP_IS_WRITABLE_DEFINED
+ | JERRY_PROP_IS_WRITABLE | JERRY_PROP_IS_ENUMERABLE_DEFINED);
// Test enumerable - non-enumerable filter
define_property (test_object, prop_names[2], &prop_desc, false);
@@ -163,9 +155,9 @@ main (void)
// Test number and string index exclusion
define_property (test_object, prop_names[5], &prop_desc, false);
- names = jerry_object_get_property_names (test_object, JERRY_PROPERTY_FILTER_ALL
- | JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS
- | JERRY_PROPERTY_FILTER_INTEGER_INDICES_AS_NUMBER);
+ names = jerry_object_get_property_names (test_object,
+ JERRY_PROPERTY_FILTER_ALL | JERRY_PROPERTY_FILTER_EXCLUDE_STRINGS
+ | JERRY_PROPERTY_FILTER_INTEGER_INDICES_AS_NUMBER);
TEST_ASSERT (jerry_get_array_length (names) == (uint32_t) 1);
compare_prop_name (names, prop_names[5], 0);
jerry_release_value (names);
@@ -185,8 +177,8 @@ main (void)
// Test symbol exclusion
define_property (test_object, prop_names[6], &prop_desc, true);
- names = jerry_object_get_property_names (test_object,
- JERRY_PROPERTY_FILTER_ALL | JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS);
+ names =
+ jerry_object_get_property_names (test_object, JERRY_PROPERTY_FILTER_ALL | JERRY_PROPERTY_FILTER_EXCLUDE_SYMBOLS);
TEST_ASSERT (jerry_get_array_length (names) == (uint32_t) 6);
jerry_release_value (names);
names = jerry_object_get_property_names (test_object, JERRY_PROPERTY_FILTER_ALL);
diff --git a/tests/unit-core/test-api-objecttype.c b/tests/unit-core/test-api-objecttype.c
index 9ee4bfef..abd66f58 100644
--- a/tests/unit-core/test-api-objecttype.c
+++ b/tests/unit-core/test-api-objecttype.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
typedef struct
@@ -25,10 +26,16 @@ typedef struct
bool active;
} test_entry_t;
-#define ENTRY(TYPE, VALUE) { TYPE, VALUE, true }
-#define ENTRY_IF(TYPE, VALUE, FEATURE) { TYPE, VALUE, jerry_is_feature_enabled (FEATURE) }
+#define ENTRY(TYPE, VALUE) \
+ { \
+ TYPE, VALUE, true \
+ }
+#define ENTRY_IF(TYPE, VALUE, FEATURE) \
+ { \
+ TYPE, VALUE, jerry_is_feature_enabled (FEATURE) \
+ }
#define EVALUATE(BUFF) (jerry_eval ((BUFF), sizeof ((BUFF)) - 1, JERRY_PARSE_NO_OPTS))
-#define PARSE(OPTS) (jerry_parse ((const jerry_char_t *) "", 0, (OPTS)))
+#define PARSE(OPTS) (jerry_parse ((const jerry_char_t *) "", 0, (OPTS)))
static jerry_value_t
test_ext_function (const jerry_call_info_t *call_info_p, /**< call information */
const jerry_value_t args_p[], /**< array of arguments */
@@ -101,8 +108,7 @@ main (void)
jerry_parse_options_t module_parse_options;
module_parse_options.options = JERRY_PARSE_MODULE;
- test_entry_t entries[] =
- {
+ test_entry_t entries[] = {
ENTRY (JERRY_OBJECT_TYPE_NONE, jerry_create_number (-33.0)),
ENTRY (JERRY_OBJECT_TYPE_NONE, jerry_create_boolean (true)),
ENTRY (JERRY_OBJECT_TYPE_NONE, jerry_create_undefined ()),
diff --git a/tests/unit-core/test-api-promise.c b/tests/unit-core/test-api-promise.c
index c2ced24d..94e5e6ee 100644
--- a/tests/unit-core/test-api-promise.c
+++ b/tests/unit-core/test-api-promise.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
static void
@@ -157,9 +158,7 @@ test_promise_from_js (void)
{
const jerry_char_t test_source[] = "(new Promise(function(rs, rj) { rs(30); })).then(function(v) { return v + 1; })";
- jerry_value_t parsed_code_val = jerry_parse (test_source,
- sizeof (test_source) - 1,
- NULL);
+ jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
jerry_value_t res = jerry_run (parsed_code_val);
diff --git a/tests/unit-core/test-api-set-and-clear-error-flag.c b/tests/unit-core/test-api-set-and-clear-error-flag.c
index 3ac27722..eba6b897 100644
--- a/tests/unit-core/test-api-set-and-clear-error-flag.c
+++ b/tests/unit-core/test-api-set-and-clear-error-flag.c
@@ -14,6 +14,7 @@
*/
#include "jerryscript.h"
+
#include "test-common.h"
static void
diff --git a/tests/unit-core/test-api-strings.c b/tests/unit-core/test-api-strings.c
index 00419871..a3b2496a 100644
--- a/tests/unit-core/test-api-strings.c
+++ b/tests/unit-core/test-api-strings.c
@@ -24,7 +24,7 @@ strict_equals (jerry_value_t a, /**< the first string to compare */
const jerry_char_t is_equal_src[] = "var isEqual = function(a, b) { return (a === b); }; isEqual";
jerry_value_t is_equal_fn_val = jerry_eval (is_equal_src, sizeof (is_equal_src) - 1, JERRY_PARSE_NO_OPTS);
TEST_ASSERT (!jerry_value_is_error (is_equal_fn_val));
- jerry_value_t args[2] = {a, b};
+ jerry_value_t args[2] = { a, b };
jerry_value_t res = jerry_call_function (is_equal_fn_val, jerry_create_undefined (), args, 2);
TEST_ASSERT (!jerry_value_is_error (res));
TEST_ASSERT (jerry_value_is_boolean (res));
@@ -102,7 +102,7 @@ main (void)
utf8_length = jerry_get_utf8_string_length (args[0]);
cesu8_sz = jerry_get_string_size (args[0]);
- utf8_sz = jerry_get_utf8_string_size (args[0]);
+ utf8_sz = jerry_get_utf8_string_size (args[0]);
TEST_ASSERT (cesu8_length == 10 && utf8_length == 8);
TEST_ASSERT (cesu8_sz != utf8_sz);
@@ -157,7 +157,7 @@ main (void)
utf8_length = jerry_get_utf8_string_length (args[0]);
cesu8_sz = jerry_get_string_size (args[0]);
- utf8_sz = jerry_get_utf8_string_size (args[0]);
+ utf8_sz = jerry_get_utf8_string_size (args[0]);
TEST_ASSERT (cesu8_length == 7 && utf8_length == 6);
TEST_ASSERT (cesu8_sz != utf8_sz);
@@ -172,7 +172,7 @@ main (void)
utf8_length = jerry_get_utf8_string_length (args[0]);
cesu8_sz = jerry_get_string_size (args[0]);
- utf8_sz = jerry_get_utf8_string_size (args[0]);
+ utf8_sz = jerry_get_utf8_string_size (args[0]);
TEST_ASSERT (cesu8_length == utf8_length);
TEST_ASSERT (cesu8_length == 10);
@@ -184,20 +184,14 @@ main (void)
{
jerry_value_t test_str = jerry_create_string ((const jerry_char_t *) "3");
char result_string[1] = { 'E' };
- jerry_size_t copied_utf8 = jerry_substring_to_utf8_char_buffer (test_str,
- 0,
- 1,
- (jerry_char_t *) result_string,
- sizeof (result_string));
+ jerry_size_t copied_utf8 =
+ jerry_substring_to_utf8_char_buffer (test_str, 0, 1, (jerry_char_t *) result_string, sizeof (result_string));
TEST_ASSERT (copied_utf8 == 1);
TEST_ASSERT (result_string[0] == '3');
result_string[0] = 'E';
- jerry_size_t copied = jerry_substring_to_char_buffer (test_str,
- 0,
- 1,
- (jerry_char_t *) result_string,
- sizeof (result_string));
+ jerry_size_t copied =
+ jerry_substring_to_char_buffer (test_str, 0, 1, (jerry_char_t *) result_string, sizeof (result_string));
TEST_ASSERT (copied == 1);
TEST_ASSERT (result_string[0] == '3');
@@ -276,11 +270,8 @@ main (void)
TEST_ASSERT (sz == 8);
TEST_ASSERT (!strncmp (supl_substring, "\x73\x74\x72\x3a \xed\xa0\x80", sz));
- sz = jerry_substring_to_char_buffer (args[0],
- cesu8_length - 1,
- cesu8_length,
- (jerry_char_t *) supl_substring,
- cesu8_sz);
+ sz =
+ jerry_substring_to_char_buffer (args[0], cesu8_length - 1, cesu8_length, (jerry_char_t *) supl_substring, cesu8_sz);
TEST_ASSERT (sz == 3);
TEST_ASSERT (!strncmp (supl_substring, "\xed\xb6\x8a", sz));
diff --git a/tests/unit-core/test-api-value-type.c b/tests/unit-core/test-api-value-type.c
index 1dce4274..208cc888 100644
--- a/tests/unit-core/test-api-value-type.c
+++ b/tests/unit-core/test-api-value-type.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
typedef struct
@@ -24,7 +25,10 @@ typedef struct
jerry_value_t value;
} test_entry_t;
-#define ENTRY(TYPE, VALUE) { TYPE, VALUE }
+#define ENTRY(TYPE, VALUE) \
+ { \
+ TYPE, VALUE \
+ }
static jerry_value_t
test_ext_function (const jerry_call_info_t *call_info_p, /**< call information */
@@ -46,8 +50,7 @@ main (void)
const jerry_char_t test_eval_function[] = "function demo(a) { return a + 1; }; demo";
- test_entry_t entries[] =
- {
+ test_entry_t entries[] = {
ENTRY (JERRY_TYPE_NUMBER, jerry_create_number (-33.0)),
ENTRY (JERRY_TYPE_NUMBER, jerry_create_number (3)),
ENTRY (JERRY_TYPE_NUMBER, jerry_create_number_nan ()),
@@ -65,9 +68,7 @@ main (void)
ENTRY (JERRY_TYPE_NULL, jerry_create_null ()),
- ENTRY (JERRY_TYPE_FUNCTION, jerry_eval (test_eval_function,
- sizeof (test_eval_function) - 1,
- JERRY_PARSE_NO_OPTS)),
+ ENTRY (JERRY_TYPE_FUNCTION, jerry_eval (test_eval_function, sizeof (test_eval_function) - 1, JERRY_PARSE_NO_OPTS)),
ENTRY (JERRY_TYPE_FUNCTION, jerry_create_external_function (test_ext_function)),
ENTRY (JERRY_TYPE_STRING, jerry_create_string (test_eval_function)),
diff --git a/tests/unit-core/test-api.c b/tests/unit-core/test-api.c
index d3dff7c3..077a75b3 100644
--- a/tests/unit-core/test-api.c
+++ b/tests/unit-core/test-api.c
@@ -13,51 +13,50 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+#include "config.h"
#include "test-common.h"
-const jerry_char_t test_source[] = TEST_STRING_LITERAL (
- "function assert (arg) { "
- " if (!arg) { "
- " throw Error('Assert failed');"
- " } "
- "} "
- "this.t = 1; "
- "function f () { "
- "return this.t; "
- "} "
- "this.foo = f; "
- "this.bar = function (a) { "
- "return a + t; "
- "}; "
- "function A () { "
- "this.t = 12; "
- "} "
- "this.A = A; "
- "this.a = new A (); "
- "function call_external () { "
- " return this.external ('1', true); "
- "} "
- "function call_throw_test() { "
- " var catched = false; "
- " try { "
- " this.throw_test(); "
- " } catch (e) { "
- " catched = true; "
- " assert(e.name == 'TypeError'); "
- " assert(e.message == 'error'); "
- " } "
- " assert(catched); "
- "} "
- "function throw_reference_error() { "
- " throw new ReferenceError ();"
- "} "
- "p = {'alpha':32, 'bravo':false, 'charlie':{}, 'delta':123.45, 'echo':'foobar'};"
- "np = {}; Object.defineProperty (np, 'foxtrot', { "
- "get: function() { throw 'error'; }, enumerable: true }) "
-);
+const jerry_char_t test_source[] =
+ TEST_STRING_LITERAL ("function assert (arg) { "
+ " if (!arg) { "
+ " throw Error('Assert failed');"
+ " } "
+ "} "
+ "this.t = 1; "
+ "function f () { "
+ "return this.t; "
+ "} "
+ "this.foo = f; "
+ "this.bar = function (a) { "
+ "return a + t; "
+ "}; "
+ "function A () { "
+ "this.t = 12; "
+ "} "
+ "this.A = A; "
+ "this.a = new A (); "
+ "function call_external () { "
+ " return this.external ('1', true); "
+ "} "
+ "function call_throw_test() { "
+ " var catched = false; "
+ " try { "
+ " this.throw_test(); "
+ " } catch (e) { "
+ " catched = true; "
+ " assert(e.name == 'TypeError'); "
+ " assert(e.message == 'error'); "
+ " } "
+ " assert(catched); "
+ "} "
+ "function throw_reference_error() { "
+ " throw new ReferenceError ();"
+ "} "
+ "p = {'alpha':32, 'bravo':false, 'charlie':{}, 'delta':123.45, 'echo':'foobar'};"
+ "np = {}; Object.defineProperty (np, 'foxtrot', { "
+ "get: function() { throw 'error'; }, enumerable: true }) ");
bool test_api_is_free_callback_was_called = false;
@@ -80,9 +79,7 @@ handler (const jerry_call_info_t *call_info_p, /**< call information */
TEST_ASSERT (jerry_value_is_string (args_p[0]));
sz = jerry_get_string_size (args_p[0]);
TEST_ASSERT (sz == 1);
- sz = jerry_string_to_char_buffer (args_p[0],
- (jerry_char_t *) buffer,
- sz);
+ sz = jerry_string_to_char_buffer (args_p[0], (jerry_char_t *) buffer, sz);
TEST_ASSERT (sz == 1);
TEST_ASSERT (!strncmp (buffer, "1", (size_t) sz));
@@ -135,12 +132,11 @@ handler_construct_2_freecb (void *native_p, /**< native pointer */
/**
* Define a native pointer's type based on the C type and free callback.
*/
-#define JERRY_DEFINE_NATIVE_HANDLE_INFO(c_type, native_free_cb) \
- static const jerry_object_native_info_t JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (c_type) = \
- { \
- .free_cb = (jerry_object_native_free_callback_t) native_free_cb, \
- .number_of_references = 0, \
- .offset_of_references = 0, \
+#define JERRY_DEFINE_NATIVE_HANDLE_INFO(c_type, native_free_cb) \
+ static const jerry_object_native_info_t JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (c_type) = { \
+ .free_cb = (jerry_object_native_free_callback_t) native_free_cb, \
+ .number_of_references = 0, \
+ .offset_of_references = 0, \
}
JERRY_DEFINE_NATIVE_HANDLE_INFO (bind1, handler_construct_1_freecb);
@@ -180,8 +176,7 @@ handler_construct (const jerry_call_info_t *call_info_p, /**< call information *
/* Check that the native pointer was set. */
void *ptr = NULL;
bool is_ok = jerry_get_object_native_pointer (this_value, &ptr, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind1));
- TEST_ASSERT (is_ok
- && (uintptr_t) ptr == (uintptr_t) 0x0000000000000000ull);
+ TEST_ASSERT (is_ok && (uintptr_t) ptr == (uintptr_t) 0x0000000000000000ull);
/* Set a second native pointer. */
jerry_set_object_native_pointer (this_value,
@@ -190,55 +185,47 @@ handler_construct (const jerry_call_info_t *call_info_p, /**< call information *
/* Check that a second native pointer was set. */
is_ok = jerry_get_object_native_pointer (this_value, &ptr, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind2));
- TEST_ASSERT (is_ok
- && (uintptr_t) ptr == (uintptr_t) 0x0012345678abcdefull);
+ TEST_ASSERT (is_ok && (uintptr_t) ptr == (uintptr_t) 0x0012345678abcdefull);
/* Check that the first native pointer is still set. */
is_ok = jerry_get_object_native_pointer (this_value, &ptr, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind1));
- TEST_ASSERT (is_ok
- && (uintptr_t) ptr == (uintptr_t) 0x0000000000000000ull);
+ TEST_ASSERT (is_ok && (uintptr_t) ptr == (uintptr_t) 0x0000000000000000ull);
return jerry_create_boolean (true);
} /* handler_construct */
/**
* Extended Magic Strings
*/
-#define JERRY_MAGIC_STRING_ITEMS \
- JERRY_MAGIC_STRING_DEF (GLOBAL, global) \
+#define JERRY_MAGIC_STRING_ITEMS \
+ JERRY_MAGIC_STRING_DEF (GLOBAL, global) \
JERRY_MAGIC_STRING_DEF (GREEK_ZERO_SIGN, \xed\xa0\x80\xed\xb6\x8a) \
JERRY_MAGIC_STRING_DEF (CONSOLE, console)
-#define JERRY_MAGIC_STRING_DEF(NAME, STRING) \
- static const char jerry_magic_string_ex_ ## NAME[] = # STRING;
+#define JERRY_MAGIC_STRING_DEF(NAME, STRING) static const char jerry_magic_string_ex_##NAME[] = #STRING;
JERRY_MAGIC_STRING_ITEMS
#undef JERRY_MAGIC_STRING_DEF
-const jerry_length_t magic_string_lengths[] =
-{
-#define JERRY_MAGIC_STRING_DEF(NAME, STRING) \
- (jerry_length_t) (sizeof (jerry_magic_string_ex_ ## NAME) - 1u),
+const jerry_length_t magic_string_lengths[] = {
+#define JERRY_MAGIC_STRING_DEF(NAME, STRING) (jerry_length_t) (sizeof (jerry_magic_string_ex_##NAME) - 1u),
JERRY_MAGIC_STRING_ITEMS
#undef JERRY_MAGIC_STRING_DEF
};
-const jerry_char_t *magic_string_items[] =
-{
-#define JERRY_MAGIC_STRING_DEF(NAME, STRING) \
- (const jerry_char_t *) jerry_magic_string_ex_ ## NAME,
+const jerry_char_t *magic_string_items[] = {
+#define JERRY_MAGIC_STRING_DEF(NAME, STRING) (const jerry_char_t *) jerry_magic_string_ex_##NAME,
JERRY_MAGIC_STRING_ITEMS
#undef JERRY_MAGIC_STRING_DEF
};
-static bool
-foreach (const jerry_value_t name, /**< field name */
- const jerry_value_t value, /**< field value */
- void *user_data) /**< user data */
+static bool foreach (const jerry_value_t name, /**< field name */
+ const jerry_value_t value, /**< field value */
+ void *user_data) /**< user data */
{
char str_buf_p[128];
jerry_size_t sz = jerry_string_to_char_buffer (name, (jerry_char_t *) str_buf_p, 128);
@@ -274,9 +261,7 @@ foreach (const jerry_value_t name, /**< field name */
else if (!strncmp (str_buf_p, "echo", (size_t) sz))
{
TEST_ASSERT (jerry_value_is_string (value));
- jerry_size_t echo_sz = jerry_string_to_char_buffer (value,
- (jerry_char_t *) str_buf_p,
- 128);
+ jerry_size_t echo_sz = jerry_string_to_char_buffer (value, (jerry_char_t *) str_buf_p, 128);
str_buf_p[echo_sz] = '\0';
TEST_ASSERT (!strncmp (str_buf_p, "foobar", (size_t) echo_sz));
return true;
@@ -357,9 +342,7 @@ test_syntax_error (const char *script_p, /**< source code to run */
const char *error_message_p, /**< error message */
bool run_script) /**< run script before checking the error message */
{
- jerry_value_t result_val = jerry_parse ((const jerry_char_t *) script_p,
- strlen (script_p),
- options_p);
+ jerry_value_t result_val = jerry_parse ((const jerry_char_t *) script_p, strlen (script_p), options_p);
if (run_script)
{
@@ -410,9 +393,7 @@ main (void)
jerry_init (JERRY_INIT_EMPTY);
- parsed_code_val = jerry_parse (test_source,
- sizeof (test_source) - 1,
- NULL);
+ parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
res = jerry_run (parsed_code_val);
@@ -430,8 +411,7 @@ main (void)
/* Get global.t */
val_t = get_property (global_obj_val, "t");
TEST_ASSERT (!jerry_value_is_error (val_t));
- TEST_ASSERT (jerry_value_is_number (val_t)
- && jerry_get_number_value (val_t) == 1.0);
+ TEST_ASSERT (jerry_value_is_number (val_t) && jerry_get_number_value (val_t) == 1.0);
jerry_release_value (val_t);
/* Get global.foo */
@@ -444,8 +424,7 @@ main (void)
args[1] = jerry_create_number (2);
res = jerry_call_function (val_foo, jerry_create_undefined (), args, 2);
TEST_ASSERT (!jerry_value_is_error (res));
- TEST_ASSERT (jerry_value_is_number (res)
- && jerry_get_number_value (res) == 1.0);
+ TEST_ASSERT (jerry_value_is_number (res) && jerry_get_number_value (res) == 1.0);
jerry_release_value (res);
/* Get global.bar */
@@ -456,8 +435,7 @@ main (void)
/* Call bar (4, 2) */
res = jerry_call_function (val_bar, jerry_create_undefined (), args, 2);
TEST_ASSERT (!jerry_value_is_error (res));
- TEST_ASSERT (jerry_value_is_number (res)
- && jerry_get_number_value (res) == 5.0);
+ TEST_ASSERT (jerry_value_is_number (res) && jerry_get_number_value (res) == 5.0);
jerry_release_value (res);
jerry_release_value (val_bar);
@@ -511,8 +489,7 @@ main (void)
/* Get a.t */
res = get_property (val_a, "t");
TEST_ASSERT (!jerry_value_is_error (res));
- TEST_ASSERT (jerry_value_is_number (res)
- && jerry_get_number_value (res) == 12.0);
+ TEST_ASSERT (jerry_value_is_number (res) && jerry_get_number_value (res) == 12.0);
jerry_release_value (res);
/* foreach properties */
@@ -541,8 +518,7 @@ main (void)
/* Call a.foo () */
res = jerry_call_function (val_a_foo, val_a, NULL, 0);
TEST_ASSERT (!jerry_value_is_error (res));
- TEST_ASSERT (jerry_value_is_number (res)
- && jerry_get_number_value (res) == 12.0);
+ TEST_ASSERT (jerry_value_is_number (res) && jerry_get_number_value (res) == 12.0);
jerry_release_value (res);
jerry_release_value (val_a_foo);
@@ -550,8 +526,7 @@ main (void)
/* Create native handler bound function object and set it to 'external' variable */
external_func_val = jerry_create_external_function (handler);
- TEST_ASSERT (jerry_value_is_function (external_func_val)
- && jerry_value_is_constructor (external_func_val));
+ TEST_ASSERT (jerry_value_is_function (external_func_val) && jerry_value_is_constructor (external_func_val));
res = set_property (global_obj_val, "external", external_func_val);
TEST_ASSERT (!jerry_value_is_error (res));
@@ -575,8 +550,7 @@ main (void)
/* Create native handler bound function object and set it to 'external_construct' variable */
external_construct_val = jerry_create_external_function (handler_construct);
- TEST_ASSERT (jerry_value_is_function (external_construct_val)
- && jerry_value_is_constructor (external_construct_val));
+ TEST_ASSERT (jerry_value_is_function (external_construct_val) && jerry_value_is_constructor (external_construct_val));
res = set_property (global_obj_val, "external_construct", external_construct_val);
TEST_ASSERT (!jerry_value_is_error (res));
@@ -592,15 +566,13 @@ main (void)
/* Get 'value_field' of constructed object */
TEST_ASSERT (!jerry_value_is_error (val_value_field));
- TEST_ASSERT (jerry_value_is_boolean (val_value_field)
- && jerry_value_is_true (val_value_field));
+ TEST_ASSERT (jerry_value_is_boolean (val_value_field) && jerry_value_is_true (val_value_field));
jerry_release_value (val_value_field);
jerry_release_value (external_construct_val);
void *ptr = NULL;
is_ok = jerry_get_object_native_pointer (res, &ptr, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind2));
- TEST_ASSERT (is_ok
- && (uintptr_t) ptr == (uintptr_t) 0x0012345678abcdefull);
+ TEST_ASSERT (is_ok && (uintptr_t) ptr == (uintptr_t) 0x0012345678abcdefull);
/* Passing NULL for info_p is allowed. */
is_ok = jerry_get_object_native_pointer (res, &ptr, NULL);
@@ -610,9 +582,7 @@ main (void)
/* Test: It is ok to set native pointer's free callback as NULL. */
jerry_value_t obj_freecb = jerry_create_object ();
- jerry_set_object_native_pointer (obj_freecb,
- (void *) 0x1234,
- &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind3));
+ jerry_set_object_native_pointer (obj_freecb, (void *) 0x1234, &JERRY_NATIVE_HANDLE_INFO_FOR_CTYPE (bind3));
jerry_release_value (obj_freecb);
@@ -700,8 +670,7 @@ main (void)
jerry_release_value (res);
jerry_value_t v_out = jerry_get_property_by_index (array_obj_val, 5);
- TEST_ASSERT (jerry_value_is_number (v_out)
- && jerry_get_number_value (v_out) == 10.5);
+ TEST_ASSERT (jerry_value_is_number (v_out) && jerry_get_number_value (v_out) == 10.5);
jerry_delete_property_by_index (array_obj_val, 5);
jerry_value_t v_und = jerry_get_property_by_index (array_obj_val, 5);
@@ -807,8 +776,7 @@ main (void)
res = jerry_call_function (val_t, jerry_create_undefined (), NULL, 0);
TEST_ASSERT (!jerry_value_is_error (res));
- TEST_ASSERT (jerry_value_is_number (res)
- && jerry_get_number_value (res) == 123.0);
+ TEST_ASSERT (jerry_value_is_number (res) && jerry_get_number_value (res) == 123.0);
jerry_release_value (res);
jerry_release_value (val_t);
@@ -823,8 +791,7 @@ main (void)
const jerry_char_t eval_code_src2[] = "\x0a \x0b \x0c \xc2\xa0 \xe2\x80\xa8 \xe2\x80\xa9 \xef\xbb\xbf 4321";
val_t = jerry_eval (eval_code_src2, sizeof (eval_code_src2) - 1, JERRY_PARSE_STRICT_MODE);
TEST_ASSERT (!jerry_value_is_error (val_t));
- TEST_ASSERT (jerry_value_is_number (val_t)
- && jerry_get_number_value (val_t) == 4321.0);
+ TEST_ASSERT (jerry_value_is_number (val_t) && jerry_get_number_value (val_t) == 4321.0);
jerry_release_value (val_t);
/* Test: number */
@@ -857,12 +824,7 @@ main (void)
jerry_release_value (parse_options.argument_list);
jerry_release_value (script_source);
- jerry_value_t func_args[3] =
- {
- jerry_create_number (4),
- jerry_create_number (6),
- jerry_create_number (-2)
- };
+ jerry_value_t func_args[3] = { jerry_create_number (4), jerry_create_number (6), jerry_create_number (-2) };
val_t = jerry_call_function (func_val, func_args[0], func_args, 3);
number_val = jerry_get_number_value (val_t);
@@ -877,16 +839,14 @@ main (void)
func_val = jerry_parse ((const jerry_char_t *) "", 0, &parse_options);
jerry_release_value (parse_options.argument_list);
- TEST_ASSERT (jerry_value_is_error (func_val)
- && jerry_get_error_type (func_val) == JERRY_ERROR_TYPE);
+ TEST_ASSERT (jerry_value_is_error (func_val) && jerry_get_error_type (func_val) == JERRY_ERROR_TYPE);
jerry_release_value (func_val);
script_source = jerry_create_number (4.5);
func_val = jerry_parse_value (script_source, NULL);
jerry_release_value (script_source);
- TEST_ASSERT (jerry_value_is_error (func_val)
- && jerry_get_error_type (func_val) == JERRY_ERROR_TYPE);
+ TEST_ASSERT (jerry_value_is_error (func_val) && jerry_get_error_type (func_val) == JERRY_ERROR_TYPE);
jerry_release_value (func_val);
jerry_cleanup ();
@@ -917,15 +877,11 @@ main (void)
{
jerry_init (JERRY_INIT_EMPTY);
const jerry_char_t scoped_src_p[] = "let a; this.b = 5";
- jerry_value_t parse_result = jerry_parse (scoped_src_p,
- sizeof (scoped_src_p) - 1,
- NULL);
+ jerry_value_t parse_result = jerry_parse (scoped_src_p, sizeof (scoped_src_p) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
jerry_release_value (parse_result);
- parse_result = jerry_parse (scoped_src_p,
- sizeof (scoped_src_p) - 1,
- NULL);
+ parse_result = jerry_parse (scoped_src_p, sizeof (scoped_src_p) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
jerry_value_t run_result = jerry_run (parse_result);
@@ -939,17 +895,13 @@ main (void)
jerry_release_value (parse_result);
/* The variable should have no effect on parsing. */
- parse_result = jerry_parse (scoped_src_p,
- sizeof (scoped_src_p) - 1,
- NULL);
+ parse_result = jerry_parse (scoped_src_p, sizeof (scoped_src_p) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
jerry_release_value (parse_result);
/* The already existing global binding should not affect a new lexical binding */
const jerry_char_t scoped_src2_p[] = "let b = 6; this.b + b";
- parse_result = jerry_parse (scoped_src2_p,
- sizeof (scoped_src2_p) - 1,
- NULL);
+ parse_result = jerry_parse (scoped_src2_p, sizeof (scoped_src2_p) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
run_result = jerry_run (parse_result);
TEST_ASSERT (jerry_value_is_number (run_result));
@@ -959,9 +911,7 @@ main (void)
/* Check restricted global property */
const jerry_char_t scoped_src3_p[] = "let undefined;";
- parse_result = jerry_parse (scoped_src3_p,
- sizeof (scoped_src3_p) - 1,
- NULL);
+ parse_result = jerry_parse (scoped_src3_p, sizeof (scoped_src3_p) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
run_result = jerry_run (parse_result);
TEST_ASSERT (jerry_value_is_error (run_result));
@@ -985,9 +935,7 @@ main (void)
jerry_release_value (global_obj);
const jerry_char_t scoped_src4_p[] = "let foo;";
- parse_result = jerry_parse (scoped_src4_p,
- sizeof (scoped_src4_p) - 1,
- NULL);
+ parse_result = jerry_parse (scoped_src4_p, sizeof (scoped_src4_p) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
run_result = jerry_run (parse_result);
TEST_ASSERT (jerry_value_is_error (run_result));
@@ -1009,9 +957,7 @@ main (void)
jerry_value_t old_realm = jerry_set_realm (new_realm_value);
const jerry_char_t scoped_src5_p[] = "let a;";
- parse_result = jerry_parse (scoped_src5_p,
- sizeof (scoped_src5_p) - 1,
- NULL);
+ parse_result = jerry_parse (scoped_src5_p, sizeof (scoped_src5_p) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
run_result = jerry_run (parse_result);
TEST_ASSERT (jerry_value_is_error (run_result));
@@ -1038,9 +984,7 @@ main (void)
old_realm = jerry_set_realm (new_realm_value);
const jerry_char_t scoped_src6_p[] = "let b;";
- parse_result = jerry_parse (scoped_src6_p,
- sizeof (scoped_src6_p) - 1,
- NULL);
+ parse_result = jerry_parse (scoped_src6_p, sizeof (scoped_src6_p) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
run_result = jerry_run (parse_result);
TEST_ASSERT (jerry_value_is_error (run_result));
@@ -1098,14 +1042,10 @@ main (void)
jerry_init (JERRY_INIT_SHOW_OPCODES);
uint32_t num_magic_string_items = (uint32_t) (sizeof (magic_string_items) / sizeof (jerry_char_t *));
- jerry_register_magic_strings (magic_string_items,
- num_magic_string_items,
- magic_string_lengths);
+ jerry_register_magic_strings (magic_string_items, num_magic_string_items, magic_string_lengths);
const jerry_char_t ms_code_src[] = "var global = {}; var console = [1]; var process = 1;";
- parsed_code_val = jerry_parse (ms_code_src,
- sizeof (ms_code_src) - 1,
- NULL);
+ parsed_code_val = jerry_parse (ms_code_src, sizeof (ms_code_src) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
res = jerry_run (parsed_code_val);
@@ -1130,9 +1070,7 @@ main (void)
jerry_release_value (args[0]);
const jerry_char_t test_magic_str_access_src[] = "'console'.charAt(6) == 'e'";
- res = jerry_eval (test_magic_str_access_src,
- sizeof (test_magic_str_access_src) - 1,
- JERRY_PARSE_NO_OPTS);
+ res = jerry_eval (test_magic_str_access_src, sizeof (test_magic_str_access_src) - 1, JERRY_PARSE_NO_OPTS);
TEST_ASSERT (jerry_value_is_boolean (res));
TEST_ASSERT (jerry_value_is_true (res));
diff --git a/tests/unit-core/test-arraybuffer.c b/tests/unit-core/test-arraybuffer.c
index f5668607..86777463 100644
--- a/tests/unit-core/test-arraybuffer.c
+++ b/tests/unit-core/test-arraybuffer.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
/**
@@ -44,14 +45,12 @@ assert_handler (const jerry_call_info_t *call_info_p, /**< call information */
{
JERRY_UNUSED (call_info_p);
- if (args_cnt > 0
- && jerry_value_is_true (args_p[0]))
+ if (args_cnt > 0 && jerry_value_is_true (args_p[0]))
{
return jerry_create_boolean (true);
}
- if (args_cnt > 1
- && jerry_value_is_string (args_p[1]))
+ if (args_cnt > 1 && jerry_value_is_string (args_p[1]))
{
jerry_length_t utf8_sz = jerry_get_string_size (args_p[1]);
TEST_ASSERT (utf8_sz <= 127); /* 127 is the expected max assert fail message size. */
@@ -72,14 +71,12 @@ assert_handler (const jerry_call_info_t *call_info_p, /**< call information */
static void
test_read_with_offset (uint8_t offset) /**< offset for buffer read. */
{
- const jerry_char_t eval_arraybuffer_src[] = TEST_STRING_LITERAL (
- "var array = new Uint8Array (15);"
- "for (var i = 0; i < array.length; i++) { array[i] = i * 2; };"
- "array.buffer"
- );
- jerry_value_t arraybuffer = jerry_eval (eval_arraybuffer_src,
- sizeof (eval_arraybuffer_src) - 1,
- JERRY_PARSE_STRICT_MODE);
+ const jerry_char_t eval_arraybuffer_src[] =
+ TEST_STRING_LITERAL ("var array = new Uint8Array (15);"
+ "for (var i = 0; i < array.length; i++) { array[i] = i * 2; };"
+ "array.buffer");
+ jerry_value_t arraybuffer =
+ jerry_eval (eval_arraybuffer_src, sizeof (eval_arraybuffer_src) - 1, JERRY_PARSE_STRICT_MODE);
TEST_ASSERT (!jerry_value_is_error (arraybuffer));
TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));
@@ -104,7 +101,8 @@ test_read_with_offset (uint8_t offset) /**< offset for buffer read. */
/**
* Test ArrayBuffer 'write' api call with various offset values.
*/
-static void test_write_with_offset (uint8_t offset) /**< offset for buffer write. */
+static void
+test_write_with_offset (uint8_t offset) /**< offset for buffer write. */
{
{
jerry_value_t offset_val = jerry_create_number (offset);
@@ -113,9 +111,8 @@ static void test_write_with_offset (uint8_t offset) /**< offset for buffer write
}
const jerry_char_t eval_arraybuffer_src[] = "var array = new Uint8Array (15); array.buffer";
- jerry_value_t arraybuffer = jerry_eval (eval_arraybuffer_src,
- sizeof (eval_arraybuffer_src) - 1,
- JERRY_PARSE_STRICT_MODE);
+ jerry_value_t arraybuffer =
+ jerry_eval (eval_arraybuffer_src, sizeof (eval_arraybuffer_src) - 1, JERRY_PARSE_STRICT_MODE);
TEST_ASSERT (!jerry_value_is_error (arraybuffer));
TEST_ASSERT (jerry_value_is_arraybuffer (arraybuffer));
@@ -142,11 +139,8 @@ static void test_write_with_offset (uint8_t offset) /**< offset for buffer write
" var expected = (i - offset) * 3;"
" assert (array[i] == expected, 'calc check for: ' + i + ' was: ' + array[i] + ' should be: ' + expected);"
"};"
- "assert (array[15] === undefined, 'ArrayBuffer out of bounds index should return undefined value');"
- );
- jerry_value_t res = jerry_eval (eval_test_arraybuffer,
- sizeof (eval_test_arraybuffer) - 1,
- JERRY_PARSE_STRICT_MODE);
+ "assert (array[15] === undefined, 'ArrayBuffer out of bounds index should return undefined value');");
+ jerry_value_t res = jerry_eval (eval_test_arraybuffer, sizeof (eval_test_arraybuffer) - 1, JERRY_PARSE_STRICT_MODE);
jerry_release_value (res);
jerry_release_value (arraybuffer);
} /* test_write_with_offset */
@@ -228,9 +222,8 @@ main (void)
/* Test array buffer queries */
{
const jerry_char_t eval_arraybuffer_src[] = "new ArrayBuffer (10)";
- jerry_value_t eval_arraybuffer = jerry_eval (eval_arraybuffer_src,
- sizeof (eval_arraybuffer_src) - 1,
- JERRY_PARSE_STRICT_MODE);
+ jerry_value_t eval_arraybuffer =
+ jerry_eval (eval_arraybuffer_src, sizeof (eval_arraybuffer_src) - 1, JERRY_PARSE_STRICT_MODE);
TEST_ASSERT (!jerry_value_is_error (eval_arraybuffer));
TEST_ASSERT (jerry_value_is_arraybuffer (eval_arraybuffer));
TEST_ASSERT (jerry_get_arraybuffer_byte_length (eval_arraybuffer) == 10);
@@ -358,17 +351,14 @@ main (void)
register_js_value ("input_buffer", input_buffer);
jerry_release_value (input_buffer);
- const jerry_char_t eval_arraybuffer_src[] = TEST_STRING_LITERAL (
- "var array = new Uint8Array(input_buffer);"
- "for (var i = 0; i < array.length; i++)"
- "{"
- " array[i] = i * 2;"
- "};"
- "array.buffer"
- );
- jerry_value_t buffer = jerry_eval (eval_arraybuffer_src,
- sizeof (eval_arraybuffer_src) - 1,
- JERRY_PARSE_STRICT_MODE);
+ const jerry_char_t eval_arraybuffer_src[] = TEST_STRING_LITERAL ("var array = new Uint8Array(input_buffer);"
+ "for (var i = 0; i < array.length; i++)"
+ "{"
+ " array[i] = i * 2;"
+ "};"
+ "array.buffer");
+ jerry_value_t buffer =
+ jerry_eval (eval_arraybuffer_src, sizeof (eval_arraybuffer_src) - 1, JERRY_PARSE_STRICT_MODE);
TEST_ASSERT (!jerry_value_is_error (buffer));
TEST_ASSERT (jerry_value_is_arraybuffer (buffer));
@@ -400,11 +390,8 @@ main (void)
" assert(array[i] == expected, 'Array at index ' + i + ' was: ' + array[i] + ' should be: ' + expected);"
" sum += array[i]"
"};"
- "sum"
- );
- jerry_value_t res = jerry_eval (eval_test_arraybuffer,
- sizeof (eval_test_arraybuffer) - 1,
- JERRY_PARSE_STRICT_MODE);
+ "sum");
+ jerry_value_t res = jerry_eval (eval_test_arraybuffer, sizeof (eval_test_arraybuffer) - 1, JERRY_PARSE_STRICT_MODE);
TEST_ASSERT (jerry_value_is_number (res));
TEST_ASSERT (jerry_get_number_value (res) == sum);
jerry_release_value (res);
diff --git a/tests/unit-core/test-backtrace.c b/tests/unit-core/test-backtrace.c
index e5086429..1201ab80 100644
--- a/tests/unit-core/test-backtrace.c
+++ b/tests/unit-core/test-backtrace.c
@@ -13,8 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+
+#include "config.h"
#include "test-common.h"
static jerry_value_t
@@ -257,9 +258,7 @@ run (const char *resource_name_p, /**< resource name */
parse_options.options = JERRY_PARSE_HAS_RESOURCE;
parse_options.resource_name = jerry_create_string ((const jerry_char_t *) resource_name_p);
- jerry_value_t code = jerry_parse ((const jerry_char_t *) source_p,
- strlen (source_p),
- &parse_options);
+ jerry_value_t code = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), &parse_options);
jerry_release_value (parse_options.resource_name);
TEST_ASSERT (!jerry_value_is_error (code));
@@ -282,8 +281,7 @@ compare (jerry_value_t array, /**< array */
jerry_value_t value = jerry_get_property_by_index (array, index);
- TEST_ASSERT (!jerry_value_is_error (value)
- && jerry_value_is_string (value));
+ TEST_ASSERT (!jerry_value_is_error (value) && jerry_value_is_string (value));
TEST_ASSERT (jerry_get_string_size (value) == len);
@@ -319,8 +317,7 @@ test_get_backtrace_api_call (void)
jerry_value_t backtrace = run ("something.js", source_p);
- TEST_ASSERT (!jerry_value_is_error (backtrace)
- && jerry_value_is_array (backtrace));
+ TEST_ASSERT (!jerry_value_is_error (backtrace) && jerry_value_is_array (backtrace));
TEST_ASSERT (jerry_get_array_length (backtrace) == 4);
@@ -349,8 +346,7 @@ test_get_backtrace_api_call (void)
backtrace = run ("something_else.js", source_p);
- TEST_ASSERT (!jerry_value_is_error (backtrace)
- && jerry_value_is_array (backtrace));
+ TEST_ASSERT (!jerry_value_is_error (backtrace) && jerry_value_is_array (backtrace));
TEST_ASSERT (jerry_get_array_length (backtrace) == 2);
@@ -501,8 +497,7 @@ test_exception_backtrace (void)
jerry_release_value (name);
jerry_release_value (error);
- TEST_ASSERT (!jerry_value_is_error (backtrace)
- && jerry_value_is_array (backtrace));
+ TEST_ASSERT (!jerry_value_is_error (backtrace) && jerry_value_is_array (backtrace));
TEST_ASSERT (jerry_get_array_length (backtrace) == 3);
@@ -548,8 +543,7 @@ test_large_line_count (void)
jerry_release_value (name);
jerry_release_value (error);
- TEST_ASSERT (!jerry_value_is_error (backtrace)
- && jerry_value_is_array (backtrace));
+ TEST_ASSERT (!jerry_value_is_error (backtrace) && jerry_value_is_array (backtrace));
TEST_ASSERT (jerry_get_array_length (backtrace) == 1);
diff --git a/tests/unit-core/test-bigint.c b/tests/unit-core/test-bigint.c
index 3fb654d5..b4f0f329 100644
--- a/tests/unit-core/test-bigint.c
+++ b/tests/unit-core/test-bigint.c
@@ -14,6 +14,7 @@
*/
#include "jerryscript.h"
+
#include "test-common.h"
int
diff --git a/tests/unit-core/test-common.h b/tests/unit-core/test-common.h
index 1f3a89e1..67785c3f 100644
--- a/tests/unit-core/test-common.h
+++ b/tests/unit-core/test-common.h
@@ -16,62 +16,65 @@
#ifndef TEST_COMMON_H
#define TEST_COMMON_H
-#include "jerryscript-port.h"
-
#include <math.h>
#include <setjmp.h>
+#include <stdarg.h>
#include <stdio.h>
#include <stdlib.h>
-#include <stdarg.h>
#include <string.h>
+#include "jerryscript-port.h"
+
#define JERRY_UNUSED(x) ((void) (x))
-#define TEST_ASSERT(x) \
- do \
- { \
- if (JERRY_UNLIKELY (!(x))) \
- { \
- jerry_port_log (JERRY_LOG_LEVEL_ERROR, \
+#define TEST_ASSERT(x) \
+ do \
+ { \
+ if (JERRY_UNLIKELY (!(x))) \
+ { \
+ jerry_port_log (JERRY_LOG_LEVEL_ERROR, \
"TEST: Assertion '%s' failed at %s(%s):%lu.\n", \
- #x, \
- __FILE__, \
- __func__, \
- (unsigned long) __LINE__); \
- jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \
- } \
+ #x, \
+ __FILE__, \
+ __func__, \
+ (unsigned long) __LINE__); \
+ jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \
+ } \
} while (0)
-#define TEST_ASSERT_STR(EXPECTED, RESULT) \
- do \
- { \
- const char* __expected = (const char *) (EXPECTED); \
- const char* __result = (const char *) (RESULT); \
- if (strcmp(__expected, __result) != 0) \
- { \
- jerry_port_log (JERRY_LOG_LEVEL_ERROR, \
+#define TEST_ASSERT_STR(EXPECTED, RESULT) \
+ do \
+ { \
+ const char* __expected = (const char*) (EXPECTED); \
+ const char* __result = (const char*) (RESULT); \
+ if (strcmp (__expected, __result) != 0) \
+ { \
+ jerry_port_log (JERRY_LOG_LEVEL_ERROR, \
"TEST: String comparison failed at %s(%s):%lu.\n" \
- " Expected: '%s'\n Got: '%s'\n", \
- __FILE__, \
- __func__, \
- (unsigned long) __LINE__, \
- __expected, \
- __result); \
- jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \
- \
- } \
+ " Expected: '%s'\n Got: '%s'\n", \
+ __FILE__, \
+ __func__, \
+ (unsigned long) __LINE__, \
+ __expected, \
+ __result); \
+ jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \
+ } \
} while (0)
/**
* Test initialization statement that should be included
* at the beginning of main function in every unit test.
*/
-#define TEST_INIT() \
-do \
-{ \
- union { double d; unsigned u; } now = { .d = jerry_port_get_current_time () }; \
- srand (now.u); \
-} while (0)
+#define TEST_INIT() \
+ do \
+ { \
+ union \
+ { \
+ double d; \
+ unsigned u; \
+ } now = { .d = jerry_port_get_current_time () }; \
+ srand (now.u); \
+ } while (0)
/**
* Dummy macro to enable the breaking of long string literals into multiple
diff --git a/tests/unit-core/test-container-operation.c b/tests/unit-core/test-container-operation.c
index 50e72497..a0aca68a 100644
--- a/tests/unit-core/test-container-operation.c
+++ b/tests/unit-core/test-container-operation.c
@@ -14,6 +14,7 @@
*/
#include "jerryscript.h"
+
#include "test-common.h"
int
@@ -21,10 +22,8 @@ main (void)
{
jerry_init (JERRY_INIT_EMPTY);
- if (!jerry_is_feature_enabled (JERRY_FEATURE_MAP)
- || !jerry_is_feature_enabled (JERRY_FEATURE_SET)
- || !jerry_is_feature_enabled (JERRY_FEATURE_WEAKMAP)
- || !jerry_is_feature_enabled (JERRY_FEATURE_WEAKSET))
+ if (!jerry_is_feature_enabled (JERRY_FEATURE_MAP) || !jerry_is_feature_enabled (JERRY_FEATURE_SET)
+ || !jerry_is_feature_enabled (JERRY_FEATURE_WEAKMAP) || !jerry_is_feature_enabled (JERRY_FEATURE_WEAKSET))
{
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Containers are disabled!\n");
jerry_cleanup ();
@@ -37,7 +36,7 @@ main (void)
jerry_value_t key_str = jerry_create_string ((jerry_char_t *) "number");
jerry_value_t number = jerry_create_number (10);
- jerry_value_t args[2] = {key_str, number};
+ jerry_value_t args[2] = { key_str, number };
jerry_value_t result = jerry_container_operation (JERRY_CONTAINER_OP_SET, map, args, 2);
TEST_ASSERT (!jerry_value_is_error (result));
jerry_release_value (result);
@@ -56,7 +55,7 @@ main (void)
key_str = jerry_create_string ((jerry_char_t *) "number2");
number = jerry_create_number (11);
- jerry_value_t args2[2] = {key_str, number};
+ jerry_value_t args2[2] = { key_str, number };
result = jerry_container_operation (JERRY_CONTAINER_OP_SET, map, args2, 2);
jerry_release_value (result);
@@ -128,7 +127,7 @@ main (void)
jerry_value_t obj = jerry_create_object ();
number = jerry_create_number (10);
- jerry_value_t args4[2] = {obj, number};
+ jerry_value_t args4[2] = { obj, number };
result = jerry_container_operation (JERRY_CONTAINER_OP_SET, weak_map, args4, 2);
TEST_ASSERT (!jerry_value_is_error (result));
jerry_release_value (result);
@@ -165,7 +164,7 @@ main (void)
jerry_release_value (result);
// arguments is a error
- const char * const error_message_p = "Random error.";
+ const char *const error_message_p = "Random error.";
jerry_value_t error_val = jerry_create_error (JERRY_ERROR_RANGE, (const jerry_char_t *) error_message_p);
jerry_value_t args3[2] = { error_val, error_val };
result = jerry_container_operation (JERRY_CONTAINER_OP_SET, map, args3, 2);
diff --git a/tests/unit-core/test-container.c b/tests/unit-core/test-container.c
index 3ddba3b5..b3c5b032 100644
--- a/tests/unit-core/test-container.c
+++ b/tests/unit-core/test-container.c
@@ -14,6 +14,7 @@
*/
#include "jerryscript.h"
+
#include "test-common.h"
static int global_counter;
@@ -27,8 +28,7 @@ native_free_callback (void *native_p, /**< native pointer */
global_counter++;
} /* native_free_callback */
-static const jerry_object_native_info_t native_info =
-{
+static const jerry_object_native_info_t native_info = {
.free_cb = native_free_callback,
.number_of_references = 0,
.offset_of_references = 0,
@@ -74,10 +74,8 @@ main (void)
{
jerry_init (JERRY_INIT_EMPTY);
- if (!jerry_is_feature_enabled (JERRY_FEATURE_MAP)
- || !jerry_is_feature_enabled (JERRY_FEATURE_SET)
- || !jerry_is_feature_enabled (JERRY_FEATURE_WEAKMAP)
- || !jerry_is_feature_enabled (JERRY_FEATURE_WEAKSET))
+ if (!jerry_is_feature_enabled (JERRY_FEATURE_MAP) || !jerry_is_feature_enabled (JERRY_FEATURE_SET)
+ || !jerry_is_feature_enabled (JERRY_FEATURE_WEAKMAP) || !jerry_is_feature_enabled (JERRY_FEATURE_WEAKSET))
{
jerry_port_log (JERRY_LOG_LEVEL_ERROR, "Containers are disabled!\n");
jerry_cleanup ();
@@ -143,20 +141,16 @@ main (void)
jerry_release_value (global_weakset);
jerry_release_value (empty_weakset);
- const jerry_char_t source[] = TEST_STRING_LITERAL (
- "(function () {\n"
- " var o1 = {}\n"
- " var o2 = {}\n"
- " var o3 = {}\n"
- " var wm = new WeakMap()\n"
- " wm.set(o1, o2)\n"
- " wm.set(o2, o3)\n"
- " return o3\n"
- "})()\n"
- );
- jerry_value_t result = jerry_eval (source,
- sizeof (source) - 1,
- JERRY_PARSE_NO_OPTS);
+ const jerry_char_t source[] = TEST_STRING_LITERAL ("(function () {\n"
+ " var o1 = {}\n"
+ " var o2 = {}\n"
+ " var o3 = {}\n"
+ " var wm = new WeakMap()\n"
+ " wm.set(o1, o2)\n"
+ " wm.set(o2, o3)\n"
+ " return o3\n"
+ "})()\n");
+ jerry_value_t result = jerry_eval (source, sizeof (source) - 1, JERRY_PARSE_NO_OPTS);
TEST_ASSERT (jerry_value_is_object (result));
jerry_set_object_native_pointer (result, (void *) &global_counter, &native_info);
diff --git a/tests/unit-core/test-context-data.c b/tests/unit-core/test-context-data.c
index d2ef7c57..d01f7133 100644
--- a/tests/unit-core/test-context-data.c
+++ b/tests/unit-core/test-context-data.c
@@ -13,8 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+
+#include "config.h"
#include "test-common.h"
static bool test_context_data1_new_called = false;
@@ -54,13 +55,10 @@ test_context_data1_finalize (void *user_data_p)
test_context_data1_finalize_called = true;
} /* test_context_data1_finalize */
-static const jerry_context_data_manager_t manager1 =
-{
- .init_cb = test_context_data1_new,
- .deinit_cb = test_context_data1_free,
- .finalize_cb = test_context_data1_finalize,
- .bytes_needed = sizeof (const char *)
-};
+static const jerry_context_data_manager_t manager1 = { .init_cb = test_context_data1_new,
+ .deinit_cb = test_context_data1_free,
+ .finalize_cb = test_context_data1_finalize,
+ .bytes_needed = sizeof (const char *) };
/* Context item 2 */
const char *string2 = "item2";
@@ -79,12 +77,9 @@ test_context_data2_free (void *user_data_p)
TEST_ASSERT ((*(const char **) user_data_p) == string2);
} /* test_context_data2_free */
-static const jerry_context_data_manager_t manager2 =
-{
- .init_cb = test_context_data2_new,
- .deinit_cb = test_context_data2_free,
- .bytes_needed = sizeof (const char *)
-};
+static const jerry_context_data_manager_t manager2 = { .init_cb = test_context_data2_new,
+ .deinit_cb = test_context_data2_free,
+ .bytes_needed = sizeof (const char *) };
/* Context item 3 */
@@ -95,8 +90,7 @@ test_context_data3_new (void *user_data_p)
test_context_data3_new_called = true;
} /* test_context_data3_new */
-static const jerry_context_data_manager_t manager3 =
-{
+static const jerry_context_data_manager_t manager3 = {
.init_cb = test_context_data3_new,
/* NULL is allowed: */
.deinit_cb = NULL,
@@ -129,13 +123,10 @@ test_context_data4_finalize (void *user_data_p)
TEST_ASSERT (user_data_p == NULL);
} /* test_context_data4_finalize */
-static const jerry_context_data_manager_t manager4 =
-{
- .init_cb = test_context_data4_new,
- .deinit_cb = test_context_data4_free,
- .finalize_cb = test_context_data4_finalize,
- .bytes_needed = 0
-};
+static const jerry_context_data_manager_t manager4 = { .init_cb = test_context_data4_new,
+ .deinit_cb = test_context_data4_free,
+ .finalize_cb = test_context_data4_finalize,
+ .bytes_needed = 0 };
int
main (void)
diff --git a/tests/unit-core/test-dataview.c b/tests/unit-core/test-dataview.c
index 30dd7a62..b377de69 100644
--- a/tests/unit-core/test-dataview.c
+++ b/tests/unit-core/test-dataview.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
int
@@ -39,7 +40,8 @@ main (void)
TEST_ASSERT (jerry_value_is_dataview (view1));
jerry_length_t byteOffset = 0;
- jerry_length_t byteLength = 0;;
+ jerry_length_t byteLength = 0;
+ ;
jerry_value_t internal_buffer = jerry_get_dataview_buffer (view1, &byteOffset, &byteLength);
TEST_ASSERT (jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL, internal_buffer, arraybuffer));
TEST_ASSERT (byteOffset == 0);
@@ -88,9 +90,9 @@ main (void)
TEST_ASSERT (jerry_get_number_value (jerry_eval (get_src, sizeof (get_src) - 1, JERRY_PARSE_NO_OPTS)) == 255);
const jerry_char_t get_src_little_endian[] = "view2.getInt16 (0, true)";
- TEST_ASSERT (jerry_get_number_value (jerry_eval (get_src_little_endian,
- sizeof (get_src_little_endian) - 1,
- JERRY_PARSE_NO_OPTS)) == -256);
+ TEST_ASSERT (
+ jerry_get_number_value (jerry_eval (get_src_little_endian, sizeof (get_src_little_endian) - 1, JERRY_PARSE_NO_OPTS))
+ == -256);
/* Cleanup */
jerry_release_value (view2);
diff --git a/tests/unit-core/test-date-helpers.c b/tests/unit-core/test-date-helpers.c
index bba58edb..a9c3b30d 100644
--- a/tests/unit-core/test-date-helpers.c
+++ b/tests/unit-core/test-date-helpers.c
@@ -19,13 +19,11 @@
#include "test-common.h"
-#define MS_PER_DAY ((ecma_number_t) 86400000)
+#define MS_PER_DAY ((ecma_number_t) 86400000)
#define MS_PER_YEAR ((ecma_number_t) 365 * MS_PER_DAY)
-#define START_OF_GREGORIAN_CALENDAR ((ecma_number_t) (-1970 * MS_PER_YEAR \
- - (1970 / 4) * MS_PER_DAY \
- + (1970 / 100) * MS_PER_DAY \
- - (1970 / 400) * MS_PER_DAY \
- - MS_PER_DAY))
+#define START_OF_GREGORIAN_CALENDAR \
+ ((ecma_number_t) (-1970 * MS_PER_YEAR - (1970 / 4) * MS_PER_DAY + (1970 / 100) * MS_PER_DAY \
+ - (1970 / 400) * MS_PER_DAY - MS_PER_DAY))
/**
* Unit test's main function.
@@ -40,10 +38,8 @@ main (void)
TEST_ASSERT (ecma_date_year_from_time (MS_PER_DAY) == 1970);
TEST_ASSERT (ecma_date_year_from_time ((MS_PER_DAY) * (ecma_number_t) 365 - 1) == 1970);
TEST_ASSERT (ecma_date_year_from_time (MS_PER_DAY * (ecma_number_t) 365) == 1971);
- TEST_ASSERT (ecma_date_year_from_time (MS_PER_DAY * (ecma_number_t) (365 * (2015 - 1970)))
- == 2014);
- TEST_ASSERT (ecma_date_year_from_time (MS_PER_DAY * (ecma_number_t) (365.25 * (2015 - 1970)))
- == 2015);
+ TEST_ASSERT (ecma_date_year_from_time (MS_PER_DAY * (ecma_number_t) (365 * (2015 - 1970))) == 2014);
+ TEST_ASSERT (ecma_date_year_from_time (MS_PER_DAY * (ecma_number_t) (365.25 * (2015 - 1970))) == 2015);
TEST_ASSERT (ecma_date_year_from_time (-MS_PER_YEAR) == 1969);
TEST_ASSERT (ecma_date_year_from_time (-1970 * MS_PER_YEAR) == 1);
TEST_ASSERT (ecma_date_year_from_time (START_OF_GREGORIAN_CALENDAR) == 0);
diff --git a/tests/unit-core/test-error-callback.c b/tests/unit-core/test-error-callback.c
index a71f7b6f..7f551a70 100644
--- a/tests/unit-core/test-error-callback.c
+++ b/tests/unit-core/test-error-callback.c
@@ -22,7 +22,7 @@ static int error_object_created_callback_count = 0;
static void
error_object_created_callback (const jerry_value_t error_object_t, /**< new error object */
- void *user_p) /**< user pointer */
+ void *user_p) /**< user pointer */
{
TEST_ASSERT (!error_object_created_callback_is_running);
TEST_ASSERT (user_p == (void *) &error_object_created_callback_count);
@@ -72,7 +72,7 @@ main (void)
jerry_init (JERRY_INIT_EMPTY);
jerry_set_error_object_created_callback (error_object_created_callback,
- (void *) &error_object_created_callback_count);
+ (void *) &error_object_created_callback_count);
run_test ("var result = false\n"
"try {\n"
diff --git a/tests/unit-core/test-from-property-descriptor.c b/tests/unit-core/test-from-property-descriptor.c
index 89d5a5f2..8b9c646b 100644
--- a/tests/unit-core/test-from-property-descriptor.c
+++ b/tests/unit-core/test-from-property-descriptor.c
@@ -13,8 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+
+#include "config.h"
#include "test-common.h"
int
diff --git a/tests/unit-core/test-get-own-property.c b/tests/unit-core/test-get-own-property.c
index 489bd992..433d2dc5 100644
--- a/tests/unit-core/test-get-own-property.c
+++ b/tests/unit-core/test-get-own-property.c
@@ -1,4 +1,4 @@
- /* Copyright JS Foundation and other contributors, http://js.foundation
+/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/tests/unit-core/test-has-property.c b/tests/unit-core/test-has-property.c
index 7764f150..af309429 100644
--- a/tests/unit-core/test-has-property.c
+++ b/tests/unit-core/test-has-property.c
@@ -13,8 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+
+#include "config.h"
#include "test-common.h"
static void
diff --git a/tests/unit-core/test-internal-properties.c b/tests/unit-core/test-internal-properties.c
index b7f00c43..01afd256 100644
--- a/tests/unit-core/test-internal-properties.c
+++ b/tests/unit-core/test-internal-properties.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
int
@@ -184,12 +185,9 @@ main (void)
bool has_after_delete_result_5 = jerry_has_internal_property (object, internal_prop_name_2);
bool has_after_delete_result_6 = jerry_has_internal_property (object, internal_prop_name_3);
- TEST_ASSERT (jerry_value_is_boolean (has_after_delete_result_1)
- && !jerry_value_is_true (has_after_delete_result_1));
- TEST_ASSERT (jerry_value_is_boolean (has_after_delete_result_2)
- && !jerry_value_is_true (has_after_delete_result_2));
- TEST_ASSERT (jerry_value_is_boolean (has_after_delete_result_3)
- && !jerry_value_is_true (has_after_delete_result_3));
+ TEST_ASSERT (jerry_value_is_boolean (has_after_delete_result_1) && !jerry_value_is_true (has_after_delete_result_1));
+ TEST_ASSERT (jerry_value_is_boolean (has_after_delete_result_2) && !jerry_value_is_true (has_after_delete_result_2));
+ TEST_ASSERT (jerry_value_is_boolean (has_after_delete_result_3) && !jerry_value_is_true (has_after_delete_result_3));
TEST_ASSERT (has_after_delete_result_4);
TEST_ASSERT (has_after_delete_result_5);
TEST_ASSERT (has_after_delete_result_6);
diff --git a/tests/unit-core/test-is-eval-code.c b/tests/unit-core/test-is-eval-code.c
index 224356b5..0c07838d 100644
--- a/tests/unit-core/test-is-eval-code.c
+++ b/tests/unit-core/test-is-eval-code.c
@@ -13,9 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+#include "config.h"
#include "test-common.h"
static jerry_value_t
diff --git a/tests/unit-core/test-jmem.c b/tests/unit-core/test-jmem.c
index 6799939a..aedf1876 100644
--- a/tests/unit-core/test-jmem.c
+++ b/tests/unit-core/test-jmem.c
@@ -14,8 +14,8 @@
*/
#include "ecma-init-finalize.h"
-#include "jmem.h"
+#include "jmem.h"
#include "test-common.h"
#define BASIC_SIZE (64)
diff --git a/tests/unit-core/test-json.c b/tests/unit-core/test-json.c
index 8d6fba53..3f22784d 100644
--- a/tests/unit-core/test-json.c
+++ b/tests/unit-core/test-json.c
@@ -13,9 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+#include "config.h"
#include "test-common.h"
static jerry_value_t
diff --git a/tests/unit-core/test-lit-char-helpers.c b/tests/unit-core/test-lit-char-helpers.c
index 7374a7e1..16009dac 100644
--- a/tests/unit-core/test-lit-char-helpers.c
+++ b/tests/unit-core/test-lit-char-helpers.c
@@ -14,11 +14,11 @@
*/
#include "ecma-helpers.h"
-#include "lit-strings.h"
#include "ecma-init-finalize.h"
-#include "lit-char-helpers.h"
-#include "js-parser-internal.h"
+#include "js-parser-internal.h"
+#include "lit-char-helpers.h"
+#include "lit-strings.h"
#include "test-common.h"
static lit_code_point_t
@@ -48,8 +48,7 @@ lexer_hex_to_character (const uint8_t *source_p) /**< current source position */
return UINT32_MAX;
}
}
- }
- while (*source_p);
+ } while (*source_p);
return result;
} /* lexer_hex_to_character */
diff --git a/tests/unit-core/test-literal-storage.c b/tests/unit-core/test-literal-storage.c
index 2d3ff0b3..b5286338 100644
--- a/tests/unit-core/test-literal-storage.c
+++ b/tests/unit-core/test-literal-storage.c
@@ -15,6 +15,7 @@
#include "ecma-helpers.h"
#include "ecma-literal-storage.h"
+
#include "test-common.h"
/* Iterations count. */
diff --git a/tests/unit-core/test-mem-stats.c b/tests/unit-core/test-mem-stats.c
index d736c046..cfa1caeb 100644
--- a/tests/unit-core/test-mem-stats.c
+++ b/tests/unit-core/test-mem-stats.c
@@ -14,24 +14,22 @@
*/
#include "jerryscript.h"
+
#include "test-common.h"
-int main (void)
+int
+main (void)
{
if (!jerry_is_feature_enabled (JERRY_FEATURE_MEM_STATS))
{
return 0;
}
- const jerry_char_t test_source[] = TEST_STRING_LITERAL (
- "var a = 'hello';"
- "var b = 'world';"
- "var c = a + ' ' + b;"
- );
+ const jerry_char_t test_source[] = TEST_STRING_LITERAL ("var a = 'hello';"
+ "var b = 'world';"
+ "var c = a + ' ' + b;");
jerry_init (JERRY_INIT_EMPTY);
- jerry_value_t parsed_code_val = jerry_parse (test_source,
- sizeof (test_source) - 1,
- NULL);
+ jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
jerry_value_t res = jerry_run (parsed_code_val);
diff --git a/tests/unit-core/test-module-dynamic.c b/tests/unit-core/test-module-dynamic.c
index 9afb04bf..1c62e226 100644
--- a/tests/unit-core/test-module-dynamic.c
+++ b/tests/unit-core/test-module-dynamic.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
static int mode = 0;
@@ -79,9 +80,7 @@ module_import_callback (const jerry_value_t specifier, /* string value */
if (mode != 3)
{
- jerry_value_t compare_value = jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL,
- user_value,
- global_user_value);
+ jerry_value_t compare_value = jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL, user_value, global_user_value);
TEST_ASSERT (jerry_value_is_true (compare_value));
jerry_release_value (compare_value);
diff --git a/tests/unit-core/test-module-import-meta.c b/tests/unit-core/test-module-import-meta.c
index 6208ddd0..9d5ded99 100644
--- a/tests/unit-core/test-module-import-meta.c
+++ b/tests/unit-core/test-module-import-meta.c
@@ -13,8 +13,9 @@
* limitations under the License.
*/
-#include "jerryscript.h"
#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
static int counter = 0;
@@ -69,8 +70,7 @@ test_syntax_error (const char *source_p, /**< source code */
const jerry_parse_options_t *options_p) /**< parse options */
{
jerry_value_t result_value = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), options_p);
- TEST_ASSERT (jerry_value_is_error (result_value)
- && jerry_get_error_type (result_value) == JERRY_ERROR_SYNTAX);
+ TEST_ASSERT (jerry_value_is_error (result_value) && jerry_get_error_type (result_value) == JERRY_ERROR_SYNTAX);
jerry_release_value (result_value);
} /* test_syntax_error */
@@ -120,11 +120,9 @@ main (void)
counter = 0;
- run_module (TEST_STRING_LITERAL ("assert(typeof import.meta === 'object')\n"),
- &parse_options);
+ run_module (TEST_STRING_LITERAL ("assert(typeof import.meta === 'object')\n"), &parse_options);
- run_module (TEST_STRING_LITERAL ("assert(Object.getPrototypeOf(import.meta) === null)\n"),
- &parse_options);
+ run_module (TEST_STRING_LITERAL ("assert(Object.getPrototypeOf(import.meta) === null)\n"), &parse_options);
run_module (TEST_STRING_LITERAL ("var meta = import.meta\n"
"assert(import.meta === meta)\n"
diff --git a/tests/unit-core/test-module.c b/tests/unit-core/test-module.c
index 9c0cbf4a..186bd6b8 100644
--- a/tests/unit-core/test-module.c
+++ b/tests/unit-core/test-module.c
@@ -16,6 +16,7 @@
#include <string.h>
#include "jerryscript.h"
+
#include "test-common.h"
static void
@@ -212,11 +213,8 @@ resolve_callback4 (const jerry_value_t specifier, /**< module specifier */
++counter;
- jerry_value_t exports[2] =
- {
- jerry_create_string ((const jerry_char_t *) "exp"),
- jerry_create_string ((const jerry_char_t *) "other_exp")
- };
+ jerry_value_t exports[2] = { jerry_create_string ((const jerry_char_t *) "exp"),
+ jerry_create_string ((const jerry_char_t *) "other_exp") };
jerry_value_t native_module = jerry_native_module_create (native_module_evaluate, exports, 2);
TEST_ASSERT (!jerry_value_is_error (native_module));
@@ -356,12 +354,10 @@ main (void)
jerry_parse_options_t module_parse_options;
module_parse_options.options = JERRY_PARSE_MODULE;
- jerry_char_t source1[] = TEST_STRING_LITERAL (
- "import a from '16_module.mjs'\n"
- "export * from '07_module.mjs'\n"
- "export * from '44_module.mjs'\n"
- "import * as b from '36_module.mjs'\n"
- );
+ jerry_char_t source1[] = TEST_STRING_LITERAL ("import a from '16_module.mjs'\n"
+ "export * from '07_module.mjs'\n"
+ "export * from '44_module.mjs'\n"
+ "import * as b from '36_module.mjs'\n");
module = jerry_parse (source1, sizeof (source1) - 1, &module_parse_options);
TEST_ASSERT (!jerry_value_is_error (module));
TEST_ASSERT (jerry_module_get_state (module) == JERRY_MODULE_STATE_UNLINKED);
@@ -399,10 +395,8 @@ main (void)
TEST_ASSERT (jerry_value_is_error (result));
jerry_release_value (result);
- jerry_char_t source2[] = TEST_STRING_LITERAL (
- "export let a = 6\n"
- "export let b = 8.5\n"
- );
+ jerry_char_t source2[] = TEST_STRING_LITERAL ("export let a = 6\n"
+ "export let b = 8.5\n");
module = jerry_parse (source2, sizeof (source2) - 1, &module_parse_options);
TEST_ASSERT (!jerry_value_is_error (module));
TEST_ASSERT (jerry_module_get_state (module) == JERRY_MODULE_STATE_UNLINKED);
@@ -484,8 +478,7 @@ main (void)
"import {exp, other_exp as other} from 'native.js'\n"
"import * as namespace from 'native.js'\n"
"if (exp !== 3.5 || other !== 'str') { throw 'Assertion failed!' }\n"
- "if (namespace.exp !== 3.5 || namespace.other_exp !== 'str') { throw 'Assertion failed!' }\n"
- );
+ "if (namespace.exp !== 3.5 || namespace.other_exp !== 'str') { throw 'Assertion failed!' }\n");
module = jerry_parse (source3, sizeof (source3) - 1, &module_parse_options);
TEST_ASSERT (!jerry_value_is_error (module));
TEST_ASSERT (jerry_module_get_state (module) == JERRY_MODULE_STATE_UNLINKED);
@@ -528,9 +521,7 @@ main (void)
counter = 0;
jerry_module_set_state_changed_callback (module_state_changed, (void *) &counter);
- jerry_char_t source4[] = TEST_STRING_LITERAL (
- "33.5\n"
- );
+ jerry_char_t source4[] = TEST_STRING_LITERAL ("33.5\n");
module = jerry_parse (source4, sizeof (source4) - 1, &module_parse_options);
result = jerry_module_link (module, NULL, NULL);
@@ -543,9 +534,7 @@ main (void)
jerry_release_value (module);
- jerry_char_t source5[] = TEST_STRING_LITERAL (
- "throw -5.5\n"
- );
+ jerry_char_t source5[] = TEST_STRING_LITERAL ("throw -5.5\n");
module = jerry_parse (source5, sizeof (source5) - 1, &module_parse_options);
result = jerry_module_link (module, NULL, NULL);
@@ -562,14 +551,11 @@ main (void)
TEST_ASSERT (counter == 4);
- jerry_char_t source6[] = TEST_STRING_LITERAL (
- "import a from 'self'\n"
- );
+ jerry_char_t source6[] = TEST_STRING_LITERAL ("import a from 'self'\n");
module = jerry_parse (source6, sizeof (source6) - 1, &module_parse_options);
result = jerry_module_link (module, resolve_callback5, NULL);
- TEST_ASSERT (jerry_value_is_error (result)
- && jerry_get_error_type (result) == JERRY_ERROR_SYNTAX);
+ TEST_ASSERT (jerry_value_is_error (result) && jerry_get_error_type (result) == JERRY_ERROR_SYNTAX);
jerry_release_value (result);
jerry_cleanup ();
diff --git a/tests/unit-core/test-native-callback-nested.c b/tests/unit-core/test-native-callback-nested.c
index 12bf0b23..66220b2e 100644
--- a/tests/unit-core/test-native-callback-nested.c
+++ b/tests/unit-core/test-native-callback-nested.c
@@ -13,25 +13,27 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
-static void native_cb2 (void)
+static void
+native_cb2 (void)
{
jerry_value_t array = jerry_create_array (100);
jerry_release_value (array);
} /* native_cb2 */
-static const jerry_object_native_info_t native_info2 =
-{
+static const jerry_object_native_info_t native_info2 = {
.free_cb = (jerry_object_native_free_callback_t) native_cb2,
.number_of_references = 0,
.offset_of_references = 0,
};
-static void native_cb (void)
+static void
+native_cb (void)
{
jerry_value_t array = jerry_create_array (100);
@@ -40,8 +42,7 @@ static void native_cb (void)
jerry_release_value (array);
} /* native_cb */
-static const jerry_object_native_info_t native_info =
-{
+static const jerry_object_native_info_t native_info = {
.free_cb = (jerry_object_native_free_callback_t) native_cb,
.number_of_references = 0,
.offset_of_references = 0,
diff --git a/tests/unit-core/test-native-instanceof.c b/tests/unit-core/test-native-instanceof.c
index f382fc16..5e899cee 100644
--- a/tests/unit-core/test-native-instanceof.c
+++ b/tests/unit-core/test-native-instanceof.c
@@ -14,14 +14,13 @@
*/
#include "jerryscript.h"
+
#include "test-common.h"
static const char instanceof_source[] = "var x = function(o, c) {return (o instanceof c);}; x";
static jerry_value_t
-external_function (const jerry_call_info_t *call_info_p,
- const jerry_value_t args_p[],
- const jerry_size_t args_count)
+external_function (const jerry_call_info_t *call_info_p, const jerry_value_t args_p[], const jerry_size_t args_count)
{
(void) call_info_p;
(void) args_p;
@@ -31,14 +30,10 @@ external_function (const jerry_call_info_t *call_info_p,
} /* external_function */
static void
-test_instanceof (jerry_value_t instanceof,
- jerry_value_t constructor)
+test_instanceof (jerry_value_t instanceof, jerry_value_t constructor)
{
jerry_value_t instance = jerry_construct_object (constructor, NULL, 0);
- jerry_value_t args[2] =
- {
- instance, constructor
- };
+ jerry_value_t args[2] = { instance, constructor };
jerry_value_t undefined = jerry_create_undefined ();
jerry_value_t result = jerry_call_function (instanceof, undefined, args, 2);
diff --git a/tests/unit-core/test-native-pointer.c b/tests/unit-core/test-native-pointer.c
index d2b6dcfb..d769004a 100644
--- a/tests/unit-core/test-native-pointer.c
+++ b/tests/unit-core/test-native-pointer.c
@@ -1,4 +1,4 @@
- /* Copyright JS Foundation and other contributors, http://js.foundation
+/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -30,22 +30,19 @@ native_free_callback (void *native_p, /**< native pointer */
global_counter++;
} /* native_free_callback */
-static const jerry_object_native_info_t native_info_1 =
-{
+static const jerry_object_native_info_t native_info_1 = {
.free_cb = native_free_callback,
.number_of_references = 0,
.offset_of_references = 0,
};
-static const jerry_object_native_info_t native_info_2 =
-{
+static const jerry_object_native_info_t native_info_2 = {
.free_cb = NULL,
.number_of_references = 0,
.offset_of_references = 0,
};
-static const jerry_object_native_info_t native_info_3 =
-{
+static const jerry_object_native_info_t native_info_3 = {
.free_cb = NULL,
.number_of_references = 0,
.offset_of_references = 0,
@@ -90,8 +87,7 @@ native_references_free_callback (void *native_p, /**< native pointer */
call_count++;
} /* native_references_free_callback */
-static const jerry_object_native_info_t native_info_4 =
-{
+static const jerry_object_native_info_t native_info_4 = {
.free_cb = native_references_free_callback,
.number_of_references = 3,
.offset_of_references = (uint16_t) offsetof (test_references_t, a),
@@ -127,12 +123,9 @@ set_references (test_references_t *refs_p, /**< native pointer */
jerry_native_pointer_set_reference (&refs_p->b, value2);
jerry_native_pointer_set_reference (&refs_p->c, value3);
- TEST_ASSERT (jerry_value_is_object (value1) ? jerry_value_is_object (refs_p->a)
- : jerry_value_is_string (refs_p->a));
- TEST_ASSERT (jerry_value_is_object (value2) ? jerry_value_is_object (refs_p->b)
- : jerry_value_is_string (refs_p->b));
- TEST_ASSERT (jerry_value_is_object (value3) ? jerry_value_is_object (refs_p->c)
- : jerry_value_is_string (refs_p->c));
+ TEST_ASSERT (jerry_value_is_object (value1) ? jerry_value_is_object (refs_p->a) : jerry_value_is_string (refs_p->a));
+ TEST_ASSERT (jerry_value_is_object (value2) ? jerry_value_is_object (refs_p->b) : jerry_value_is_string (refs_p->b));
+ TEST_ASSERT (jerry_value_is_object (value3) ? jerry_value_is_object (refs_p->c) : jerry_value_is_string (refs_p->c));
} /* set_references */
static void
diff --git a/tests/unit-core/test-newtarget.c b/tests/unit-core/test-newtarget.c
index f1df972c..861083fe 100644
--- a/tests/unit-core/test-newtarget.c
+++ b/tests/unit-core/test-newtarget.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
/**
@@ -150,9 +151,7 @@ main (void)
{
static const jerry_char_t test_source[] = TEST_STRING_LITERAL ("new Demo (1)");
- jerry_value_t parsed_code_val = jerry_parse (test_source,
- sizeof (test_source) - 1,
- NULL);
+ jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
jerry_value_t res = jerry_run (parsed_code_val);
@@ -165,9 +164,7 @@ main (void)
{
static const jerry_char_t test_source[] = TEST_STRING_LITERAL ("Demo (2)");
- jerry_value_t parsed_code_val = jerry_parse (test_source,
- sizeof (test_source) - 1,
- NULL);
+ jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
jerry_value_t res = jerry_run (parsed_code_val);
@@ -178,16 +175,12 @@ main (void)
}
{
- static const jerry_char_t test_source[] = TEST_STRING_LITERAL (
- "function base(arg) { new Demo (arg); };"
- "base (1);"
- "new base(1);"
- "new base(3);"
- );
-
- jerry_value_t parsed_code_val = jerry_parse (test_source,
- sizeof (test_source) - 1,
- NULL);
+ static const jerry_char_t test_source[] = TEST_STRING_LITERAL ("function base(arg) { new Demo (arg); };"
+ "base (1);"
+ "new base(1);"
+ "new base(3);");
+
+ jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
jerry_value_t res = jerry_run (parsed_code_val);
diff --git a/tests/unit-core/test-number-converter.c b/tests/unit-core/test-number-converter.c
index d026e027..71e5e712 100644
--- a/tests/unit-core/test-number-converter.c
+++ b/tests/unit-core/test-number-converter.c
@@ -115,7 +115,7 @@ main (void)
test_to_interger (-4294967297, -4294967297);
// few test-cases which return with error
- jerry_value_t error_val = jerry_create_error (JERRY_ERROR_TYPE, (const jerry_char_t *) "error");
+ jerry_value_t error_val = jerry_create_error (JERRY_ERROR_TYPE, (const jerry_char_t *) "error");
double number = jerry_value_as_integer (error_val);
jerry_release_value (error_val);
TEST_ASSERT (number == 0);
@@ -125,8 +125,8 @@ main (void)
TEST_ASSERT (number == 0);
jerry_release_value (error_val);
- error_val = jerry_eval ((const jerry_char_t *) "({ valueOf() { throw new TypeError('foo')}})",
- 44, JERRY_PARSE_NO_OPTS);
+ error_val =
+ jerry_eval ((const jerry_char_t *) "({ valueOf() { throw new TypeError('foo')}})", 44, JERRY_PARSE_NO_OPTS);
number = jerry_value_as_integer (error_val);
TEST_ASSERT (number == 0);
jerry_release_value (error_val);
diff --git a/tests/unit-core/test-number-to-int32.c b/tests/unit-core/test-number-to-int32.c
index 698376a5..3b2e3b7f 100644
--- a/tests/unit-core/test-number-to-int32.c
+++ b/tests/unit-core/test-number-to-int32.c
@@ -38,8 +38,7 @@ main (void)
{
TEST_INIT ();
- const uint32_test_case_t test_cases_uint32[] =
- {
+ const uint32_test_case_t test_cases_uint32[] = {
#define TEST_CASE(num, uint32) { num, uint32 }
TEST_CASE (1.0, 1),
TEST_CASE (0.0, 0),
@@ -60,15 +59,12 @@ main (void)
#undef TEST_CASE
};
- for (uint32_t i = 0;
- i < sizeof (test_cases_uint32) / sizeof (test_cases_uint32[0]);
- i++)
+ for (uint32_t i = 0; i < sizeof (test_cases_uint32) / sizeof (test_cases_uint32[0]); i++)
{
TEST_ASSERT (ecma_number_to_uint32 (test_cases_uint32[i].num) == test_cases_uint32[i].uint32_num);
}
- int32_test_case_t test_cases_int32[] =
- {
+ int32_test_case_t test_cases_int32[] = {
#define TEST_CASE(num, int32) { num, int32 }
TEST_CASE (1.0, 1),
TEST_CASE (0.0, 0),
@@ -95,9 +91,7 @@ main (void)
#undef TEST_CASE
};
- for (uint32_t i = 0;
- i < sizeof (test_cases_int32) / sizeof (test_cases_int32[0]);
- i++)
+ for (uint32_t i = 0; i < sizeof (test_cases_int32) / sizeof (test_cases_int32[0]); i++)
{
TEST_ASSERT (ecma_number_to_int32 (test_cases_int32[i].num) == test_cases_int32[i].int32_num);
}
diff --git a/tests/unit-core/test-number-to-string.c b/tests/unit-core/test-number-to-string.c
index 20c9203c..ed5fce22 100644
--- a/tests/unit-core/test-number-to-string.c
+++ b/tests/unit-core/test-number-to-string.c
@@ -26,39 +26,19 @@ main (void)
{
TEST_INIT ();
- const lit_utf8_byte_t *strings[] =
- {
- (const lit_utf8_byte_t *) "1",
- (const lit_utf8_byte_t *) "0.5",
- (const lit_utf8_byte_t *) "12345",
- (const lit_utf8_byte_t *) "12345.123",
- (const lit_utf8_byte_t *) "1e-45",
- (const lit_utf8_byte_t *) "-2.5e+38",
- (const lit_utf8_byte_t *) "NaN",
- (const lit_utf8_byte_t *) "Infinity",
- (const lit_utf8_byte_t *) "-Infinity",
- (const lit_utf8_byte_t *) "0",
- (const lit_utf8_byte_t *) "0",
+ const lit_utf8_byte_t *strings[] = {
+ (const lit_utf8_byte_t *) "1", (const lit_utf8_byte_t *) "0.5", (const lit_utf8_byte_t *) "12345",
+ (const lit_utf8_byte_t *) "12345.123", (const lit_utf8_byte_t *) "1e-45", (const lit_utf8_byte_t *) "-2.5e+38",
+ (const lit_utf8_byte_t *) "NaN", (const lit_utf8_byte_t *) "Infinity", (const lit_utf8_byte_t *) "-Infinity",
+ (const lit_utf8_byte_t *) "0", (const lit_utf8_byte_t *) "0",
};
- const ecma_number_t nums[] =
- {
- (ecma_number_t) 1.0,
- (ecma_number_t) 0.5,
- (ecma_number_t) 12345.0,
- (ecma_number_t) 12345.123,
- (ecma_number_t) 1.0e-45,
- (ecma_number_t) -2.5e+38,
- (ecma_number_t) NAN,
- (ecma_number_t) INFINITY,
- (ecma_number_t) -INFINITY,
- (ecma_number_t) +0.0,
- (ecma_number_t) -0.0
- };
+ const ecma_number_t nums[] = { (ecma_number_t) 1.0, (ecma_number_t) 0.5, (ecma_number_t) 12345.0,
+ (ecma_number_t) 12345.123, (ecma_number_t) 1.0e-45, (ecma_number_t) -2.5e+38,
+ (ecma_number_t) NAN, (ecma_number_t) INFINITY, (ecma_number_t) -INFINITY,
+ (ecma_number_t) + 0.0, (ecma_number_t) -0.0 };
- for (uint32_t i = 0;
- i < sizeof (nums) / sizeof (nums[0]);
- i++)
+ for (uint32_t i = 0; i < sizeof (nums) / sizeof (nums[0]); i++)
{
lit_utf8_byte_t str[64];
diff --git a/tests/unit-core/test-objects-foreach.c b/tests/unit-core/test-objects-foreach.c
index 1c5b0913..1cf6f487 100644
--- a/tests/unit-core/test-objects-foreach.c
+++ b/tests/unit-core/test-objects-foreach.c
@@ -14,6 +14,7 @@
*/
#include "jerryscript.h"
+
#include "test-common.h"
static bool
@@ -132,15 +133,15 @@ test_internal_prop (void)
static int test_data = 1;
-static void free_test_data (void *native_p, /**< native pointer */
- jerry_object_native_info_t *info_p) /**< native info */
+static void
+free_test_data (void *native_p, /**< native pointer */
+ jerry_object_native_info_t *info_p) /**< native info */
{
TEST_ASSERT ((int *) native_p == &test_data);
TEST_ASSERT (info_p->free_cb == free_test_data);
} /* free_test_data */
-static const jerry_object_native_info_t test_info =
-{
+static const jerry_object_native_info_t test_info = {
.free_cb = free_test_data,
.number_of_references = 0,
.offset_of_references = 0,
@@ -149,9 +150,7 @@ static const jerry_object_native_info_t test_info =
static const jerry_char_t strict_equal_source[] = "var x = function(a, b) {return a === b;}; x";
static bool
-find_test_object_by_data (const jerry_value_t candidate,
- void *object_data_p,
- void *context_p)
+find_test_object_by_data (const jerry_value_t candidate, void *object_data_p, void *context_p)
{
if (object_data_p == &test_data)
{
@@ -162,8 +161,7 @@ find_test_object_by_data (const jerry_value_t candidate,
} /* find_test_object_by_data */
static bool
-find_test_object_by_property (const jerry_value_t candidate,
- void *context_p)
+find_test_object_by_property (const jerry_value_t candidate, void *context_p)
{
jerry_value_t *args_p = (jerry_value_t *) context_p;
jerry_value_t result = jerry_has_property (candidate, args_p[0]);
@@ -191,9 +189,7 @@ main (void)
parse_options.options = JERRY_PARSE_STRICT_MODE;
/* Render strict-equal as a function. */
- jerry_value_t parse_result = jerry_parse (strict_equal_source,
- sizeof (strict_equal_source) - 1,
- &parse_options);
+ jerry_value_t parse_result = jerry_parse (strict_equal_source, sizeof (strict_equal_source) - 1, &parse_options);
TEST_ASSERT (!jerry_value_is_error (parse_result));
jerry_value_t strict_equal = jerry_run (parse_result);
TEST_ASSERT (!jerry_value_is_error (strict_equal));
@@ -207,7 +203,7 @@ main (void)
jerry_value_t found_object;
TEST_ASSERT (jerry_objects_foreach_by_native_info (&test_info, find_test_object_by_data, &found_object));
- jerry_value_t args[2] = {object, found_object};
+ jerry_value_t args[2] = { object, found_object };
/* Assert that the correct object was retrieved. */
jerry_value_t undefined = jerry_create_undefined ();
diff --git a/tests/unit-core/test-poolman.c b/tests/unit-core/test-poolman.c
index 478fc91c..9a737e79 100644
--- a/tests/unit-core/test-poolman.c
+++ b/tests/unit-core/test-poolman.c
@@ -25,15 +25,14 @@
#define JMEM_ALLOCATOR_INTERNAL
#include "jmem-allocator-internal.h"
-
#include "test-common.h"
/* Iterations count. */
const uint32_t test_iters = 1024;
/* Subiterations count. */
-#define TEST_MAX_SUB_ITERS 1024
-#define TEST_CHUNK_SIZE 8
+#define TEST_MAX_SUB_ITERS 1024
+#define TEST_CHUNK_SIZE 8
uint8_t *ptrs[TEST_MAX_SUB_ITERS];
uint8_t data[TEST_MAX_SUB_ITERS][TEST_CHUNK_SIZE];
diff --git a/tests/unit-core/test-promise-callback.c b/tests/unit-core/test-promise-callback.c
index b2303250..5c7bfda0 100644
--- a/tests/unit-core/test-promise-callback.c
+++ b/tests/unit-core/test-promise-callback.c
@@ -134,13 +134,10 @@ main (void)
jerry_init (JERRY_INIT_EMPTY);
- jerry_promise_event_filter_t filters = (JERRY_PROMISE_EVENT_FILTER_CREATE
- | JERRY_PROMISE_EVENT_FILTER_RESOLVE
- | JERRY_PROMISE_EVENT_FILTER_REJECT
- | JERRY_PROMISE_EVENT_FILTER_ERROR
- | JERRY_PROMISE_EVENT_FILTER_REACTION_JOB
- | JERRY_PROMISE_EVENT_FILTER_ASYNC_MAIN
- | JERRY_PROMISE_EVENT_FILTER_ASYNC_REACTION_JOB);
+ jerry_promise_event_filter_t filters =
+ (JERRY_PROMISE_EVENT_FILTER_CREATE | JERRY_PROMISE_EVENT_FILTER_RESOLVE | JERRY_PROMISE_EVENT_FILTER_REJECT
+ | JERRY_PROMISE_EVENT_FILTER_ERROR | JERRY_PROMISE_EVENT_FILTER_REACTION_JOB
+ | JERRY_PROMISE_EVENT_FILTER_ASYNC_MAIN | JERRY_PROMISE_EVENT_FILTER_ASYNC_REACTION_JOB);
jerry_promise_set_callback (filters, promise_callback, (void *) &user);
@@ -203,14 +200,12 @@ main (void)
/* Test Promise.resolve. */
static uint8_t events7[] = { C, RS, CP, BR, RS, AR, E };
- run_eval (events7,
- "Promise.resolve(4).then(() => {})\n");
+ run_eval (events7, "Promise.resolve(4).then(() => {})\n");
/* Test Promise.reject. */
static uint8_t events8[] = { C, RJ, RWH, CP, CHA, BR, RJ, RWH, AR, E };
- run_eval (events8,
- "Promise.reject(4).catch(() => { throw 'Error' })\n");
+ run_eval (events8, "Promise.reject(4).catch(() => { throw 'Error' })\n");
/* Test Promise.race without resolve */
static uint8_t events9[] = { C, C, C, CP, CP, E };
diff --git a/tests/unit-core/test-promise.c b/tests/unit-core/test-promise.c
index 66a0ae11..bf2fe390 100644
--- a/tests/unit-core/test-promise.c
+++ b/tests/unit-core/test-promise.c
@@ -13,21 +13,20 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
-static const jerry_char_t test_source[] = TEST_STRING_LITERAL (
- "var p1 = create_promise1();"
- "var p2 = create_promise2();"
- "p1.then(function(x) { "
- " assert(x==='resolved'); "
- "}); "
- "p2.catch(function(x) { "
- " assert(x==='rejected'); "
- "}); "
-);
+static const jerry_char_t test_source[] = TEST_STRING_LITERAL ("var p1 = create_promise1();"
+ "var p2 = create_promise2();"
+ "p1.then(function(x) { "
+ " assert(x==='resolved'); "
+ "}); "
+ "p2.catch(function(x) { "
+ " assert(x==='rejected'); "
+ "}); ");
static int count_in_assert = 0;
static jerry_value_t my_promise1;
@@ -44,7 +43,7 @@ create_promise1_handler (const jerry_call_info_t *call_info_p, /**< call informa
JERRY_UNUSED (args_p);
JERRY_UNUSED (args_cnt);
- jerry_value_t ret = jerry_create_promise ();
+ jerry_value_t ret = jerry_create_promise ();
my_promise1 = jerry_acquire_value (ret);
return ret;
@@ -59,7 +58,7 @@ create_promise2_handler (const jerry_call_info_t *call_info_p, /**< call informa
JERRY_UNUSED (args_p);
JERRY_UNUSED (args_cnt);
- jerry_value_t ret = jerry_create_promise ();
+ jerry_value_t ret = jerry_create_promise ();
my_promise2 = jerry_acquire_value (ret);
return ret;
@@ -74,8 +73,7 @@ assert_handler (const jerry_call_info_t *call_info_p, /**< call information */
count_in_assert++;
- if (args_cnt == 1
- && jerry_value_is_true (args_p[0]))
+ if (args_cnt == 1 && jerry_value_is_true (args_p[0]))
{
return jerry_create_boolean (true);
}
@@ -121,9 +119,7 @@ main (void)
register_js_function ("create_promise2", create_promise2_handler);
register_js_function ("assert", assert_handler);
- jerry_value_t parsed_code_val = jerry_parse (test_source,
- sizeof (test_source) - 1,
- NULL);
+ jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
jerry_value_t res = jerry_run (parsed_code_val);
diff --git a/tests/unit-core/test-proxy.c b/tests/unit-core/test-proxy.c
index 4c70672d..c72ceda1 100644
--- a/tests/unit-core/test-proxy.c
+++ b/tests/unit-core/test-proxy.c
@@ -13,9 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+#include "config.h"
#include "test-common.h"
/** Test in Proxy on C side. Equivalent test code in JS:
@@ -159,8 +159,7 @@ proxy_native_freecb (void *native_p, /**< native pointer */
data_p->value = -1;
} /* proxy_native_freecb */
-static const jerry_object_native_info_t proxy_native_info =
-{
+static const jerry_object_native_info_t proxy_native_info = {
.free_cb = proxy_native_freecb,
.number_of_references = 0,
.offset_of_references = 0,
@@ -247,9 +246,7 @@ main (void)
}
const jerry_char_t get_value_src[] = TEST_STRING_LITERAL ("pdemo.value");
- jerry_value_t parsed_get_code_val = jerry_parse (get_value_src,
- sizeof (get_value_src) - 1,
- NULL);
+ jerry_value_t parsed_get_code_val = jerry_parse (get_value_src, sizeof (get_value_src) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_get_code_val));
{
@@ -274,9 +271,7 @@ main (void)
}
const jerry_char_t set_value_src[] = TEST_STRING_LITERAL ("pdemo.value = 55");
- jerry_value_t parsed_set_code_val = jerry_parse (set_value_src,
- sizeof (set_value_src) - 1,
- NULL);
+ jerry_value_t parsed_set_code_val = jerry_parse (set_value_src, sizeof (set_value_src) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_set_code_val));
{
@@ -316,9 +311,7 @@ main (void)
const jerry_char_t has_value_src[] = TEST_STRING_LITERAL ("new Proxy({}, {\n"
" has: function(target, key) { throw 33 }\n"
"})");
- jerry_value_t parsed_has_code_val = jerry_parse (has_value_src,
- sizeof (has_value_src) - 1,
- NULL);
+ jerry_value_t parsed_has_code_val = jerry_parse (has_value_src, sizeof (has_value_src) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_has_code_val));
jerry_value_t res = jerry_run (parsed_has_code_val);
diff --git a/tests/unit-core/test-realm.c b/tests/unit-core/test-realm.c
index 17ba8ed0..2d4f7a49 100644
--- a/tests/unit-core/test-realm.c
+++ b/tests/unit-core/test-realm.c
@@ -235,9 +235,7 @@ main (void)
TEST_ASSERT (!jerry_value_is_error (result_value));
const char *script_p = "global2 = global1 - 1; Object.getPrototypeOf([])";
- jerry_value_t script_value = jerry_parse ((const jerry_char_t *) script_p,
- strlen (script_p),
- NULL);
+ jerry_value_t script_value = jerry_parse ((const jerry_char_t *) script_p, strlen (script_p), NULL);
TEST_ASSERT (!jerry_value_is_error (script_value));
jerry_set_realm (result_value);
diff --git a/tests/unit-core/test-regexp-dotall-unicode.c b/tests/unit-core/test-regexp-dotall-unicode.c
index d203ac63..516de1c8 100644
--- a/tests/unit-core/test-regexp-dotall-unicode.c
+++ b/tests/unit-core/test-regexp-dotall-unicode.c
@@ -1,4 +1,4 @@
- /* Copyright JS Foundation and other contributors, http://js.foundation
+/* Copyright JS Foundation and other contributors, http://js.foundation
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
diff --git a/tests/unit-core/test-regression-3588.c b/tests/unit-core/test-regression-3588.c
index 3a3dcac6..9effe6a3 100644
--- a/tests/unit-core/test-regression-3588.c
+++ b/tests/unit-core/test-regression-3588.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
/**
@@ -61,14 +62,11 @@ main (void)
}
{
- static const jerry_char_t test_source[] = TEST_STRING_LITERAL (
- "class Sub1 extends Demo { constructor () { super (1); } };"
- "new Sub1 ()"
- );
-
- jerry_value_t parsed_code_val = jerry_parse (test_source,
- sizeof (test_source) - 1,
- NULL);
+ static const jerry_char_t test_source[] =
+ TEST_STRING_LITERAL ("class Sub1 extends Demo { constructor () { super (1); } };"
+ "new Sub1 ()");
+
+ jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
jerry_value_t result = jerry_run (parsed_code_val);
@@ -79,14 +77,10 @@ main (void)
}
{
- static const jerry_char_t test_source[] = TEST_STRING_LITERAL (
- "class Sub2 extends Demo { };"
- "new Sub2 (1)"
- );
-
- jerry_value_t parsed_code_val = jerry_parse (test_source,
- sizeof (test_source) - 1,
- NULL);
+ static const jerry_char_t test_source[] = TEST_STRING_LITERAL ("class Sub2 extends Demo { };"
+ "new Sub2 (1)");
+
+ jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
jerry_value_t result = jerry_run (parsed_code_val);
diff --git a/tests/unit-core/test-resource-name.c b/tests/unit-core/test-resource-name.c
index 2893bcc2..1ac1e99d 100644
--- a/tests/unit-core/test-resource-name.c
+++ b/tests/unit-core/test-resource-name.c
@@ -13,8 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+
+#include "config.h"
#include "test-common.h"
static jerry_value_t
@@ -71,9 +72,7 @@ main (void)
parse_options.resource_name = jerry_create_string ((jerry_char_t *) "demo1.js");
- jerry_value_t program = jerry_parse ((const jerry_char_t *) source_1,
- strlen (source_1),
- &parse_options);
+ jerry_value_t program = jerry_parse ((const jerry_char_t *) source_1, strlen (source_1), &parse_options);
TEST_ASSERT (!jerry_value_is_error (program));
jerry_value_t run_result = jerry_run (program);
@@ -81,9 +80,8 @@ main (void)
TEST_ASSERT (jerry_value_is_object (run_result));
jerry_value_t resource_value = jerry_get_resource_name (run_result);
- jerry_value_t compare_result = jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL,
- resource_value,
- parse_options.resource_name);
+ jerry_value_t compare_result =
+ jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL, resource_value, parse_options.resource_name);
TEST_ASSERT (jerry_value_is_true (compare_result));
jerry_release_value (compare_result);
@@ -105,9 +103,7 @@ main (void)
parse_options.resource_name = jerry_create_string ((const jerry_char_t *) "demo2.js");
- program = jerry_parse ((const jerry_char_t *) source_2,
- strlen (source_2),
- &parse_options);
+ program = jerry_parse ((const jerry_char_t *) source_2, strlen (source_2), &parse_options);
TEST_ASSERT (!jerry_value_is_error (program));
run_result = jerry_run (program);
@@ -132,9 +128,7 @@ main (void)
parse_options.options = JERRY_PARSE_MODULE | JERRY_PARSE_HAS_RESOURCE;
parse_options.resource_name = jerry_create_string ((const jerry_char_t *) "demo3.js");
- program = jerry_parse ((const jerry_char_t *) source_3,
- strlen (source_3),
- &parse_options);
+ program = jerry_parse ((const jerry_char_t *) source_3, strlen (source_3), &parse_options);
TEST_ASSERT (!jerry_value_is_error (program));
resource_value = jerry_get_resource_name (program);
@@ -174,9 +168,7 @@ main (void)
parse_options.options = JERRY_PARSE_HAS_RESOURCE;
parse_options.resource_name = jerry_create_string ((jerry_char_t *) "demo4.js");
- program = jerry_parse ((const jerry_char_t *) source_4,
- strlen (source_4),
- &parse_options);
+ program = jerry_parse ((const jerry_char_t *) source_4, strlen (source_4), &parse_options);
TEST_ASSERT (!jerry_value_is_error (program));
run_result = jerry_run (program);
@@ -199,9 +191,7 @@ main (void)
parse_options.user_value = jerry_create_object ();
parse_options.resource_name = jerry_create_string ((jerry_char_t *) "demo5.js");
- program = jerry_parse ((const jerry_char_t *) source_5,
- strlen (source_5),
- &parse_options);
+ program = jerry_parse ((const jerry_char_t *) source_5, strlen (source_5), &parse_options);
TEST_ASSERT (!jerry_value_is_error (program));
resource_value = jerry_get_resource_name (program);
@@ -219,9 +209,7 @@ main (void)
parse_options.options = JERRY_PARSE_HAS_RESOURCE;
parse_options.resource_name = jerry_create_string ((jerry_char_t *) "demo6.js");
- program = jerry_parse ((const jerry_char_t *) source_6,
- strlen (source_6),
- &parse_options);
+ program = jerry_parse ((const jerry_char_t *) source_6, strlen (source_6), &parse_options);
if (!jerry_value_is_error (program))
{
resource_value = jerry_get_resource_name (program);
diff --git a/tests/unit-core/test-script-user-value.c b/tests/unit-core/test-script-user-value.c
index 67a5bd20..7c473bab 100644
--- a/tests/unit-core/test-script-user-value.c
+++ b/tests/unit-core/test-script-user-value.c
@@ -13,9 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+#include "config.h"
#include "test-common.h"
static jerry_value_t user_values[4];
@@ -31,9 +31,7 @@ test_parse (const char *source_p, /**< source code */
{
options_p->user_value = user_values[i];
- jerry_value_t result = jerry_parse ((const jerry_char_t *) source_p,
- strlen (source_p),
- options_p);
+ jerry_value_t result = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), options_p);
TEST_ASSERT (!jerry_value_is_error (result));
if (run_code)
@@ -45,9 +43,7 @@ test_parse (const char *source_p, /**< source code */
}
jerry_value_t user_value = jerry_get_user_value (result);
- jerry_value_t compare_value = jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL,
- user_value,
- user_values[i]);
+ jerry_value_t compare_value = jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL, user_value, user_values[i]);
TEST_ASSERT (jerry_value_is_true (compare_value));
@@ -69,9 +65,7 @@ test_parse_function (const char *source_p, /**< source code */
{
options_p->user_value = user_values[i];
- jerry_value_t result = jerry_parse ((const jerry_char_t *) source_p,
- strlen (source_p),
- options_p);
+ jerry_value_t result = jerry_parse ((const jerry_char_t *) source_p, strlen (source_p), options_p);
TEST_ASSERT (!jerry_value_is_error (result));
if (run_code)
@@ -85,9 +79,7 @@ test_parse_function (const char *source_p, /**< source code */
}
jerry_value_t user_value = jerry_get_user_value (result);
- jerry_value_t compare_value = jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL,
- user_value,
- user_values[i]);
+ jerry_value_t compare_value = jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL, user_value, user_values[i]);
TEST_ASSERT (jerry_value_is_true (compare_value));
diff --git a/tests/unit-core/test-snapshot.c b/tests/unit-core/test-snapshot.c
index 1a3a6fdd..d4e4cc59 100644
--- a/tests/unit-core/test-snapshot.c
+++ b/tests/unit-core/test-snapshot.c
@@ -13,9 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+#include "config.h"
#include "test-common.h"
/**
@@ -31,27 +31,18 @@
/**
* Magic strings
*/
-static const jerry_char_t *magic_strings[] =
-{
- (const jerry_char_t *) " ",
- (const jerry_char_t *) "a",
- (const jerry_char_t *) "b",
- (const jerry_char_t *) "c",
- (const jerry_char_t *) "from",
- (const jerry_char_t *) "func",
- (const jerry_char_t *) "string",
- (const jerry_char_t *) "snapshot"
-};
+static const jerry_char_t *magic_strings[] = { (const jerry_char_t *) " ", (const jerry_char_t *) "a",
+ (const jerry_char_t *) "b", (const jerry_char_t *) "c",
+ (const jerry_char_t *) "from", (const jerry_char_t *) "func",
+ (const jerry_char_t *) "string", (const jerry_char_t *) "snapshot" };
/**
* Magic string lengths
*/
-static const jerry_length_t magic_string_lengths[] =
-{
- 1, 1, 1, 1, 4, 4, 6, 8
-};
+static const jerry_length_t magic_string_lengths[] = { 1, 1, 1, 1, 4, 4, 6, 8 };
-static void test_function_snapshot (void)
+static void
+test_function_snapshot (void)
{
/* function to snapshot */
if (!jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE)
@@ -71,20 +62,15 @@ static void test_function_snapshot (void)
parse_options.options = JERRY_PARSE_HAS_ARGUMENT_LIST;
parse_options.argument_list = jerry_create_string ((const jerry_char_t *) "a, b");
- jerry_value_t parse_result = jerry_parse (code_to_snapshot,
- sizeof (code_to_snapshot) - 1,
- &parse_options);
+ jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, &parse_options);
TEST_ASSERT (!jerry_value_is_error (parse_result));
- jerry_value_t generate_result = jerry_generate_snapshot (parse_result,
- 0,
- function_snapshot_buffer,
- SNAPSHOT_BUFFER_SIZE);
+ jerry_value_t generate_result =
+ jerry_generate_snapshot (parse_result, 0, function_snapshot_buffer, SNAPSHOT_BUFFER_SIZE);
jerry_release_value (parse_result);
jerry_release_value (parse_options.argument_list);
- TEST_ASSERT (!jerry_value_is_error (generate_result)
- && jerry_value_is_number (generate_result));
+ TEST_ASSERT (!jerry_value_is_error (generate_result) && jerry_value_is_number (generate_result));
size_t function_snapshot_size = (size_t) jerry_get_number_value (generate_result);
jerry_release_value (generate_result);
@@ -122,7 +108,8 @@ static void test_function_snapshot (void)
jerry_cleanup ();
} /* test_function_snapshot */
-static void arguments_test_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_size, uint32_t exec_snapshot_flags)
+static void
+arguments_test_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_size, uint32_t exec_snapshot_flags)
{
jerry_init (JERRY_INIT_EMPTY);
jerry_value_t res = jerry_exec_snapshot (snapshot_p, snapshot_size, 0, exec_snapshot_flags, NULL);
@@ -135,37 +122,30 @@ static void arguments_test_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_
jerry_cleanup ();
} /* arguments_test_exec_snapshot */
-static void test_function_arguments_snapshot (void)
+static void
+test_function_arguments_snapshot (void)
{
- if (jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE)
- && jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))
+ if (jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))
{
static uint32_t arguments_snapshot_buffer[SNAPSHOT_BUFFER_SIZE];
- const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL (
- "function f(a,b,c) {"
- " arguments[0]++;"
- " arguments[1]++;"
- " arguments[2]++;"
- " return a + b + c;"
- "}"
- "f(3,4,5);"
- );
+ const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL ("function f(a,b,c) {"
+ " arguments[0]++;"
+ " arguments[1]++;"
+ " arguments[2]++;"
+ " return a + b + c;"
+ "}"
+ "f(3,4,5);");
jerry_init (JERRY_INIT_EMPTY);
- jerry_value_t parse_result = jerry_parse (code_to_snapshot,
- sizeof (code_to_snapshot) - 1,
- NULL);
+ jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
- jerry_value_t generate_result= jerry_generate_snapshot (parse_result,
- 0,
- arguments_snapshot_buffer,
- SNAPSHOT_BUFFER_SIZE);
+ jerry_value_t generate_result =
+ jerry_generate_snapshot (parse_result, 0, arguments_snapshot_buffer, SNAPSHOT_BUFFER_SIZE);
jerry_release_value (parse_result);
- TEST_ASSERT (!jerry_value_is_error (generate_result)
- && jerry_value_is_number (generate_result));
+ TEST_ASSERT (!jerry_value_is_error (generate_result) && jerry_value_is_number (generate_result));
size_t snapshot_size = (size_t) jerry_get_number_value (generate_result);
jerry_release_value (generate_result);
@@ -177,7 +157,8 @@ static void test_function_arguments_snapshot (void)
}
} /* test_function_arguments_snapshot */
-static void test_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_size, uint32_t exec_snapshot_flags)
+static void
+test_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_size, uint32_t exec_snapshot_flags)
{
char string_data[32];
@@ -201,32 +182,24 @@ static void test_exec_snapshot (uint32_t *snapshot_p, size_t snapshot_size, uint
jerry_cleanup ();
} /* test_exec_snapshot */
-static void test_snapshot_with_user (void)
+static void
+test_snapshot_with_user (void)
{
- if (jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE)
- && jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))
+ if (jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))
{
static uint32_t snapshot_buffer[SNAPSHOT_BUFFER_SIZE];
- const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL (
- "function f() {}\n"
- "f"
- );
+ const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL ("function f() {}\n"
+ "f");
jerry_init (JERRY_INIT_EMPTY);
- jerry_value_t parse_result = jerry_parse (code_to_snapshot,
- sizeof (code_to_snapshot) - 1,
- NULL);
+ jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
- jerry_value_t generate_result = jerry_generate_snapshot (parse_result,
- 0,
- snapshot_buffer,
- SNAPSHOT_BUFFER_SIZE);
+ jerry_value_t generate_result = jerry_generate_snapshot (parse_result, 0, snapshot_buffer, SNAPSHOT_BUFFER_SIZE);
jerry_release_value (parse_result);
- TEST_ASSERT (!jerry_value_is_error (generate_result)
- && jerry_value_is_number (generate_result));
+ TEST_ASSERT (!jerry_value_is_error (generate_result) && jerry_value_is_number (generate_result));
size_t snapshot_size = (size_t) jerry_get_number_value (generate_result);
jerry_release_value (generate_result);
@@ -254,15 +227,12 @@ static void test_snapshot_with_user (void)
JERRY_SNAPSHOT_EXEC_HAS_USER_VALUE,
&snapshot_exec_options);
- TEST_ASSERT (!jerry_value_is_error (result)
- && jerry_value_is_function (result));
+ TEST_ASSERT (!jerry_value_is_error (result) && jerry_value_is_function (result));
jerry_value_t user_value = jerry_get_user_value (result);
jerry_release_value (result);
- result = jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL,
- user_value,
- snapshot_exec_options.user_value);
+ result = jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL, user_value, snapshot_exec_options.user_value);
TEST_ASSERT (jerry_value_is_true (result));
@@ -281,36 +251,28 @@ main (void)
TEST_INIT ();
/* Static snapshot */
- if (jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE)
- && jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))
+ if (jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))
{
static uint32_t snapshot_buffer[SNAPSHOT_BUFFER_SIZE];
- const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL (
- "function func(a, b, c) {"
- " c = 'snapshot';"
- " return arguments[0] + ' ' + b + ' ' + arguments[2];"
- "};"
- "func('string', 'from');"
- );
+ const jerry_char_t code_to_snapshot[] = TEST_STRING_LITERAL ("function func(a, b, c) {"
+ " c = 'snapshot';"
+ " return arguments[0] + ' ' + b + ' ' + arguments[2];"
+ "};"
+ "func('string', 'from');");
jerry_init (JERRY_INIT_EMPTY);
jerry_register_magic_strings (magic_strings,
sizeof (magic_string_lengths) / sizeof (jerry_length_t),
magic_string_lengths);
- jerry_value_t parse_result = jerry_parse (code_to_snapshot,
- sizeof (code_to_snapshot) - 1,
- NULL);
+ jerry_value_t parse_result = jerry_parse (code_to_snapshot, sizeof (code_to_snapshot) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
- jerry_value_t generate_result = jerry_generate_snapshot (parse_result,
- JERRY_SNAPSHOT_SAVE_STATIC,
- snapshot_buffer,
- SNAPSHOT_BUFFER_SIZE);
+ jerry_value_t generate_result =
+ jerry_generate_snapshot (parse_result, JERRY_SNAPSHOT_SAVE_STATIC, snapshot_buffer, SNAPSHOT_BUFFER_SIZE);
jerry_release_value (parse_result);
- TEST_ASSERT (!jerry_value_is_error (generate_result)
- && jerry_value_is_number (generate_result));
+ TEST_ASSERT (!jerry_value_is_error (generate_result) && jerry_value_is_number (generate_result));
size_t snapshot_size = (size_t) jerry_get_number_value (generate_result);
jerry_release_value (generate_result);
@@ -326,8 +288,7 @@ main (void)
}
/* Merge snapshot */
- if (jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE)
- && jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))
+ if (jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_SAVE) && jerry_is_feature_enabled (JERRY_FEATURE_SNAPSHOT_EXEC))
{
static uint32_t snapshot_buffer_0[SNAPSHOT_BUFFER_SIZE];
static uint32_t snapshot_buffer_1[SNAPSHOT_BUFFER_SIZE];
@@ -338,19 +299,13 @@ main (void)
jerry_init (JERRY_INIT_EMPTY);
- jerry_value_t parse_result = jerry_parse (code_to_snapshot1,
- sizeof (code_to_snapshot1) - 1,
- NULL);
+ jerry_value_t parse_result = jerry_parse (code_to_snapshot1, sizeof (code_to_snapshot1) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
- jerry_value_t generate_result = jerry_generate_snapshot (parse_result,
- 0,
- snapshot_buffer_0,
- SNAPSHOT_BUFFER_SIZE);
+ jerry_value_t generate_result = jerry_generate_snapshot (parse_result, 0, snapshot_buffer_0, SNAPSHOT_BUFFER_SIZE);
jerry_release_value (parse_result);
- TEST_ASSERT (!jerry_value_is_error (generate_result)
- && jerry_value_is_number (generate_result));
+ TEST_ASSERT (!jerry_value_is_error (generate_result) && jerry_value_is_number (generate_result));
snapshot_sizes[0] = (size_t) jerry_get_number_value (generate_result);
jerry_release_value (generate_result);
@@ -361,19 +316,13 @@ main (void)
jerry_init (JERRY_INIT_EMPTY);
- parse_result = jerry_parse (code_to_snapshot2,
- sizeof (code_to_snapshot2) - 1,
- NULL);
+ parse_result = jerry_parse (code_to_snapshot2, sizeof (code_to_snapshot2) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
- generate_result = jerry_generate_snapshot (parse_result,
- 0,
- snapshot_buffer_1,
- SNAPSHOT_BUFFER_SIZE);
+ generate_result = jerry_generate_snapshot (parse_result, 0, snapshot_buffer_1, SNAPSHOT_BUFFER_SIZE);
jerry_release_value (parse_result);
- TEST_ASSERT (!jerry_value_is_error (generate_result)
- && jerry_value_is_number (generate_result));
+ TEST_ASSERT (!jerry_value_is_error (generate_result) && jerry_value_is_number (generate_result));
snapshot_sizes[1] = (size_t) jerry_get_number_value (generate_result);
jerry_release_value (generate_result);
@@ -431,15 +380,11 @@ main (void)
static uint32_t literal_snapshot_buffer[SNAPSHOT_BUFFER_SIZE];
static const jerry_char_t code_for_c_format[] = "var object = { aa:'fo\" o\\n \\\\', Bb:'max', aaa:'xzy0' };";
- jerry_value_t parse_result = jerry_parse (code_for_c_format,
- sizeof (code_for_c_format) - 1,
- NULL);
+ jerry_value_t parse_result = jerry_parse (code_for_c_format, sizeof (code_for_c_format) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parse_result));
- jerry_value_t generate_result = jerry_generate_snapshot (parse_result,
- 0,
- literal_snapshot_buffer,
- SNAPSHOT_BUFFER_SIZE);
+ jerry_value_t generate_result =
+ jerry_generate_snapshot (parse_result, 0, literal_snapshot_buffer, SNAPSHOT_BUFFER_SIZE);
jerry_release_value (parse_result);
TEST_ASSERT (!jerry_value_is_error (generate_result));
@@ -455,8 +400,7 @@ main (void)
true);
TEST_ASSERT (lit_c_buf_sz == 239);
- static const char *expected_c_format = (
- "jerry_length_t literal_count = 5;\n\n"
+ static const char *expected_c_format = ("jerry_length_t literal_count = 5;\n\n"
"jerry_char_t *literals[5] =\n"
"{\n"
" \"Bb\",\n"
@@ -472,8 +416,7 @@ main (void)
" 3 /* aaa */,\n"
" 4 /* xzy0 */,\n"
" 8 /* fo\" o\n \\ */\n"
- "};\n"
- );
+ "};\n");
TEST_ASSERT (!strncmp ((char *) literal_buffer_c, expected_c_format, lit_c_buf_sz));
@@ -485,9 +428,8 @@ main (void)
LITERAL_BUFFER_SIZE,
false);
TEST_ASSERT (lit_list_buf_sz == 34);
- TEST_ASSERT (!strncmp ((char *) literal_buffer_list,
- "2 Bb\n2 aa\n3 aaa\n4 xzy0\n8 fo\" o\n \\\n",
- lit_list_buf_sz));
+ TEST_ASSERT (
+ !strncmp ((char *) literal_buffer_list, "2 Bb\n2 aa\n3 aaa\n4 xzy0\n8 fo\" o\n \\\n", lit_list_buf_sz));
jerry_cleanup ();
}
diff --git a/tests/unit-core/test-source-info.c b/tests/unit-core/test-source-info.c
index 2e578aa2..0401eccd 100644
--- a/tests/unit-core/test-source-info.c
+++ b/tests/unit-core/test-source-info.c
@@ -13,9 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+#include "config.h"
#include "test-common.h"
static void
@@ -106,8 +106,8 @@ main (void)
value = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);
source_info_p = jerry_get_source_info (value);
TEST_ASSERT (source_info_p != NULL);
- TEST_ASSERT (source_info_p->enabled_fields == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE
- | JERRY_SOURCE_INFO_HAS_SOURCE_RANGE));
+ TEST_ASSERT (source_info_p->enabled_fields
+ == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE | JERRY_SOURCE_INFO_HAS_SOURCE_RANGE));
compare_string (source_info_p->source_code, source_p);
TEST_ASSERT (jerry_value_is_undefined (source_info_p->function_arguments));
TEST_ASSERT (source_info_p->source_range_start == 2);
@@ -120,8 +120,8 @@ main (void)
value = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);
source_info_p = jerry_get_source_info (value);
TEST_ASSERT (source_info_p != NULL);
- TEST_ASSERT (source_info_p->enabled_fields == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE
- | JERRY_SOURCE_INFO_HAS_FUNCTION_ARGUMENTS));
+ TEST_ASSERT (source_info_p->enabled_fields
+ == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE | JERRY_SOURCE_INFO_HAS_FUNCTION_ARGUMENTS));
compare_string (source_info_p->source_code, "return 0;");
compare_string (source_info_p->function_arguments, "a,b");
TEST_ASSERT (source_info_p->source_range_start == 0);
@@ -134,8 +134,8 @@ main (void)
value = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);
source_info_p = jerry_get_source_info (value);
TEST_ASSERT (source_info_p != NULL);
- TEST_ASSERT (source_info_p->enabled_fields == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE
- | JERRY_SOURCE_INFO_HAS_SOURCE_RANGE));
+ TEST_ASSERT (source_info_p->enabled_fields
+ == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE | JERRY_SOURCE_INFO_HAS_SOURCE_RANGE));
compare_string (source_info_p->source_code, "a = ( function() { } )");
TEST_ASSERT (jerry_value_is_undefined (source_info_p->function_arguments));
TEST_ASSERT (source_info_p->source_range_start == 6);
@@ -148,8 +148,8 @@ main (void)
value = jerry_eval ((const jerry_char_t *) source_p, strlen (source_p), 0);
source_info_p = jerry_get_source_info (value);
TEST_ASSERT (source_info_p != NULL);
- TEST_ASSERT (source_info_p->enabled_fields == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE
- | JERRY_SOURCE_INFO_HAS_SOURCE_RANGE));
+ TEST_ASSERT (source_info_p->enabled_fields
+ == (JERRY_SOURCE_INFO_HAS_SOURCE_CODE | JERRY_SOURCE_INFO_HAS_SOURCE_RANGE));
compare_string (source_info_p->source_code, source_p);
TEST_ASSERT (jerry_value_is_undefined (source_info_p->function_arguments));
TEST_ASSERT (source_info_p->source_range_start == 1);
diff --git a/tests/unit-core/test-string-to-number.c b/tests/unit-core/test-string-to-number.c
index fd16102e..09927534 100644
--- a/tests/unit-core/test-string-to-number.c
+++ b/tests/unit-core/test-string-to-number.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
+#include "jerryscript.h"
+
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "jerryscript.h"
#include "test-common.h"
@@ -27,59 +28,27 @@ main (void)
{
TEST_INIT ();
- const jerry_char_t *strings[] =
- {
- (const jerry_char_t *) "1",
- (const jerry_char_t *) "0.5",
- (const jerry_char_t *) "12345",
- (const jerry_char_t *) "1e-45",
- (const jerry_char_t *) "-2.5e+38",
- (const jerry_char_t *) "-2.5e38",
- (const jerry_char_t *) "- 2.5e+38",
- (const jerry_char_t *) "-2 .5e+38",
- (const jerry_char_t *) "-2. 5e+38",
- (const jerry_char_t *) "-2.5e+ 38",
- (const jerry_char_t *) "-2.5 e+38",
- (const jerry_char_t *) "-2.5e +38",
- (const jerry_char_t *) "NaN",
- (const jerry_char_t *) "abc",
- (const jerry_char_t *) " Infinity ",
- (const jerry_char_t *) "-Infinity",
- (const jerry_char_t *) "0",
- (const jerry_char_t *) "0",
+ const jerry_char_t *strings[] = {
+ (const jerry_char_t *) "1", (const jerry_char_t *) "0.5", (const jerry_char_t *) "12345",
+ (const jerry_char_t *) "1e-45", (const jerry_char_t *) "-2.5e+38", (const jerry_char_t *) "-2.5e38",
+ (const jerry_char_t *) "- 2.5e+38", (const jerry_char_t *) "-2 .5e+38", (const jerry_char_t *) "-2. 5e+38",
+ (const jerry_char_t *) "-2.5e+ 38", (const jerry_char_t *) "-2.5 e+38", (const jerry_char_t *) "-2.5e +38",
+ (const jerry_char_t *) "NaN", (const jerry_char_t *) "abc", (const jerry_char_t *) " Infinity ",
+ (const jerry_char_t *) "-Infinity", (const jerry_char_t *) "0", (const jerry_char_t *) "0",
};
- const ecma_number_t nums[] =
- {
- (ecma_number_t) 1.0,
- (ecma_number_t) 0.5,
- (ecma_number_t) 12345.0,
- (ecma_number_t) 1.0e-45,
- (ecma_number_t) -2.5e+38,
- (ecma_number_t) -2.5e+38,
- (ecma_number_t) NAN,
- (ecma_number_t) NAN,
- (ecma_number_t) NAN,
- (ecma_number_t) NAN,
- (ecma_number_t) NAN,
- (ecma_number_t) NAN,
- (ecma_number_t) NAN,
- (ecma_number_t) NAN,
- (ecma_number_t) INFINITY,
- (ecma_number_t) -INFINITY,
- (ecma_number_t) +0.0,
- (ecma_number_t) -0.0
- };
+ const ecma_number_t nums[] = { (ecma_number_t) 1.0, (ecma_number_t) 0.5, (ecma_number_t) 12345.0,
+ (ecma_number_t) 1.0e-45, (ecma_number_t) -2.5e+38, (ecma_number_t) -2.5e+38,
+ (ecma_number_t) NAN, (ecma_number_t) NAN, (ecma_number_t) NAN,
+ (ecma_number_t) NAN, (ecma_number_t) NAN, (ecma_number_t) NAN,
+ (ecma_number_t) NAN, (ecma_number_t) NAN, (ecma_number_t) INFINITY,
+ (ecma_number_t) -INFINITY, (ecma_number_t) + 0.0, (ecma_number_t) -0.0 };
- for (uint32_t i = 0;
- i < sizeof (nums) / sizeof (nums[0]);
- i++)
+ for (uint32_t i = 0; i < sizeof (nums) / sizeof (nums[0]); i++)
{
ecma_number_t num = ecma_utf8_string_to_number (strings[i], lit_zt_utf8_string_size (strings[i]), 0);
- if (num != nums[i]
- && (!ecma_number_is_nan (num)
- || !ecma_number_is_nan (nums[i])))
+ if (num != nums[i] && (!ecma_number_is_nan (num) || !ecma_number_is_nan (nums[i])))
{
return 1;
}
diff --git a/tests/unit-core/test-stringbuilder.c b/tests/unit-core/test-stringbuilder.c
index 99a1defb..3eabbbc4 100644
--- a/tests/unit-core/test-stringbuilder.c
+++ b/tests/unit-core/test-stringbuilder.c
@@ -15,9 +15,9 @@
#include "ecma-helpers.h"
#include "ecma-init-finalize.h"
+
#include "lit-char-helpers.h"
#include "lit-strings.h"
-
#include "test-common.h"
int
@@ -158,10 +158,8 @@ main (void)
ecma_string_t *expected_p = ecma_get_magic_string (LIT_MAGIC_STRING__EMPTY);
for (size_t i = 0; i < count; i++)
{
- expected_p = ecma_append_chars_to_string (expected_p,
- string_data,
- sizeof (string_data) - 1,
- sizeof (string_data) - 1);
+ expected_p =
+ ecma_append_chars_to_string (expected_p, string_data, sizeof (string_data) - 1, sizeof (string_data) - 1);
}
TEST_ASSERT (ecma_compare_ecma_strings (result_p, expected_p));
diff --git a/tests/unit-core/test-strings.c b/tests/unit-core/test-strings.c
index 0f756fe0..275a2fb8 100644
--- a/tests/unit-core/test-strings.c
+++ b/tests/unit-core/test-strings.c
@@ -14,9 +14,9 @@
*/
#include "ecma-helpers.h"
-#include "lit-strings.h"
#include "ecma-init-finalize.h"
+#include "lit-strings.h"
#include "test-common.h"
/* Iterations count. */
@@ -26,7 +26,7 @@
#define test_subiters (128)
/* Max bytes in string. */
-#define max_bytes_in_string (65 * 1024)
+#define max_bytes_in_string (65 * 1024)
#define max_code_units_in_string (max_bytes_in_string)
typedef enum
@@ -38,8 +38,7 @@ typedef enum
} utf8_char_size;
static lit_utf8_size_t
-generate_cesu8_char (utf8_char_size char_size,
- lit_utf8_byte_t *buf)
+generate_cesu8_char (utf8_char_size char_size, lit_utf8_byte_t *buf)
{
TEST_ASSERT (char_size >= 0 && char_size <= LIT_CESU8_MAX_BYTES_IN_CODE_UNIT);
lit_code_point_t code_point = (lit_code_point_t) rand ();
@@ -50,21 +49,20 @@ generate_cesu8_char (utf8_char_size char_size,
}
else if (char_size == 2)
{
- code_point = LIT_UTF8_2_BYTE_CODE_POINT_MIN + code_point % (LIT_UTF8_2_BYTE_CODE_POINT_MAX -
- LIT_UTF8_2_BYTE_CODE_POINT_MIN);
+ code_point =
+ LIT_UTF8_2_BYTE_CODE_POINT_MIN + code_point % (LIT_UTF8_2_BYTE_CODE_POINT_MAX - LIT_UTF8_2_BYTE_CODE_POINT_MIN);
}
else if (char_size == 3)
{
- code_point = LIT_UTF8_3_BYTE_CODE_POINT_MIN + code_point % (LIT_UTF8_3_BYTE_CODE_POINT_MAX -
- LIT_UTF8_3_BYTE_CODE_POINT_MIN);
+ code_point =
+ LIT_UTF8_3_BYTE_CODE_POINT_MIN + code_point % (LIT_UTF8_3_BYTE_CODE_POINT_MAX - LIT_UTF8_3_BYTE_CODE_POINT_MIN);
}
else
{
code_point %= LIT_UTF8_3_BYTE_CODE_POINT_MAX;
}
- if (code_point >= LIT_UTF16_HIGH_SURROGATE_MIN
- && code_point <= LIT_UTF16_LOW_SURROGATE_MAX)
+ if (code_point >= LIT_UTF16_HIGH_SURROGATE_MIN && code_point <= LIT_UTF16_LOW_SURROGATE_MAX)
{
code_point = LIT_UTF16_HIGH_SURROGATE_MIN - 1;
}
@@ -73,17 +71,15 @@ generate_cesu8_char (utf8_char_size char_size,
} /* generate_cesu8_char */
static lit_utf8_size_t
-generate_cesu8_string (lit_utf8_byte_t *buf_p,
- lit_utf8_size_t buf_size)
+generate_cesu8_string (lit_utf8_byte_t *buf_p, lit_utf8_size_t buf_size)
{
lit_utf8_size_t length = 0;
lit_utf8_size_t size = 0;
- while (size < buf_size)
+ while (size < buf_size)
{
- const utf8_char_size char_size = (((buf_size - size) > LIT_CESU8_MAX_BYTES_IN_CODE_UNIT)
- ? CESU8_ANY_SIZE
- : (utf8_char_size) (buf_size - size));
+ const utf8_char_size char_size =
+ (((buf_size - size) > LIT_CESU8_MAX_BYTES_IN_CODE_UNIT) ? CESU8_ANY_SIZE : (utf8_char_size) (buf_size - size));
lit_utf8_size_t bytes_generated = generate_cesu8_char (char_size, buf_p);
@@ -182,19 +178,19 @@ main (void)
}
/* Overlong-encoded code point */
- lit_utf8_byte_t invalid_cesu8_string_1[] = {0xC0, 0x82};
+ lit_utf8_byte_t invalid_cesu8_string_1[] = { 0xC0, 0x82 };
TEST_ASSERT (!lit_is_valid_cesu8_string (invalid_cesu8_string_1, sizeof (invalid_cesu8_string_1)));
/* Overlong-encoded code point */
- lit_utf8_byte_t invalid_cesu8_string_2[] = {0xE0, 0x80, 0x81};
+ lit_utf8_byte_t invalid_cesu8_string_2[] = { 0xE0, 0x80, 0x81 };
TEST_ASSERT (!lit_is_valid_cesu8_string (invalid_cesu8_string_2, sizeof (invalid_cesu8_string_2)));
/* Pair of surrogates: 0xD901 0xDFF0 which encode Unicode character 0x507F0 */
- lit_utf8_byte_t invalid_cesu8_string_3[] = {0xED, 0xA4, 0x81, 0xED, 0xBF, 0xB0};
+ lit_utf8_byte_t invalid_cesu8_string_3[] = { 0xED, 0xA4, 0x81, 0xED, 0xBF, 0xB0 };
TEST_ASSERT (lit_is_valid_cesu8_string (invalid_cesu8_string_3, sizeof (invalid_cesu8_string_3)));
/* Isolated high surrogate 0xD901 */
- lit_utf8_byte_t valid_utf8_string_1[] = {0xED, 0xA4, 0x81};
+ lit_utf8_byte_t valid_utf8_string_1[] = { 0xED, 0xA4, 0x81 };
TEST_ASSERT (lit_is_valid_cesu8_string (valid_utf8_string_1, sizeof (valid_utf8_string_1)));
lit_utf8_byte_t res_buf[3];
@@ -216,39 +212,39 @@ main (void)
TEST_ASSERT (res_buf[2] == 0xBF);
/* Ascii string */
- lit_utf8_byte_t utf8_string_ascii[] = {'G','o','o','d','b','y','e'};
+ lit_utf8_byte_t utf8_string_ascii[] = { 'G', 'o', 'o', 'd', 'b', 'y', 'e' };
TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_ascii, sizeof (utf8_string_ascii), true));
/* Control character */
- lit_utf8_byte_t utf8_string_control[] = {0x00};
+ lit_utf8_byte_t utf8_string_control[] = { 0x00 };
TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_control, sizeof (utf8_string_control), true));
/* 3 byte characters */
- lit_utf8_byte_t utf8_string_3byte[] = {0xe4, 0xbd, 0xa0, 0xe5, 0xa5, 0xbd, 0xe4, 0xb8, 0x96, 0xe7, 0x95, 0x8c};
+ lit_utf8_byte_t utf8_string_3byte[] = { 0xe4, 0xbd, 0xa0, 0xe5, 0xa5, 0xbd, 0xe4, 0xb8, 0x96, 0xe7, 0x95, 0x8c };
TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_3byte, sizeof (utf8_string_3byte), true));
/* 4 byte characters */
- lit_utf8_byte_t utf8_string_4byte[] = {0xf0, 0x90, 0x80, 0x80, 0xf0, 0x9f, 0xa7, 0xbf};
+ lit_utf8_byte_t utf8_string_4byte[] = { 0xf0, 0x90, 0x80, 0x80, 0xf0, 0x9f, 0xa7, 0xbf };
TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_4byte, sizeof (utf8_string_4byte), true));
/* Invalid continuation byte */
- lit_utf8_byte_t utf8_string_invalid[] = {0xa0};
+ lit_utf8_byte_t utf8_string_invalid[] = { 0xa0 };
TEST_ASSERT (!lit_is_valid_utf8_string (utf8_string_invalid, sizeof (utf8_string_invalid), true));
/* Isolated high surrogate */
- lit_utf8_byte_t utf8_string_high[] = {0xed, 0xa0, 0x80};
+ lit_utf8_byte_t utf8_string_high[] = { 0xed, 0xa0, 0x80 };
TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_high, sizeof (utf8_string_high), true));
/* Isolated low surrogate */
- lit_utf8_byte_t utf8_string_low[] = {0xed, 0xbf, 0xbf};
+ lit_utf8_byte_t utf8_string_low[] = { 0xed, 0xbf, 0xbf };
TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_low, sizeof (utf8_string_low), true));
/* Correct pair of surrogates in strict*/
- lit_utf8_byte_t utf8_string_surrogates_strict[] = {0xed, 0xa0, 0x80, 0xed, 0xbf, 0xbf};
+ lit_utf8_byte_t utf8_string_surrogates_strict[] = { 0xed, 0xa0, 0x80, 0xed, 0xbf, 0xbf };
TEST_ASSERT (!lit_is_valid_utf8_string (utf8_string_surrogates_strict, sizeof (utf8_string_surrogates_strict), true));
/* Correct pair of surrogates*/
- lit_utf8_byte_t utf8_string_surrogates[] = {0xed, 0xa0, 0x80, 0xed, 0xbf, 0xbf};
+ lit_utf8_byte_t utf8_string_surrogates[] = { 0xed, 0xa0, 0x80, 0xed, 0xbf, 0xbf };
TEST_ASSERT (lit_is_valid_utf8_string (utf8_string_surrogates, sizeof (utf8_string_surrogates), false));
ecma_finalize ();
diff --git a/tests/unit-core/test-symbol.c b/tests/unit-core/test-symbol.c
index 500c2a4e..b6eae332 100644
--- a/tests/unit-core/test-symbol.c
+++ b/tests/unit-core/test-symbol.c
@@ -13,9 +13,10 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
#include "jerryscript-port-default.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
+
#include "test-common.h"
/* foo string */
@@ -107,10 +108,8 @@ main (void)
prop_desc = jerry_property_descriptor_create ();
jerry_value_t value_3 = jerry_create_string (STRING_BAR);
- prop_desc.flags |= JERRY_PROP_IS_VALUE_DEFINED
- | JERRY_PROP_IS_WRITABLE_DEFINED
- | JERRY_PROP_IS_ENUMERABLE_DEFINED
- | JERRY_PROP_IS_CONFIGURABLE_DEFINED;
+ prop_desc.flags |= JERRY_PROP_IS_VALUE_DEFINED | JERRY_PROP_IS_WRITABLE_DEFINED | JERRY_PROP_IS_ENUMERABLE_DEFINED
+ | JERRY_PROP_IS_CONFIGURABLE_DEFINED;
prop_desc.value = jerry_acquire_value (value_3);
TEST_ASSERT (jerry_value_is_true (jerry_define_own_property (object, symbol_2, &prop_desc)));
jerry_property_descriptor_free (&prop_desc);
@@ -216,37 +215,25 @@ main (void)
jerry_release_value (null_value);
const jerry_char_t obj_src[] = ""
- "({"
- " [Symbol.asyncIterator]: 1,"
- " [Symbol.hasInstance]: 2,"
- " [Symbol.isConcatSpreadable]: 3,"
- " [Symbol.iterator]: 4,"
- " [Symbol.match]: 5,"
- " [Symbol.replace]: 6,"
- " [Symbol.search]: 7,"
- " [Symbol.species]: 8,"
- " [Symbol.split]: 9,"
- " [Symbol.toPrimitive]: 10,"
- " [Symbol.toStringTag]: 11,"
- " [Symbol.unscopables]: 12,"
- " [Symbol.matchAll]: 13,"
- "})";
-
- const char *symbols[] =
- {
- "asyncIterator",
- "hasInstance",
- "isConcatSpreadable",
- "iterator",
- "match",
- "replace",
- "search",
- "species",
- "split",
- "toPrimitive",
- "toStringTag",
- "unscopables",
- "matchAll",
+ "({"
+ " [Symbol.asyncIterator]: 1,"
+ " [Symbol.hasInstance]: 2,"
+ " [Symbol.isConcatSpreadable]: 3,"
+ " [Symbol.iterator]: 4,"
+ " [Symbol.match]: 5,"
+ " [Symbol.replace]: 6,"
+ " [Symbol.search]: 7,"
+ " [Symbol.species]: 8,"
+ " [Symbol.split]: 9,"
+ " [Symbol.toPrimitive]: 10,"
+ " [Symbol.toStringTag]: 11,"
+ " [Symbol.unscopables]: 12,"
+ " [Symbol.matchAll]: 13,"
+ "})";
+
+ const char *symbols[] = {
+ "asyncIterator", "hasInstance", "isConcatSpreadable", "iterator", "match", "replace", "search",
+ "species", "split", "toPrimitive", "toStringTag", "unscopables", "matchAll",
};
jerry_value_t obj = jerry_eval (obj_src, sizeof (obj_src) - 1, JERRY_PARSE_NO_OPTS);
@@ -260,8 +247,7 @@ main (void)
double expected = 1.0;
uint32_t prop_index = 0;
- for (jerry_well_known_symbol_t id = JERRY_SYMBOL_ASYNC_ITERATOR;
- id <= JERRY_SYMBOL_MATCH_ALL;
+ for (jerry_well_known_symbol_t id = JERRY_SYMBOL_ASYNC_ITERATOR; id <= JERRY_SYMBOL_MATCH_ALL;
id++, expected++, prop_index++)
{
jerry_value_t well_known_symbol = jerry_get_well_known_symbol (id);
@@ -270,12 +256,10 @@ main (void)
jerry_value_t current_global_symbol = jerry_get_property (builtin_symbol, prop_str);
jerry_release_value (prop_str);
- jerry_value_t relation = jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL,
- well_known_symbol,
- current_global_symbol);
+ jerry_value_t relation =
+ jerry_binary_operation (JERRY_BIN_OP_STRICT_EQUAL, well_known_symbol, current_global_symbol);
- TEST_ASSERT (jerry_value_is_boolean (relation)
- && jerry_value_is_true (relation));
+ TEST_ASSERT (jerry_value_is_boolean (relation) && jerry_value_is_true (relation));
jerry_release_value (relation);
@@ -303,8 +287,7 @@ main (void)
const jerry_char_t deleter_src[] = "delete Symbol";
jerry_value_t deleter = jerry_eval (deleter_src, sizeof (deleter_src) - 1, JERRY_PARSE_NO_OPTS);
- TEST_ASSERT (jerry_value_is_boolean (deleter)
- && jerry_value_is_true (deleter));
+ TEST_ASSERT (jerry_value_is_boolean (deleter) && jerry_value_is_true (deleter));
jerry_release_value (deleter);
builtin_symbol = jerry_get_property (global_obj, symbol_str);
@@ -314,8 +297,7 @@ main (void)
expected = 1.0;
prop_index = 0;
- for (jerry_well_known_symbol_t id = JERRY_SYMBOL_ASYNC_ITERATOR;
- id <= JERRY_SYMBOL_MATCH_ALL;
+ for (jerry_well_known_symbol_t id = JERRY_SYMBOL_ASYNC_ITERATOR; id <= JERRY_SYMBOL_MATCH_ALL;
id++, expected++, prop_index++)
{
jerry_value_t well_known_symbol = jerry_get_well_known_symbol (id);
diff --git a/tests/unit-core/test-to-integer.c b/tests/unit-core/test-to-integer.c
index e606b2c1..a82b95ed 100644
--- a/tests/unit-core/test-to-integer.c
+++ b/tests/unit-core/test-to-integer.c
@@ -14,14 +14,15 @@
* limitations under the License.
*/
+#include "jerryscript.h"
+
+#include "ecma-conversion.h"
+#include "ecma-exceptions.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-conversion.h"
#include "ecma-init-finalize.h"
-#include "ecma-exceptions.h"
-#include "jerryscript.h"
-#include "jcontext.h"
+#include "jcontext.h"
#include "test-common.h"
/**
@@ -66,7 +67,7 @@ main (void)
TEST_ASSERT (num == 0);
/* 4 */
- /* -0 */
+ /* -0 */
ecma_value_t negative_zero = ecma_make_number_value (-0.0f);
result = ecma_op_to_integer (negative_zero, &num);
@@ -76,7 +77,7 @@ main (void)
TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));
TEST_ASSERT (1.0f / num == ecma_number_make_infinity (true));
- /* +0 */
+ /* +0 */
ecma_value_t positive_zero = ecma_make_number_value (+0.0f);
result = ecma_op_to_integer (positive_zero, &num);
@@ -86,7 +87,7 @@ main (void)
TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));
TEST_ASSERT (1.0f / num == ecma_number_make_infinity (false));
- /* -infinity */
+ /* -infinity */
ecma_value_t negative_infinity = ecma_make_number_value (ecma_number_make_infinity (true));
result = ecma_op_to_integer (negative_infinity, &num);
@@ -96,7 +97,7 @@ main (void)
TEST_ASSERT (!ECMA_IS_VALUE_ERROR (result));
TEST_ASSERT (num == ecma_number_make_infinity (true));
- /* +infinity */
+ /* +infinity */
ecma_value_t positive_infinity = ecma_make_number_value (ecma_number_make_infinity (false));
result = ecma_op_to_integer (positive_infinity, &num);
diff --git a/tests/unit-core/test-to-length.c b/tests/unit-core/test-to-length.c
index 4b0094cc..fc98dac7 100644
--- a/tests/unit-core/test-to-length.c
+++ b/tests/unit-core/test-to-length.c
@@ -14,14 +14,15 @@
* limitations under the License.
*/
+#include "jerryscript.h"
+
+#include "ecma-conversion.h"
+#include "ecma-exceptions.h"
#include "ecma-globals.h"
#include "ecma-helpers.h"
-#include "ecma-conversion.h"
#include "ecma-init-finalize.h"
-#include "ecma-exceptions.h"
-#include "jerryscript.h"
-#include "jcontext.h"
+#include "jcontext.h"
#include "test-common.h"
/**
diff --git a/tests/unit-core/test-to-property-descriptor.c b/tests/unit-core/test-to-property-descriptor.c
index 993eea19..e7c40481 100644
--- a/tests/unit-core/test-to-property-descriptor.c
+++ b/tests/unit-core/test-to-property-descriptor.c
@@ -13,8 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+
+#include "config.h"
#include "test-common.h"
static jerry_value_t
diff --git a/tests/unit-core/test-typedarray.c b/tests/unit-core/test-typedarray.c
index 623d31a5..4f19856f 100644
--- a/tests/unit-core/test-typedarray.c
+++ b/tests/unit-core/test-typedarray.c
@@ -13,12 +13,13 @@
* limitations under the License.
*/
-#include "jerryscript.h"
-#include "jerryscript-port.h"
+#include <stdio.h>
+
#include "jerryscript-port-default.h"
-#include "test-common.h"
+#include "jerryscript-port.h"
+#include "jerryscript.h"
-#include <stdio.h>
+#include "test-common.h"
/**
* Type to describe test cases.
@@ -62,8 +63,7 @@ assert_handler (const jerry_call_info_t *call_info_p, /**< call information */
}
else
{
- if (args_cnt > 1
- && jerry_value_is_string (args_p[1]))
+ if (args_cnt > 1 && jerry_value_is_string (args_p[1]))
{
jerry_length_t utf8_sz = jerry_get_string_size (args_p[1]);
TEST_ASSERT (utf8_sz <= 127); /* 127 is the expected max assert fail message size. */
@@ -135,8 +135,8 @@ test_typedarray_queries (test_entry_t test_entries[]) /**< test cases */
/* Create TypedArray via api call */
{
- jerry_value_t typedarray = jerry_create_typedarray (test_entries[i].typedarray_type,
- test_entries[i].element_count);
+ jerry_value_t typedarray =
+ jerry_create_typedarray (test_entries[i].typedarray_type, test_entries[i].element_count);
test_typedarray_info (typedarray,
test_entries[i].typedarray_type,
test_entries[i].element_count,
@@ -151,12 +151,12 @@ test_typedarray_queries (test_entry_t test_entries[]) /**< test cases */
/**
* Test value at given position in the buffer based on TypedArray type.
*/
-static
-void test_buffer_value (uint64_t value, /**< value to test for */
- const void *buffer, /**< buffer to read value from */
- uint32_t start_offset, /**< start offset of the value */
- jerry_typedarray_type_t typedarray_type, /**< type of TypedArray */
- uint32_t bytes_per_element) /**< bytes per element for the given type */
+static void
+test_buffer_value (uint64_t value, /**< value to test for */
+ const void *buffer, /**< buffer to read value from */
+ uint32_t start_offset, /**< start offset of the value */
+ jerry_typedarray_type_t typedarray_type, /**< type of TypedArray */
+ uint32_t bytes_per_element) /**< bytes per element for the given type */
{
uint32_t offset = start_offset / bytes_per_element;
@@ -164,16 +164,36 @@ void test_buffer_value (uint64_t value, /**< value to test for */
switch (typedarray_type)
{
- case JERRY_TYPEDARRAY_UINT8: TEST_VALUE_AT (uint8_t, buffer, offset, value); break;
- case JERRY_TYPEDARRAY_INT8: TEST_VALUE_AT (int8_t, buffer, offset, value); break;
- case JERRY_TYPEDARRAY_UINT16: TEST_VALUE_AT (uint16_t, buffer, offset, value); break;
- case JERRY_TYPEDARRAY_INT16: TEST_VALUE_AT (int16_t, buffer, offset, value); break;
- case JERRY_TYPEDARRAY_UINT32: TEST_VALUE_AT (uint32_t, buffer, offset, value); break;
- case JERRY_TYPEDARRAY_INT32: TEST_VALUE_AT (int32_t, buffer, offset, value); break;
- case JERRY_TYPEDARRAY_FLOAT32: TEST_VALUE_AT (float, buffer, offset, value); break;
- case JERRY_TYPEDARRAY_FLOAT64: TEST_VALUE_AT (double, buffer, offset, value); break;
- case JERRY_TYPEDARRAY_BIGINT64: TEST_VALUE_AT (int64_t, buffer, offset, value); break;
- case JERRY_TYPEDARRAY_BIGUINT64: TEST_VALUE_AT (uint64_t, buffer, offset, value); break;
+ case JERRY_TYPEDARRAY_UINT8:
+ TEST_VALUE_AT (uint8_t, buffer, offset, value);
+ break;
+ case JERRY_TYPEDARRAY_INT8:
+ TEST_VALUE_AT (int8_t, buffer, offset, value);
+ break;
+ case JERRY_TYPEDARRAY_UINT16:
+ TEST_VALUE_AT (uint16_t, buffer, offset, value);
+ break;
+ case JERRY_TYPEDARRAY_INT16:
+ TEST_VALUE_AT (int16_t, buffer, offset, value);
+ break;
+ case JERRY_TYPEDARRAY_UINT32:
+ TEST_VALUE_AT (uint32_t, buffer, offset, value);
+ break;
+ case JERRY_TYPEDARRAY_INT32:
+ TEST_VALUE_AT (int32_t, buffer, offset, value);
+ break;
+ case JERRY_TYPEDARRAY_FLOAT32:
+ TEST_VALUE_AT (float, buffer, offset, value);
+ break;
+ case JERRY_TYPEDARRAY_FLOAT64:
+ TEST_VALUE_AT (double, buffer, offset, value);
+ break;
+ case JERRY_TYPEDARRAY_BIGINT64:
+ TEST_VALUE_AT (int64_t, buffer, offset, value);
+ break;
+ case JERRY_TYPEDARRAY_BIGUINT64:
+ TEST_VALUE_AT (uint64_t, buffer, offset, value);
+ break;
case JERRY_TYPEDARRAY_UINT8CLAMPED:
{
@@ -190,9 +210,12 @@ void test_buffer_value (uint64_t value, /**< value to test for */
expected = 0;
}
- TEST_VALUE_AT (uint8_t, buffer, offset, expected); break;
+ TEST_VALUE_AT (uint8_t, buffer, offset, expected);
+ break;
}
- default: TEST_ASSERT (false); break;
+ default:
+ TEST_ASSERT (false);
+ break;
}
#undef TEST_VALUE_AT
@@ -245,20 +268,15 @@ test_typedarray_complex_creation (test_entry_t test_entries[], /**< test cases *
register_js_value ("array", typedarray);
- const jerry_char_t test_exptected_src[] = TEST_STRING_LITERAL (
- "assert (array.length == expected_length,"
- " 'expected length: ' + expected_length + ' got: ' + array.length);"
- "assert (array.byteOffset == expected_offset);"
- );
- jerry_value_t result = jerry_eval (test_exptected_src,
- sizeof (test_exptected_src) - 1,
- JERRY_PARSE_STRICT_MODE);
+ const jerry_char_t test_exptected_src[] =
+ TEST_STRING_LITERAL ("assert (array.length == expected_length,"
+ " 'expected length: ' + expected_length + ' got: ' + array.length);"
+ "assert (array.byteOffset == expected_offset);");
+ jerry_value_t result = jerry_eval (test_exptected_src, sizeof (test_exptected_src) - 1, JERRY_PARSE_STRICT_MODE);
TEST_ASSERT (!jerry_value_is_error (result));
jerry_release_value (result);
- const jerry_char_t set_element_src[] = TEST_STRING_LITERAL (
- "array[0] = 0x11223344n"
- );
+ const jerry_char_t set_element_src[] = TEST_STRING_LITERAL ("array[0] = 0x11223344n");
/* crop the last 'n' character */
size_t src_length = sizeof (set_element_src) - 2;
@@ -303,13 +321,14 @@ test_typedarray_complex_creation (test_entry_t test_entries[], /**< test cases *
/**
* Test get/set/delete property by index.
*/
-static void test_property_by_index (test_entry_t test_entries[])
+static void
+test_property_by_index (test_entry_t test_entries[])
{
- int test_int_numbers[5] = {-5, -70, 13, 0, 56};
- double test_double_numbers[5] = {-83.153, -35.15, 0, 13.1, 89.8975};
- uint8_t test_uint_numbers[5] = {83, 15, 36, 0, 43};
- uint64_t test_uint64_numbers[5] = {83, 0, 1, UINT32_MAX, UINT64_MAX};
- int64_t test_int64_numbers[5] = {INT64_MAX, INT64_MIN, 0, INT32_MAX, INT32_MIN};
+ int test_int_numbers[5] = { -5, -70, 13, 0, 56 };
+ double test_double_numbers[5] = { -83.153, -35.15, 0, 13.1, 89.8975 };
+ uint8_t test_uint_numbers[5] = { 83, 15, 36, 0, 43 };
+ uint64_t test_uint64_numbers[5] = { 83, 0, 1, UINT32_MAX, UINT64_MAX };
+ int64_t test_int64_numbers[5] = { INT64_MAX, INT64_MIN, 0, INT32_MAX, INT32_MIN };
for (uint32_t i = 0; test_entries[i].constructor_name != NULL; i++)
{
@@ -486,19 +505,10 @@ static void test_property_by_index (test_entry_t test_entries[])
static void
test_detached_arraybuffer (void)
{
- static jerry_typedarray_type_t types[] =
- {
- JERRY_TYPEDARRAY_UINT8,
- JERRY_TYPEDARRAY_UINT8CLAMPED,
- JERRY_TYPEDARRAY_INT8,
- JERRY_TYPEDARRAY_UINT16,
- JERRY_TYPEDARRAY_INT16,
- JERRY_TYPEDARRAY_UINT32,
- JERRY_TYPEDARRAY_INT32,
- JERRY_TYPEDARRAY_FLOAT32,
- JERRY_TYPEDARRAY_FLOAT64,
- JERRY_TYPEDARRAY_BIGINT64,
- JERRY_TYPEDARRAY_BIGUINT64,
+ static jerry_typedarray_type_t types[] = {
+ JERRY_TYPEDARRAY_UINT8, JERRY_TYPEDARRAY_UINT8CLAMPED, JERRY_TYPEDARRAY_INT8, JERRY_TYPEDARRAY_UINT16,
+ JERRY_TYPEDARRAY_INT16, JERRY_TYPEDARRAY_UINT32, JERRY_TYPEDARRAY_INT32, JERRY_TYPEDARRAY_FLOAT32,
+ JERRY_TYPEDARRAY_FLOAT64, JERRY_TYPEDARRAY_BIGINT64, JERRY_TYPEDARRAY_BIGUINT64,
};
/* Creating an TypedArray for a detached array buffer with a given length/offset is invalid */
@@ -576,24 +586,22 @@ main (void)
register_js_value ("assert", function_val);
jerry_release_value (function_val);
- test_entry_t test_entries[] =
- {
-#define TEST_ENTRY(TYPE, CONSTRUCTOR, COUNT, BYTES_PER_ELEMENT) \
- { TYPE, CONSTRUCTOR, COUNT, BYTES_PER_ELEMENT }
+ test_entry_t test_entries[] = {
+#define TEST_ENTRY(TYPE, CONSTRUCTOR, COUNT, BYTES_PER_ELEMENT) { TYPE, CONSTRUCTOR, COUNT, BYTES_PER_ELEMENT }
- TEST_ENTRY (JERRY_TYPEDARRAY_UINT8, "Uint8Array", 12, 1),
+ TEST_ENTRY (JERRY_TYPEDARRAY_UINT8, "Uint8Array", 12, 1),
TEST_ENTRY (JERRY_TYPEDARRAY_UINT8CLAMPED, "Uint8ClampedArray", 12, 1),
- TEST_ENTRY (JERRY_TYPEDARRAY_INT8, "Int8Array", 12, 1),
- TEST_ENTRY (JERRY_TYPEDARRAY_UINT16, "Uint16Array", 12, 2),
- TEST_ENTRY (JERRY_TYPEDARRAY_INT16, "Int16Array", 12, 2),
- TEST_ENTRY (JERRY_TYPEDARRAY_UINT16, "Uint16Array", 12, 2),
- TEST_ENTRY (JERRY_TYPEDARRAY_INT32, "Int32Array", 12, 4),
- TEST_ENTRY (JERRY_TYPEDARRAY_UINT32, "Uint32Array", 12, 4),
- TEST_ENTRY (JERRY_TYPEDARRAY_FLOAT32, "Float32Array", 12, 4),
- /* TODO: add check if the float64 is supported */
- TEST_ENTRY (JERRY_TYPEDARRAY_FLOAT64, "Float64Array", 12, 8),
- TEST_ENTRY (JERRY_TYPEDARRAY_BIGINT64, "BigInt64Array", 12, 8),
- TEST_ENTRY (JERRY_TYPEDARRAY_BIGUINT64, "BigUint64Array", 12, 8),
+ TEST_ENTRY (JERRY_TYPEDARRAY_INT8, "Int8Array", 12, 1),
+ TEST_ENTRY (JERRY_TYPEDARRAY_UINT16, "Uint16Array", 12, 2),
+ TEST_ENTRY (JERRY_TYPEDARRAY_INT16, "Int16Array", 12, 2),
+ TEST_ENTRY (JERRY_TYPEDARRAY_UINT16, "Uint16Array", 12, 2),
+ TEST_ENTRY (JERRY_TYPEDARRAY_INT32, "Int32Array", 12, 4),
+ TEST_ENTRY (JERRY_TYPEDARRAY_UINT32, "Uint32Array", 12, 4),
+ TEST_ENTRY (JERRY_TYPEDARRAY_FLOAT32, "Float32Array", 12, 4),
+ /* TODO: add check if the float64 is supported */
+ TEST_ENTRY (JERRY_TYPEDARRAY_FLOAT64, "Float64Array", 12, 8),
+ TEST_ENTRY (JERRY_TYPEDARRAY_BIGINT64, "BigInt64Array", 12, 8),
+ TEST_ENTRY (JERRY_TYPEDARRAY_BIGUINT64, "BigUint64Array", 12, 8),
TEST_ENTRY (JERRY_TYPEDARRAY_INVALID, NULL, 0, 0)
#undef TEST_ENTRY
@@ -639,11 +647,8 @@ main (void)
"{"
" assert (array[i] == expected_value);"
" array[i] = i;"
- "};"
- );
- jerry_value_t result = jerry_eval (eval_src,
- sizeof (eval_src) - 1,
- JERRY_PARSE_STRICT_MODE);
+ "};");
+ jerry_value_t result = jerry_eval (eval_src, sizeof (eval_src) - 1, JERRY_PARSE_STRICT_MODE);
TEST_ASSERT (!jerry_value_is_error (result));
jerry_release_value (result);
@@ -678,8 +683,7 @@ main (void)
/* test invalid things */
{
- jerry_value_t values[] =
- {
+ jerry_value_t values[] = {
jerry_create_number (11),
jerry_create_boolean (false),
jerry_create_string ((const jerry_char_t *) "test"),
diff --git a/tests/unit-core/test-unicode.c b/tests/unit-core/test-unicode.c
index 78b1ddad..86a4db84 100644
--- a/tests/unit-core/test-unicode.c
+++ b/tests/unit-core/test-unicode.c
@@ -14,14 +14,13 @@
*/
#include "jerryscript.h"
+
#include "test-common.h"
static bool
test_syntax_error (char *script_p) /**< script */
{
- jerry_value_t parse_result = jerry_parse ((const jerry_char_t *) script_p,
- strlen (script_p),
- NULL);
+ jerry_value_t parse_result = jerry_parse ((const jerry_char_t *) script_p, strlen (script_p), NULL);
bool result = false;
diff --git a/tests/unit-core/test-vm-exec-stop.c b/tests/unit-core/test-vm-exec-stop.c
index 7704b4f8..083095e3 100644
--- a/tests/unit-core/test-vm-exec-stop.c
+++ b/tests/unit-core/test-vm-exec-stop.c
@@ -13,9 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+#include "config.h"
#include "test-common.h"
static jerry_value_t
@@ -50,9 +50,7 @@ main (void)
jerry_set_vm_exec_stop_callback (vm_exec_stop_callback, &countdown, 16);
const jerry_char_t inf_loop_code_src1[] = "while(true) {}";
- jerry_value_t parsed_code_val = jerry_parse (inf_loop_code_src1,
- sizeof (inf_loop_code_src1) - 1,
- NULL);
+ jerry_value_t parsed_code_val = jerry_parse (inf_loop_code_src1, sizeof (inf_loop_code_src1) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
jerry_value_t res = jerry_run (parsed_code_val);
@@ -69,14 +67,10 @@ main (void)
/* We keep the callback function, only the countdown is reset. */
countdown = 6;
- const jerry_char_t inf_loop_code_src2[] = TEST_STRING_LITERAL (
- "function f() { while (true) ; }\n"
- "try { f(); } catch(e) {}"
- );
+ const jerry_char_t inf_loop_code_src2[] = TEST_STRING_LITERAL ("function f() { while (true) ; }\n"
+ "try { f(); } catch(e) {}");
- parsed_code_val = jerry_parse (inf_loop_code_src2,
- sizeof (inf_loop_code_src2) - 1,
- NULL);
+ parsed_code_val = jerry_parse (inf_loop_code_src2, sizeof (inf_loop_code_src2) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
res = jerry_run (parsed_code_val);
diff --git a/tests/unit-core/test-vm-throw.c b/tests/unit-core/test-vm-throw.c
index dd781b62..ba74da50 100644
--- a/tests/unit-core/test-vm-throw.c
+++ b/tests/unit-core/test-vm-throw.c
@@ -13,9 +13,9 @@
* limitations under the License.
*/
-#include "config.h"
#include "jerryscript.h"
+#include "config.h"
#include "test-common.h"
static int mode = 0;
@@ -147,8 +147,7 @@ main (void)
mode = 0;
counter = 0;
- do_eval (TEST_STRING_LITERAL ("throw -5.6"),
- true);
+ do_eval (TEST_STRING_LITERAL ("throw -5.6"), true);
TEST_ASSERT (counter == 1);
mode = 1;
@@ -195,20 +194,17 @@ main (void)
mode = 5;
counter = 0;
- do_eval (TEST_STRING_LITERAL ("native()\n"),
- true);
+ do_eval (TEST_STRING_LITERAL ("native()\n"), true);
TEST_ASSERT (counter == 1);
mode = 6;
counter = 0;
- do_eval (TEST_STRING_LITERAL ("native()\n"),
- true);
+ do_eval (TEST_STRING_LITERAL ("native()\n"), true);
TEST_ASSERT (counter == 2);
mode = 7;
counter = 0;
- do_eval (TEST_STRING_LITERAL ("native()\n"),
- true);
+ do_eval (TEST_STRING_LITERAL ("native()\n"), true);
TEST_ASSERT (counter == 0);
/* Built-in functions should not trigger the call twice: */
diff --git a/tests/unit-ext/module/jerry-module-test.c b/tests/unit-ext/module/jerry-module-test.c
index a62aa6fc..201b3846 100644
--- a/tests/unit-ext/module/jerry-module-test.c
+++ b/tests/unit-ext/module/jerry-module-test.c
@@ -16,8 +16,9 @@
#include <string.h>
#include "jerryscript.h"
-#include "test-common.h"
+
#include "jerryscript-ext/module.h"
+#include "test-common.h"
/* Load a module. */
const char eval_string1[] = "require ('my_custom_module');";
@@ -26,64 +27,58 @@ const char eval_string1[] = "require ('my_custom_module');";
const char eval_string2[] = "require ('differently-handled-module');";
/* Load a broken module using the built-in resolver. */
-const char eval_string3[] =
-"(function() {"
-" var theError;"
-" try {"
-" require ('my_broken_module');"
-" } catch (anError) {"
-" theError = anError;"
-" }"
-" return (((theError.message === 'Module on_resolve () must not be NULL') &&"
-" (theError.moduleName === 'my_broken_module') &&"
-" (theError instanceof TypeError)) ? 1 : 0);"
-"}) ();";
+const char eval_string3[] = "(function() {"
+ " var theError;"
+ " try {"
+ " require ('my_broken_module');"
+ " } catch (anError) {"
+ " theError = anError;"
+ " }"
+ " return (((theError.message === 'Module on_resolve () must not be NULL') &&"
+ " (theError.moduleName === 'my_broken_module') &&"
+ " (theError instanceof TypeError)) ? 1 : 0);"
+ "}) ();";
/* Load a non-existent module. */
-const char eval_string4[] =
-"(function() {"
-" var theError;"
-" try {"
-" require ('some_missing_module_xyzzy');"
-" } catch (anError) {"
-" theError = anError;"
-" }"
-" return (((theError.message === 'Module not found') &&"
-" (theError.moduleName === 'some_missing_module_xyzzy')) ? 1 : 0);"
-"}) ();";
+const char eval_string4[] = "(function() {"
+ " var theError;"
+ " try {"
+ " require ('some_missing_module_xyzzy');"
+ " } catch (anError) {"
+ " theError = anError;"
+ " }"
+ " return (((theError.message === 'Module not found') &&"
+ " (theError.moduleName === 'some_missing_module_xyzzy')) ? 1 : 0);"
+ "}) ();";
/* Make sure the result of a module load is cached. */
-const char eval_string5[] =
-"(function() {"
-" var x = require('cache-check');"
-" var y = require('cache-check');"
-" return x === y ? 1 : 0;"
-"}) ();";
+const char eval_string5[] = "(function() {"
+ " var x = require('cache-check');"
+ " var y = require('cache-check');"
+ " return x === y ? 1 : 0;"
+ "}) ();";
/* Make sure the result of a module load is removed from the cache. */
-const char eval_string6[] =
-"(function() {"
-" var x = require('cache-check');"
-" clear_require_cache('cache-check');"
-" var y = require('cache-check');"
-" return x !== y ? 1 : 0;"
-"}) ();";
+const char eval_string6[] = "(function() {"
+ " var x = require('cache-check');"
+ " clear_require_cache('cache-check');"
+ " var y = require('cache-check');"
+ " return x !== y ? 1 : 0;"
+ "}) ();";
/* Make sure the entire cache is cleared. */
-const char eval_string7[] =
-"(function() {"
-" var x = require('cache-check');"
-" clear_require_cache(undefined);"
-" var y = require('cache-check');"
-" return x !== y ? 1 : 0;"
-"}) ();";
+const char eval_string7[] = "(function() {"
+ " var x = require('cache-check');"
+ " clear_require_cache(undefined);"
+ " var y = require('cache-check');"
+ " return x !== y ? 1 : 0;"
+ "}) ();";
/*
* Define a resolver for a module named "differently-handled-module" to check that custom resolvers work.
*/
static bool
-resolve_differently_handled_module (const jerry_value_t name,
- jerry_value_t *result)
+resolve_differently_handled_module (const jerry_value_t name, jerry_value_t *result)
{
jerry_size_t name_size = jerry_get_utf8_string_size (name);
JERRY_VLA (jerry_char_t, name_string, name_size);
@@ -97,11 +92,7 @@ resolve_differently_handled_module (const jerry_value_t name,
return false;
} /* resolve_differently_handled_module */
-static jerryx_module_resolver_t differently_handled_module_resolver =
-{
- NULL,
- resolve_differently_handled_module
-};
+static jerryx_module_resolver_t differently_handled_module_resolver = { NULL, resolve_differently_handled_module };
/*
* Define module "cache-check" via its own resolver as an empty object. Since objects are accessible only via references
@@ -109,8 +100,7 @@ static jerryx_module_resolver_t differently_handled_module_resolver =
* on the first attempt and establish that the two are in fact the same object - which in turn shows that caching works.
*/
static bool
-cache_check (const jerry_value_t name,
- jerry_value_t *result)
+cache_check (const jerry_value_t name, jerry_value_t *result)
{
jerry_size_t name_size = jerry_get_utf8_string_size (name);
JERRY_VLA (jerry_char_t, name_string, name_size);
@@ -124,18 +114,11 @@ cache_check (const jerry_value_t name,
return false;
} /* cache_check */
-static jerryx_module_resolver_t cache_check_resolver =
-{
- NULL,
- cache_check
-};
+static jerryx_module_resolver_t cache_check_resolver = { NULL, cache_check };
-static const jerryx_module_resolver_t *resolvers[3] =
-{
- &jerryx_module_native_resolver,
- &differently_handled_module_resolver,
- &cache_check_resolver
-};
+static const jerryx_module_resolver_t *resolvers[3] = { &jerryx_module_native_resolver,
+ &differently_handled_module_resolver,
+ &cache_check_resolver };
static jerry_value_t
handle_clear_require_cache (const jerry_call_info_t *call_info_p,
@@ -152,9 +135,7 @@ handle_clear_require_cache (const jerry_call_info_t *call_info_p,
} /* handle_clear_require_cache */
static jerry_value_t
-handle_require (const jerry_call_info_t *call_info_p,
- const jerry_value_t args_p[],
- const jerry_length_t args_count)
+handle_require (const jerry_call_info_t *call_info_p, const jerry_value_t args_p[], const jerry_length_t args_count)
{
(void) call_info_p;
(void) args_count;
@@ -177,9 +158,8 @@ assert_number (jerry_value_t js_value, double expected_result)
static void
eval_one (const char *the_string, double expected_result)
{
- jerry_value_t js_eval_result = jerry_eval ((const jerry_char_t *) the_string,
- strlen (the_string),
- JERRY_PARSE_STRICT_MODE);
+ jerry_value_t js_eval_result =
+ jerry_eval ((const jerry_char_t *) the_string, strlen (the_string), JERRY_PARSE_STRICT_MODE);
assert_number (js_eval_result, expected_result);
jerry_release_value (js_eval_result);
} /* eval_one */
diff --git a/tests/unit-ext/module/my-broken-module.c b/tests/unit-ext/module/my-broken-module.c
index 39d4112a..1081770e 100644
--- a/tests/unit-ext/module/my-broken-module.c
+++ b/tests/unit-ext/module/my-broken-module.c
@@ -14,6 +14,7 @@
*/
#include "jerryscript.h"
+
#include "jerryscript-ext/module.h"
#define MODULE_NAME my_broken_module
diff --git a/tests/unit-ext/module/my-custom-module.c b/tests/unit-ext/module/my-custom-module.c
index 541e971d..ab7800e6 100644
--- a/tests/unit-ext/module/my-custom-module.c
+++ b/tests/unit-ext/module/my-custom-module.c
@@ -14,6 +14,7 @@
*/
#include "jerryscript.h"
+
#include "jerryscript-ext/module.h"
#define MODULE_NAME my_custom_module
diff --git a/tests/unit-ext/test-common.h b/tests/unit-ext/test-common.h
index cbc4feb9..b65772c2 100644
--- a/tests/unit-ext/test-common.h
+++ b/tests/unit-ext/test-common.h
@@ -22,19 +22,19 @@
#define JERRY_UNUSED(x) ((void) (x))
-#define TEST_ASSERT(x) \
- do \
- { \
- if (!(x)) \
- { \
- jerry_port_log (JERRY_LOG_LEVEL_ERROR, \
+#define TEST_ASSERT(x) \
+ do \
+ { \
+ if (!(x)) \
+ { \
+ jerry_port_log (JERRY_LOG_LEVEL_ERROR, \
"TEST: Assertion '%s' failed at %s(%s):%lu.\n", \
- #x, \
- __FILE__, \
- __func__, \
- (unsigned long) __LINE__); \
- jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \
- } \
+ #x, \
+ __FILE__, \
+ __func__, \
+ (unsigned long) __LINE__); \
+ jerry_port_fatal (ERR_FAILED_INTERNAL_ASSERTION); \
+ } \
} while (0)
#define TEST_STRING_LITERAL(x) x
diff --git a/tests/unit-ext/test-ext-arg.c b/tests/unit-ext/test-ext-arg.c
index fa1c47f3..49f8657b 100644
--- a/tests/unit-ext/test-ext-arg.c
+++ b/tests/unit-ext/test-ext-arg.c
@@ -18,62 +18,61 @@
*/
#include <string.h>
+
#include "jerryscript.h"
+
#include "jerryscript-ext/arg.h"
#include "test-common.h"
-static const jerry_char_t test_source[] = TEST_STRING_LITERAL (
- "var arg1 = true;"
- "var arg2 = 10.5;"
- "var arg3 = 'abc';"
- "var arg4 = function foo() {};"
- "test_validator1(arg1, arg2, arg3, arg4);"
- "arg1 = new Boolean(true);"
- "arg3 = new String('abc');"
- "test_validator1(arg1, arg2, arg3);"
- "test_validator1(arg1, arg2, '');"
- "arg2 = new Number(10.5);"
- "test_validator1(arg1, arg2, arg3);"
- "test_validator1(arg1, 10.5, 'abcdef');"
- "test_validator3(arg1, arg1);"
- "test_validator3(arg1);"
- "test_validator3();"
- "test_validator3(undefined, undefined);"
- "var obj_a = new MyObjectA();"
- "var obj_b = new MyObjectB();"
- "test_validator2.call(obj_a, 5);"
- "test_validator2.call(obj_b, 5);"
- "test_validator2.call(obj_a, 1);"
- "var obj1 = {prop1:true, prop2:'1.5'};"
- "test_validator_prop1(obj1);"
- "test_validator_prop2(obj1);"
- "test_validator_prop2();"
- "var obj2 = {prop1:true};"
- "Object.defineProperty(obj2, 'prop2', {"
- " get: function() { throw new TypeError('prop2 error') }"
- "});"
- "test_validator_prop3(obj2);"
- "test_validator_int1(-1000, 1000, 128, -1000, 1000, -127,"
- " -1000, 4294967297, 65536, -2200000000, 4294967297, -2147483647);"
- "test_validator_int2(-1.5, -1.5, -1.5, 1.5, 1.5, 1.5, Infinity, -Infinity, 300.5, 300.5);"
- "test_validator_int3(NaN);"
- "var arr = [1, 2];"
- "test_validator_array1(arr);"
- "test_validator_array1();"
- "test_validator_array2(arr);"
- "test_validator_restore(false, 3.0);"
- "test_validator_restore(3.0, false);"
-);
-
-static const jerry_object_native_info_t thing_a_info =
-{
+static const jerry_char_t test_source[] =
+ TEST_STRING_LITERAL ("var arg1 = true;"
+ "var arg2 = 10.5;"
+ "var arg3 = 'abc';"
+ "var arg4 = function foo() {};"
+ "test_validator1(arg1, arg2, arg3, arg4);"
+ "arg1 = new Boolean(true);"
+ "arg3 = new String('abc');"
+ "test_validator1(arg1, arg2, arg3);"
+ "test_validator1(arg1, arg2, '');"
+ "arg2 = new Number(10.5);"
+ "test_validator1(arg1, arg2, arg3);"
+ "test_validator1(arg1, 10.5, 'abcdef');"
+ "test_validator3(arg1, arg1);"
+ "test_validator3(arg1);"
+ "test_validator3();"
+ "test_validator3(undefined, undefined);"
+ "var obj_a = new MyObjectA();"
+ "var obj_b = new MyObjectB();"
+ "test_validator2.call(obj_a, 5);"
+ "test_validator2.call(obj_b, 5);"
+ "test_validator2.call(obj_a, 1);"
+ "var obj1 = {prop1:true, prop2:'1.5'};"
+ "test_validator_prop1(obj1);"
+ "test_validator_prop2(obj1);"
+ "test_validator_prop2();"
+ "var obj2 = {prop1:true};"
+ "Object.defineProperty(obj2, 'prop2', {"
+ " get: function() { throw new TypeError('prop2 error') }"
+ "});"
+ "test_validator_prop3(obj2);"
+ "test_validator_int1(-1000, 1000, 128, -1000, 1000, -127,"
+ " -1000, 4294967297, 65536, -2200000000, 4294967297, -2147483647);"
+ "test_validator_int2(-1.5, -1.5, -1.5, 1.5, 1.5, 1.5, Infinity, -Infinity, 300.5, 300.5);"
+ "test_validator_int3(NaN);"
+ "var arr = [1, 2];"
+ "test_validator_array1(arr);"
+ "test_validator_array1();"
+ "test_validator_array2(arr);"
+ "test_validator_restore(false, 3.0);"
+ "test_validator_restore(3.0, false);");
+
+static const jerry_object_native_info_t thing_a_info = {
.free_cb = NULL,
.number_of_references = 0,
.offset_of_references = 0,
};
-static const jerry_object_native_info_t thing_b_info =
-{
+static const jerry_object_native_info_t thing_b_info = {
.free_cb = NULL,
.number_of_references = 0,
.offset_of_references = 0,
@@ -119,25 +118,20 @@ test_validator1_handler (const jerry_call_info_t *call_info_p, /**< call informa
char arg3[5] = "1234";
jerry_value_t arg4 = jerry_create_undefined ();
- jerryx_arg_t mapping[] =
- {
- /* ignore this */
- jerryx_arg_ignore (),
- /* 1st argument should be boolean */
- jerryx_arg_boolean (&arg1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
- /* 2nd argument should be strict number */
- jerryx_arg_number (&arg2, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),
- /* 3th argument should be string */
- jerryx_arg_string (arg3, 5, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
- /* 4th argument should be function, and it is optional */
- jerryx_arg_function (&arg4, JERRYX_ARG_OPTIONAL)
+ jerryx_arg_t mapping[] = { /* ignore this */
+ jerryx_arg_ignore (),
+ /* 1st argument should be boolean */
+ jerryx_arg_boolean (&arg1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
+ /* 2nd argument should be strict number */
+ jerryx_arg_number (&arg2, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED),
+ /* 3th argument should be string */
+ jerryx_arg_string (arg3, 5, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
+ /* 4th argument should be function, and it is optional */
+ jerryx_arg_function (&arg4, JERRYX_ARG_OPTIONAL)
};
- jerry_value_t is_ok = jerryx_arg_transform_this_and_args (call_info_p->this_value,
- args_p,
- args_cnt,
- mapping,
- ARRAY_SIZE (mapping));
+ jerry_value_t is_ok =
+ jerryx_arg_transform_this_and_args (call_info_p->this_value, args_p, args_cnt, mapping, ARRAY_SIZE (mapping));
if (validator1_count == 0)
{
@@ -189,8 +183,7 @@ my_custom_transform (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS
{
jerry_release_value (to_number);
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "It can not be converted to a number.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "It can not be converted to a number.");
}
int expected_num = (int) c_arg_p->extra_info;
@@ -198,8 +191,7 @@ my_custom_transform (jerryx_arg_js_iterator_t *js_arg_iter_p, /**< available JS
if (get_num != expected_num)
{
- return jerry_create_error (JERRY_ERROR_TYPE,
- (jerry_char_t *) "Number value is not expected.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (jerry_char_t *) "Number value is not expected.");
}
return jerry_create_undefined ();
@@ -217,19 +209,14 @@ test_validator2_handler (const jerry_call_info_t *call_info_p, /**< call informa
{
my_type_a_t *thing_p;
- jerryx_arg_t mapping[] =
- {
- /* this should has native pointer, whose type is thing_a_info */
- jerryx_arg_native_pointer ((void **) &thing_p, &thing_a_info, JERRYX_ARG_REQUIRED),
- /* custom tranform function */
- jerryx_arg_custom (NULL, 5, my_custom_transform)
+ jerryx_arg_t mapping[] = { /* this should has native pointer, whose type is thing_a_info */
+ jerryx_arg_native_pointer ((void **) &thing_p, &thing_a_info, JERRYX_ARG_REQUIRED),
+ /* custom tranform function */
+ jerryx_arg_custom (NULL, 5, my_custom_transform)
};
- jerry_value_t is_ok = jerryx_arg_transform_this_and_args (call_info_p->this_value,
- args_p,
- args_cnt,
- mapping,
- ARRAY_SIZE (mapping));
+ jerry_value_t is_ok =
+ jerryx_arg_transform_this_and_args (call_info_p->this_value, args_p, args_cnt, mapping, ARRAY_SIZE (mapping));
if (validator2_count == 0)
{
@@ -261,8 +248,7 @@ test_validator3_handler (const jerry_call_info_t *call_info_p, /**< call informa
bool arg1 = false;
bool arg2 = false;
- jerryx_arg_t mapping[] =
- {
+ jerryx_arg_t mapping[] = {
/* ignore this */
jerryx_arg_ignore (),
/* 1th argument should be boolean, and it is optional */
@@ -271,11 +257,8 @@ test_validator3_handler (const jerry_call_info_t *call_info_p, /**< call informa
jerryx_arg_boolean (&arg2, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL),
};
- jerry_value_t is_ok = jerryx_arg_transform_this_and_args (call_info_p->this_value,
- args_p,
- args_cnt,
- mapping,
- ARRAY_SIZE (mapping));
+ jerry_value_t is_ok =
+ jerryx_arg_transform_this_and_args (call_info_p->this_value, args_p, args_cnt, mapping, ARRAY_SIZE (mapping));
if (validator3_count == 0)
{
@@ -328,14 +311,11 @@ test_validator_prop1_handler (const jerry_call_info_t *call_info_p, /**< call in
double native2 = 0;
double native3 = 3;
- const char *name_p[] = {"prop1", "prop2", "prop3"};
+ const char *name_p[] = { "prop1", "prop2", "prop3" };
- jerryx_arg_t mapping[] =
- {
- jerryx_arg_boolean (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
- jerryx_arg_number (&native2, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
- jerryx_arg_number (&native3, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL)
- };
+ jerryx_arg_t mapping[] = { jerryx_arg_boolean (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
+ jerryx_arg_number (&native2, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
+ jerryx_arg_number (&native3, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL) };
jerry_value_t is_ok = jerryx_arg_transform_object_properties (args_p[0],
(const jerry_char_t **) name_p,
@@ -372,20 +352,16 @@ test_validator_prop2_handler (const jerry_call_info_t *call_info_p, /**< call in
const char *name_p[] = { "prop1", "prop2", "prop3" };
- jerryx_arg_t prop_mapping[] =
- {
- jerryx_arg_boolean (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
- jerryx_arg_number (&native2, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
- jerryx_arg_number (&native3, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL)
- };
+ jerryx_arg_t prop_mapping[] = { jerryx_arg_boolean (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
+ jerryx_arg_number (&native2, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
+ jerryx_arg_number (&native3, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL) };
prop_info.name_p = (const jerry_char_t **) name_p;
prop_info.name_cnt = 3;
prop_info.c_arg_p = prop_mapping;
prop_info.c_arg_cnt = 3;
- jerryx_arg_t mapping[] =
- {
+ jerryx_arg_t mapping[] = {
jerryx_arg_object_properties (&prop_info, JERRYX_ARG_OPTIONAL),
};
@@ -418,8 +394,7 @@ test_validator_prop3_handler (const jerry_call_info_t *call_info_p, /**< call in
const char *name_p[] = { "prop1", "prop2" };
- jerryx_arg_t mapping[] =
- {
+ jerryx_arg_t mapping[] = {
jerryx_arg_boolean (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
jerryx_arg_boolean (&native2, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
};
@@ -455,8 +430,7 @@ test_validator_int1_handler (const jerry_call_info_t *call_info_p, /**< call inf
uint32_t num6, num7, num8;
int32_t num9, num10, num11;
- jerryx_arg_t mapping[] =
- {
+ jerryx_arg_t mapping[] = {
jerryx_arg_uint8 (&num0, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
jerryx_arg_uint8 (&num1, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
jerryx_arg_uint8 (&num2, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
@@ -471,10 +445,7 @@ test_validator_int1_handler (const jerry_call_info_t *call_info_p, /**< call inf
jerryx_arg_int32 (&num11, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED)
};
- jerry_value_t is_ok = jerryx_arg_transform_args (args_p,
- args_cnt,
- mapping,
- ARRAY_SIZE (mapping));
+ jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, mapping, ARRAY_SIZE (mapping));
TEST_ASSERT (!jerry_value_is_error (is_ok));
TEST_ASSERT (num0 == 0);
@@ -507,8 +478,7 @@ test_validator_int2_handler (const jerry_call_info_t *call_info_p, /**< call inf
num8 = 123;
num9 = 123;
- jerryx_arg_t mapping[] =
- {
+ jerryx_arg_t mapping[] = {
jerryx_arg_int8 (&num0, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
jerryx_arg_int8 (&num1, JERRYX_ARG_FLOOR, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
jerryx_arg_int8 (&num2, JERRYX_ARG_CEIL, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
@@ -521,10 +491,7 @@ test_validator_int2_handler (const jerry_call_info_t *call_info_p, /**< call inf
jerryx_arg_int8 (&num9, JERRYX_ARG_ROUND, JERRYX_ARG_NO_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
};
- jerry_value_t is_ok = jerryx_arg_transform_args (args_p,
- args_cnt,
- mapping,
- ARRAY_SIZE (mapping));
+ jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, mapping, ARRAY_SIZE (mapping));
TEST_ASSERT (jerry_value_is_error (is_ok));
TEST_ASSERT (num0 == -2);
@@ -553,15 +520,11 @@ test_validator_int3_handler (const jerry_call_info_t *call_info_p, /**< call inf
int8_t num0;
- jerryx_arg_t mapping[] =
- {
+ jerryx_arg_t mapping[] = {
jerryx_arg_int8 (&num0, JERRYX_ARG_ROUND, JERRYX_ARG_CLAMP, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
};
- jerry_value_t is_ok = jerryx_arg_transform_args (args_p,
- args_cnt,
- mapping,
- ARRAY_SIZE (mapping));
+ jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, mapping, ARRAY_SIZE (mapping));
TEST_ASSERT (jerry_value_is_error (is_ok));
@@ -584,18 +547,14 @@ test_validator_array1_handler (const jerry_call_info_t *call_info_p, /**< call i
jerryx_arg_array_items_t arr_info;
- jerryx_arg_t item_mapping[] =
- {
- jerryx_arg_number (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
- jerryx_arg_number (&native2, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
- jerryx_arg_number (&native3, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL)
- };
+ jerryx_arg_t item_mapping[] = { jerryx_arg_number (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
+ jerryx_arg_number (&native2, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
+ jerryx_arg_number (&native3, JERRYX_ARG_COERCE, JERRYX_ARG_OPTIONAL) };
arr_info.c_arg_p = item_mapping;
arr_info.c_arg_cnt = 3;
- jerryx_arg_t mapping[] =
- {
+ jerryx_arg_t mapping[] = {
jerryx_arg_array (&arr_info, JERRYX_ARG_OPTIONAL),
};
@@ -626,11 +585,8 @@ test_validator_array2_handler (const jerry_call_info_t *call_info_p, /**< call i
double native1 = 0;
bool native2 = false;
- jerryx_arg_t item_mapping[] =
- {
- jerryx_arg_number (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
- jerryx_arg_boolean (&native2, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED)
- };
+ jerryx_arg_t item_mapping[] = { jerryx_arg_number (&native1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
+ jerryx_arg_boolean (&native2, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED) };
jerry_value_t is_ok = jerryx_arg_transform_array (args_p[0], item_mapping, ARRAY_SIZE (item_mapping));
@@ -654,10 +610,10 @@ test_validator_array2_handler (const jerry_call_info_t *call_info_p, /**< call i
* against backing up too far, when the check for the double fails,
* we'll "restore" the stack three times; this shouldn't break
* anything.
-*/
+ */
/*
* This enumeration type specifies the kind of thing held in the union.
-*/
+ */
typedef enum
{
DOUBLE_VALUE,
@@ -667,7 +623,7 @@ typedef enum
/*
* This struct holds either a boolean or double in a union and has a
* second field that describes the type held in the union.
-*/
+ */
typedef struct
{
union_type_t type_of_value;
@@ -682,21 +638,20 @@ typedef struct
* This creates a jerryx_arg_t that can be used like any
* of the installed functions, like jerryx_arg_bool().
*/
-#define jerryx_arg_double_or_bool_t(value_ptr, coerce_or_not, optional_or_not, last_parameter) \
- jerryx_arg_custom (value_ptr, \
- (uintptr_t)&((uintptr_t []){(uintptr_t)coerce_or_not, \
- (uintptr_t)optional_or_not, \
- (uintptr_t)last_parameter}), \
- jerry_arg_to_double_or_bool_t)
+#define jerryx_arg_double_or_bool_t(value_ptr, coerce_or_not, optional_or_not, last_parameter) \
+ jerryx_arg_custom ( \
+ value_ptr, \
+ (uintptr_t) \
+ & ((uintptr_t[]){ (uintptr_t) coerce_or_not, (uintptr_t) optional_or_not, (uintptr_t) last_parameter }), \
+ jerry_arg_to_double_or_bool_t)
/*
* This function is the argument validator used in the above macro called
* jerryx_arg_double_or_bool. It calls jerryx_arg_js_iterator_restore()
* more times than it should to ensure that calling that function too
* often doesn't cause an error.
-*/
+ */
static jerry_value_t
-jerry_arg_to_double_or_bool_t (jerryx_arg_js_iterator_t *js_arg_iter_p,
- const jerryx_arg_t *c_arg_p)
+jerry_arg_to_double_or_bool_t (jerryx_arg_js_iterator_t *js_arg_iter_p, const jerryx_arg_t *c_arg_p)
{
/* c_arg_p has two fields: dest, which is a pointer to the data that
* gets filled in, and extra_info, which contains the flags used to
@@ -763,14 +718,13 @@ jerry_arg_to_double_or_bool_t (jerryx_arg_js_iterator_t *js_arg_iter_p,
/* Fall through indicates that whatever they gave us, it wasn't
* one of the types we were expecting... */
jerry_release_value (conversion_result);
- return jerry_create_error (JERRY_ERROR_TYPE,
- (const jerry_char_t *) "double_or_bool-type error.");
+ return jerry_create_error (JERRY_ERROR_TYPE, (const jerry_char_t *) "double_or_bool-type error.");
} /* jerry_arg_to_double_or_bool_t */
/**
* This validator expects two parameters, one a bool and one a double -- the
* order doesn't matter (so we'll call it twice with the orders reversed).
-*/
+ */
static jerry_value_t
test_validator_restore_handler (const jerry_call_info_t *call_info_p, /**< call information */
const jerry_value_t args_p[], /**< arguments list */
@@ -781,11 +735,8 @@ test_validator_restore_handler (const jerry_call_info_t *call_info_p, /**< call
double_or_bool_t arg1;
double_or_bool_t arg2;
- jerryx_arg_t item_mapping[] =
- {
- jerryx_arg_double_or_bool_t (&arg1, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED, 0),
- jerryx_arg_double_or_bool_t (&arg2, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED, 1)
- };
+ jerryx_arg_t item_mapping[] = { jerryx_arg_double_or_bool_t (&arg1, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED, 0),
+ jerryx_arg_double_or_bool_t (&arg2, JERRYX_ARG_NO_COERCE, JERRYX_ARG_REQUIRED, 1) };
jerry_value_t is_ok = jerryx_arg_transform_args (args_p, args_cnt, item_mapping, ARRAY_SIZE (item_mapping));
@@ -812,15 +763,11 @@ test_utf8_string (void)
size_t buf_len = sizeof (expect_utf8_buf) - 1;
JERRY_VLA (char, buf, buf_len + 1);
- jerryx_arg_t mapping[] =
- {
+ jerryx_arg_t mapping[] = {
jerryx_arg_utf8_string (buf, (uint32_t) buf_len + 1, JERRYX_ARG_COERCE, JERRYX_ARG_REQUIRED),
};
- jerry_value_t is_ok = jerryx_arg_transform_args (&str,
- 1,
- mapping,
- ARRAY_SIZE (mapping));
+ jerry_value_t is_ok = jerryx_arg_transform_args (&str, 1, mapping, ARRAY_SIZE (mapping));
TEST_ASSERT (!jerry_value_is_error (is_ok));
TEST_ASSERT (!strcmp (buf, expect_utf8_buf));
@@ -839,9 +786,7 @@ create_object_a_handler (const jerry_call_info_t *call_info_p, /**< call informa
TEST_ASSERT (jerry_value_is_object (call_info_p->this_value));
my_thing_a.x = 1;
- jerry_set_object_native_pointer (call_info_p->this_value,
- &my_thing_a,
- &thing_a_info);
+ jerry_set_object_native_pointer (call_info_p->this_value, &my_thing_a, &thing_a_info);
return jerry_create_boolean (true);
} /* create_object_a_handler */
@@ -857,9 +802,7 @@ create_object_b_handler (const jerry_call_info_t *call_info_p, /**< call informa
TEST_ASSERT (jerry_value_is_object (call_info_p->this_value));
my_thing_b.x = false;
- jerry_set_object_native_pointer (call_info_p->this_value,
- &my_thing_b,
- &thing_b_info);
+ jerry_set_object_native_pointer (call_info_p->this_value, &my_thing_b, &thing_b_info);
return jerry_create_boolean (true);
} /* create_object_b_handler */
@@ -906,9 +849,7 @@ main (void)
register_js_function ("test_validator_array2", test_validator_array2_handler);
register_js_function ("test_validator_restore", test_validator_restore_handler);
- jerry_value_t parsed_code_val = jerry_parse (test_source,
- sizeof (test_source) - 1,
- NULL);
+ jerry_value_t parsed_code_val = jerry_parse (test_source, sizeof (test_source) - 1, NULL);
TEST_ASSERT (!jerry_value_is_error (parsed_code_val));
jerry_value_t res = jerry_run (parsed_code_val);
diff --git a/tests/unit-ext/test-ext-autorelease.c b/tests/unit-ext/test-ext-autorelease.c
index f545df66..235f64ba 100644
--- a/tests/unit-ext/test-ext-autorelease.c
+++ b/tests/unit-ext/test-ext-autorelease.c
@@ -18,6 +18,7 @@
*/
#include "jerryscript.h"
+
#include "jerryscript-ext/autorelease.h"
#include "test-common.h"
@@ -32,8 +33,7 @@ native_free_cb (void *native_p, /**< native pointer */
++native_free_cb_call_count;
} /* native_free_cb */
-static const jerry_object_native_info_t native_info =
-{
+static const jerry_object_native_info_t native_info = {
.free_cb = native_free_cb,
.number_of_references = 0,
.offset_of_references = 0,
diff --git a/tests/unit-ext/test-ext-handle-scope-escape.c b/tests/unit-ext/test-ext-handle-scope-escape.c
index e1daffe9..b967e057 100644
--- a/tests/unit-ext/test-ext-handle-scope-escape.c
+++ b/tests/unit-ext/test-ext-handle-scope-escape.c
@@ -18,6 +18,7 @@
*/
#include "jerryscript.h"
+
#include "jerryscript-ext/handle-scope.h"
#include "test-common.h"
@@ -32,8 +33,7 @@ native_free_cb (void *native_p, /**< native pointer */
++native_free_cb_call_count;
} /* native_free_cb */
-static const jerry_object_native_info_t native_info =
-{
+static const jerry_object_native_info_t native_info = {
.free_cb = native_free_cb,
.number_of_references = 0,
.offset_of_references = 0,
diff --git a/tests/unit-ext/test-ext-handle-scope-handle-prelist-escape.c b/tests/unit-ext/test-ext-handle-scope-handle-prelist-escape.c
index e8ff8d46..9070d6d4 100644
--- a/tests/unit-ext/test-ext-handle-scope-handle-prelist-escape.c
+++ b/tests/unit-ext/test-ext-handle-scope-handle-prelist-escape.c
@@ -20,6 +20,7 @@
*/
#include "jerryscript.h"
+
#include "jerryscript-ext/handle-scope.h"
#include "test-common.h"
@@ -35,8 +36,7 @@ native_free_cb (void *native_p, /**< native pointer */
++native_free_cb_call_count;
} /* native_free_cb */
-static const jerry_object_native_info_t native_info =
-{
+static const jerry_object_native_info_t native_info = {
.free_cb = native_free_cb,
.number_of_references = 0,
.offset_of_references = 0,
@@ -49,7 +49,7 @@ create_object (void)
jerryx_open_escapable_handle_scope (&scope);
jerry_value_t obj;
- for (size_t idx = 0; idx < handle_count; idx ++)
+ for (size_t idx = 0; idx < handle_count; idx++)
{
obj = jerryx_create_handle (jerry_create_object ());
jerry_set_object_native_pointer (obj, NULL, &native_info);
@@ -73,7 +73,7 @@ test_handle_scope_val (void)
(void) obj;
jerry_gc (JERRY_GC_PRESSURE_LOW);
- TEST_ASSERT (native_free_cb_call_count == (handle_count -1));
+ TEST_ASSERT (native_free_cb_call_count == (handle_count - 1));
jerryx_close_handle_scope (scope);
} /* test_handle_scope_val */
diff --git a/tests/unit-ext/test-ext-handle-scope-handle-prelist.c b/tests/unit-ext/test-ext-handle-scope-handle-prelist.c
index 9b2dd097..e00d0fa8 100644
--- a/tests/unit-ext/test-ext-handle-scope-handle-prelist.c
+++ b/tests/unit-ext/test-ext-handle-scope-handle-prelist.c
@@ -20,6 +20,7 @@
*/
#include "jerryscript.h"
+
#include "jerryscript-ext/handle-scope.h"
#include "test-common.h"
@@ -35,8 +36,7 @@ native_free_cb (void *native_p, /**< native pointer */
++native_free_cb_call_count;
} /* native_free_cb */
-static const jerry_object_native_info_t native_info =
-{
+static const jerry_object_native_info_t native_info = {
.free_cb = native_free_cb,
.number_of_references = 0,
.offset_of_references = 0,
@@ -49,7 +49,7 @@ create_object (void)
jerryx_open_escapable_handle_scope (&scope);
jerry_value_t obj;
- for (size_t idx = 0; idx < handle_count; idx ++)
+ for (size_t idx = 0; idx < handle_count; idx++)
{
obj = jerryx_create_handle (jerry_create_object ());
jerry_set_object_native_pointer (obj, NULL, &native_info);
@@ -73,7 +73,7 @@ test_handle_scope_val (void)
(void) obj;
jerry_gc (JERRY_GC_PRESSURE_LOW);
- TEST_ASSERT (native_free_cb_call_count == (handle_count -1));
+ TEST_ASSERT (native_free_cb_call_count == (handle_count - 1));
jerryx_close_handle_scope (scope);
} /* test_handle_scope_val */
diff --git a/tests/unit-ext/test-ext-handle-scope-nested.c b/tests/unit-ext/test-ext-handle-scope-nested.c
index 6f4cd37f..9e7a16a3 100644
--- a/tests/unit-ext/test-ext-handle-scope-nested.c
+++ b/tests/unit-ext/test-ext-handle-scope-nested.c
@@ -21,6 +21,7 @@
*/
#include "jerryscript.h"
+
#include "jerryscript-ext/handle-scope.h"
#include "test-common.h"
@@ -35,8 +36,7 @@ native_free_cb (void *native_p, /**< native pointer */
++native_free_cb_call_count;
} /* native_free_cb */
-static const jerry_object_native_info_t native_info =
-{
+static const jerry_object_native_info_t native_info = {
.free_cb = native_free_cb,
.number_of_references = 0,
.offset_of_references = 0,
diff --git a/tests/unit-ext/test-ext-handle-scope-remove.c b/tests/unit-ext/test-ext-handle-scope-remove.c
index dccc5c0d..c1dacba7 100644
--- a/tests/unit-ext/test-ext-handle-scope-remove.c
+++ b/tests/unit-ext/test-ext-handle-scope-remove.c
@@ -18,6 +18,7 @@
*/
#include "jerryscript.h"
+
#include "jerryscript-ext/handle-scope.h"
#include "test-common.h"
@@ -32,8 +33,7 @@ native_free_cb (void *native_p, /**< native pointer */
++native_free_cb_call_count;
} /* native_free_cb */
-static const jerry_object_native_info_t native_info =
-{
+static const jerry_object_native_info_t native_info = {
.free_cb = native_free_cb,
.number_of_references = 0,
.offset_of_references = 0,
diff --git a/tests/unit-ext/test-ext-handle-scope-root.c b/tests/unit-ext/test-ext-handle-scope-root.c
index f363ed12..cd282fd6 100644
--- a/tests/unit-ext/test-ext-handle-scope-root.c
+++ b/tests/unit-ext/test-ext-handle-scope-root.c
@@ -18,6 +18,7 @@
*/
#include "jerryscript.h"
+
#include "jerryscript-ext/handle-scope.h"
#include "test-common.h"
@@ -33,8 +34,7 @@ native_free_cb (void *native_p, /**< native pointer */
++native_free_cb_call_count;
} /* native_free_cb */
-static const jerry_object_native_info_t native_info =
-{
+static const jerry_object_native_info_t native_info = {
.free_cb = native_free_cb,
.number_of_references = 0,
.offset_of_references = 0,
diff --git a/tests/unit-ext/test-ext-handle-scope.c b/tests/unit-ext/test-ext-handle-scope.c
index 60225654..58381735 100644
--- a/tests/unit-ext/test-ext-handle-scope.c
+++ b/tests/unit-ext/test-ext-handle-scope.c
@@ -18,6 +18,7 @@
*/
#include "jerryscript.h"
+
#include "jerryscript-ext/handle-scope.h"
#include "test-common.h"
@@ -32,8 +33,7 @@ native_free_cb (void *native_p, /**< native pointer */
++native_free_cb_call_count;
} /* native_free_cb */
-static const jerry_object_native_info_t native_info =
-{
+static const jerry_object_native_info_t native_info = {
.free_cb = native_free_cb,
.number_of_references = 0,
.offset_of_references = 0,
diff --git a/tests/unit-ext/test-ext-method-register.c b/tests/unit-ext/test-ext-method-register.c
index 119417dc..d39c2892 100644
--- a/tests/unit-ext/test-ext-method-register.c
+++ b/tests/unit-ext/test-ext-method-register.c
@@ -17,12 +17,13 @@
* Unit test for jerry-ext/handler property registration
*/
+#include <string.h>
+
#include "jerryscript.h"
+
#include "jerryscript-ext/handler.h"
#include "test-common.h"
-#include <string.h>
-
static jerry_value_t
method_hello (const jerry_call_info_t *call_info_p, /**< call information */
const jerry_value_t jargv[], /**< arguments */
@@ -64,16 +65,11 @@ test_simple_registration (void)
jerry_value_t target_object = jerry_create_object ();
// Test simple registration
- jerryx_property_entry methods[] =
- {
- JERRYX_PROPERTY_FUNCTION ("hello", method_hello),
- JERRYX_PROPERTY_NUMBER ("my_number", 42.5),
- JERRYX_PROPERTY_STRING ("my_str", "super_str"),
- JERRYX_PROPERTY_STRING_SZ ("my_str_sz", "super_str", 6),
- JERRYX_PROPERTY_BOOLEAN ("my_bool", true),
- JERRYX_PROPERTY_BOOLEAN ("my_bool_false", false),
- JERRYX_PROPERTY_UNDEFINED ("my_non_value"),
- JERRYX_PROPERTY_LIST_END (),
+ jerryx_property_entry methods[] = {
+ JERRYX_PROPERTY_FUNCTION ("hello", method_hello), JERRYX_PROPERTY_NUMBER ("my_number", 42.5),
+ JERRYX_PROPERTY_STRING ("my_str", "super_str"), JERRYX_PROPERTY_STRING_SZ ("my_str_sz", "super_str", 6),
+ JERRYX_PROPERTY_BOOLEAN ("my_bool", true), JERRYX_PROPERTY_BOOLEAN ("my_bool_false", false),
+ JERRYX_PROPERTY_UNDEFINED ("my_non_value"), JERRYX_PROPERTY_LIST_END (),
};
jerryx_register_result register_result = jerryx_set_properties (target_object, methods);
@@ -196,8 +192,7 @@ test_error_single_function (void)
jerry_value_t target_object = jerry_create_object ();
freeze_property (target_object, target_prop);
- jerryx_property_entry methods[] =
- {
+ jerryx_property_entry methods[] = {
JERRYX_PROPERTY_FUNCTION (target_prop, method_hello), // This registration should fail
JERRYX_PROPERTY_LIST_END (),
};
@@ -228,8 +223,7 @@ test_error_multiple_functions (void)
jerry_value_t target_object = jerry_create_object ();
freeze_property (target_object, prop_err);
- jerryx_property_entry methods[] =
- {
+ jerryx_property_entry methods[] = {
JERRYX_PROPERTY_FUNCTION (prop_ok, method_hello), // This registration is ok
JERRYX_PROPERTY_FUNCTION (prop_err, method_hello), // This registration should fail
JERRYX_PROPERTY_FUNCTION (prop_not, method_hello), // This registration is not done
@@ -254,16 +248,12 @@ test_error_multiple_functions (void)
// Try calling the method
jerry_value_t prop_ok_func = jerry_get_property (target_object, prop_ok_val);
TEST_ASSERT (jerry_value_is_function (prop_ok_func) == true);
- jerry_value_t args[2] =
- {
+ jerry_value_t args[2] = {
jerry_create_number (22),
jerry_create_number (-3),
};
jerry_size_t args_cnt = sizeof (args) / sizeof (jerry_value_t);
- jerry_value_t func_result = jerry_call_function (prop_ok_func,
- jerry_create_undefined (),
- args,
- args_cnt);
+ jerry_value_t func_result = jerry_call_function (prop_ok_func, jerry_create_undefined (), args, args_cnt);
TEST_ASSERT (jerry_value_is_number (func_result) == true);
TEST_ASSERT ((uint32_t) jerry_get_number_value (func_result) == 2u);
jerry_release_value (func_result);
diff --git a/tests/unit-ext/test-ext-module-canonical.c b/tests/unit-ext/test-ext-module-canonical.c
index a6c3e812..07c00b03 100644
--- a/tests/unit-ext/test-ext-module-canonical.c
+++ b/tests/unit-ext/test-ext-module-canonical.c
@@ -16,11 +16,12 @@
#include <string.h>
#include "jerryscript.h"
-#include "test-common.h"
+
#include "jerryscript-ext/module.h"
+#include "test-common.h"
#define ACTUAL_NAME "alice"
-#define ALIAS_NAME "bob"
+#define ALIAS_NAME "bob"
static jerry_value_t
get_canonical_name (const jerry_value_t name)
@@ -60,11 +61,8 @@ resolve (const jerry_value_t canonical_name, jerry_value_t *result)
return false;
} /* resolve */
-static const jerryx_module_resolver_t canonical_test =
-{
- .get_canonical_name_p = get_canonical_name,
- .resolve_p = resolve
-};
+static const jerryx_module_resolver_t canonical_test = { .get_canonical_name_p = get_canonical_name,
+ .resolve_p = resolve };
#define TEST_VALUE 95.0
diff --git a/tests/unit-ext/test-ext-module-empty.c b/tests/unit-ext/test-ext-module-empty.c
index 0e316582..b9b0ad22 100644
--- a/tests/unit-ext/test-ext-module-empty.c
+++ b/tests/unit-ext/test-ext-module-empty.c
@@ -16,8 +16,9 @@
#include <string.h>
#include "jerryscript.h"
-#include "test-common.h"
+
#include "jerryscript-ext/module.h"
+#include "test-common.h"
int
main (int argc, char **argv)
diff --git a/tests/unit-math/test-math.c b/tests/unit-math/test-math.c
index 67e2e2c4..aa25a856 100644
--- a/tests/unit-math/test-math.c
+++ b/tests/unit-math/test-math.c
@@ -51,9 +51,12 @@ check_double (const char *expr, double computed, double expected)
computed_bits.value = computed;
expected_bits.value = expected;
- printf ("%s = 0x%08x%08x [expected=0x%08x%08x] ", expr,
- (unsigned int) computed_bits.bits32[1], (unsigned int) computed_bits.bits32[0],
- (unsigned int) expected_bits.bits32[1], (unsigned int) expected_bits.bits32[0]);
+ printf ("%s = 0x%08x%08x [expected=0x%08x%08x] ",
+ expr,
+ (unsigned int) computed_bits.bits32[1],
+ (unsigned int) computed_bits.bits32[0],
+ (unsigned int) expected_bits.bits32[1],
+ (unsigned int) expected_bits.bits32[0]);
bool result;
if (isnan (computed) && isnan (expected))
diff --git a/tools/amalgam.py b/tools/amalgam.py
index 4d788873..f84629da 100755
--- a/tools/amalgam.py
+++ b/tools/amalgam.py
@@ -250,7 +250,7 @@ def amalgamate_jerry_core(output_dir):
amalgamate(
base_dir=JERRY_CORE,
input_files=[
- os.path.join(JERRY_CORE, 'api', 'jerry.c'),
+ os.path.join(JERRY_CORE, 'api', 'jerryscript.c'),
# Add the global built-in by default to include some common items
# to avoid problems with common built-in headers
os.path.join(JERRY_CORE, 'ecma', 'builtin-objects', 'ecma-builtins.c'),
diff --git a/tools/apt-get-install-deps.sh b/tools/apt-get-install-deps.sh
index f4f39640..23261be3 100755
--- a/tools/apt-get-install-deps.sh
+++ b/tools/apt-get-install-deps.sh
@@ -23,4 +23,4 @@ ${SUDO} apt-get install -q -y \
make cmake \
gcc gcc-multilib \
doxygen \
- cppcheck vera++ python pylint python-serial
+ cppcheck clang-format-10 python pylint python-serial
diff --git a/tools/brew-install-deps.sh b/tools/brew-install-deps.sh
index 8e4c7834..e9e37587 100755
--- a/tools/brew-install-deps.sh
+++ b/tools/brew-install-deps.sh
@@ -18,7 +18,7 @@ brew update
PKGS="
cmake
- cppcheck vera++
+ cppcheck clang-format-10
"
for pkg in $PKGS
diff --git a/tools/check-format.py b/tools/check-format.py
new file mode 100755
index 00000000..eaf5d7fe
--- /dev/null
+++ b/tools/check-format.py
@@ -0,0 +1,137 @@
+#!/usr/bin/env python
+
+# Copyright JS Foundation and other contributors, http://js.foundation
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+from __future__ import print_function
+
+import argparse
+import multiprocessing
+import subprocess
+from os import path
+from glob import glob
+import sys
+import re
+
+from settings import PROJECT_DIR
+
+RE_CLANG_FORMAT_VERSION = re.compile(
+ r".*clang-format version (?P<version>\d{2})\.")
+RE_DIRECTIVE_COMMENT = re.compile(r"^#\s*(else|endif)$", re.MULTILINE)
+RE_FUNCTION_NAME_COMMENT = re.compile(
+ r"^\}(?!(?:\s\/\*\s\w+\s\*\/$|\s?\w*;))", re.MULTILINE)
+
+CLANG_FORMAT_MIN_VERSION = 10
+
+FOLDERS = ["jerry-core",
+ "jerry-ext",
+ "jerry-port",
+ "jerry-math",
+ "jerry-main",
+ "tests/unit-core",
+ "tests/unit-ext",
+ "tests/unit-math"]
+
+
+def get_arguments():
+ parser = argparse.ArgumentParser()
+ parser.add_argument('--fix', action='store_true', dest='fix',
+ help='fix source code stlye')
+ parser.add_argument('--clang-format', dest='clang_format', default='clang-format-%d' % CLANG_FORMAT_MIN_VERSION,
+ help='path to clang-format executable')
+
+ script_args = parser.parse_args()
+ return script_args
+
+
+def check_clang_format(args, source_file_name):
+ cmd = [args.clang_format]
+
+ if args.fix:
+ cmd.append('-i')
+ else:
+ cmd.extend(['--dry-run', '--Werror'])
+
+ cmd.append(source_file_name)
+
+ proc = subprocess.Popen(cmd, stdout=subprocess.PIPE,
+ stderr=subprocess.PIPE)
+ _, error = proc.communicate()
+
+ if proc.returncode == 0:
+ return 0
+
+ print(error.decode('utf8'))
+
+ return 1
+
+
+def check_comments(regexps, source_file_name):
+ failed = 0
+
+ with open(source_file_name, encoding='utf-8') as source_file:
+ data = source_file.read()
+
+ for regexp in regexps:
+ for match in re.finditer(regexp, data):
+ failed += 1
+ print("Invalid/Missing comment in %s:%d" %
+ (source_file_name, data.count('\n', 0, match.start()) + 1))
+
+ return 1 if failed else 0
+
+
+def run_pass(pool, process, process_args):
+ return sum(pool.starmap(process, process_args))
+
+
+def check_clang_format_version(args):
+ try:
+ out = subprocess.check_output([args.clang_format, '--version'])
+ match = RE_CLANG_FORMAT_VERSION.match(out.decode('utf8'))
+
+ if match and int(match.group('version')) >= CLANG_FORMAT_MIN_VERSION:
+ return 0
+ except OSError:
+ pass
+
+ return 1
+
+
+def main(args):
+ if check_clang_format_version(args) != 0:
+ print("clang-format >= %d is not installed." %
+ CLANG_FORMAT_MIN_VERSION)
+ return 1
+
+ pool = multiprocessing.Pool()
+ failed = 0
+
+ for folder in FOLDERS:
+ # pylint: disable=unexpected-keyword-arg
+ files = sum(([glob(path.join(PROJECT_DIR, folder, "**/*.%s" % e), recursive=True)
+ for e in ['c', 'h']]), [])
+
+ failed += run_pass(pool, check_clang_format,
+ [(args, sourece_file) for sourece_file in files])
+ failed += run_pass(pool, check_comments,
+ [([RE_DIRECTIVE_COMMENT, RE_FUNCTION_NAME_COMMENT], sourece_file) for sourece_file in files])
+
+ pool.close()
+
+ return 1 if failed else 0
+
+
+if __name__ == "__main__":
+ sys.exit(main(get_arguments()))
diff --git a/tools/check-vera.sh b/tools/check-vera.sh
deleted file mode 100755
index 9ce86367..00000000
--- a/tools/check-vera.sh
+++ /dev/null
@@ -1,31 +0,0 @@
-#!/bin/bash
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-JERRY_CORE_FILES=`find ./jerry-core -name "*.c" -or -name "*.h"`
-JERRY_EXT_FILES=`find ./jerry-ext -name "*.c" -or -name "*.h"`
-JERRY_PORT_FILES=`find ./jerry-port -name "*.c" -or -name "*.h"`
-JERRY_MATH_FILES=`find ./jerry-math -name "*.c" -or -name "*.h"`
-JERRY_MAIN_FILES=`find ./jerry-main -name "*.c" -or -name "*.h"`
-UNIT_TEST_FILES=`find ./tests/unit-* -name "*.c" -or -name "*.h"`
-
-if [ -n "$1" ]
-then
-MANUAL_CHECK_FILES=`find $1 -name "*.c" -or -name "*.h"`
-fi
-
-vera++ -r tools/vera++ -p jerry \
- -e --no-duplicate \
- $MANUAL_CHECK_FILES $JERRY_CORE_FILES $JERRY_EXT_FILES $JERRY_PORT_FILES $JERRY_MATH_FILES $JERRY_MAIN_FILES $UNIT_TEST_FILES
diff --git a/tools/gen-magic-strings.py b/tools/gen-magic-strings.py
index bf1e74da..4d77f1d5 100755
--- a/tools/gen-magic-strings.py
+++ b/tools/gen-magic-strings.py
@@ -23,17 +23,17 @@ except ImportError:
import argparse
import fileinput
+import subprocess
import json
import os
import re
-from settings import PROJECT_DIR
+from settings import FORMAT_SCRIPT, PROJECT_DIR
MAGIC_STRINGS_INI = os.path.join(PROJECT_DIR, 'jerry-core', 'lit', 'lit-magic-strings.ini')
MAGIC_STRINGS_INC_H = os.path.join(PROJECT_DIR, 'jerry-core', 'lit', 'lit-magic-strings.inc.h')
-
def debug_dump(obj):
def deepcopy(obj):
if isinstance(obj, (list, tuple)):
@@ -172,7 +172,7 @@ def calculate_magic_string_guards(defs, uses, debug=False):
# guard1 = A and B and C and D and E and F
# guard2 = A and B and C
# then guard1 or guard2 == guard2.
- guards = [set(guard_tuple) for guard_tuple in uses[str_ref].keys()]
+ guards = [set(guard_tuple) for guard_tuple in sorted(uses[str_ref].keys())]
for i, guard_i in enumerate(guards):
if guard_i is None:
continue
@@ -230,7 +230,7 @@ def generate_magic_string_defs(gen_file, defs):
for str_ref, str_value, guards in defs:
if last_guards != guards:
if () not in last_guards:
- print('#endif', file=gen_file)
+ print('#endif /* {guards} */'.format(guards=guards_to_str(last_guards)), file=gen_file)
if () not in guards:
print('#if {guards}'.format(guards=guards_to_str(guards)), file=gen_file)
@@ -240,7 +240,7 @@ def generate_magic_string_defs(gen_file, defs):
last_guards = guards
if () not in last_guards:
- print('#endif', file=gen_file)
+ print('#endif /* {guards} */'.format(guards=guards_to_str(last_guards)), file=gen_file)
def generate_first_magic_strings(gen_file, defs):
@@ -258,7 +258,7 @@ def generate_first_magic_strings(gen_file, defs):
continue
print('#elif {guards}'.format(guards=guards_to_str(guards)), file=gen_file)
elif () in guards and () not in last_guards:
- print('#else', file=gen_file)
+ print('#else /* !({guards}) */'.format(guards=guards_to_str(last_guards)), file=gen_file)
print('LIT_MAGIC_STRING_FIRST_STRING_WITH_SIZE ({size}, {str_ref})'
.format(size=size, str_ref=str_ref), file=gen_file)
@@ -269,8 +269,7 @@ def generate_first_magic_strings(gen_file, defs):
last_guards = guards
if () not in last_guards:
- print('#endif', file=gen_file)
-
+ print('#endif /* {guards} */'.format(guards=guards_to_str(last_guards)), file=gen_file)
def main():
parser = argparse.ArgumentParser(description='lit-magic-strings.inc.h generator')
@@ -287,6 +286,7 @@ def main():
generate_magic_string_defs(gen_file, extended_defs)
generate_first_magic_strings(gen_file, extended_defs)
+ subprocess.call([FORMAT_SCRIPT, '--fix'])
if __name__ == '__main__':
main()
diff --git a/tools/run-tests.py b/tools/run-tests.py
index f449206e..dd5cf68a 100755
--- a/tools/run-tests.py
+++ b/tools/run-tests.py
@@ -188,8 +188,8 @@ def get_arguments():
help='Run doxygen')
parser.add_argument('--check-pylint', action='store_true',
help='Run pylint')
- parser.add_argument('--check-vera', action='store_true',
- help='Run vera check')
+ parser.add_argument('--check-format', action='store_true',
+ help='Run format check')
parser.add_argument('--check-license', action='store_true',
help='Run license check')
parser.add_argument('--check-magic-strings', action='store_true',
@@ -504,7 +504,7 @@ def main(options):
Check(options.check_cppcheck, run_check, [settings.CPPCHECK_SCRIPT]),
Check(options.check_doxygen, run_check, [settings.DOXYGEN_SCRIPT]),
Check(options.check_pylint, run_check, [settings.PYLINT_SCRIPT]),
- Check(options.check_vera, run_check, [settings.VERA_SCRIPT]),
+ Check(options.check_format, run_check, [settings.FORMAT_SCRIPT]),
Check(options.check_license, run_check, [settings.LICENSE_SCRIPT]),
Check(options.check_magic_strings, run_check, [settings.MAGIC_STRINGS_SCRIPT]),
Check(options.jerry_debugger, run_jerry_debugger_tests, options),
diff --git a/tools/settings.py b/tools/settings.py
index 7b5dc795..095b52b1 100755
--- a/tools/settings.py
+++ b/tools/settings.py
@@ -33,5 +33,5 @@ PYLINT_SCRIPT = path.join(TOOLS_DIR, 'check-pylint.sh')
SIGNED_OFF_SCRIPT = path.join(TOOLS_DIR, 'check-signed-off.sh')
TEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-test-suite.py')
TEST262_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-test-suite-test262.py')
-VERA_SCRIPT = path.join(TOOLS_DIR, 'check-vera.sh')
+FORMAT_SCRIPT = path.join(TOOLS_DIR, 'check-format.py')
UNITTEST_RUNNER_SCRIPT = path.join(TOOLS_DIR, 'runners/run-unittests.py')
diff --git a/tools/vera++/profiles/jerry b/tools/vera++/profiles/jerry
deleted file mode 100644
index 1ffa7a50..00000000
--- a/tools/vera++/profiles/jerry
+++ /dev/null
@@ -1,19 +0,0 @@
-set rules {
- jerry_always_curly
- jerry_braces_on_separate_line
- jerry_braces_same_line_or_column
- jerry_comment_function_end
- jerry_funcname_space_parentheses
- jerry_identifier_no_space_bracket
- jerry_indentation
- jerry_max_line_length
- jerry_no_space_after_opening_parentheses
- jerry_no_space_before_closing_parentheses
- jerry_no_tabs
- jerry_no_trailing_spaces
- jerry_no_leading_or_trailing_empty_line
- jerry_no_consecutive_empty_lines
- jerry_pointer_declarator_space
- jerry_switch_case
- jerry_typecast_space_parentheses
-}
diff --git a/tools/vera++/scripts/rules/jerry_always_curly.tcl b/tools/vera++/scripts/rules/jerry_always_curly.tcl
deleted file mode 100644
index ec5dd748..00000000
--- a/tools/vera++/scripts/rules/jerry_always_curly.tcl
+++ /dev/null
@@ -1,87 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-foreach file_name [getSourceFileNames] {
- set state "control"
- set do_marks {}
- set prev_tok_type ""
- set prev_ctrl ""
- set expect_while false
- set expect_open_brace false
- set paren_count 0
-
- foreach token [getTokens $file_name 1 0 -1 -1 {if do while else for leftparen rightparen semicolon leftbrace rightbrace}] {
- set tok_val [lindex $token 0]
- set line_num [lindex $token 1]
- set col_num [lindex $token 2]
- set tok_type [lindex $token 3]
-
- if {$state == "expression"} {
- # puts "expression $paren_count $tok_type ($line_num , $col_num)"
- if {$tok_type == "leftparen"} {
- incr paren_count
- } elseif {$tok_type == "rightparen"} {
- incr paren_count -1
- if {$paren_count == 0} {
- set state "control"
- set expect_open_brace true
- } elseif {$paren_count < 0 } {
- report $file_name $line_num "unexpected right parentheses"
- }
- } elseif {$tok_type != "semicolon"} {
- report $file_name $line_num "unexpected token: $tok_type"
- }
- } else {
- if {$expect_open_brace == true} {
- if {$tok_type == "if" && $prev_tok_type == "else"} {
- # empty
- } elseif {$tok_type != "leftbrace"} {
- report $file_name [lindex $prev_ctrl 1] "brace after \'[lindex $prev_ctrl 3]\' required"
- }
- set expect_open_brace false
- }
-
- if {$tok_type == "while" && ($expect_while == true || [lindex $prev_ctrl 3] == "do")} {
- set expect_while false
- set prev_ctrl ""
- } elseif {$tok_type in {if for while}} {
- set state "expression"
- set prev_ctrl $token
- } elseif {$tok_type in {do else}} {
- set expect_open_brace true
- set prev_ctrl $token
- } elseif {$tok_type == "leftbrace"} {
- if {[lindex $prev_ctrl 3] == "do"} {
- lappend do_marks 1
- } else {
- lappend do_marks 0
- }
- set prev_ctrl ""
- } elseif {$tok_type == "rightbrace"} {
- if {[llength $do_marks] > 0} {
- if {[lindex $do_marks end] == 1} {
- set expect_while true
- }
- set do_marks [lreplace $do_marks end end]
- } else {
- report $file_name $line_num "unmatched brace"
- }
- }
- }
-
- set prev_tok_type $tok_type
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_braces_on_separate_line.tcl b/tools/vera++/scripts/rules/jerry_braces_on_separate_line.tcl
deleted file mode 100644
index c1429487..00000000
--- a/tools/vera++/scripts/rules/jerry_braces_on_separate_line.tcl
+++ /dev/null
@@ -1,115 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-foreach file_name [getSourceFileNames] {
- set state "normal"
- set lines {}
- set cols {}
- set struct_marks {}
- set expect_struct_name false
- set prev_tok ""
- set def_start false
- set expect_newline false
- set check_newline true
-
- foreach token [getTokens $file_name 1 0 -1 -1 {}] {
- set tok_val [lindex $token 0]
- set line_num [lindex $token 1]
- set col_num [lindex $token 2]
- set tok_type [lindex $token 3]
-
- if {$state == "macro"} {
- if {$col_num == 0} {
- set state "normal"
- } else {
- continue
- }
- }
-
- if {$tok_type in {space ccomment cppcomment newline}} {
- continue
- }
-
- if {$tok_type == "pp_define"} {
- set state "macro"
- set prev_tok ""
- set def_start false
- continue
- }
-
- if {$expect_struct_name == true} {
- if {$tok_type == "identifier" && $line_num != [lindex $prev_tok 1]} {
- report $file_name $line_num "type name should be on the same line with the rightbrace"
- }
- set expect_struct_name false
- }
-
- # check that rightbrace and typename (in struct, union and enum definitons) are on the same line
- if {$tok_type in {struct enum union}} {
- set def_start true
- } elseif {$tok_type == "semicolon"} {
- set def_start false
- } elseif {$tok_type == "leftbrace"} {
- lappend cols $col_num
- lappend lines $line_num
- if {$def_start == true} {
- lappend struct_marks 1
- set def_start false
- } elseif {[lindex $prev_tok 3] == "assign"} {
- lappend struct_marks 2
- set check_newline false
- } else {
- lappend struct_marks 0
- }
- } elseif {$tok_type == "rightbrace"} {
- if {[llength $lines] > 0} {
- if {[lindex $struct_marks end] == 1} {
- set expect_struct_name true
- set check_newline false
- } elseif {[lindex $struct_marks end] == 2} {
- set check_newline false
- }
- set lines [lreplace $lines end end]
- set cols [lreplace $cols end end]
- set struct_marks [lreplace $struct_marks end end]
- } else {
- report $file_name $line_num "unmatched brace"
- }
- }
-
- # check that braces are on separate lines
- if {$check_newline == true} {
- if {$expect_newline == true} {
- if {$tok_type == "semicolon"} {
- # empty
- } elseif {[lindex $prev_tok 1] == $line_num} {
- report $file_name $line_num "brace should be placed on a separate line"
- } else {
- set expect_newline false
- }
- } elseif {$tok_type in {leftbrace rightbrace}} {
- if {[lindex $prev_tok 1] == $line_num} {
- report $file_name $line_num "brace should be placed on a separate line"
- }
- set expect_newline true
- }
- } else {
- set check_newline true
- }
-
- set prev_tok $token
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_braces_same_line_or_column.tcl b/tools/vera++/scripts/rules/jerry_braces_same_line_or_column.tcl
deleted file mode 100644
index 821f4477..00000000
--- a/tools/vera++/scripts/rules/jerry_braces_same_line_or_column.tcl
+++ /dev/null
@@ -1,61 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-foreach file_name [getSourceFileNames] {
- set state "normal"
- set lines {}
- set cols {}
-
- foreach token [getTokens $file_name 1 0 -1 -1 {}] {
- set tok_val [lindex $token 0]
- set line_num [lindex $token 1]
- set col_num [lindex $token 2]
- set tok_type [lindex $token 3]
-
- if {$state == "macro"} {
- if {$col_num == 0} {
- set state "normal"
- } else {
- set prev_tok_line $line_num
- continue
- }
- }
-
- if {$tok_type in {space ccomment cppcomment newline}} {
- continue
- }
-
- if {$tok_type == "pp_define"} {
- set state "macro"
- continue
- }
-
- if {$tok_type == "leftbrace"} {
- lappend cols $col_num
- lappend lines $line_num
- } elseif {$tok_type == "rightbrace"} {
- if {[llength $lines] > 0} {
- if {[lindex $lines end] != $line_num && [lindex $cols end] != $col_num} {
- report $file_name $line_num "matching braces should be on the same line or column"
- }
- set lines [lreplace $lines end end]
- set cols [lreplace $cols end end]
- } else {
- report $file_name $line_num "unmatched brace"
- }
- }
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_comment_function_end.tcl b/tools/vera++/scripts/rules/jerry_comment_function_end.tcl
deleted file mode 100644
index e94a2716..00000000
--- a/tools/vera++/scripts/rules/jerry_comment_function_end.tcl
+++ /dev/null
@@ -1,52 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-foreach fileName [getSourceFileNames] {
- set funcStart 0
- set funcName ""
- set lineNumber 1
- foreach line [getAllLines $fileName] {
- if {[regexp {^((static |const )*\w+ )*\w+ \(.*[,\)]} $line]} {
- set type {}
- set modifier {}
- if {$funcStart == 0} {
- regexp {^((static |const )*\w+ )*(\w+) \(} $line matched type modifier funcName
- }
- }
-
- if {[regexp {^\{$} $line]} {
- set funcStart 1
- }
-
- if {$funcStart == 1} {
- if {[regexp {^\}$} $line] && [string length $funcName] != 0} {
- report $fileName $lineNumber "missing comment at the end of function: /* $funcName */"
- set funcStart 0
- } elseif {[regexp {^\} /\*\s*\w+\s*\*/$} $line] && [string length $funcName] != 0} {
- set comment {}
- regexp {^\} /\*\s*(\w+)\s*\*/$} $line -> comment
- if {$comment != $funcName} {
- report $fileName $lineNumber "comment missmatch. (Current: $comment, Expected: $funcName) "
- }
- set funcStart 0
- } elseif {[regexp {^\}.*;?$} $line]} {
- set funcStart 0
- }
- }
-
- incr lineNumber
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_funcname_space_parentheses.tcl b/tools/vera++/scripts/rules/jerry_funcname_space_parentheses.tcl
deleted file mode 100644
index c0127364..00000000
--- a/tools/vera++/scripts/rules/jerry_funcname_space_parentheses.tcl
+++ /dev/null
@@ -1,60 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-proc check_part_of_the_file {file line_num col_start col_end} {
- if {$col_start == $col_end} {
- return
- }
- set line [getLine $file $line_num]
-
- if {[regexp {^\s*#[ ]*define} $line]} {
- return
- }
-
- set line [string range $line $col_start $col_end]
-
- if {[regexp {([[:alnum:]][\s]{2,}\()|([[:alnum:]]\()} $line]} {
- report $file $line_num "there should be exactly one space before left parentheses"
- }
-}
-
-foreach fileName [getSourceFileNames] {
- set checkLine 1
- set checkColStart 0
- set seenOmitToken false
- foreach token [getTokens $fileName 1 0 -1 -1 {}] {
- set lineNumber [lindex $token 1]
- set colNumber [lindex $token 2]
- set tokenType [lindex $token 3]
-
- if {$checkLine != $lineNumber} {
- if {!$seenOmitToken} {
- check_part_of_the_file $fileName $checkLine $checkColStart end
- }
- set checkColStart $colNumber
- set checkLine $lineNumber
- } elseif {$seenOmitToken} {
- set checkColStart $colNumber
- }
-
- if {$tokenType in {ccomment cppcomment stringlit}} {
- check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
- set seenOmitToken true
- } else {
- set seenOmitToken false
- }
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_identifier_no_space_bracket.tcl b/tools/vera++/scripts/rules/jerry_identifier_no_space_bracket.tcl
deleted file mode 100644
index 5f02dce2..00000000
--- a/tools/vera++/scripts/rules/jerry_identifier_no_space_bracket.tcl
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-proc check_part_of_the_file {file line_num col_start col_end} {
- if {$col_start == $col_end} {
- return
- }
-
- set line [getLine $file $line_num]
- set line [string range $line $col_start $col_end]
-
- if {[regexp {[[:alnum:]_][\s]+\[} $line]} {
- report $file $line_num "there should be no spaces between identifier and left bracket"
- }
-}
-
-foreach fileName [getSourceFileNames] {
- set checkLine 1
- set checkColStart 0
- set seenOmitToken false
- foreach token [getTokens $fileName 1 0 -1 -1 {}] {
- set lineNumber [lindex $token 1]
- set colNumber [lindex $token 2]
- set tokenType [lindex $token 3]
-
- if {$checkLine != $lineNumber} {
- if {!$seenOmitToken} {
- check_part_of_the_file $fileName $checkLine $checkColStart end
- }
- set checkColStart $colNumber
- set checkLine $lineNumber
- } elseif {$seenOmitToken} {
- set checkColStart $colNumber
- }
-
- if {$tokenType in {ccomment cppcomment stringlit}} {
- check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
- set seenOmitToken true
- } else {
- set seenOmitToken false
- }
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_indentation.tcl b/tools/vera++/scripts/rules/jerry_indentation.tcl
deleted file mode 100644
index 97b4352d..00000000
--- a/tools/vera++/scripts/rules/jerry_indentation.tcl
+++ /dev/null
@@ -1,126 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# Indentation
-
-foreach fileName [getSourceFileNames] {
- set indent 0
- set lastCheckedLineNumber -1
- set is_in_comment "no"
- set is_in_pp_define "no"
- set is_in_class "no"
- set is_in_template "no"
- set parentheses_level 0
- set template_brackets_level 0
-
- foreach token [getTokens $fileName 1 0 -1 -1 {}] {
- set type [lindex $token 3]
- set lineNumber [lindex $token 1]
-
- if {$is_in_comment == "yes"} {
- set is_in_comment "no"
- }
-
- if {$type == "newline"} {
- set is_in_pp_define "no"
- } elseif {$type == "class"} {
- set is_in_class "yes"
- } elseif {$type == "template"} {
- set is_in_template "yes"
- } elseif {$is_in_class == "yes" && $type == "semicolon" && $indent == 0} {
- set is_in_class "no"
- } elseif {$type == "ccomment"} {
- set is_in_comment "yes"
- } elseif {[string first "pp_" $type] == 0} {
- if {$type == "pp_define"} {
- set is_in_pp_define "yes"
- }
-
- set lastCheckedLineNumber $lineNumber
- } elseif {$type == "space"} {
- } elseif {$type != "eof"} {
- if {$type == "rightbrace" && $indent > 0} {
- incr indent -2
- }
-
- if {$is_in_pp_define == "no" && $is_in_comment == "no" && $parentheses_level == 0 &&
- $is_in_template == "no"} {
- set line [getLine $fileName $lineNumber]
-
- if {$lineNumber != $lastCheckedLineNumber} {
- if {[regexp {^[[:blank:]]*} $line match]} {
- set real_indent [string length $match]
- if {$indent != $real_indent} {
- if {[regexp {^[[:blank:]]*(private:|public:|protected:)} $line]} {
- if {$indent != $real_indent + 2} {
- set exp_indent [expr {$indent - 2}]
- report $fileName $lineNumber "Indentation: $real_indent -> $exp_indent. Line: '$line'"
- }
- } elseif {![regexp {^[[:alnum:]_]{1,}:$} $line] || $real_indent != 0} {
- report $fileName $lineNumber "Indentation: $real_indent -> $indent. Line: '$line'"
- }
- }
- }
- }
-
- if {$lineNumber == $lastCheckedLineNumber} {
- if {$type == "leftbrace"} {
- if {![regexp {^[[:blank:]]*\{[[:blank:]]*$} $line]
- && ![regexp {[^\{=]=[^\{=]\{.*\},?} $line]} {
- report $fileName $lineNumber "Left brace is not the only non-space character in the line: '$line'"
- }
- }
- if {$type == "rightbrace"} {
- if {![regexp {^.* = .*\{.*\}[,;]?$} $line]
- && ![regexp {[^\{=]=[^\{=]\{.*\}[,;]?} $line]} {
- report $fileName $lineNumber "Right brace is not first non-space character in the line: '$line'"
- }
- }
- }
- if {$type == "rightbrace"} {
- if {![regexp {^[[:blank:]]*\};?((( [a-z_\(][a-z0-9_\(\)]{0,}){1,})?;| /\*.*\*/| //.*)?$} $line]
- && ![regexp {[^\{=]=[^\{=]\{.*\}[,;]?} $line]} {
- report $fileName $lineNumber "Right brace is not the only non-space character in the line and \
- is not single right brace followed by \[a-z0-9_() \] string and single semicolon character: '$line'"
- }
- }
- }
-
- if {$type == "leftbrace"} {
- if {![regexp {^extern "C"} [getLine $fileName [expr {$lineNumber - 1}]]]} {
- incr indent 2
- }
- } elseif {$type == "leftparen"} {
- incr parentheses_level 1
- } elseif {$type == "rightparen"} {
- incr parentheses_level -1
- }
-
- if {$is_in_template == "yes"} {
- if {$type == "less"} {
- incr template_brackets_level
- } elseif {$type == "greater"} {
- incr template_brackets_level -1
- if {$template_brackets_level == 0} {
- set is_in_template "no"
- }
- }
- }
-
- set lastCheckedLineNumber $lineNumber
- }
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_max_line_length.tcl b/tools/vera++/scripts/rules/jerry_max_line_length.tcl
deleted file mode 100644
index a55533a1..00000000
--- a/tools/vera++/scripts/rules/jerry_max_line_length.tcl
+++ /dev/null
@@ -1,27 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set maxLen 120
-
-foreach f [getSourceFileNames] {
- set lineNumber 1
- foreach line [getAllLines $f] {
- if {[string length $line] > $maxLen} {
- report $f $lineNumber "line is longer than ${maxLen} characters"
- }
- incr lineNumber
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_no_consecutive_empty_lines.tcl b/tools/vera++/scripts/rules/jerry_no_consecutive_empty_lines.tcl
deleted file mode 100644
index 030ce84c..00000000
--- a/tools/vera++/scripts/rules/jerry_no_consecutive_empty_lines.tcl
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-set maxEmptyLines 1
-
-foreach f [getSourceFileNames] {
- set lineNumber 1
- set emptyCount 0
- set reported false
- foreach line [getAllLines $f] {
- if {[string trim $line] == ""} {
- incr emptyCount
- if {$emptyCount > $maxEmptyLines && $reported == "false"} {
- report $f $lineNumber "too many consecutive empty lines"
- set reported true
- }
- } else {
- set emptyCount 0
- set reported false
- }
- incr lineNumber
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_no_leading_or_trailing_empty_line.tcl b/tools/vera++/scripts/rules/jerry_no_leading_or_trailing_empty_line.tcl
deleted file mode 100644
index 340dad2c..00000000
--- a/tools/vera++/scripts/rules/jerry_no_leading_or_trailing_empty_line.tcl
+++ /dev/null
@@ -1,30 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-foreach f [getSourceFileNames] {
- set lineCount [getLineCount $f]
- if {$lineCount > 0} {
- set firstLine [getLine $f 1]
- if {[string trim $firstLine] == ""} {
- report $f 1 "leading empty line(s)"
- }
-
- set lastLine [getLine $f $lineCount]
- if {[string trim $lastLine] == ""} {
- report $f $lineCount "trailing empty line(s)"
- }
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_no_space_after_opening_parentheses.tcl b/tools/vera++/scripts/rules/jerry_no_space_after_opening_parentheses.tcl
deleted file mode 100644
index 89561445..00000000
--- a/tools/vera++/scripts/rules/jerry_no_space_after_opening_parentheses.tcl
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-proc check_part_of_the_file {file line_num col_start col_end} {
- if {$col_start == $col_end} {
- return
- }
-
- set line [getLine $file $line_num]
- set line [string range $line $col_start $col_end]
-
- if {[regexp {\(+[[:blank:]]} $line]} {
- report $file $line_num "there should be no blank characters after opening parentheses"
- }
-}
-
-foreach fileName [getSourceFileNames] {
- set checkLine 1
- set checkColStart 0
- set seenOmitToken false
- foreach token [getTokens $fileName 1 0 -1 -1 {}] {
- set lineNumber [lindex $token 1]
- set colNumber [lindex $token 2]
- set tokenType [lindex $token 3]
-
- if {$checkLine != $lineNumber} {
- if {!$seenOmitToken} {
- check_part_of_the_file $fileName $checkLine $checkColStart end
- }
- set checkColStart $colNumber
- set checkLine $lineNumber
- } elseif {$seenOmitToken} {
- set checkColStart $colNumber
- }
-
- if {$tokenType in {ccomment cppcomment stringlit}} {
- check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
- set seenOmitToken true
- } else {
- set seenOmitToken false
- }
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_no_space_before_closing_parentheses.tcl b/tools/vera++/scripts/rules/jerry_no_space_before_closing_parentheses.tcl
deleted file mode 100644
index 8ddc38fe..00000000
--- a/tools/vera++/scripts/rules/jerry_no_space_before_closing_parentheses.tcl
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-proc check_part_of_the_file {file line_num col_start col_end} {
- if {$col_start == $col_end} {
- return
- }
-
- set line [getLine $file $line_num]
- set line [string range $line $col_start $col_end]
-
- if {[regexp {[[:graph:]][[:blank:]]+\)} $line]} {
- report $file $line_num "there should be no blank characters before closing parentheses"
- }
-}
-
-foreach fileName [getSourceFileNames] {
- set checkLine 1
- set checkColStart 0
- set seenOmitToken false
- foreach token [getTokens $fileName 1 0 -1 -1 {}] {
- set lineNumber [lindex $token 1]
- set colNumber [lindex $token 2]
- set tokenType [lindex $token 3]
-
- if {$checkLine != $lineNumber} {
- if {!$seenOmitToken} {
- check_part_of_the_file $fileName $checkLine $checkColStart end
- }
- set checkColStart $colNumber
- set checkLine $lineNumber
- } elseif {$seenOmitToken} {
- set checkColStart $colNumber
- }
-
- if {$tokenType in {ccomment cppcomment stringlit}} {
- check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
- set seenOmitToken true
- } else {
- set seenOmitToken false
- }
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_no_tabs.tcl b/tools/vera++/scripts/rules/jerry_no_tabs.tcl
deleted file mode 100644
index a065c082..00000000
--- a/tools/vera++/scripts/rules/jerry_no_tabs.tcl
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-foreach f [getSourceFileNames] {
- set lineNumber 1
- foreach line [getAllLines $f] {
- if {[regexp {\t} $line]} {
- report $f $lineNumber "tabs are not allowed"
- }
- incr lineNumber
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_no_trailing_spaces.tcl b/tools/vera++/scripts/rules/jerry_no_trailing_spaces.tcl
deleted file mode 100644
index 31ee30f8..00000000
--- a/tools/vera++/scripts/rules/jerry_no_trailing_spaces.tcl
+++ /dev/null
@@ -1,25 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-foreach f [getSourceFileNames] {
- set lineNumber 1
- foreach line [getAllLines $f] {
- if {[regexp {[[:blank:]]$} $line]} {
- report $f $lineNumber "trailing space is not allowed"
- }
- incr lineNumber
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_pointer_declarator_space.tcl b/tools/vera++/scripts/rules/jerry_pointer_declarator_space.tcl
deleted file mode 100644
index c6da4e1a..00000000
--- a/tools/vera++/scripts/rules/jerry_pointer_declarator_space.tcl
+++ /dev/null
@@ -1,58 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-proc check_part_of_the_file {file line_num col_start col_end} {
- if {$col_start == $col_end} {
- return
- }
-
- set line [getLine $file $line_num]
- set line [string range $line $col_start $col_end]
-
- if {[regexp {\w\*\s\w+} $line]
- || [regexp {\w\*\)} $line]
- || [regexp {\w\*$} $line]} {
- report $file $line_num "there should be a space between the referenced type and the pointer declarator."
- }
-}
-
-foreach fileName [getSourceFileNames] {
- set checkLine 1
- set checkColStart 0
- set seenOmitToken false
- foreach token [getTokens $fileName 1 0 -1 -1 {}] {
- set lineNumber [lindex $token 1]
- set colNumber [lindex $token 2]
- set tokenType [lindex $token 3]
-
- if {$checkLine != $lineNumber} {
- if {!$seenOmitToken} {
- check_part_of_the_file $fileName $checkLine $checkColStart end
- }
- set checkColStart $colNumber
- set checkLine $lineNumber
- } elseif {$seenOmitToken} {
- set checkColStart $colNumber
- }
-
- if {$tokenType in {ccomment cppcomment stringlit}} {
- check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
- set seenOmitToken true
- } else {
- set seenOmitToken false
- }
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_switch_case.tcl b/tools/vera++/scripts/rules/jerry_switch_case.tcl
deleted file mode 100644
index d332a124..00000000
--- a/tools/vera++/scripts/rules/jerry_switch_case.tcl
+++ /dev/null
@@ -1,282 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-# switch-case
-
-foreach fileName [getSourceFileNames] {
- set is_in_comment "no"
- set is_in_pp_define "no"
-
- foreach token [getTokens $fileName 1 0 -1 -1 {}] {
- set type [lindex $token 3]
- set lineNumber [lindex $token 1]
-
- if {$is_in_comment == "yes"} {
- set is_in_comment "no"
- }
-
- if {$type == "newline"} {
- set is_in_pp_define "no"
- } elseif {$type == "ccomment"} {
- set is_in_comment "yes"
- } elseif {[string first "pp_" $type] == 0} {
- if {$type == "pp_define"} {
- set is_in_pp_define "yes"
- }
- } elseif {$type == "space"} {
- } elseif {$type != "eof"} {
- if {$is_in_pp_define == "no" && $type == "switch"} {
- set next_token_start [lindex $token 2]
- incr next_token_start 1
- set line_num 0
- set state "switch"
- set case_block "no"
- set seen_braces 0
- foreach next_token [getTokens $fileName $lineNumber $next_token_start -1 -1 {}] {
- set next_token_type [lindex $next_token 3]
- set next_token_value [lindex $next_token 0]
- if {$state == "switch"} {
- if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
- continue
- } elseif {$next_token_type == "leftbrace"} {
- set state "first-case"
- continue
- } else {
- # TODO: check switch
- continue
- }
- } elseif {$state == "first-case"} {
- if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
- continue
- } elseif {$next_token_type == "case"} {
- set state "case"
- continue
- } elseif {$next_token_type == "default"} {
- set state "default"
- continue
- } else {
- # Macros magic: give up
- break
- }
- } elseif {$state == "case"} {
- if {$next_token_type == "space"} {
- set state "space-after-case"
- continue
- } else {
- report $fileName [lindex $next_token 1] "There should be single space character after 'case' keyword (state $state)"
- }
- } elseif {$state == "space-after-case"} {
- if {$next_token_type != "identifier" && $next_token_type != "intlit" && $next_token_type != "charlit" && $next_token_type != "sizeof"} {
- report $fileName [lindex $next_token 1] "There should be single space character after 'case' keyword (state $state, next_token_type $next_token_type)"
- } else {
- set state "case-label"
- continue
- }
- } elseif {$state == "case-label" || $state == "default"} {
- set case_block "no"
- if {$next_token_type != "colon"} {
- continue
- } else {
- set state "colon"
- continue
- }
- } elseif {$state == "after-colon-preprocessor"} {
- if {$next_token_type == "newline"} {
- set state "colon"
- }
- } elseif {$state == "colon"} {
- if {$next_token_type == "space" || $next_token_type == "newline"} {
- continue
- } elseif {$next_token_type == "ccomment"} {
- if {[string match "*FALL*" $next_token_value]} {
- set state "fallthru"
- set line_num [lindex $next_token 1]
- continue
- } else {
- continue
- }
- } elseif {$next_token_type == "case"} {
- set state "case"
- continue
- } elseif {$next_token_type == "default"} {
- set state "default"
- continue
- } elseif {$next_token_type == "leftbrace"} {
- set case_block "yes"
- set state "wait-for-break"
- continue
- } elseif {$next_token_type == "identifier"} {
- if {[string compare "JERRY_UNREACHABLE" $next_token_value] == 0
- || [string first "JERRY_UNIMPLEMENTED" $next_token_value] == 0} {
- set state "wait-for-semicolon"
- continue
- } else {
- set state "wait-for-break"
- continue
- }
- } elseif {$next_token_type == "break"
- || $next_token_type == "continue"
- || $next_token_type == "return"} {
- set state "wait-for-semicolon"
- continue
- } elseif {[string first "pp_" $next_token_type] == 0} {
- set state "after-colon-preprocessor"
- } else {
- set state "wait-for-break"
- continue
- }
- } elseif {$state == "wait-for-semicolon"} {
- if {$next_token_type == "semicolon"} {
- set state "break"
- }
- continue
- } elseif {$state == "wait-for-break"} {
- if {$next_token_type == "case" || $next_token_type == "default"} {
- report $fileName [lindex $next_token 1] "Missing break, continue or FALLTHRU comment before case (state $state)"
- } elseif {$next_token_type == "leftbrace"} {
- set state "inside-braces"
- incr seen_braces 1
- continue
- } elseif {$next_token_type == "rightbrace"} {
- if {$case_block == "yes"} {
- set state "case-blocks-end"
- continue
- } else {
- break
- }
- } elseif {[string compare "JERRY_UNREACHABLE" $next_token_value] == 0
- || [string first "JERRY_UNIMPLEMENTED" $next_token_value] == 0} {
- set state "wait-for-semicolon"
- continue
- } elseif {$next_token_type == "ccomment" && [string match "*FALL*" $next_token_value]} {
- set state "fallthru"
- set line_num [lindex $next_token 1]
- continue
- } elseif {$next_token_type == "break"
- || $next_token_type == "continue"
- || $next_token_type == "return"
- || $next_token_type == "goto"} {
- set state "wait-for-semicolon"
- continue
- }
- continue
- } elseif {$state == "break" || $state == "fallthru"} {
- if {$case_block == "no"} {
- if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
- continue
- } elseif {$next_token_type == "case"} {
- set state "case"
- continue
- } elseif {$next_token_type == "default"} {
- set state "default"
- continue
- } elseif {$next_token_type == "leftbrace"} {
- set state "inside-braces"
- incr seen_braces 1
- continue
- } elseif {$next_token_type == "rightbrace"} {
- lappend switch_ends [lindex $next_token 1]
- break
- } elseif {$next_token_type == "break"
- || $next_token_type == "continue"
- || $next_token_type == "return"} {
- set state "wait-for-semicolon"
- continue
- } else {
- set state "wait-for-break"
- continue
- }
- } else {
- if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
- continue
- } elseif {$next_token_type == "case"} {
- set state "case"
- continue
- } elseif {$next_token_type == "default"} {
- set state "default"
- continue
- } elseif {$next_token_type == "leftbrace"} {
- set state "inside-braces"
- incr seen_braces 1
- continue
- } elseif {$next_token_type == "rightbrace"} {
- set state "after-rightbrace"
- continue
- } elseif {$next_token_type == "break"
- || $next_token_type == "continue"
- || $next_token_type == "return"} {
- set state "wait-for-semicolon"
- continue
- } else {
- set state "wait-for-break"
- continue
- }
- }
- } elseif {$state == "inside-braces"} {
- if {$next_token_type == "rightbrace"} {
- incr seen_braces -1
- if {$seen_braces == 0} {
- set state "wait-for-break"
- continue
- }
- } elseif {$next_token_type == "leftbrace"} {
- incr seen_braces 1
- }
- continue
- } elseif {$state == "after-rightbrace-preprocessor"} {
- if {$next_token_type == "newline"} {
- set state "after-rightbrace"
- }
- } elseif {$state == "after-rightbrace"} {
- if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
- continue
- } elseif {$next_token_type == "case"} {
- set state "case"
- continue
- } elseif {$next_token_type == "default"} {
- set state "default"
- continue
- } elseif {$next_token_type == "rightbrace"} {
- lappend switch_ends [lindex $next_token 1]
- break
- } elseif {[string first "pp_" $next_token_type] == 0} {
- set state "after-rightbrace-preprocessor"
- } else {
- report $fileName [lindex $next_token 1] "There should be 'case' or 'default' (state $state)"
- }
- } elseif {$state == "case-blocks-end-preprocessor"} {
- if {$next_token_type == "newline"} {
- set state "case-blocks-end"
- }
- } elseif {$state == "case-blocks-end"} {
- if {$next_token_type == "ccomment" || $next_token_type == "space" || $next_token_type == "newline"} {
- continue
- } elseif {$next_token_type == "rightbrace"} {
- lappend switch_ends [lindex $next_token 1]
- break
- } elseif {[string first "pp_" $next_token_type] == 0} {
- set state "case-blocks-end-preprocessor"
- } else {
- report $fileName [lindex $next_token 1] "Missing break, continue or FALLTHRU comment before rightbrace (state $state)"
- }
- } else {
- report $fileName [lindex $next_token 1] "Unknown state: $state"
- }
- }
- }
- }
- }
-}
diff --git a/tools/vera++/scripts/rules/jerry_typecast_space_parentheses.tcl b/tools/vera++/scripts/rules/jerry_typecast_space_parentheses.tcl
deleted file mode 100644
index c952ef99..00000000
--- a/tools/vera++/scripts/rules/jerry_typecast_space_parentheses.tcl
+++ /dev/null
@@ -1,56 +0,0 @@
-#!/usr/bin/tclsh
-
-# Copyright JS Foundation and other contributors, http://js.foundation
-#
-# Licensed under the Apache License, Version 2.0 (the "License");
-# you may not use this file except in compliance with the License.
-# You may obtain a copy of the License at
-#
-# http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-
-proc check_part_of_the_file {file line_num col_start col_end} {
- if {$col_start == $col_end} {
- return
- }
-
- set line [getLine $file $line_num]
- set line [string range $line $col_start $col_end]
-
- if {[regexp {\)[\w\(&~=]} $line]} {
- report $file $line_num "there should be exactly one space after right parentheses"
- }
-}
-
-foreach fileName [getSourceFileNames] {
- set checkLine 1
- set checkColStart 0
- set seenOmitToken false
- foreach token [getTokens $fileName 1 0 -1 -1 {}] {
- set lineNumber [lindex $token 1]
- set colNumber [lindex $token 2]
- set tokenType [lindex $token 3]
-
- if {$checkLine != $lineNumber} {
- if {!$seenOmitToken} {
- check_part_of_the_file $fileName $checkLine $checkColStart end
- }
- set checkColStart $colNumber
- set checkLine $lineNumber
- } elseif {$seenOmitToken} {
- set checkColStart $colNumber
- }
-
- if {$tokenType in {ccomment cppcomment stringlit}} {
- check_part_of_the_file $fileName $checkLine $checkColStart $colNumber
- set seenOmitToken true
- } else {
- set seenOmitToken false
- }
- }
-}