Index: pkg/dev_compiler/lib/src/compiler/code_generator.dart |
diff --git a/pkg/dev_compiler/lib/src/compiler/code_generator.dart b/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
index 8c56a4bef6397a14ac745f0478274c472cc5d504..e2552798ef4753d54ddc48977344feef0937fdb1 100644 |
--- a/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
+++ b/pkg/dev_compiler/lib/src/compiler/code_generator.dart |
@@ -963,6 +963,7 @@ class CodeGenerator extends Object |
_emitVirtualFieldSymbols(classElem, body); |
_emitClassSignature(methods, allFields, classElem, ctors, className, body); |
+ _initExtensionSymbols(classElem, methods, fields); |
_defineExtensionMembers(className, body); |
_emitClassMetadata(node.metadata, className, body); |
@@ -1982,6 +1983,30 @@ class CodeGenerator extends Object |
} |
} |
+ /// Ensure `dartx.` symbols we will use are present. |
+ void _initExtensionSymbols(ClassElement classElem, |
+ List<MethodDeclaration> methods, List<FieldDeclaration> fields) { |
+ if (_extensionTypes.hasNativeSubtype(classElem.type)) { |
+ for (var m in methods) { |
+ if (!m.isAbstract && |
+ !m.isStatic && |
+ resolutionMap.elementDeclaredByMethodDeclaration(m).isPublic) { |
+ _declareMemberName(m.element, useExtension: true); |
Jennifer Messerly
2017/08/31 21:00:48
FYI, this is mostly the original code, restored fr
|
+ } |
+ } |
+ for (var fieldDecl in fields) { |
+ if (!fieldDecl.isStatic) { |
+ for (var field in fieldDecl.fields.variables) { |
+ var e = field.element as FieldElement; |
+ if (e.isPublic) { |
+ _declareMemberName(e.getter, useExtension: true); |
+ } |
+ } |
+ } |
+ } |
+ } |
+ } |
+ |
/// If a concrete class implements one of our extensions, we might need to |
/// add forwarders. |
void _defineExtensionMembers( |