| Index: frog/parser.dart
|
| diff --git a/frog/parser.dart b/frog/parser.dart
|
| index 0a56b8b0f9bba0f7b5536664e667a04577ea5452..294d3d20458d6d9b29723f15127f722976c0e142 100644
|
| --- a/frog/parser.dart
|
| +++ b/frog/parser.dart
|
| @@ -250,7 +250,7 @@ class Parser {
|
| classDefinition(int kind) {
|
| int start = _peekToken.start;
|
| _eat(kind);
|
| - var name = identifier();
|
| + var name = identifierForType();
|
|
|
| var typeParams = null;
|
| if (_peekKind(TokenKind.LT)) {
|
| @@ -321,6 +321,7 @@ class Parser {
|
| var formals = formalParameterList();
|
| _eatSemicolon();
|
|
|
| + // TODO(jimhug): Validate that di.name is not a pseudo-keyword
|
| var func = new FunctionDefinition(null, di.type, di.name, formals,
|
| null, null, null, _makeSpan(start));
|
|
|
| @@ -1616,6 +1617,18 @@ class Parser {
|
| return formals;
|
| }
|
|
|
| + // Type names are not allowed to use pseudo keywords
|
| + identifierForType() {
|
| + var tok = _next();
|
| + if (!_isIdentifier(tok.kind)) {
|
| + _error('expected identifier, but found $tok', tok.span);
|
| + }
|
| + if (tok.kind !== TokenKind.IDENTIFIER && tok.kind != TokenKind.NATIVE) {
|
| + _error('$tok may not be used as a type name', tok.span);
|
| + }
|
| + return new Identifier(tok.text, _makeSpan(tok.start));
|
| + }
|
| +
|
| identifier() {
|
| var tok = _next();
|
| if (!_isIdentifier(tok.kind)) {
|
|
|