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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/element.dart

Issue 1676573002: Add name/offset constructors for default parameter elements. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 analyzer.src.dart.element.element; 5 library analyzer.src.dart.element.element;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 import 'dart:math' show min; 8 import 'dart:math' show min;
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 1442 matching lines...) Expand 10 before | Expand all | Expand 10 after
1453 * A [FieldFormalParameterElementImpl] for parameters that have an initializer. 1453 * A [FieldFormalParameterElementImpl] for parameters that have an initializer.
1454 */ 1454 */
1455 class DefaultFieldFormalParameterElementImpl 1455 class DefaultFieldFormalParameterElementImpl
1456 extends FieldFormalParameterElementImpl with ConstVariableElement { 1456 extends FieldFormalParameterElementImpl with ConstVariableElement {
1457 /** 1457 /**
1458 * The result of evaluating this variable's initializer. 1458 * The result of evaluating this variable's initializer.
1459 */ 1459 */
1460 EvaluationResultImpl _result; 1460 EvaluationResultImpl _result;
1461 1461
1462 /** 1462 /**
1463 * Initialize a newly created parameter element to have the given [name] and
1464 * [nameOffset].
1465 */
1466 DefaultFieldFormalParameterElementImpl(String name, int nameOffset)
1467 : super(name, nameOffset);
1468
1469 /**
1463 * Initialize a newly created parameter element to have the given [name]. 1470 * Initialize a newly created parameter element to have the given [name].
1464 */ 1471 */
1465 DefaultFieldFormalParameterElementImpl(Identifier name) : super(name); 1472 DefaultFieldFormalParameterElementImpl.forNode(Identifier name)
1473 : super.forNode(name);
1466 1474
1467 @override 1475 @override
1468 DartObject get constantValue => _result.value; 1476 DartObject get constantValue => _result.value;
1469 1477
1470 @override 1478 @override
1471 EvaluationResultImpl get evaluationResult => _result; 1479 EvaluationResultImpl get evaluationResult => _result;
1472 1480
1473 @override 1481 @override
1474 void set evaluationResult(EvaluationResultImpl result) { 1482 void set evaluationResult(EvaluationResultImpl result) {
1475 this._result = result; 1483 this._result = result;
1476 } 1484 }
1477 } 1485 }
1478 1486
1479 /** 1487 /**
1480 * A [ParameterElement] for parameters that have an initializer. 1488 * A [ParameterElement] for parameters that have an initializer.
1481 */ 1489 */
1482 class DefaultParameterElementImpl extends ParameterElementImpl 1490 class DefaultParameterElementImpl extends ParameterElementImpl
1483 with ConstVariableElement { 1491 with ConstVariableElement {
1484 /** 1492 /**
1485 * The result of evaluating this variable's initializer. 1493 * The result of evaluating this variable's initializer.
1486 */ 1494 */
1487 EvaluationResultImpl _result; 1495 EvaluationResultImpl _result;
1488 1496
1489 /** 1497 /**
1498 * Initialize a newly created parameter element to have the given [name] and
1499 * [nameOffset].
1500 */
1501 DefaultParameterElementImpl(String name, int nameOffset)
1502 : super(name, nameOffset);
1503
1504 /**
1490 * Initialize a newly created parameter element to have the given [name]. 1505 * Initialize a newly created parameter element to have the given [name].
1491 */ 1506 */
1492 DefaultParameterElementImpl(Identifier name) : super.forNode(name); 1507 DefaultParameterElementImpl.forNode(Identifier name) : super.forNode(name);
1493 1508
1494 @override 1509 @override
1495 DartObject get constantValue => _result.value; 1510 DartObject get constantValue => _result.value;
1496 1511
1497 @override 1512 @override
1498 EvaluationResultImpl get evaluationResult => _result; 1513 EvaluationResultImpl get evaluationResult => _result;
1499 1514
1500 @override 1515 @override
1501 void set evaluationResult(EvaluationResultImpl result) { 1516 void set evaluationResult(EvaluationResultImpl result) {
1502 this._result = result; 1517 this._result = result;
(...skipping 1035 matching lines...) Expand 10 before | Expand all | Expand 10 after
2538 * [FieldElement] associated with the parameter. 2553 * [FieldElement] associated with the parameter.
2539 */ 2554 */
2540 class FieldFormalParameterElementImpl extends ParameterElementImpl 2555 class FieldFormalParameterElementImpl extends ParameterElementImpl
2541 implements FieldFormalParameterElement { 2556 implements FieldFormalParameterElement {
2542 /** 2557 /**
2543 * The field associated with this field formal parameter. 2558 * The field associated with this field formal parameter.
2544 */ 2559 */
2545 FieldElement field; 2560 FieldElement field;
2546 2561
2547 /** 2562 /**
2563 * Initialize a newly created parameter element to have the given [name] and
2564 * [nameOffset].
2565 */
2566 FieldFormalParameterElementImpl(String name, int nameOffset)
2567 : super(name, nameOffset);
2568
2569 /**
2548 * Initialize a newly created parameter element to have the given [name]. 2570 * Initialize a newly created parameter element to have the given [name].
2549 */ 2571 */
2550 FieldFormalParameterElementImpl(Identifier name) : super.forNode(name); 2572 FieldFormalParameterElementImpl.forNode(Identifier name)
2551 2573 : super.forNode(name);
2552 /**
2553 * Initialize a newly created parameter element to have the given [name] and
2554 * [offset].
2555 */
2556 FieldFormalParameterElementImpl.forNameAndOffset(String name, int nameOffset)
2557 : super(name, nameOffset);
2558 2574
2559 @override 2575 @override
2560 bool get isInitializingFormal => true; 2576 bool get isInitializingFormal => true;
2561 2577
2562 @override 2578 @override
2563 accept(ElementVisitor visitor) => 2579 accept(ElementVisitor visitor) =>
2564 visitor.visitFieldFormalParameterElement(this); 2580 visitor.visitFieldFormalParameterElement(this);
2565 } 2581 }
2566 2582
2567 /** 2583 /**
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after
4109 int _visibleRangeOffset = 0; 4125 int _visibleRangeOffset = 0;
4110 4126
4111 /** 4127 /**
4112 * The length of the visible range for this element, or `-1` if this element 4128 * The length of the visible range for this element, or `-1` if this element
4113 * does not have a visible range. 4129 * does not have a visible range.
4114 */ 4130 */
4115 int _visibleRangeLength = -1; 4131 int _visibleRangeLength = -1;
4116 4132
4117 /** 4133 /**
4118 * Initialize a newly created parameter element to have the given [name] and 4134 * Initialize a newly created parameter element to have the given [name] and
4119 * [offset]. 4135 * [nameOffset].
4120 */ 4136 */
4121 ParameterElementImpl(String name, int nameOffset) : super(name, nameOffset); 4137 ParameterElementImpl(String name, int nameOffset) : super(name, nameOffset);
4122 4138
4123 /** 4139 /**
4124 * Initialize a newly created parameter element to have the given [name]. 4140 * Initialize a newly created parameter element to have the given [name].
4125 */ 4141 */
4126 ParameterElementImpl.forNode(Identifier name) : super.forNode(name); 4142 ParameterElementImpl.forNode(Identifier name) : super.forNode(name);
4127 4143
4128 /** 4144 /**
4129 * Creates a synthetic parameter with [name], [type] and [kind]. 4145 * Creates a synthetic parameter with [name], [type] and [kind].
(...skipping 659 matching lines...) Expand 10 before | Expand all | Expand 10 after
4789 4805
4790 @override 4806 @override
4791 void visitElement(Element element) { 4807 void visitElement(Element element) {
4792 int offset = element.nameOffset; 4808 int offset = element.nameOffset;
4793 if (offset != -1) { 4809 if (offset != -1) {
4794 map[offset] = element; 4810 map[offset] = element;
4795 } 4811 }
4796 super.visitElement(element); 4812 super.visitElement(element);
4797 } 4813 }
4798 } 4814 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/dart/element/builder.dart ('k') | pkg/analyzer/lib/src/generated/testing/element_factory.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698