in lib/parser.js [1355:1454]
idThings() {
var id = this.look;
this.matchID();
// id++
if (this.is(Tag.INCREMENT)) {
this.move();
return {
type: 'increment',
position: 'backend',
expr: {
type: 'variable',
id: id,
loc: id.loc
},
loc: {
start: id.loc.start,
end: this.look.loc.end
}
};
}
// id--
if (this.is(Tag.DECREMENT)) {
this.move();
return {
type: 'decrement',
position: 'backend',
expr: {
type: 'variable',
id: id,
loc: id.loc
},
loc: {
start: id.loc.start,
end: this.look.loc.end
}
};
}
// id = xxx
if (this.look.tag === '=') {
this.move();
let expr = this.expr();
return {
type: 'assign',
left: {
type: 'variable',
id: id,
},
expr
};
}
// id()
if (this.look.tag === '(') {
this.move();
const args = this.args();
this.match(')');
return {
type: 'call',
left: {
type: 'method_call',
id: id
},
args,
loc: {
start: id.loc.start,
end: this.lexer.loc()
}
};
}
if (this.look.tag === '[') {
this.move();
let accessKey = this.expr();
this.match(']');
// @id.x[]
return this.mapAccess({
type: 'map_access',
id: id,
accessKey: accessKey,
loc: {
start: id.loc.start,
end: this.lexer.loc()
}
});
}
// id.x = xxx, id.x(), id.x
if (this.look.tag === '.') {
return this.properties(id);
}
return {
type: 'variable',
id: id,
loc: id.loc
};
}