OLD | NEW |
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 1203 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1214 * [name] and [offset]. | 1214 * [name] and [offset]. |
1215 */ | 1215 */ |
1216 ConstFieldElementImpl(String name, int offset) : super(name, offset); | 1216 ConstFieldElementImpl(String name, int offset) : super(name, offset); |
1217 | 1217 |
1218 /** | 1218 /** |
1219 * Initialize a newly created field element to have the given [name]. | 1219 * Initialize a newly created field element to have the given [name]. |
1220 */ | 1220 */ |
1221 ConstFieldElementImpl.forNode(Identifier name) : super.forNode(name); | 1221 ConstFieldElementImpl.forNode(Identifier name) : super.forNode(name); |
1222 | 1222 |
1223 @override | 1223 @override |
1224 DartObject get constantValue => _result.value; | 1224 DartObject get constantValue => _result?.value; |
1225 | 1225 |
1226 @override | 1226 @override |
1227 EvaluationResultImpl get evaluationResult => _result; | 1227 EvaluationResultImpl get evaluationResult => _result; |
1228 | 1228 |
1229 @override | 1229 @override |
1230 void set evaluationResult(EvaluationResultImpl result) { | 1230 void set evaluationResult(EvaluationResultImpl result) { |
1231 this._result = result; | 1231 this._result = result; |
1232 } | 1232 } |
1233 } | 1233 } |
1234 | 1234 |
(...skipping 13 matching lines...) Expand all Loading... |
1248 * and [offset]. | 1248 * and [offset]. |
1249 */ | 1249 */ |
1250 ConstLocalVariableElementImpl(String name, int offset) : super(name, offset); | 1250 ConstLocalVariableElementImpl(String name, int offset) : super(name, offset); |
1251 | 1251 |
1252 /** | 1252 /** |
1253 * Initialize a newly created local variable element to have the given [name]. | 1253 * Initialize a newly created local variable element to have the given [name]. |
1254 */ | 1254 */ |
1255 ConstLocalVariableElementImpl.forNode(Identifier name) : super.forNode(name); | 1255 ConstLocalVariableElementImpl.forNode(Identifier name) : super.forNode(name); |
1256 | 1256 |
1257 @override | 1257 @override |
1258 DartObject get constantValue => _result.value; | 1258 DartObject get constantValue => _result?.value; |
1259 | 1259 |
1260 @override | 1260 @override |
1261 EvaluationResultImpl get evaluationResult => _result; | 1261 EvaluationResultImpl get evaluationResult => _result; |
1262 | 1262 |
1263 @override | 1263 @override |
1264 void set evaluationResult(EvaluationResultImpl result) { | 1264 void set evaluationResult(EvaluationResultImpl result) { |
1265 this._result = result; | 1265 this._result = result; |
1266 } | 1266 } |
1267 } | 1267 } |
1268 | 1268 |
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1407 : super(name, offset); | 1407 : super(name, offset); |
1408 | 1408 |
1409 /** | 1409 /** |
1410 * Initialize a newly created top-level variable element to have the given | 1410 * Initialize a newly created top-level variable element to have the given |
1411 * [name]. | 1411 * [name]. |
1412 */ | 1412 */ |
1413 ConstTopLevelVariableElementImpl.forNode(Identifier name) | 1413 ConstTopLevelVariableElementImpl.forNode(Identifier name) |
1414 : super.forNode(name); | 1414 : super.forNode(name); |
1415 | 1415 |
1416 @override | 1416 @override |
1417 DartObject get constantValue => _result.value; | 1417 DartObject get constantValue => _result?.value; |
1418 | 1418 |
1419 @override | 1419 @override |
1420 EvaluationResultImpl get evaluationResult => _result; | 1420 EvaluationResultImpl get evaluationResult => _result; |
1421 | 1421 |
1422 @override | 1422 @override |
1423 void set evaluationResult(EvaluationResultImpl result) { | 1423 void set evaluationResult(EvaluationResultImpl result) { |
1424 this._result = result; | 1424 this._result = result; |
1425 } | 1425 } |
1426 } | 1426 } |
1427 | 1427 |
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1466 DefaultFieldFormalParameterElementImpl(String name, int nameOffset) | 1466 DefaultFieldFormalParameterElementImpl(String name, int nameOffset) |
1467 : super(name, nameOffset); | 1467 : super(name, nameOffset); |
1468 | 1468 |
1469 /** | 1469 /** |
1470 * Initialize a newly created parameter element to have the given [name]. | 1470 * Initialize a newly created parameter element to have the given [name]. |
1471 */ | 1471 */ |
1472 DefaultFieldFormalParameterElementImpl.forNode(Identifier name) | 1472 DefaultFieldFormalParameterElementImpl.forNode(Identifier name) |
1473 : super.forNode(name); | 1473 : super.forNode(name); |
1474 | 1474 |
1475 @override | 1475 @override |
1476 DartObject get constantValue => _result.value; | 1476 DartObject get constantValue => _result?.value; |
1477 | 1477 |
1478 @override | 1478 @override |
1479 EvaluationResultImpl get evaluationResult => _result; | 1479 EvaluationResultImpl get evaluationResult => _result; |
1480 | 1480 |
1481 @override | 1481 @override |
1482 void set evaluationResult(EvaluationResultImpl result) { | 1482 void set evaluationResult(EvaluationResultImpl result) { |
1483 this._result = result; | 1483 this._result = result; |
1484 } | 1484 } |
1485 } | 1485 } |
1486 | 1486 |
(...skipping 13 matching lines...) Expand all Loading... |
1500 */ | 1500 */ |
1501 DefaultParameterElementImpl(String name, int nameOffset) | 1501 DefaultParameterElementImpl(String name, int nameOffset) |
1502 : super(name, nameOffset); | 1502 : super(name, nameOffset); |
1503 | 1503 |
1504 /** | 1504 /** |
1505 * Initialize a newly created parameter element to have the given [name]. | 1505 * Initialize a newly created parameter element to have the given [name]. |
1506 */ | 1506 */ |
1507 DefaultParameterElementImpl.forNode(Identifier name) : super.forNode(name); | 1507 DefaultParameterElementImpl.forNode(Identifier name) : super.forNode(name); |
1508 | 1508 |
1509 @override | 1509 @override |
1510 DartObject get constantValue => _result.value; | 1510 DartObject get constantValue => _result?.value; |
1511 | 1511 |
1512 @override | 1512 @override |
1513 EvaluationResultImpl get evaluationResult => _result; | 1513 EvaluationResultImpl get evaluationResult => _result; |
1514 | 1514 |
1515 @override | 1515 @override |
1516 void set evaluationResult(EvaluationResultImpl result) { | 1516 void set evaluationResult(EvaluationResultImpl result) { |
1517 this._result = result; | 1517 this._result = result; |
1518 } | 1518 } |
1519 | 1519 |
1520 @override | 1520 @override |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1603 */ | 1603 */ |
1604 EvaluationResultImpl evaluationResult; | 1604 EvaluationResultImpl evaluationResult; |
1605 | 1605 |
1606 /** | 1606 /** |
1607 * Initialize a newly created annotation. The given [compilationUnit] is the | 1607 * Initialize a newly created annotation. The given [compilationUnit] is the |
1608 * compilation unit in which the annotation appears. | 1608 * compilation unit in which the annotation appears. |
1609 */ | 1609 */ |
1610 ElementAnnotationImpl(this.compilationUnit); | 1610 ElementAnnotationImpl(this.compilationUnit); |
1611 | 1611 |
1612 @override | 1612 @override |
1613 DartObject get constantValue => evaluationResult.value; | 1613 DartObject get constantValue => evaluationResult?.value; |
1614 | 1614 |
1615 @override | 1615 @override |
1616 AnalysisContext get context => compilationUnit.library.context; | 1616 AnalysisContext get context => compilationUnit.library.context; |
1617 | 1617 |
1618 @override | 1618 @override |
1619 bool get isDeprecated { | 1619 bool get isDeprecated { |
1620 if (element != null) { | 1620 if (element != null) { |
1621 LibraryElement library = element.library; | 1621 LibraryElement library = element.library; |
1622 if (library != null && library.isDartCore) { | 1622 if (library != null && library.isDartCore) { |
1623 if (element is ConstructorElement) { | 1623 if (element is ConstructorElement) { |
(...skipping 3167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4791 | 4791 |
4792 @override | 4792 @override |
4793 void visitElement(Element element) { | 4793 void visitElement(Element element) { |
4794 int offset = element.nameOffset; | 4794 int offset = element.nameOffset; |
4795 if (offset != -1) { | 4795 if (offset != -1) { |
4796 map[offset] = element; | 4796 map[offset] = element; |
4797 } | 4797 } |
4798 super.visitElement(element); | 4798 super.visitElement(element); |
4799 } | 4799 } |
4800 } | 4800 } |
OLD | NEW |