Commit Graph
19556 Commits
Author SHA1 Message Date
dotCooCoo 30eb12aba3 JavaScript: generator functions, yield and yield* in ES2015 realms
A realm made with Options::es2015 reads function* declarations and
expressions, *name() methods in object literals, yield and yield*, as
ECMA-262 11th edition sections 14.4 and 25.4 define them. A suspended
generator keeps its frame in its object; next, return and throw on
%GeneratorPrototype% push it back on the interpreter's frame stack, so
a resumption takes fuel and counts against the frame limit, and return
runs the finally blocks around the yield. Resuming a running generator
throws a TypeError. yield* passes next, throw and return on to its
iterator and closes one without throw before throwing a TypeError.
%GeneratorFunction% is reached through a generator function's
constructor. Outside generators, sloppy code still reads yield as a
name, and a realm without the option reads function* as a syntax error.

An engine that #targetengine kept from a .jsx run has no generator
built-ins, so a generator function called there throws a TypeError.

cargo xtask test262 runs the generator folders: 509 of 549 runs pass
(94 of 96 before). Docs: docs/mcp.md, docs/target-app-parity.md.
2026-11-22 08:15:47 -08:00
dotCooCoo f1f0911ddb Merge branch feat/js-es2015-symbol-iterators into feat/js-es2015-generators 2026-11-22 06:28:23 -08:00
dotCooCoo 93df144331 JavaScript: keep Symbol keys and converted operands counted while script runs
Object.defineProperties and Object.create now keep the Symbol keys of the
properties object rooted until they are defined, so a getter that deletes
a Symbol-keyed property already read no longer lets a collection drop the
Symbol's description from the heap count.

The + operator and the relational comparisons now keep the first
operand's converted value rooted while the second operand's
@@toPrimitive or valueOf runs, so a fresh Symbol or string from the first
conversion stays counted against the heap limit.
2026-11-22 02:35:00 -08:00
dotCooCoo e475181329 JavaScript: Date.prototype[@@toPrimitive] and ToPrimitive fixes in ES2015 realms
In a realm with `Options::es2015`, `Date.prototype[Symbol.toPrimitive]`
converts with `toString` first for the hints "string" and "default" and
with `valueOf` first for "number" (ECMA-262 11th edition, section
20.4.4.45). An object without an `@@toPrimitive` method, a Date whose
own method is `null` or `undefined` included, converts without a hint
with `valueOf` first (section 7.1.1.1), so `d + 1` gives 8 when
`valueOf` returns 7. A realm without the option keeps the ES5 order for
a Date.

`JSON.stringify` converts a Number or String object with ToPrimitive. A
`valueOf` or `toString` deleted from the object's own prototype is now
looked up further along the chain, so `Object.prototype.toString` is
called instead of the stored primitive value being returned.

A Symbol that an object's `@@toPrimitive` method gives as a property
key is rooted while the property is read or incremented, so it and its description
still count against the heap when a getter starts a collection.
2026-11-22 01:56:22 -08:00
dotCooCoo c021b269e7 JavaScript: tighten Symbol conversions, lookups and host crossings in ES2015 realms
- A string in `0b` or `0o` form converts to a number in a realm with
  `Options::es2015`, so an array iterator over an object whose length
  is "0b10" visits two elements. Realms without the option still read
  such strings as NaN.
- `JSON.stringify` calls a String or Number object's `@@toPrimitive`
  method before using its stored value, for the value itself, a
  replacer list entry and the `space` argument.
- A host function that returns a Symbol in a realm without the option
  throws a `TypeError`. A Symbol's description is charged to the heap
  before it is built.
- A text function takes a Symbol as `String(symbol)` gives it, and a
  data function refuses an object or array with an enumerable
  Symbol-keyed property; checking the keys takes fuel.
- A Symbol-keyed lookup takes a unit of fuel for each prototype it
  passes, and removing most of an object's Symbol keys releases their
  storage.
2026-11-22 01:24:03 -08:00
dotCooCoo 33bcf63381 JavaScript: a global function declaration reads the global object's own property
With ES2015 scripts, a function declaration was judged by a property the
global object inherits, so a fixed property on Object.prototype stopped
`function name() {}`. The check now reads the global object's own
property, as ECMA-262 2015 section 8.1.1.4.16 does, and declares nothing
when the global object is not extensible and has no property of that
name. Indirect eval code makes the same check for all of its functions
before it declares any of them, and a function declaration never adds a
property to a global object that is not extensible.
2026-11-22 01:13:14 -08:00
dotCooCoo 4447e02955 JavaScript: a rest parameter checks the heap before its array is made
A call to a function with a rest parameter built the array of its extra
arguments without reserving room for it, so `f.apply(null, big)` could
push the heap estimate past the limit. The call now counts the rest
array, its binding and one property per extra argument in the room it
reserves before the function's environment is made.
2026-11-22 00:52:01 -08:00
dotCooCoo e5a1f339c3 JavaScript: spreading a string counts its flattened copy against the heap
Spreading a concatenated string (`[...s]`, `f(...s)`) flattened it before
any limit was checked, so a script could make the host build the whole
copy before the per-element fuel and heap accounting ran. The spread now
flattens through the same counted helper the string built-ins use, which
ends the run with the heap limit before the copy is made.
2026-11-22 00:44:02 -08:00
dotCooCoo 8d12b37da2 JavaScript: Symbol and the iterators of arrays, strings and arguments in ES2015 realms
With Options::es2015 set, a vectorcraft-js realm has Symbol (ECMA-262
11th edition, section 19.4): Symbol(description), which new refuses,
the description getter, toString, valueOf, and Symbol.for and
Symbol.keyFor over a registry that lasts as long as the realm. typeof
gives "symbol". Symbols are property keys: Object.getOwnPropertySymbols
lists them in the order they were added, defineProperty,
getOwnPropertyDescriptor, freeze, seal, in, delete and hasOwnProperty
take them, and for-in, Object.keys, getOwnPropertyNames and
JSON.stringify leave them out. String(symbol) and symbol.toString()
give Symbol(description); any other conversion of a Symbol to a string
or a number throws a TypeError.

Symbol.iterator, asyncIterator, hasInstance, toPrimitive and
toStringTag are defined. Conversion to a primitive calls @@toPrimitive,
instanceof calls @@hasInstance, and Object.prototype.toString writes a
string @@toStringTag. Array.prototype.values (also @@iterator), keys
and entries, String.prototype[@@iterator] (by code point) and every
arguments object's @@iterator return iterators with next(). An Array
Iterator's next keeps its object reachable while a length getter or
valueOf runs script.

Each iterator step takes fuel, and each Symbol and registry entry
counts against the heap limit. An error about a Symbol-keyed property
names the Symbol by at most 256 units of its description, built only
when the error is thrown. String(symbol), symbol.toString() and the
[object tag] of Object.prototype.toString charge their copies to the
heap and fuel first. Realms without the option, including the one the
app runs scripts in, are unchanged. for-of, spread and destructuring
are not part of this change.

cargo xtask test262 runs the suite's Symbol, ArrayIteratorPrototype,
StringIteratorPrototype, getOwnPropertySymbols, Array.prototype
values/keys/entries/Symbol.iterator and String.prototype[Symbol.iterator]
tests in such a realm: 164 of 216 runs pass (6 before). The 52 others
expect a configurable function length and a function name property.
2026-11-22 00:09:15 -08:00
dotCooCoo e717698e02 Scripts: Annex B block functions are judged one declaration at a time
A function declared in a block sets the enclosing variable of its name
only when that declaration itself is eligible, so a declaration inside
a let of the same name no longer assigns the variable because another
declaration of that name elsewhere in the body is eligible.
2026-11-21 23:37:47 -08:00
dotCooCoo 2ba5dd3735 Scripts: spread reads lengths with ToLength and function scopes stay rooted
Spread of an object with a length property reads the length with
ToLength, so a negative or NaN length adds no elements instead of
wrapping to a count near 2^32. A function body's environments stay on
the collector's roots while its scope, functions and arguments object
are made.
2026-11-21 23:31:38 -08:00
dotCooCoo 21ce815b34 Scripts: global let and const reach functions from every run
Global code runs in the realm's lexical scope in either language, so a
function an earlier ES5.1 run, an indirect eval or the Function
constructor made can read a let or const a later .js run declares. With
the ES2015 option, a script whose function cannot replace a property of
the global object throws a TypeError before any of its let or const
names is declared, so a failed run leaves no name uninitialized.
2026-11-21 23:24:52 -08:00
dotCooCoo f287c5fabb Docs: name the failing test262 runs as ECMAScript 2015 rules 2026-11-21 23:07:28 -08:00
dotCooCoo 8d0001308f Merge main into feat/js-es2015-block-arrow-template 2026-11-21 22:52:36 -08:00
dotCooCoo 7d3094afe6 Scripts: .js scripts run let, const, arrows, templates, default and rest parameters and spread
vectorcraft-js gains Options::es2015, which reads and runs these
ECMAScript 2015 forms: let and const with block scope and their
temporal dead zone, a new let binding for each loop iteration,
function declarations scoped to their block (with the Annex B.3.3
variable outside strict mode code), arrow functions, template
literals and tagged templates, default and rest parameters, and
spread in array literals, calls and new. Spread reads arrays,
strings by code point and objects with a length, by index, and
throws a TypeError for anything else until iterators are added.

Eval code outside strict mode code cannot declare a var that clashes
with a let or const around it, or with a parameter inside a default
value. Spread, template objects and the new scopes take fuel and
count against the heap limit, and nested arrows and templates count
against the depth limit.

script.run sets the option for a .js file; eval, Function, #include
files, $.evalFile and a kept #targetengine read code the way the
running script does. A .jsx file and a source string stay ES5.1.

The test262 runner gains an ES2015 subset run, read without and with
the option. docs/mcp.md and docs/target-app-parity.md describe the
new forms.
2026-11-21 20:43:20 -08:00
BFlat db9acab4da Merge pull request #9004 from dotCooCoo/fix/retype-even-odd-turned-counters
Retype: a glyph in an even-odd compound matches with only some of its contours reversed
2026-11-22 11:38:53 +07:00
BFlat 90cd5eef57 Merge pull request #9016 from dotCooCoo/fix/dynamic-symbol-part-selection-paint
Symbols: Direct Selection picks a dynamic instance's part where its fill and stroke effects draw it
2026-11-22 11:38:33 +07:00
BFlat f03d04b91b Merge pull request #8996 from dotCooCoo/fix/simplify-smooth-keep-closed-start
Paths: Object > Path > Simplify and Smooth keep a closed path's start
2026-11-22 11:38:13 +07:00
BFlat 37610608f1 Merge pull request #8976 from dotCooCoo/fix/smooth-region-rejects-bad-params
Smooth: path.smoothRegion and path.joinScrub refuse a radius, fidelity or tolerance out of range
2026-11-22 11:37:54 +07:00
BFlat d13a06b2f2 Merge pull request #8963 from dotCooCoo/fix/live-paint-bucket-lent-tool-release
Live Paint: a Cmd-drag cut short keeps the bucket's colors
2026-11-22 11:37:34 +07:00
BFlat 1360f9ac6f Merge pull request #8961 from dotCooCoo/fix/safe-mode-expand-hidden-symbol-art
Expand Appearance: Safe Mode skips art that a group's raster image leaves out
2026-11-22 11:37:14 +07:00
BFlat 789f5033bb Merge pull request #8954 from dotCooCoo/fix/params-textedit-rest
Type: text commands refuse a parameter of the wrong type
2026-11-22 11:36:54 +07:00
BFlat 55064f7f59 Merge pull request #8949 from dotCooCoo/feat/dimension-drag-reposition
Dimension tool: a drag from a dimension already drawn moves it
2026-11-22 11:36:34 +07:00
BFlat b9c9e82f74 Merge pull request #8943 from dotCooCoo/fix/font-version-rescan-and-steady-gate
Fonts: a rescan clears the version record after it publishes its catalog
2026-11-22 11:36:13 +07:00
BFlat 1cf0a2806a Merge pull request #9045 from dotCooCoo/feat/quick-pen-arc-protractor-i9314
Pen: Quick Pen shows a protractor around an arc's center and snaps to its ticks
2026-11-22 10:54:06 +07:00
BFlat 7ad52eacb8 Merge pull request #9017 from dotCooCoo/fix/test262-runner-coverage
Tests: the test262 runner parses and runs the Annex B tests
2026-11-22 10:53:45 +07:00
BFlat f658b42bc6 Merge pull request #9013 from dotCooCoo/feat/psd-invert-threshold-posterize-layers
PSD import: apply Invert, Threshold and Posterize adjustment layers
2026-11-22 10:53:23 +07:00
BFlat 0aa2601eb9 Merge pull request #8995 from dotCooCoo/fix/3d-expand-inflate-bevel-twist-curves
3D: Expand Appearance keeps curves on Inflate faces, interior bevel edges and twist cuts
2026-11-22 10:53:03 +07:00
BFlat 3cc55c480e Merge pull request #8994 from dotCooCoo/fix/family-tool-prefs-keep-valid-counts
Tools: restored Spiral, Rectangular Grid and Polar Grid counts keep the current value
2026-11-22 10:52:41 +07:00
BFlat 980bd43e34 Merge pull request #8979 from dotCooCoo/fix/smooth-never-rougher
Smooth: a drag that reaches only a sliver of the next segment no longer splits it
2026-11-22 10:52:20 +07:00
BFlat 8f27f7c4ba Merge pull request #8978 from dotCooCoo/fix/unembed-keeps-current-mask
Links: Unembed leaves a released or edited clipping mask as it is
2026-11-22 10:51:59 +07:00
BFlat e6e376e1ca Merge pull request #8974 from dotCooCoo/fix/sample-color-stop-of-given-objects
Eyedropper: sampling into a stop of given objects reads their gradient
2026-11-22 10:51:39 +07:00
BFlat 1de9ad593c Merge pull request #8973 from dotCooCoo/fix/eps-freeform-plate-cells
Print: an overprinting freeform gradient leaves out the cells its plate samples write without ink
2026-11-22 10:51:19 +07:00
BFlat 0882bd3850 Merge pull request #8970 from dotCooCoo/fix/image-quad-malformed-corner
Native file: a distorted image with a malformed saved corner opens placed by its transform
2026-11-22 10:50:58 +07:00
BFlat 4cea62ceee Merge pull request #8969 from dotCooCoo/fix/live-paint-bucket-freeform-points
Live Paint: freeform point edits without a target leave the selection alone under the bucket
2026-11-22 10:50:38 +07:00
BFlat 6767fefb11 Merge pull request #8968 from dotCooCoo/feat/script-file-hidden-create-alias
Scripts: File.hidden can be set and File.createAlias makes a link within the grants
2026-11-22 10:50:17 +07:00
BFlat b2bcc0367c Merge pull request #8967 from dotCooCoo/fix/inline-refresh-test-created
Tests: the inline refresh test's two sessions share one created date
2026-11-22 10:49:56 +07:00
BFlat ce062ce2a5 Merge pull request #8966 from dotCooCoo/fix/pattern-commands-unknown-ids
Patterns: pattern and Repeat commands refuse an ids entry that names no object
2026-11-22 10:49:36 +07:00
BFlat c2e1e28f87 Merge pull request #8958 from dotCooCoo/fix/duplicate-item-aligned-to-identical
Appearance: aligned copies go to `to` when the stacks are the same
2026-11-22 10:49:15 +07:00
BFlat 467261f531 Merge pull request #8957 from dotCooCoo/feat/plugin-storage-fuel
Plug-ins: storage calls pay instructions for the bytes they move
2026-11-22 10:48:55 +07:00
BFlat 6ba9e7ab0a Merge pull request #8956 from dotCooCoo/fix/curvature-circle-skip-on-selection
Shapes: the Curvature Circle tool reaches its circles again after Deselect
2026-11-22 10:48:35 +07:00
BFlat bbf17b4daf Merge pull request #8955 from dotCooCoo/fix/save-for-web-fixed-palette-clear-slot
Save for Web: a Custom table keeps shifted and locked colors first, and 255 opaque colors beside transparent pixels
2026-11-22 10:48:14 +07:00
BFlat 261fa6aa8d Merge pull request #8946 from dotCooCoo/fix/restore-min-size-fits-work-area
Window: a restored window fitted to a small work area is not held at the minimum size
2026-11-22 10:47:54 +07:00
BFlat a79fab35fe Merge pull request #8945 from dotCooCoo/fix/scriptcheck-folder-ambiguity
Script checker: setting length, hidden or readonly on new Folder(...) or a Folder place is not a file write
2026-11-22 10:47:33 +07:00
BFlat 27c59e3125 Merge pull request #8941 from dotCooCoo/fix/symbol-art-ignores-layer-preview
Gradient: freeform Lines mode counts a symbol's stroke on a Preview-off layer of its art
2026-11-22 10:47:12 +07:00
BFlat 27e413fda5 Merge pull request #8936 from dotCooCoo/fix/dimension-level-snap-checks
Dimension tool: a line at a slight angle or past the distance limit is not a level
2026-11-22 10:46:51 +07:00
BFlat b288f27bd8 Merge pull request #8930 from dotCooCoo/fix/flare-lone-x2-y2-error
Flare: a lone x2 or y2 in shape.flare is an error
2026-11-22 10:46:31 +07:00
BFlat 2ec2894ae9 Merge pull request #8929 from dotCooCoo/fix/transform-null-origin-pivot-test
Tests: transform turns about the same pivot with a null or omitted origin
2026-11-22 10:46:11 +07:00
BFlat 29f5c65cdf Merge pull request #8926 from dotCooCoo/fix/soft-mix-rate-same-value
Pathfinder: setting Soft Mix's Mixing Rate to the value it has records no undo step
2026-11-22 10:45:51 +07:00
BFlat b3c83f75ba Merge pull request #8923 from dotCooCoo/fix/library-pattern-color-copies
Swatch libraries: repeated adds reuse numbered colors, and tints link to a color of their kind
2026-11-22 10:45:30 +07:00