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

Unified Diff: lib/src/codegen/js_codegen.dart

Issue 1492523004: Fixes #378 (Closed) Base URL: https://github.com/dart-lang/dev_compiler.git@master
Patch Set: Use virtual fields for extension fields Created 5 years 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/js_field_storage.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 9879bd42cd72f1e394626f7626358fdd7f062d68..91b8c018766099a7ae1822a9b7501dbd96a481d4 100644
--- a/lib/src/codegen/js_codegen.dart
+++ b/lib/src/codegen/js_codegen.dart
@@ -776,6 +776,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
}
// Emit the signature on the class recording the runtime type information
+ var extensions = _extensionsToImplement(classElem);
{
var tStatics = <JS.Property>[];
var tMethods = <JS.Property>[];
@@ -827,7 +828,7 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
sigFields.add(build('statics', tStatics));
sigFields.add(aNames);
}
- if (!sigFields.isEmpty) {
+ if (!sigFields.isEmpty || extensions.isNotEmpty) {
var sig = new JS.ObjectInitializer(sigFields);
var classExpr = new JS.Identifier(name);
body.add(js.statement('dart.setSignature(#, #);', [classExpr, sig]));
@@ -836,7 +837,6 @@ class JSCodegenVisitor extends GeneralizingAstVisitor with ClosureAnnotator {
// If a concrete class implements one of our extensions, we might need to
// add forwarders.
- var extensions = _extensionsToImplement(classElem);
if (extensions.isNotEmpty) {
var methodNames = <JS.Expression>[];
for (var e in extensions) {
@@ -3388,7 +3388,7 @@ class JSGenerator extends CodeGenerator {
// Clone the AST first, so we can mutate it.
unit = unit.clone();
var library = unit.library.element.library;
- var fields = findFieldsNeedingStorage(unit);
+ var fields = findFieldsNeedingStorage(unit, _extensionTypes);
var codegen =
new JSCodegenVisitor(compiler, rules, library, _extensionTypes, fields);
var module = codegen.emitLibrary(unit);
« no previous file with comments | « no previous file | lib/src/codegen/js_field_storage.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698