-
Notifications
You must be signed in to change notification settings - Fork 1.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Work towards #50702 * This adds a `docImport` field to the `Comment` class. * Doc imports are parsed with the standard Fasta parser and AstBuilder. * We add one static check that `deferred` isn't used. Other checks are needed. * Many tests. * We need to add support for line splits in a doc comment. * I think doc comment imports need to be visted by AST visitors, but maybe I am wrong... Change-Id: I06e2b6fe42ef5ce916d46d9a9db35334726677d0 Reviewed-on: https://dart-review.googlesource.com/c/sdk/+/322591 Commit-Queue: Samuel Rawlins <[email protected]> Reviewed-by: Brian Wilkerson <[email protected]>
- Loading branch information
Showing
13 changed files
with
528 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
// Copyright (c) 2023, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:analyzer/error/listener.dart'; | ||
import 'package:analyzer/src/dart/ast/ast.dart'; | ||
import 'package:analyzer/src/error/codes.g.dart'; | ||
|
||
/// Verifies doc imports, written as `@docImport` inside doc comments. | ||
class DocImportVerifier { | ||
final ErrorReporter _errorReporter; | ||
|
||
DocImportVerifier(this._errorReporter); | ||
|
||
void docImport(DocImport node) { | ||
var deferredKeyword = node.import.deferredKeyword; | ||
if (deferredKeyword != null) { | ||
_errorReporter.reportErrorForToken( | ||
WarningCode.DOC_IMPORT_CANNOT_BE_DEFERRED, | ||
deferredKeyword, | ||
); | ||
} | ||
// TODO(srawlins): Report warnings for configurations. | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.