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

Side by Side Diff: lib/compiler/implementation/tree/nodes.dart

Issue 11191078: Make hashCode a getter and not a method. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Update status file with co19 issue number. Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file
2 // for details. All rights reserved. Use of this source code is governed by a 2 // for details. All rights reserved. Use of this source code is governed by a
3 // BSD-style license that can be found in the LICENSE file. 3 // BSD-style license that can be found in the LICENSE file.
4 4
5 abstract class Visitor<R> { 5 abstract class Visitor<R> {
6 const Visitor(); 6 const Visitor();
7 7
8 abstract R visitNode(Node node); 8 abstract R visitNode(Node node);
9 9
10 R visitBlock(Block node) => visitStatement(node); 10 R visitBlock(Block node) => visitStatement(node);
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
102 * 102 *
103 * The abstract part of "abstract syntax tree" is invalidated when 103 * The abstract part of "abstract syntax tree" is invalidated when
104 * supporting tools such as code formatting. These tools need concrete 104 * supporting tools such as code formatting. These tools need concrete
105 * syntax such as parentheses and no constant folding. 105 * syntax such as parentheses and no constant folding.
106 * 106 *
107 * We support these tools by storing additional references back to the 107 * We support these tools by storing additional references back to the
108 * token stream. These references are stored in fields ending with 108 * token stream. These references are stored in fields ending with
109 * "Token". 109 * "Token".
110 */ 110 */
111 abstract class Node implements Spannable { 111 abstract class Node implements Spannable {
112 final int _hashCode; 112 final int hashCode;
113 static int _HASH_COUNTER = 0; 113 static int _HASH_COUNTER = 0;
114 114
115 Node() : _hashCode = ++_HASH_COUNTER; 115 Node() : hashCode = ++_HASH_COUNTER;
116
117 hashCode() => _hashCode;
118 116
119 abstract accept(Visitor visitor); 117 abstract accept(Visitor visitor);
120 118
121 abstract visitChildren(Visitor visitor); 119 abstract visitChildren(Visitor visitor);
122 120
123 /** 121 /**
124 * Returns this node unparsed to Dart source string. 122 * Returns this node unparsed to Dart source string.
125 */ 123 */
126 toString() => unparse(this); 124 toString() => unparse(this);
127 125
(...skipping 1889 matching lines...) Expand 10 before | Expand all | Expand 10 after
2017 * argument). 2015 * argument).
2018 * 2016 *
2019 * TODO(ahe): This method is controversial, the team needs to discuss 2017 * TODO(ahe): This method is controversial, the team needs to discuss
2020 * if top-level methods are acceptable and what naming conventions to 2018 * if top-level methods are acceptable and what naming conventions to
2021 * use. 2019 * use.
2022 */ 2020 */
2023 initializerDo(Node node, f(Node node)) { 2021 initializerDo(Node node, f(Node node)) {
2024 SendSet send = node.asSendSet(); 2022 SendSet send = node.asSendSet();
2025 if (send != null) return f(send.arguments.head); 2023 if (send != null) return f(send.arguments.head);
2026 } 2024 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698