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

Unified Diff: lib/compiler/implementation/tree/nodes.dart

Issue 10996062: Use static final empty Modifier instead of null. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Missing uses fixed. Created 8 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 | « lib/compiler/implementation/ssa/optimize.dart ('k') | lib/compiler/implementation/tree/unparser.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/tree/nodes.dart
diff --git a/lib/compiler/implementation/tree/nodes.dart b/lib/compiler/implementation/tree/nodes.dart
index fff93e450b05f3ac76f218898bbfbd2c97a66121..42f51c5986f0a9c4a668cdffe295b6102bb6f678 100644
--- a/lib/compiler/implementation/tree/nodes.dart
+++ b/lib/compiler/implementation/tree/nodes.dart
@@ -609,7 +609,9 @@ class FunctionExpression extends Expression {
final Token getOrSet;
FunctionExpression(this.name, this.parameters, this.body, this.returnType,
- this.modifiers, this.initializers, this.getOrSet);
+ this.modifiers, this.initializers, this.getOrSet) {
+ assert(modifiers !== null);
+ }
FunctionExpression asFunctionExpression() => this;
@@ -994,7 +996,9 @@ class VariableDefinitions extends Statement {
final Modifiers modifiers;
final NodeList definitions;
VariableDefinitions(this.type, this.modifiers, this.definitions,
- this.endToken);
+ this.endToken) {
+ assert(modifiers !== null);
+ }
VariableDefinitions asVariableDefinitions() => this;
@@ -1093,6 +1097,11 @@ class ParenthesizedExpression extends Expression {
/** Representation of modifiers such as static, abstract, final, etc. */
class Modifiers extends Node {
+ /**
+ * Pseudo-constant for empty modifiers. Use this instead of null.
floitsch 2012/10/01 09:02:59 Remove "Use this instead of null".
Johnni Winther 2012/10/01 09:12:11 Why?
+ */
+ static final Modifiers EMPTY = new Modifiers(new NodeList.empty());
+
/* TODO(ahe): The following should be validated relating to modifiers:
* 1. The nodes must come in a certain order.
* 2. The keywords "var" and "final" may not be used at the same time.
@@ -1114,8 +1123,6 @@ class Modifiers extends Node {
Modifiers(NodeList nodes) : this.withFlags(nodes, computeFlags(nodes.nodes));
- Modifiers.empty() : this(new NodeList.empty());
-
Modifiers.withFlags(this.nodes, this.flags);
static int computeFlags(Link<Node> nodes) {
« no previous file with comments | « lib/compiler/implementation/ssa/optimize.dart ('k') | lib/compiler/implementation/tree/unparser.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698