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

Unified Diff: pkg/smoke/lib/codegen/generator.dart

Issue 204143002: Changes in smoke in preparation of polymer's codegen: (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 6 years, 9 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 | « pkg/polymer/lib/src/declaration.dart ('k') | pkg/smoke/lib/codegen/recorder.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: pkg/smoke/lib/codegen/generator.dart
diff --git a/pkg/smoke/lib/codegen/generator.dart b/pkg/smoke/lib/codegen/generator.dart
index 06313f794c6dbafbe820eeeb777fb9b01d45f6b7..6269abe9ff6baa2e4f4ab0e73882157f1d0182b2 100644
--- a/pkg/smoke/lib/codegen/generator.dart
+++ b/pkg/smoke/lib/codegen/generator.dart
@@ -12,6 +12,8 @@ library smoke.codegen.generator;
import 'dart:collection' show SplayTreeMap, SplayTreeSet;
+import 'package:smoke/src/common.dart' show compareLists, compareMaps;
+
/// Collects the necessary information and generates code to initialize a
/// `StaticConfiguration`. After setting up the generator by calling
/// [addGetter], [addSetter], [addSymbol], and [addDeclaration], you can
@@ -274,7 +276,7 @@ class _DeclarationCode extends ConstExpression {
operator== (other) => other is _DeclarationCode && name == other.name &&
type == other.type && kind == other.kind && isFinal == other.isFinal &&
isStatic == other.isStatic &&
- _compareLists(annotations, other.annotations);
+ compareLists(annotations, other.annotations);
int get hashCode => name.hashCode + (31 * type.hashCode);
}
@@ -384,8 +386,8 @@ class ConstructorExpression extends ConstExpression {
String toString() => '(ctor: $importUrl, $name, $positionalArgs, $namedArgs)';
operator== (other) => other is ConstructorExpression && name == other.name
&& importUrl == other.importUrl &&
- _compareLists(positionalArgs, other.positionalArgs) &&
- _compareMaps(namedArgs, other.namedArgs);
+ compareLists(positionalArgs, other.positionalArgs) &&
+ compareMaps(namedArgs, other.namedArgs);
int get hashCode => 31 * importUrl.hashCode + name.hashCode;
}
@@ -421,25 +423,3 @@ const DEFAULT_IMPORTS = const [
"import 'package:smoke/static.dart' show "
"useGeneratedCode, StaticConfiguration;",
];
-
-/// Shallow comparison of two lists.
-bool _compareLists(List a, List b) {
- if (a == null && b != null) return false;
- if (a != null && b == null) return false;
- if (a.length != b.length) return false;
- for (int i = 0; i < a.length; i++) {
- if (a[i] != b[i]) return false;
- }
- return true;
-}
-
-/// Shallow comparison of two maps.
-bool _compareMaps(Map a, Map b) {
- if (a == null && b != null) return false;
- if (a != null && b == null) return false;
- if (a.length != b.length) return false;
- for (var k in a.keys) {
- if (!b.containsKey(k) || a[k] != b[k]) return false;
- }
- return true;
-}
« no previous file with comments | « pkg/polymer/lib/src/declaration.dart ('k') | pkg/smoke/lib/codegen/recorder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698