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

Unified Diff: dart/sdk/lib/_internal/compiler/implementation/elements/modelx.dart

Issue 22300007: Compute the correct signature for default constructors. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Created 7 years, 4 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
Index: dart/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
diff --git a/dart/sdk/lib/_internal/compiler/implementation/elements/modelx.dart b/dart/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
index 6c8bdd14cffd97bbe5adc11e92dac55f53b77da0..62d5f14c447b3fd180890def7b2becb8c9615656 100644
--- a/dart/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
+++ b/dart/sdk/lib/_internal/compiler/implementation/elements/modelx.dart
@@ -1398,17 +1398,19 @@ class ConstructorBodyElementX extends FunctionElementX
*/
class SynthesizedConstructorElementX extends FunctionElementX {
final FunctionElement superMember;
+ final bool isDefaultConstructor;
SynthesizedConstructorElementX(SourceString name,
this.superMember,
- Element enclosing)
+ Element enclosing,
+ this.isDefaultConstructor)
ngeoffray 2013/08/08 21:55:24 Did you consider a named parameter?
: super(name,
ElementKind.GENERATIVE_CONSTRUCTOR,
Modifiers.EMPTY,
enclosing);
SynthesizedConstructorElementX.forDefault(superMember, Element enclosing)
- : this(const SourceString(''), superMember, enclosing);
+ : this(const SourceString(''), superMember, enclosing, true);
Token position() => enclosingElement.position();
@@ -1417,6 +1419,11 @@ class SynthesizedConstructorElementX extends FunctionElementX {
FunctionElement get targetConstructor => superMember;
FunctionSignature computeSignature(compiler) {
+ if (isDefaultConstructor) {
+ return new FunctionSignatureX(
+ const Link<Element>(), const Link<Element>(), 0, 0, false,
+ getEnclosingClass().thisType);
+ }
if (superMember.isErroneous()) {
return compiler.objectClass.localLookup(
const SourceString('')).computeSignature(compiler);

Powered by Google App Engine
This is Rietveld 408576698