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

Unified Diff: lib/src/codegen/js_codegen.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 | « no previous file | lib/src/codegen/side_effect_analysis.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/src/codegen/js_codegen.dart
diff --git a/lib/src/codegen/js_codegen.dart b/lib/src/codegen/js_codegen.dart
index 872a7a532064a9b18f9151a540d69a136561907a..daea2b29cf01cf301df0287360141c09e5b64b7a 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -249,7 +249,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
var jsName = findAnnotation(node.element, _isJsNameAnnotation);
_jsModuleValue =
- getConstantField(jsName, 'name', types.stringType) as String;
+ getConstantField(jsName, 'name', types.stringType)?.toStringValue();
}
@override
@@ -401,8 +401,9 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
return _finishClassDef(element.type, classDecl);
}
- JS.Statement _emitJsType(String dartClassName, DartObjectImpl jsName) {
- var jsTypeName = getConstantField(jsName, 'name', types.stringType);
+ JS.Statement _emitJsType(String dartClassName, DartObject jsName) {
+ var jsTypeName =
+ getConstantField(jsName, 'name', types.stringType)?.toStringValue();
if (jsTypeName != null && jsTypeName != dartClassName) {
// We export the JS type as if it was a Dart type. For example this allows
@@ -442,7 +443,8 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
String jsPeerName;
var jsPeer = findAnnotation(classElem, _isJsPeerInterface);
if (jsPeer != null) {
- jsPeerName = getConstantField(jsPeer, 'name', types.stringType) as String;
+ jsPeerName =
+ getConstantField(jsPeer, 'name', types.stringType)?.toStringValue();
}
var body = _finishClassMembers(classElem, classExpr, ctors, fields, methods,
@@ -3300,9 +3302,9 @@ String jsLibraryName(LibraryElement library) => canonicalLibraryName(library);
JS.LiteralString _propertyName(String name) => js.string(name, "'");
// TODO(jmesserly): validate the library. See issue #135.
-bool _isJsNameAnnotation(DartObjectImpl value) => value.type.name == 'JsName';
+bool _isJsNameAnnotation(DartObject value) => value.type.name == 'JsName';
-bool _isJsPeerInterface(DartObjectImpl value) =>
+bool _isJsPeerInterface(DartObject value) =>
value.type.name == 'JsPeerInterface';
// TODO(jacobr): we would like to do something like the following
« no previous file with comments | « no previous file | lib/src/codegen/side_effect_analysis.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698