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

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: Address comments. 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..4af21fb4fcf4e83a5fed1497f29a49e42a1dea96 100644
--- a/frog/leg/tree/nodes.dart
+++ b/frog/leg/tree/nodes.dart
@@ -226,10 +226,29 @@ class Send extends Expression {
int argumentCount() => argumentsNode.length();
+ bool get isSuperConstructorCall() {
ngeoffray 2012/01/19 08:56:12 I don't really like these methods being here, as t
karlklose 2012/01/19 13:51:24 Done.
+ 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 &&
- receiver.asIdentifier().isSuper();
+ receiver.asIdentifier().isSuper() &&
+ selector.asIdentifier() !== null;
ngeoffray 2012/01/19 08:56:12 I think you're allowed to do super[2]. Checking if
karlklose 2012/01/19 13:51:24 Done.
}
bool get isOperator() => selector is Operator;
bool get isPropertyAccess() => argumentsNode === null;
@@ -521,6 +540,18 @@ class FunctionExpression extends Expression {
final Modifiers modifiers;
final NodeList initializers;
+ int _cachedParameterCount;
ngeoffray 2012/01/19 08:56:12 Like I said in the resolver, I think this belongs
karlklose 2012/01/19 13:51:24 Done.
+
+ 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