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

Side by Side Diff: pkg/compiler/lib/src/resolution/members.dart

Issue 2059883002: Implementation of modified scoping for initializing formals. (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Review response Created 4 years, 5 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 unified diff | Download patch
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 library dart2js.resolution.members; 5 library dart2js.resolution.members;
6 6
7 import '../common.dart'; 7 import '../common.dart';
8 import '../common/names.dart' show Selectors; 8 import '../common/names.dart' show Selectors;
9 import '../common/resolution.dart' show Feature; 9 import '../common/resolution.dart' show Feature;
10 import '../compiler.dart' show Compiler; 10 import '../compiler.dart' show Compiler;
(...skipping 426 matching lines...) Expand 10 before | Expand all | Expand 10 after
437 } else { 437 } else {
438 element.constant = new NullConstantExpression(); 438 element.constant = new NullConstantExpression();
439 } 439 }
440 } 440 }
441 VariableDefinitions variableDefinitions = parameterNodes.head; 441 VariableDefinitions variableDefinitions = parameterNodes.head;
442 Node parameterNode = variableDefinitions.definitions.nodes.head; 442 Node parameterNode = variableDefinitions.definitions.nodes.head;
443 // Field parameters (this.x) are not visible inside the constructor. The 443 // Field parameters (this.x) are not visible inside the constructor. The
444 // fields they reference are visible, but must be resolved independently. 444 // fields they reference are visible, but must be resolved independently.
445 if (element.isInitializingFormal) { 445 if (element.isInitializingFormal) {
446 registry.useElement(parameterNode, element); 446 registry.useElement(parameterNode, element);
447 if (compiler.options.enableInitializingFormalAccess) {
448 InitializingFormalElementX initializingFormalElementX = element;
449 defineLocalVariable(parameterNode, initializingFormalElementX);
450 addToScope(initializingFormalElementX);
451 }
452 } else { 447 } else {
453 LocalParameterElementX parameterElement = element; 448 LocalParameterElementX parameterElement = element;
454 defineLocalVariable(parameterNode, parameterElement); 449 defineLocalVariable(parameterNode, parameterElement);
455 addToScope(parameterElement); 450 addToScope(parameterElement);
456 } 451 }
457 parameterNodes = parameterNodes.tail; 452 parameterNodes = parameterNodes.tail;
458 }); 453 });
459 addDeferredAction(enclosingElement, () { 454 addDeferredAction(enclosingElement, () {
460 functionSignature.forEachOptionalParameter((ParameterElementX parameter) { 455 functionSignature.forEachOptionalParameter((ParameterElementX parameter) {
461 parameter.constant = 456 parameter.constant =
(...skipping 4269 matching lines...) Expand 10 before | Expand all | Expand 10 after
4731 } 4726 }
4732 return const NoneResult(); 4727 return const NoneResult();
4733 } 4728 }
4734 } 4729 }
4735 4730
4736 /// Looks up [name] in [scope] and unwraps the result. 4731 /// Looks up [name] in [scope] and unwraps the result.
4737 Element lookupInScope( 4732 Element lookupInScope(
4738 DiagnosticReporter reporter, Node node, Scope scope, String name) { 4733 DiagnosticReporter reporter, Node node, Scope scope, String name) {
4739 return Elements.unwrap(scope.lookup(name), reporter, node); 4734 return Elements.unwrap(scope.lookup(name), reporter, node);
4740 } 4735 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/resolution/constructors.dart ('k') | pkg/compiler/lib/src/resolution/resolution.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698