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

Unified Diff: lib/src/utils.dart

Issue 1413923003: Remove uses of DartObjectImpl (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Created 5 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « lib/src/codegen/side_effect_analysis.dart ('k') | test/codegen/expect/collection/equality.txt » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/utils.dart
diff --git a/lib/src/utils.dart b/lib/src/utils.dart
index b38f531ef757649e3c50a147348921c81d2a25fe..e0ad090ca0a9807f3b71da7d6320ddb19f323b9a 100644
--- a/lib/src/utils.dart
+++ b/lib/src/utils.dart
@@ -20,7 +20,7 @@ import 'package:analyzer/src/generated/ast.dart'
Expression,
SimpleIdentifier,
MethodInvocation;
-import 'package:analyzer/src/generated/constant.dart' show DartObjectImpl;
+import 'package:analyzer/src/generated/constant.dart' show DartObject;
import 'package:analyzer/src/generated/element.dart';
import 'package:analyzer/src/generated/engine.dart'
show ParseDartTask, AnalysisContext;
@@ -338,13 +338,9 @@ String resourceOutputPath(Uri resourceUri, Uri entryUri, String runtimeDir) {
///
/// (v) => v.type.name == 'Deprecated' && v.type.element.library.isDartCore
///
-DartObjectImpl findAnnotation(
- Element element, bool test(DartObjectImpl value)) {
+DartObject findAnnotation(Element element, bool test(DartObject value)) {
for (var metadata in element.metadata) {
- var evalResult = metadata.evaluationResult;
- if (evalResult == null) continue;
-
- var value = evalResult.value;
+ var value = metadata.constantValue;
if (value != null && test(value)) return value;
}
return null;
@@ -354,11 +350,10 @@ DartObjectImpl findAnnotation(
/// value of that field.
///
/// If the field is missing or is not [expectedType], returns null.
-Object getConstantField(
- DartObjectImpl value, String fieldName, DartType expectedType) {
- if (value == null) return null;
- var f = value.fields[fieldName];
- return (f == null || f.type != expectedType) ? null : f.value;
+DartObject getConstantField(
+ DartObject value, String fieldName, DartType expectedType) {
+ var f = value?.getField(fieldName);
+ return (f == null || f.type != expectedType) ? null : f;
}
DartType fillDynamicTypeArgs(DartType t, TypeProvider types) {
« no previous file with comments | « lib/src/codegen/side_effect_analysis.dart ('k') | test/codegen/expect/collection/equality.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698