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

Unified Diff: pkg/analyzer/lib/src/dart/resolver/scope.dart

Issue 2335693002: Add support for accessing field formal parameters in the initializer list of constructors (Closed)
Patch Set: Clean up Created 4 years, 3 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
« no previous file with comments | « pkg/analyzer/lib/src/dart/constant/evaluation.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/dart/resolver/scope.dart
diff --git a/pkg/analyzer/lib/src/dart/resolver/scope.dart b/pkg/analyzer/lib/src/dart/resolver/scope.dart
index 765144b48655dc6cf072a97abe68f2d54e94d3e9..e3f02b08ab85e5e11b651ce6d7b7536b354fb6d7 100644
--- a/pkg/analyzer/lib/src/dart/resolver/scope.dart
+++ b/pkg/analyzer/lib/src/dart/resolver/scope.dart
@@ -113,6 +113,30 @@ class ClassScope extends EnclosedScope {
}
/**
+ * The scope defined for the initializers in a constructor.
+ */
+class ConstructorInitializerScope extends EnclosedScope {
+ /**
+ * Initialize a newly created scope, enclosed within the [enclosingScope].
+ */
+ ConstructorInitializerScope(Scope enclosingScope, ConstructorElement element)
+ : super(enclosingScope) {
+ _initializeFieldFormalParameters(element);
+ }
+
+ /**
+ * Initialize the local scope with all of the field formal parameters.
+ */
+ void _initializeFieldFormalParameters(ConstructorElement element) {
+ for (ParameterElement parameter in element.parameters) {
+ if (parameter is FieldFormalParameterElement) {
+ define(parameter);
+ }
+ }
+ }
+}
+
+/**
* A scope that is lexically enclosed in another scope.
*/
class EnclosedScope extends Scope {
« no previous file with comments | « pkg/analyzer/lib/src/dart/constant/evaluation.dart ('k') | pkg/analyzer/lib/src/generated/engine.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698