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

Unified Diff: sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart

Issue 526263002: Remove unneeded generation of default constructors from the dart backend. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Added language test. Created 6 years, 3 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 | tests/compiler/dart2js/backend_dart/dart_backend_test.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
diff --git a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
index 4160a2777d3533c1cba4bcc018c90c1d4ed126bd..708818eb46f1902b95592a9894300e05e51d2dd1 100644
--- a/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
+++ b/sdk/lib/_internal/compiler/implementation/dart_backend/backend.dart
@@ -346,51 +346,9 @@ class DartBackend extends Backend {
}
});
- // Add synthesized constructors to classes with no resolved constructors,
- // but which originally had any constructor. That should prevent
- // those classes from being instantiable with default constructor.
- Identifier synthesizedIdentifier = new Identifier(
- new StringToken.fromString(IDENTIFIER_INFO, '', -1));
-
- NextClassElement:
- for (ClassElement classElement in classMembers.keys) {
- if (emitNoMembersFor.contains(classElement)) continue;
- for (Element member in classMembers[classElement]) {
- if (member.isConstructor) continue NextClassElement;
- }
- if (classElement.constructors.isEmpty) continue NextClassElement;
-
- // TODO(antonm): check with AAR team if there is better approach.
- // As an idea: provide template as a Dart code---class C { C.name(); }---
- // and then overwrite necessary parts.
- var classNode = classElement.node;
- SynthesizedConstructorElementX constructor =
- new SynthesizedConstructorElementX(
- classElement.name, null, classElement, false);
- constructor.typeCache =
- new FunctionType(constructor, const VoidType());
- if (!constructor.isSynthesized) {
- classMembers[classElement].add(constructor);
- }
- FunctionExpression node = new FunctionExpression(
- new Send(classNode.name, synthesizedIdentifier),
- new NodeList(new StringToken.fromString(OPEN_PAREN_INFO, '(', -1),
- const Link<Node>(),
- new StringToken.fromString(CLOSE_PAREN_INFO, ')', -1)),
- new EmptyStatement(
- new StringToken.fromString(SEMICOLON_INFO, ';', -1)),
- null, Modifiers.EMPTY, null, null);
-
- elementAsts[constructor] =
- new ElementAst.internal(node, new TreeElementMapping(null));
- }
-
// Create all necessary placeholders.
PlaceholderCollector collector =
new PlaceholderCollector(compiler, fixedMemberNames, elementAsts);
- // Add synthesizedIdentifier to set of unresolved names to rename it to
- // some unused identifier.
- collector.unresolvedNodes.add(synthesizedIdentifier);
makePlaceholders(element) {
bool oldUseHelper = useMirrorHelperLibrary;
useMirrorHelperLibrary = (useMirrorHelperLibrary
« no previous file with comments | « no previous file | tests/compiler/dart2js/backend_dart/dart_backend_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698