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

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

Issue 2021133003: Revert "Introduces "--initializing-formal-access"." (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 6 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
« no previous file with comments | « pkg/compiler/lib/src/options.dart ('k') | pkg/compiler/lib/src/typechecker.dart » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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;
11 import '../constants/constructors.dart' 11 import '../constants/constructors.dart'
12 show RedirectingFactoryConstantConstructor; 12 show RedirectingFactoryConstantConstructor;
13 import '../constants/expressions.dart'; 13 import '../constants/expressions.dart';
14 import '../constants/values.dart'; 14 import '../constants/values.dart';
15 import '../core_types.dart'; 15 import '../core_types.dart';
16 import '../dart_types.dart'; 16 import '../dart_types.dart';
17 import '../elements/elements.dart'; 17 import '../elements/elements.dart';
18 import '../elements/modelx.dart' 18 import '../elements/modelx.dart'
19 show 19 show
20 BaseFunctionElementX,
20 ConstructorElementX, 21 ConstructorElementX,
21 ErroneousElementX, 22 ErroneousElementX,
22 FunctionElementX, 23 FunctionElementX,
23 InitializingFormalElementX,
24 JumpTargetX, 24 JumpTargetX,
25 LocalFunctionElementX, 25 LocalFunctionElementX,
26 LocalParameterElementX, 26 LocalParameterElementX,
27 ParameterElementX, 27 ParameterElementX,
28 VariableElementX, 28 VariableElementX,
29 VariableList; 29 VariableList;
30 import '../tokens/token.dart' show isUserDefinableOperator; 30 import '../tokens/token.dart' show isUserDefinableOperator;
31 import '../tree/tree.dart'; 31 import '../tree/tree.dart';
32 import '../universe/call_structure.dart' show CallStructure; 32 import '../universe/call_structure.dart' show CallStructure;
33 import '../universe/selector.dart' show Selector; 33 import '../universe/selector.dart' show Selector;
(...skipping 403 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 422 matching lines...) Expand 10 before | Expand all | Expand 10 after
884 879
885 /// Compute the [AccessSemantics] corresponding to a local access of [target]. 880 /// Compute the [AccessSemantics] corresponding to a local access of [target].
886 AccessSemantics computeLocalAccessSemantics( 881 AccessSemantics computeLocalAccessSemantics(
887 Spannable node, LocalElement target) { 882 Spannable node, LocalElement target) {
888 if (target.isParameter) { 883 if (target.isParameter) {
889 if (target.isFinal || target.isConst) { 884 if (target.isFinal || target.isConst) {
890 return new StaticAccess.finalParameter(target); 885 return new StaticAccess.finalParameter(target);
891 } else { 886 } else {
892 return new StaticAccess.parameter(target); 887 return new StaticAccess.parameter(target);
893 } 888 }
894 } else if (target.isInitializingFormal){
895 return new StaticAccess.finalParameter(target);
896 } else if (target.isVariable) { 889 } else if (target.isVariable) {
897 if (target.isFinal || target.isConst) { 890 if (target.isFinal || target.isConst) {
898 return new StaticAccess.finalLocalVariable(target); 891 return new StaticAccess.finalLocalVariable(target);
899 } else { 892 } else {
900 return new StaticAccess.localVariable(target); 893 return new StaticAccess.localVariable(target);
901 } 894 }
902 } else { 895 } else {
903 assert(invariant(node, target.isFunction, 896 assert(invariant(node, target.isFunction,
904 message: "Unexpected local target '$target'.")); 897 message: "Unexpected local target '$target'."));
905 return new StaticAccess.localFunction(target); 898 return new StaticAccess.localFunction(target);
(...skipping 3820 matching lines...) Expand 10 before | Expand all | Expand 10 after
4726 } 4719 }
4727 return const NoneResult(); 4720 return const NoneResult();
4728 } 4721 }
4729 } 4722 }
4730 4723
4731 /// Looks up [name] in [scope] and unwraps the result. 4724 /// Looks up [name] in [scope] and unwraps the result.
4732 Element lookupInScope( 4725 Element lookupInScope(
4733 DiagnosticReporter reporter, Node node, Scope scope, String name) { 4726 DiagnosticReporter reporter, Node node, Scope scope, String name) {
4734 return Elements.unwrap(scope.lookup(name), reporter, node); 4727 return Elements.unwrap(scope.lookup(name), reporter, node);
4735 } 4728 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/options.dart ('k') | pkg/compiler/lib/src/typechecker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698