async function g() { // note: not a generator function
yield 42; // same error message without the semicolon
}
Raises unexpected 'yield' keyword in ESM mode but expecting ';' in classic mode.
It's not strictly wrong because yield is a valid identifier in classic mode (you get the same error with yolo 42) but it's unhelpful.
Raises
unexpected 'yield' keywordin ESM mode butexpecting ';'in classic mode.It's not strictly wrong because
yieldis a valid identifier in classic mode (you get the same error withyolo 42) but it's unhelpful.