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

Side by Side Diff: pkg/analyzer2dart/test/sexpr_data.dart

Issue 658103003: Support map and list literals in analyzer2dart. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Use LiteralMapEntry to ensure build order Created 6 years, 1 month 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 /// Test data for sexpr_test. 5 /// Test data for sexpr_test.
6 library test.sexpr.data; 6 library test.sexpr.data;
7 7
8 import 'test_helper.dart'; 8 import 'test_helper.dart';
9 9
10 const List<Group> TEST_DATA = const [ 10 const List<Group> TEST_DATA = const [
(...skipping 798 matching lines...) Expand 10 before | Expand all | Expand 10 after
809 ''', ''' 809 ''', '''
810 (FunctionDefinition main (a return) 810 (FunctionDefinition main (a return)
811 (LetPrim v0 (Constant StringConstant(""))) 811 (LetPrim v0 (Constant StringConstant("")))
812 (LetCont (k0 v1) 812 (LetCont (k0 v1)
813 (LetPrim v2 (Constant NullConstant)) 813 (LetPrim v2 (Constant NullConstant))
814 (InvokeContinuation return v2)) 814 (InvokeContinuation return v2))
815 (InvokeConstructor Deprecated v0 k0)) 815 (InvokeConstructor Deprecated v0 k0))
816 '''), 816 '''),
817 ]), 817 ]),
818 818
819 const Group('List literal', const <TestSpec>[
820 const TestSpec('''
821 main() {
822 return [];
823 }
824 ''', '''
825 (FunctionDefinition main ( return)
826 (LetPrim v0 (LiteralList ()))
827 (InvokeContinuation return v0))
828 '''),
829
830 const TestSpec('''
831 main() {
832 return [0];
833 }
834 ''', '''
835 (FunctionDefinition main ( return)
836 (LetPrim v0 (Constant IntConstant(0)))
837 (LetPrim v1 (LiteralList (v0)))
838 (InvokeContinuation return v1))
839 '''),
840
841 const TestSpec('''
842 main(a) {
843 return [0, 1, a];
844 }
845 ''', '''
846 (FunctionDefinition main (a return)
847 (LetPrim v0 (Constant IntConstant(0)))
848 (LetPrim v1 (Constant IntConstant(1)))
849 (LetPrim v2 (LiteralList (v0 v1 a)))
850 (InvokeContinuation return v2))
851 '''),
852
853 const TestSpec('''
854 main(a) {
855 return [0, [1], [a, [3]]];
856 }
857 ''', '''
858 (FunctionDefinition main (a return)
859 (LetPrim v0 (Constant IntConstant(0)))
860 (LetPrim v1 (Constant IntConstant(1)))
861 (LetPrim v2 (LiteralList (v1)))
862 (LetPrim v3 (Constant IntConstant(3)))
863 (LetPrim v4 (LiteralList (v3)))
864 (LetPrim v5 (LiteralList (a v4)))
865 (LetPrim v6 (LiteralList (v0 v2 v5)))
866 (InvokeContinuation return v6))
867 '''),
868 ]),
869
870 const Group('Map literal', const <TestSpec>[
871 const TestSpec('''
872 main() {
873 return {};
874 }
875 ''', '''
876 (FunctionDefinition main ( return)
877 (LetPrim v0 (LiteralMap () ()))
878 (InvokeContinuation return v0))
879 '''),
880
881 const TestSpec('''
882 main() {
883 return {"a": 0};
884 }
885 ''', '''
886 (FunctionDefinition main ( return)
887 (LetPrim v0 (Constant StringConstant("a")))
888 (LetPrim v1 (Constant IntConstant(0)))
889 (LetPrim v2 (LiteralMap (v0) (v1)))
890 (InvokeContinuation return v2))
891 '''),
892
893 const TestSpec('''
894 main(a) {
895 return {"a": 0, "b": 1, "c": a};
896 }
897 ''', '''
898 (FunctionDefinition main (a return)
899 (LetPrim v0 (Constant StringConstant("a")))
900 (LetPrim v1 (Constant IntConstant(0)))
901 (LetPrim v2 (Constant StringConstant("b")))
902 (LetPrim v3 (Constant IntConstant(1)))
903 (LetPrim v4 (Constant StringConstant("c")))
904 (LetPrim v5 (LiteralMap (v0 v2 v4) (v1 v3 a)))
905 (InvokeContinuation return v5))
906 '''),
907
908 const TestSpec('''
909 main(a) {
910 return {0: "a", 1: {2: "b"}, a: {3: "c"}};
911 }
912 ''', '''
913 (FunctionDefinition main (a return)
914 (LetPrim v0 (Constant IntConstant(0)))
915 (LetPrim v1 (Constant StringConstant("a")))
916 (LetPrim v2 (Constant IntConstant(1)))
917 (LetPrim v3 (Constant IntConstant(2)))
918 (LetPrim v4 (Constant StringConstant("b")))
919 (LetPrim v5 (LiteralMap (v3) (v4)))
920 (LetPrim v6 (Constant IntConstant(3)))
921 (LetPrim v7 (Constant StringConstant("c")))
922 (LetPrim v8 (LiteralMap (v6) (v7)))
923 (LetPrim v9 (LiteralMap (v0 v2 a) (v1 v5 v8)))
924 (InvokeContinuation return v9))
925 '''),
926 ]),
927
819 const Group('For loop', const <TestSpec>[ 928 const Group('For loop', const <TestSpec>[
820 const TestSpec(''' 929 const TestSpec('''
821 main() { 930 main() {
822 for (;;) {} 931 for (;;) {}
823 } 932 }
824 ''', ''' 933 ''', '''
825 (FunctionDefinition main ( return) 934 (FunctionDefinition main ( return)
826 (LetCont* (k0) 935 (LetCont* (k0)
827 (LetPrim v0 (Constant BoolConstant(true))) 936 (LetPrim v0 (Constant BoolConstant(true)))
828 (LetCont (k1) 937 (LetCont (k1)
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
882 (LetCont (k5 v7) 991 (LetCont (k5 v7)
883 (InvokeContinuation* k0 v7)) 992 (InvokeContinuation* k0 v7))
884 (InvokeMethod v1 + v6 k5)) 993 (InvokeMethod v1 + v6 k5))
885 (InvokeStatic print v1 k4)) 994 (InvokeStatic print v1 k4))
886 (Branch (IsTrue v3) k3 k2)) 995 (Branch (IsTrue v3) k3 k2))
887 (InvokeMethod v1 < v2 k1)) 996 (InvokeMethod v1 < v2 k1))
888 (InvokeContinuation k0 v0)) 997 (InvokeContinuation k0 v0))
889 '''), 998 '''),
890 ]), 999 ]),
891 ]; 1000 ];
OLDNEW
« no previous file with comments | « pkg/analyzer2dart/test/end2end_data.dart ('k') | sdk/lib/_internal/compiler/implementation/cps_ir/cps_ir_builder.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698