OLD | NEW |
1 /* | 1 /* |
2 * Copyright (c) 2012, the Dart project authors. | 2 * Copyright (c) 2012, the Dart project authors. |
3 * | 3 * |
4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except | 4 * Licensed under the Eclipse Public License v1.0 (the "License"); you may not u
se this file except |
5 * in compliance with the License. You may obtain a copy of the License at | 5 * in compliance with the License. You may obtain a copy of the License at |
6 * | 6 * |
7 * http://www.eclipse.org/legal/epl-v10.html | 7 * http://www.eclipse.org/legal/epl-v10.html |
8 * | 8 * |
9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License | 9 * Unless required by applicable law or agreed to in writing, software distribut
ed under the License |
10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express | 10 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY K
IND, either express |
(...skipping 4806 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4817 * Parse a type name. | 4817 * Parse a type name. |
4818 * | 4818 * |
4819 * <pre> | 4819 * <pre> |
4820 * type ::= | 4820 * type ::= |
4821 * qualified typeArguments? | 4821 * qualified typeArguments? |
4822 * </pre> | 4822 * </pre> |
4823 * | 4823 * |
4824 * @return the type name that was parsed | 4824 * @return the type name that was parsed |
4825 */ | 4825 */ |
4826 private TypeName parseTypeName() { | 4826 private TypeName parseTypeName() { |
4827 Identifier typeName = parsePrefixedIdentifier(); | 4827 Identifier typeName; |
| 4828 if (matches(Keyword.VAR)) { |
| 4829 reportError(ParserErrorCode.VAR_AS_TYPE_NAME); |
| 4830 typeName = new SimpleIdentifier(getAndAdvance()); |
| 4831 } else if (matchesIdentifier()) { |
| 4832 typeName = parsePrefixedIdentifier(); |
| 4833 } else { |
| 4834 typeName = createSyntheticIdentifier(); |
| 4835 reportError(ParserErrorCode.EXPECTED_TYPE_NAME); |
| 4836 } |
4828 TypeArgumentList typeArguments = null; | 4837 TypeArgumentList typeArguments = null; |
4829 if (matches(TokenType.LT)) { | 4838 if (matches(TokenType.LT)) { |
4830 typeArguments = parseTypeArgumentList(); | 4839 typeArguments = parseTypeArgumentList(); |
4831 } | 4840 } |
4832 return new TypeName(typeName, typeArguments); | 4841 return new TypeName(typeName, typeArguments); |
4833 } | 4842 } |
4834 | 4843 |
4835 /** | 4844 /** |
4836 * Parse a type parameter. | 4845 * Parse a type parameter. |
4837 * | 4846 * |
(...skipping 1169 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
6007 reportError(ParserErrorCode.EXTERNAL_TYPEDEF, modifiers.getExternalKeyword
()); | 6016 reportError(ParserErrorCode.EXTERNAL_TYPEDEF, modifiers.getExternalKeyword
()); |
6008 } | 6017 } |
6009 if (modifiers.getFinalKeyword() != null) { | 6018 if (modifiers.getFinalKeyword() != null) { |
6010 reportError(ParserErrorCode.FINAL_TYPEDEF, modifiers.getFinalKeyword()); | 6019 reportError(ParserErrorCode.FINAL_TYPEDEF, modifiers.getFinalKeyword()); |
6011 } | 6020 } |
6012 if (modifiers.getVarKeyword() != null) { | 6021 if (modifiers.getVarKeyword() != null) { |
6013 reportError(ParserErrorCode.VAR_TYPEDEF, modifiers.getVarKeyword()); | 6022 reportError(ParserErrorCode.VAR_TYPEDEF, modifiers.getVarKeyword()); |
6014 } | 6023 } |
6015 } | 6024 } |
6016 } | 6025 } |
OLD | NEW |