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

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

Issue 688253004: Prevent conflict between parameter names and local function names. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 1 month 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 | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/analyzer/lib/src/generated/resolver.dart
diff --git a/pkg/analyzer/lib/src/generated/resolver.dart b/pkg/analyzer/lib/src/generated/resolver.dart
index 85919ee7b867a4b886b3ae5d26ade7243aaf5a33..61a0f12a5bbe393e7c7d8a0d0404b18c589ba9dc 100644
--- a/pkg/analyzer/lib/src/generated/resolver.dart
+++ b/pkg/analyzer/lib/src/generated/resolver.dart
@@ -5294,12 +5294,6 @@ class FunctionScope extends EnclosedScope {
}
_parametersDefined = true;
Scope parameterScope = enclosingScope;
- if (_functionElement.enclosingElement is ExecutableElement) {
- String name = _functionElement.name;
- if (name != null && !name.isEmpty) {
- parameterScope.define(_functionElement);
- }
- }
for (ParameterElement parameter in _functionElement.parameters) {
if (!parameter.isInitializingFormal) {
parameterScope.define(parameter);
@@ -12748,6 +12742,10 @@ abstract class ScopedVisitor extends UnifyingAstVisitor<Object> {
@override
Object visitFunctionDeclaration(FunctionDeclaration node) {
ExecutableElement functionElement = node.element;
+ if (functionElement != null &&
+ functionElement.enclosingElement is! CompilationUnitElement) {
+ _nameScope.define(functionElement);
+ }
Scope outerScope = _nameScope;
try {
if (functionElement == null) {
@@ -12761,9 +12759,6 @@ abstract class ScopedVisitor extends UnifyingAstVisitor<Object> {
} finally {
_nameScope = outerScope;
}
- if (functionElement != null && functionElement.enclosingElement is! CompilationUnitElement) {
- _nameScope.define(functionElement);
- }
return null;
}
« no previous file with comments | « no previous file | pkg/analyzer/test/generated/compile_time_error_code_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698