Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1120)

Unified Diff: pkg/analyzer/lib/src/task/dart.dart

Issue 2199323002: Initial implementation for lazy compound assignment operators (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/lib/src/task/dart.dart
diff --git a/pkg/analyzer/lib/src/task/dart.dart b/pkg/analyzer/lib/src/task/dart.dart
index 13e7b89620c4ff97579f37ebd22240d46fe09525..4ddfee51c4792a9fb3c93e8d0ec245ca95fb8b85 100644
--- a/pkg/analyzer/lib/src/task/dart.dart
+++ b/pkg/analyzer/lib/src/task/dart.dart
@@ -2669,12 +2669,12 @@ class DartDelta extends Delta {
// We could just invalidate errors if we moved reporting of
// HintCode.DEPRECATED_MEMBER_USE from resolver to verifier.
for (String name in references.names) {
- ClassElementDelta classDelta = changedClasses[name];
- if (classDelta != null && classDelta.hasAnnotationChanges) {
- _log(() => '$refLibrary is affected because '
- '$name has a class delta with annotation changes');
- return true;
- }
+ ClassElementDelta classDelta = changedClasses[name];
+ if (classDelta != null && classDelta.hasAnnotationChanges) {
+ _log(() => '$refLibrary is affected because '
+ '$name has a class delta with annotation changes');
+ return true;
+ }
}
return false;
}
@@ -4895,16 +4895,6 @@ class ReferencedNamesBuilder extends GeneralizingAstVisitor {
}
}
- static String _getSimpleName(Identifier identifier) {
- if (identifier is SimpleIdentifier) {
- return identifier.name;
- }
- if (identifier is PrefixedIdentifier) {
- return identifier.identifier.name;
- }
- return null;
- }
-
@override
visitClassTypeAlias(ClassTypeAlias node) {
ReferencedNamesScope outerScope = scope;
@@ -4934,14 +4924,6 @@ class ReferencedNamesBuilder extends GeneralizingAstVisitor {
}
@override
- visitSuperConstructorInvocation(SuperConstructorInvocation node) {
- if (node.constructorName == null && enclosingSuperClassName != null) {
- names.extendedUsedUnnamedConstructorNames.add(enclosingSuperClassName);
- }
- super.visitSuperConstructorInvocation(node);
- }
-
- @override
visitConstructorName(ConstructorName node) {
if (node.parent is! ConstructorDeclaration) {
super.visitConstructorName(node);
@@ -5061,6 +5043,14 @@ class ReferencedNamesBuilder extends GeneralizingAstVisitor {
}
@override
+ visitSuperConstructorInvocation(SuperConstructorInvocation node) {
+ if (node.constructorName == null && enclosingSuperClassName != null) {
+ names.extendedUsedUnnamedConstructorNames.add(enclosingSuperClassName);
+ }
+ super.visitSuperConstructorInvocation(node);
+ }
+
+ @override
visitTopLevelVariableDeclaration(TopLevelVariableDeclaration node) {
VariableDeclarationList variableList = node.variables;
// Prepare type dependencies.
@@ -5092,6 +5082,16 @@ class ReferencedNamesBuilder extends GeneralizingAstVisitor {
void _addSuperNames(String className, List<TypeName> types) {
types?.forEach((type) => _addSuperName(className, type));
}
+
+ static String _getSimpleName(Identifier identifier) {
+ if (identifier is SimpleIdentifier) {
+ return identifier.name;
+ }
+ if (identifier is PrefixedIdentifier) {
+ return identifier.identifier.name;
+ }
+ return null;
+ }
}
class ReferencedNamesScope {
@@ -6145,6 +6145,8 @@ class ScanDartTask extends SourceBasedAnalysisTask {
scanner.setSourceStart(fragment.line, fragment.column);
scanner.preserveComments = context.analysisOptions.preserveComments;
scanner.scanGenericMethodComments = context.analysisOptions.strongMode;
+ scanner.scanLazyAssignmentOperators =
+ context.analysisOptions.enableLazyAssignmentOperators;
LineInfo lineInfo = new LineInfo(scanner.lineStarts);
@@ -6160,6 +6162,8 @@ class ScanDartTask extends SourceBasedAnalysisTask {
new Scanner(source, new CharSequenceReader(content), errorListener);
scanner.preserveComments = context.analysisOptions.preserveComments;
scanner.scanGenericMethodComments = context.analysisOptions.strongMode;
+ scanner.scanLazyAssignmentOperators =
+ context.analysisOptions.enableLazyAssignmentOperators;
LineInfo lineInfo = new LineInfo(scanner.lineStarts);

Powered by Google App Engine
This is Rietveld 408576698