`(null ?? 1 | 2)` and `(null ?? 0 ? 'a' : 'b')` give the same result under
either grouping. `(1 ?? 2 | 4)` gives 5 and `(1 ?? 0 ? 'a' : 'b')` gives 1
when `??` binds the wrong way, so the test now fails on a wrong precedence.
Strict eval code runs in a new declarative environment that no frame holds
until its declarations are made. Making the scope of its let and const names
reserves heap, and a collection there freed that environment, so the new
scope's outer link pointed at a reused slot. The environment is now a root
while the declarations are made, for direct and indirect eval.
With Options::es2015, vectorcraft-js reads and runs two ECMAScript 2020
forms: optional chains (a?.b, a?.[key], f?.(args) and the accesses and
calls after them) and ??.
- An optional step that finds undefined or null ends the whole chain
with undefined, without evaluating its other keys and arguments.
Parentheses end a chain. a?.b() and a.b?.() call with a as this,
(a?.b)() does too, eval?.(code) is an indirect eval, and delete a?.b
is true when a is undefined or null.
- ?? keeps any left side other than undefined and null.
- ?. before a digit still reads as ? and a number (a?.5:1).
- Mixing ?? with && or || without parentheses, assigning to or updating
an optional chain, a tagged template after one and new a?.b() are
syntax errors.
Two new jump instructions test for undefined and null, and the verifier
checks both of their paths. A chain of any length compiles with a loop.
.jsx files and source strings stay ES5.1, where ?. and ?? are syntax
errors.
The test262 ES2015 subset now also reads expressions/optional-chaining
and expressions/coalesce: 426 of 426 negative parse runs and 591 of 615
other runs pass with the option. The 24 failing runs are the same as
before this change.
A grayscale or 1-bit image colorized with a fill color had no way to
overprint: object.setOverprint {fill: true} changed nothing, since an
image has no fill row. The color now carries its own overprint flag
(colorize_overprint in native files).
- object.setOverprint (fill, without item) and attributes.info set and
read it; Overprint Black and Print Ink Fixes' Remove White Overprint
treat the color as the image's fill.
- Overprint Preview, Separations Preview and printed separations show
the inks below the image where its color has none; on a plate the
color puts no ink on, the image is left out.
- PDF export draws the image in an overprinting graphics state, a
process color as an image of only the process inks it puts down.
- EPS export turns overprinting on for it, and now leaves white fills,
strokes and colorized images knocking out with Discard White
Overprint, as PDF export does.
- A legacy .ai file writes it as the image mask's fill overprint and
reads it back. Warped pieces, geometry-effect copies and flattening
keep or drop it as they do for fills.
- A white spot color is an ink: with Discard White Overprint it keeps
overprinting in PDF and EPS export and in both previews.
Docs: docs/mcp.md (Overprint, Print Ink Fixes), docs/target-app-parity.md.
A filter run, a plug-in command, or a run that calls commands applied its
output through Session::edit, which records an undo step and marks the
document modified even when the output changes nothing. The output is now
applied to a copy first, as colorcmds::edit_if_changed does: only a copy
whose objects or kept documentData differ becomes the document, as one undo
step. Otherwise the document, its undo history and its saved state stay as
they were, and the run's objects are still selected.
Docs: params text of plugin.run and plug-in commands, docs/plugins.md,
docs/mcp.md, docs/target-app-parity.md.
wat::module and wat::sectioned give a module at least one page of
initial memory, so the first vc_alloc block does not start at 0, which
the host refuses. wat::with_field adds its field after a module's $name
when the module has one, so a named module stays valid WebAssembly text.
With a twist, a band cuts each edge into pieces whose cut corners lie on
the art's curve, but the smoothed mesh normals and the 60 degree crease
test were worked out on straight chords between the edge's corners. On
a curved outline the normals then described quads other than the faces
the mesh holds. The corner rule is now one function, cut_corner, which
curved_band and smoothed_rows both use, so each piece's smoothed normal
comes from the quad that is built. Straight and uncut edges are as
before.
The test a_twisted_round_bevels_smoothed_normals_follow_its_curved_pieces
checks that each smoothed corner of a twisted, rounded bevel on a circle
is the mean of the normals of the two faces that meet there, with and
without perspective.
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.
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.
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.
When defining the UnitValue members fails part way, the realm turns the
unit operators off again and restores the global UnitValue to what it was
before the call, so a second add_unit_values() installs everything.
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.
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.
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.
The other character a shape read as a combining mark also is was kept
by the shape's id. The parts of a compound path share that id, so with
two such marks in one compound the second mark's character replaced the
first's, and a split that left the first mark first on a line set it as
the second mark's character (a dot below became a small tilde). The
character is now kept by the part's own glyph match, and the new test
moves a dot below and a tilde off their base into one compound path.
curved_band took eight arguments once it gained the mesh's band data,
and an allow attribute silenced clippy's too_many_arguments lint. It now
takes the partner rings as one [a, b] array, and the allow attribute has
been removed.
With a twist, each edge of a band is cut into pieces, and the mesh gave
those pieces their flat face normals, so a rounded or custom bevel with
a twist was exported faceted. The smoothed normals are now worked out
for each piece of each edge, from the same pieces the band is cut into,
and every piece takes its own.
The test a_twisted_rounded_bevel_keeps_its_normals_smoothed_on_every_piece_of_a_cut_edge
checks that where the pieces of two bevel bands meet, the two bands
give each piece one normal.
The merge of main brought in code that indexes the anchor list while
smooth_open now keeps it in an EditsFromEnd, which has no indexing, so
the engine did not build. The anchors at both ends of a run and of its
neighboring segments are now read from the span that EditsFromEnd::get
returns.
Extrude & Bevel's caps, Rotate's plane and Inflate's front and back took
their texture coordinates in the bounds of each part's own rings, so a
part smaller than its object had its coordinates stretched to its own
extent and did not line up with the object's other parts. They now use
the bounds the solid is built with, which every part of one object
shares, as the Turn, Placing and Camera transforms already do.
The test the_parts_of_one_object_place_their_caps_and_planes_in_its_shared_bounds
builds a small part inside a larger object's bounds with each effect and
checks every front and back corner against the shared bounds.
docs/mcp.md now says the measuring spacing is a target (at least 4 and at
most 1,024 pieces per curved segment, fewer on subpaths of more than 256
segments) and gives the acceptance test as formulas: t1 <= t0 + 0.001 * s
and fewer anchors, t0 - t1 >= 0.000001 * s, or b0 - b1 > 0.0001 * b0,
with s the larger of t0 and 1. The roughness doc comment says the points
are about `step` apart.
The expected value multiplied 1e307 by 1000 before dividing, which
overflows to infinity, so the closeness check accepted any finite
result. The expected value now divides the factors first.
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.
With two UnitValues and a left one in px or %, the right one is now
converted with the left one's baseUnit, so a 1 px value with a 2 pt base
plus 1 in gives 37 px. Conversions keep their intermediate values in
range, so a result that is a finite number no longer fails because a
step on the way overflows or reaches 0.
Scripts get the global UnitValue constructor: a number with one of the
length units (inches, feet, yards, miles, millimeters, centimeters,
meters, kilometers, points, picas, traditional points and picas,
ciceros), pixels or percent. as() and convert() give or change the
unit, baseUnit sets what one pixel and 100% measure, and the arithmetic,
comparison and unary operators calculate with the object's number. With
two objects the right one is converted to the left one's unit.
Conversions go through exact ratios to the inch, so 1 in is exactly
72 pt. An unknown unit or text makes an invalid object; converting it or
using it with an operator, a result that is not finite and a comparison
with a number that is not finite throw a RangeError.
A realm without UnitValue keeps the standard operators. docs/mcp.md
describes the class.