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

Side by Side 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 library test_lib; 5 library test_lib;
6 6
7 import 'test_lib_foo.dart'; 7 import 'test_lib_foo.dart';
8 import 'test_lib_bar.dart'; 8 import 'test_lib_bar.dart';
9 export 'test_lib_foo.dart'; 9 export 'test_lib_foo.dart';
10 export 'test_lib_bar.dart'; 10 export 'test_lib_bar.dart';
(...skipping 22 matching lines...) Expand all
33 void doThis(int A) { 33 void doThis(int A) {
34 print(A); 34 print(A);
35 } 35 }
36 } 36 }
37 37
38 // A trivial use of `B` and `C` to eliminate import warnings 38 // A trivial use of `B` and `C` to eliminate import warnings
39 B sampleMethod(C cInstance) { 39 B sampleMethod(C cInstance) {
40 throw new UnimplementedError(); 40 throw new UnimplementedError();
41 } 41 }
42 42
43 int positionalDefaultValues([int intConst = INT_CONST, 43 int positionalDefaultValues([
44 bool boolConst = BOOL_CONST, List listConst = LIST_CONST, 44 int intConst = 42,
45 String stringConst = STRING_CONST, Map mapConst = MAP_CONST, 45 bool boolConst = true,
46 Map emptyMap = EMPTY_MAP_CONST]) { 46 List listConst = const [true, 42, 'Shanna', null, 3.14, const []],
47 String stringConst = 'Shanna',
48 Map mapConst = const {'a':1, 2: true, 'c': const [1,null,true]},
49 Map emptyMap = const {},
50 int referencedConst = INT_CONST,
51 ConstClass constructedConstant1 = const ConstClass<int>(0, true),
52 ConstClass constructedConstant2 = const ConstClass(1, false, str: "str")]) {
47 throw new UnimplementedError(); 53 throw new UnimplementedError();
48 } 54 }
49 55
50 const int INT_CONST = 42; 56 const int INT_CONST = 42;
51 57
52 const bool BOOL_CONST = true; 58 class ConstClass<T> {
59 final bool boolField;
60 final int intField;
61 final String stringField;
53 62
54 const LIST_CONST = const [true, 42, 'Shanna', null, 3.14, const []]; 63 const ConstClass(this.intField, this.boolField, {String str: 'default'})
55 64 : this.stringField = str;
56 const STRING_CONST = 'Shanna'; 65 }
57
58 const MAP_CONST = const {'a':1, 2: true, 'c': const [1,null,true]};
59
60 const EMPTY_MAP_CONST = const {};
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698