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

Unified Diff: frog/leg/tree/nodes.dart

Issue 9243011: Implement named constructors and resolving of redirecting constructors and super-initializers. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Rename field. Created 8 years, 11 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: frog/leg/tree/nodes.dart
diff --git a/frog/leg/tree/nodes.dart b/frog/leg/tree/nodes.dart
index 82eaeccd5812d4b087729b442c257b847d01a481..8f05b129b76f76a9cb67b22171d6e98d0341a2a6 100644
--- a/frog/leg/tree/nodes.dart
+++ b/frog/leg/tree/nodes.dart
@@ -226,6 +226,24 @@ class Send extends Expression {
int argumentCount() => argumentsNode.length();
+ bool get isSuperConstructorCall() {
+ return (receiver === null &&
+ selector.asIdentifier() !== null &&
+ selector.asIdentifier().isSuper()) ||
+ (receiver !== null &&
+ receiver.asIdentifier() !== null &&
+ receiver.asIdentifier().isSuper() &&
+ selector.asIdentifier() !== null);
+ }
+ bool get isConstructorRedirect() {
+ return (receiver === null &&
+ selector.asIdentifier() !== null &&
+ selector.asIdentifier().isThis()) ||
+ (receiver !== null &&
+ receiver.asIdentifier() !== null &&
+ receiver.asIdentifier().isThis() &&
+ selector.asIdentifier() !== null);
+ }
bool get isSuperCall() {
return receiver !== null &&
receiver.asIdentifier() !== null &&
@@ -521,6 +539,18 @@ class FunctionExpression extends Expression {
final Modifiers modifiers;
final NodeList initializers;
+ int _cachedParameterCount;
+
+ int parameterCount() {
+ if (_cachedParameterCount === null) {
+ _cachedParameterCount = 0;
+ for (Link l = parameters._nodes; !l.isEmpty(); l = l.tail) {
+ _cachedParameterCount++;
+ }
+ }
+ return _cachedParameterCount;
+ }
+
FunctionExpression(this.name, this.parameters, this.body, this.returnType,
this.modifiers, this.initializers);

Powered by Google App Engine
This is Rietveld 408576698