@@ -155,8 +155,11 @@ abstract class ModelElement implements Comparable {
155
155
List <String > get annotations {
156
156
// Check https://code.google.com/p/dart/issues/detail?id=23181
157
157
// 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) {
160
163
var annotationString = a.toSource ().substring (1 ); // remove the @
161
164
var e = a.element;
162
165
if (e != null && (e is ConstructorElement )) {
@@ -1244,7 +1247,7 @@ class Enum extends Class {
1244
1247
abstract class SourceCodeMixin {
1245
1248
String get sourceCode {
1246
1249
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
1248
1251
// find the start of the line, so that we can line up all the indents
1249
1252
int i = node.offset;
1250
1253
while (i > 0 ) {
@@ -1369,8 +1372,8 @@ class Field extends ModelElement {
1369
1372
String get constantValue {
1370
1373
if (_constantValue != null ) return _constantValue;
1371
1374
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 ();
1374
1377
if (v == null ) return null ;
1375
1378
var string = v.substring (v.indexOf ('=' ) + 1 , v.length).trim ();
1376
1379
_constantValue = string.replaceAll (modelType.name, modelType.linkedName);
@@ -1617,7 +1620,9 @@ class TopLevelVariable extends ModelElement {
1617
1620
}
1618
1621
1619
1622
String get constantValue {
1620
- var v = (_variable as ConstTopLevelVariableElementImpl ).node.toSource ();
1623
+ var v = (_variable as ConstTopLevelVariableElementImpl )
1624
+ .computeNode ()
1625
+ .toSource ();
1621
1626
if (v == null ) return '' ;
1622
1627
var string = v.substring (v.indexOf ('=' ) + 1 , v.length).trim ();
1623
1628
return string.replaceAll (modelType.name, modelType.linkedName);
0 commit comments