makePropertyName method
Implementation
Node makePropertyName(Token? tok) {
int start = tok?.startOffset??0;
int end = tok?.endOffset??0;
int line = tok?.line??0;
switch (tok?.type) {
case Token.NAME:
return new Name(tok?.text?? '')
..start = start
..end = end
..line = line;
case Token.STRING:
return new LiteralExpression(tok?.value)
..raw = tok?.text
..start = start
..end = end
..line = line;
case Token.NUMBER:
return new LiteralExpression(double.parse(tok?.text?? "0"))
..raw = tok?.text
..start = start
..end = end
..line = line;
default:
throw fail(tok: tok, expected: 'property name');
}
}