commit
8aa74ab845
5
acorn.js
5
acorn.js
@ -805,7 +805,10 @@
|
|||||||
|
|
||||||
function readToken_pipe_amp(code) { // '|&'
|
function readToken_pipe_amp(code) { // '|&'
|
||||||
var next = input.charCodeAt(tokPos + 1);
|
var next = input.charCodeAt(tokPos + 1);
|
||||||
if (next === code) return finishOp(code === 124 ? _logicalOR : _logicalAND, 2);
|
if (next === code) {
|
||||||
|
if (options.playground && input.charCodeAt(tokPos + 2) === 61) return finishOp(_assign, 3);
|
||||||
|
return finishOp(code === 124 ? _logicalOR : _logicalAND, 2);
|
||||||
|
}
|
||||||
if (next === 61) return finishOp(_assign, 2);
|
if (next === 61) return finishOp(_assign, 2);
|
||||||
return finishOp(code === 124 ? _bitwiseOR : _bitwiseAND, 1);
|
return finishOp(code === 124 ? _bitwiseOR : _bitwiseAND, 1);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -245,6 +245,83 @@ test("obj.x ?= 2;", {
|
|||||||
playground: true
|
playground: true
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
test("x ||= 2;", {
|
||||||
|
type: "Program",
|
||||||
|
start: 0,
|
||||||
|
end: 8,
|
||||||
|
body: [{
|
||||||
|
type: "ExpressionStatement",
|
||||||
|
start: 0,
|
||||||
|
end: 8,
|
||||||
|
expression: {
|
||||||
|
type: "AssignmentExpression",
|
||||||
|
start: 0,
|
||||||
|
end: 7,
|
||||||
|
left: {
|
||||||
|
type: "Identifier",
|
||||||
|
start: 0,
|
||||||
|
end: 1
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "Literal",
|
||||||
|
start: 6,
|
||||||
|
end: 7,
|
||||||
|
value: 2,
|
||||||
|
raw: "2"
|
||||||
|
},
|
||||||
|
operator: "||="
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
playground: true
|
||||||
|
});
|
||||||
|
|
||||||
|
test("obj.x ||= 2;", {
|
||||||
|
type: "Program",
|
||||||
|
start: 0,
|
||||||
|
end: 12,
|
||||||
|
body: [{
|
||||||
|
type: "ExpressionStatement",
|
||||||
|
start: 0,
|
||||||
|
end: 12,
|
||||||
|
expression: {
|
||||||
|
type: "AssignmentExpression",
|
||||||
|
start: 0,
|
||||||
|
end: 11,
|
||||||
|
left: {
|
||||||
|
type: "MemberExpression",
|
||||||
|
start: 0,
|
||||||
|
end: 5,
|
||||||
|
object: {
|
||||||
|
type: "Identifier",
|
||||||
|
start: 0,
|
||||||
|
end: 3,
|
||||||
|
name: "obj"
|
||||||
|
},
|
||||||
|
property: {
|
||||||
|
type: "Identifier",
|
||||||
|
start: 4,
|
||||||
|
end: 5,
|
||||||
|
name: "x"
|
||||||
|
},
|
||||||
|
computed: false
|
||||||
|
},
|
||||||
|
right: {
|
||||||
|
type: "Literal",
|
||||||
|
start: 10,
|
||||||
|
end: 11,
|
||||||
|
value: 2,
|
||||||
|
raw: "2"
|
||||||
|
},
|
||||||
|
operator: "||="
|
||||||
|
}
|
||||||
|
}]
|
||||||
|
}, {
|
||||||
|
playground: true
|
||||||
|
});
|
||||||
|
|
||||||
// Method binding
|
// Method binding
|
||||||
|
|
||||||
test("var fn = obj#method", {
|
test("var fn = obj#method", {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user