Skip to content

Commit 6ca3b28

Browse files
committed
Merge pull request #812 from dart-lang/ddc_remove_deprecated
remove calls to deprecated methods
2 parents a7ae7db + 759573c commit 6ca3b28

File tree

2 files changed

+22
-16
lines changed

2 files changed

+22
-16
lines changed

lib/markdown_processor.dart

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -110,28 +110,29 @@ NodeList<CommentReference> _getCommentRefs(ModelElement modelElement) {
110110
if (modelElement.documentation == null && modelElement.canOverride()) {
111111
var melement = modelElement.overriddenElement;
112112
if (melement != null &&
113-
melement.element.node != null &&
114-
melement.element.node is AnnotatedNode) {
115-
var docComment =
116-
(melement.element.node as AnnotatedNode).documentationComment;
113+
melement.element.computeNode() != null &&
114+
melement.element.computeNode() is AnnotatedNode) {
115+
var docComment = (melement.element.computeNode() as AnnotatedNode)
116+
.documentationComment;
117117
if (docComment != null) return docComment.references;
118118
return null;
119119
}
120120
}
121-
if (modelElement.element.node is AnnotatedNode) {
122-
if ((modelElement.element.node as AnnotatedNode).documentationComment !=
121+
if (modelElement.element.computeNode() is AnnotatedNode) {
122+
if ((modelElement.element.computeNode() as AnnotatedNode)
123+
.documentationComment !=
123124
null) {
124-
return (modelElement.element.node as AnnotatedNode)
125+
return (modelElement.element.computeNode() as AnnotatedNode)
125126
.documentationComment
126127
.references;
127128
}
128129
} else if (modelElement.element is LibraryElement) {
129130
// handle anonymous libraries
130-
if (modelElement.element.node == null ||
131-
modelElement.element.node.parent == null) {
131+
if (modelElement.element.computeNode() == null ||
132+
modelElement.element.computeNode().parent == null) {
132133
return null;
133134
}
134-
var node = modelElement.element.node.parent.parent;
135+
var node = modelElement.element.computeNode().parent.parent;
135136
if (node is AnnotatedNode) {
136137
if ((node as AnnotatedNode).documentationComment != null) {
137138
return (node as AnnotatedNode).documentationComment.references;

lib/src/model.dart

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -155,8 +155,11 @@ abstract class ModelElement implements Comparable {
155155
List<String> get annotations {
156156
// Check https://code.google.com/p/dart/issues/detail?id=23181
157157
// If that is fixed, this code might get a lot easier
158-
if (element.node != null && element.node is AnnotatedNode) {
159-
return (element.node as AnnotatedNode).metadata.map((Annotation a) {
158+
if (element.computeNode() != null &&
159+
element.computeNode() is AnnotatedNode) {
160+
return (element.computeNode() as AnnotatedNode)
161+
.metadata
162+
.map((Annotation a) {
160163
var annotationString = a.toSource().substring(1); // remove the @
161164
var e = a.element;
162165
if (e != null && (e is ConstructorElement)) {
@@ -1244,7 +1247,7 @@ class Enum extends Class {
12441247
abstract class SourceCodeMixin {
12451248
String get sourceCode {
12461249
String contents = element.source.contents.data;
1247-
var node = element.node; // TODO: computeNode once we go to 0.25.2
1250+
var node = element.computeNode(); // TODO: computeNode once we go to 0.25.2
12481251
// find the start of the line, so that we can line up all the indents
12491252
int i = node.offset;
12501253
while (i > 0) {
@@ -1369,8 +1372,8 @@ class Field extends ModelElement {
13691372
String get constantValue {
13701373
if (_constantValue != null) return _constantValue;
13711374

1372-
if (_field.node == null) return null;
1373-
var v = _field.node.toSource();
1375+
if (_field.computeNode() == null) return null;
1376+
var v = _field.computeNode().toSource();
13741377
if (v == null) return null;
13751378
var string = v.substring(v.indexOf('=') + 1, v.length).trim();
13761379
_constantValue = string.replaceAll(modelType.name, modelType.linkedName);
@@ -1617,7 +1620,9 @@ class TopLevelVariable extends ModelElement {
16171620
}
16181621

16191622
String get constantValue {
1620-
var v = (_variable as ConstTopLevelVariableElementImpl).node.toSource();
1623+
var v = (_variable as ConstTopLevelVariableElementImpl)
1624+
.computeNode()
1625+
.toSource();
16211626
if (v == null) return '';
16221627
var string = v.substring(v.indexOf('=') + 1, v.length).trim();
16231628
return string.replaceAll(modelType.name, modelType.linkedName);

0 commit comments

Comments
 (0)