blob: a82e7e406695df4efbc2df5a5ed0eae4307d956b [file] [log] [blame]
40 columns |
(experiment null-aware-elements)
>>> List element.
var list = [ ? x ];
<<< 3.8
var list = [?x];
>>> Set element.
var set = { ? x };
<<< 3.8
var set = {?x};
>>> Map key.
var map = { ? key : value};
<<< 3.8
var map = {?key: value};
>>> Map value.
var map = { key: ? value };
<<< 3.8
var map = {key: ?value};
>>> Both key and value.
var map = { ? key : ? value };
<<< 3.8
var map = {?key: ?value};
>>> Split inside element.
var list = [?(veryLongExpression +thatIsForcedToSplit)];
<<< 3.8
var list = [
?(veryLongExpression +
thatIsForcedToSplit),
];
>>> (experiment dot-shorthands) Preserves space for dot shorthand.
### If the space between `?` and `.` is removed, it would become a single `?.`
### token and thus a parse error.
var list = [
?. property ,
? . invocation ( ) ,
? . new ( ) ,
];
<<< 3.10
var list = [
?.property,
?.invocation(),
?.new(),
];
>>> (experiment dot-shorthands) Ambiguous dot shorthand versus null-aware.
### Because there is no space in "?.", it must be a null-aware access in a map.
c = { e1 ?. e2 : e3 };
<<< 3.10
c = {e1?.e2: e3};
>>> (experiment dot-shorthands) Ambiguous dot shorthand versus null-aware.
### Because there is a space in "? .", it must be a dot shorthand in a set.
c = { e1 ? . e2 : e3 };
<<< 3.10
c = {e1 ? .e2 : e3};