Adjust qualifiedName, constructorDesignation, metadata
Cf. language issue #1341: The grammar rule in Dart.g for <metadata> is wrong, it does not allow `@x` where `x` is the name of a variable which is not a `<typeIdentifier>` (in particular, a variable can have a name like `required` even though it's a built-in identifier). This CL changes `qualifiedName` such that it only includes the cases with a '.', and then the remaining case is added where `qualifiedName` is used. We add `identifier` in `metadata` such that it allows `@required` and such, and we add `typeIdentifier` in `constructorDesignation`, because that's required to be an import prefix or a class name, which are both `typeIdentifier`s. Change-Id: Ia22d9d9842b995c4ebaa8e18e1c2ccbce1c30e62 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/174540 Commit-Queue: Erik Ernst <eernst@google.com> Reviewed-by: Lasse R.H. Nielsen <lrn@google.com>
This commit is contained in:
committed by
commit-bot@chromium.org
parent
2fafa55d90
commit
82403371ac
@@ -472,6 +472,7 @@ metadata
|
||||
|
||||
metadatum
|
||||
: constructorDesignation arguments
|
||||
| identifier
|
||||
| qualifiedName
|
||||
;
|
||||
|
||||
@@ -905,8 +906,7 @@ identifier
|
||||
;
|
||||
|
||||
qualifiedName
|
||||
: typeIdentifier
|
||||
| typeIdentifier '.' identifier
|
||||
: typeIdentifier '.' identifier
|
||||
| typeIdentifier '.' typeIdentifier '.' identifier
|
||||
;
|
||||
|
||||
@@ -1253,7 +1253,8 @@ typedIdentifier
|
||||
;
|
||||
|
||||
constructorDesignation
|
||||
: qualifiedName
|
||||
: typeIdentifier
|
||||
| qualifiedName
|
||||
| typeName typeArguments ('.' identifier)?
|
||||
;
|
||||
|
||||
|
||||
@@ -101,8 +101,8 @@ public class SpecParser {
|
||||
}
|
||||
}
|
||||
|
||||
/// From [arguments], obey the flags ("--<flag_name>") if known and ignore
|
||||
/// them if unknown; treat the remaining [arguments] as file paths and
|
||||
/// From [arguments], obey the flags ("--<flag_name>", "-<any>") if known and
|
||||
/// ignore them if unknown; treat the remaining [arguments] as file paths and
|
||||
/// parse each of them. Return a [ParsingResult] specifying how many files
|
||||
/// were parsed, and how many of them failed to parse.
|
||||
private static ParsingResult parseFiles(String[] arguments)
|
||||
@@ -113,13 +113,13 @@ public class SpecParser {
|
||||
result.numberOfFileArguments = arguments.length;
|
||||
for (int i = 0; i < arguments.length; i++) {
|
||||
String filePath = arguments[i];
|
||||
if (filePath.substring(0, 2).equals("--")) {
|
||||
result.numberOfFileArguments--;
|
||||
if (result.numberOfFileArguments == 0) return result;
|
||||
if (filePath.equals("--verbose")) verbose = true;
|
||||
if (filePath.equals("--batch")) runAsBatch();
|
||||
// Ignore all other flags.
|
||||
continue;
|
||||
if (filePath.startsWith("-")) {
|
||||
result.numberOfFileArguments--;
|
||||
if (result.numberOfFileArguments == 0) return result;
|
||||
if (filePath.equals("--verbose")) verbose = true;
|
||||
if (filePath.equals("--batch")) runAsBatch();
|
||||
// Ignore all other flags.
|
||||
continue;
|
||||
}
|
||||
if (verbose) System.err.println("Parsing file: " + filePath);
|
||||
DartLexer lexer = new DartLexer(new ANTLRFileStream(filePath));
|
||||
|
||||
Reference in New Issue
Block a user