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

Unified Diff: pkg/docgen/test/multi_library_code/lib/test_lib.dart

Issue 574683002: Use ConstExp for storing constants. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Fixes and further implementation. Created 6 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
Index: pkg/docgen/test/multi_library_code/lib/test_lib.dart
diff --git a/pkg/docgen/test/multi_library_code/lib/test_lib.dart b/pkg/docgen/test/multi_library_code/lib/test_lib.dart
index 0ecf007c83240033a2b88cd1b9f031cae8580213..8d766246f629ba5296e5359baac0dcd86c9536f0 100644
--- a/pkg/docgen/test/multi_library_code/lib/test_lib.dart
+++ b/pkg/docgen/test/multi_library_code/lib/test_lib.dart
@@ -40,21 +40,26 @@ B sampleMethod(C cInstance) {
throw new UnimplementedError();
}
-int positionalDefaultValues([int intConst = INT_CONST,
- bool boolConst = BOOL_CONST, List listConst = LIST_CONST,
- String stringConst = STRING_CONST, Map mapConst = MAP_CONST,
- Map emptyMap = EMPTY_MAP_CONST]) {
+int positionalDefaultValues([
+ int intConst = 42,
+ bool boolConst = true,
+ List listConst = const [true, 42, 'Shanna', null, 3.14, const []],
+ String stringConst = 'Shanna',
+ Map mapConst = const {'a':1, 2: true, 'c': const [1,null,true]},
+ Map emptyMap = const {},
+ int referencedConst = INT_CONST,
+ ConstClass constructedConstant1 = const ConstClass<int>(0, true),
+ ConstClass constructedConstant2 = const ConstClass(1, false, str: "str")]) {
throw new UnimplementedError();
}
const int INT_CONST = 42;
-const bool BOOL_CONST = true;
+class ConstClass<T> {
+ final bool boolField;
+ final int intField;
+ final String stringField;
-const LIST_CONST = const [true, 42, 'Shanna', null, 3.14, const []];
-
-const STRING_CONST = 'Shanna';
-
-const MAP_CONST = const {'a':1, 2: true, 'c': const [1,null,true]};
-
-const EMPTY_MAP_CONST = const {};
+ const ConstClass(this.intField, this.boolField, {String str: 'default'})
+ : this.stringField = str;
+}

Powered by Google App Engine
This is Rietveld 408576698