OLD | NEW |
---|---|
1 // Copyright 2012 the V8 project authors. All rights reserved. | 1 // Copyright 2012 the V8 project authors. All rights reserved. |
2 // Redistribution and use in source and binary forms, with or without | 2 // Redistribution and use in source and binary forms, with or without |
3 // modification, are permitted provided that the following conditions are | 3 // modification, are permitted provided that the following conditions are |
4 // met: | 4 // met: |
5 // | 5 // |
6 // * Redistributions of source code must retain the above copyright | 6 // * Redistributions of source code must retain the above copyright |
7 // notice, this list of conditions and the following disclaimer. | 7 // notice, this list of conditions and the following disclaimer. |
8 // * Redistributions in binary form must reproduce the above | 8 // * Redistributions in binary form must reproduce the above |
9 // copyright notice, this list of conditions and the following | 9 // copyright notice, this list of conditions and the following |
10 // disclaimer in the documentation and/or other materials provided | 10 // disclaimer in the documentation and/or other materials provided |
(...skipping 7864 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
7875 const char* correct_data[] = { | 7875 const char* correct_data[] = { |
7876 "class C { f(x: number) : boolean { return x == 42; } }", | 7876 "class C { f(x: number) : boolean { return x == 42; } }", |
7877 "class D extends C { g<A>(x: A[]) : A { return x[0]; } }", | 7877 "class D extends C { g<A>(x: A[]) : A { return x[0]; } }", |
7878 "class E extends D implements I, J {}", | 7878 "class E extends D implements I, J {}", |
7879 "class F<A> extends D implements I<A>, J<number, A> {}", | 7879 "class F<A> extends D implements I<A>, J<number, A> {}", |
7880 "class C { x; y=42; z: number; w: number = 17; }", | 7880 "class C { x; y=42; z: number; w: number = 17; }", |
7881 "class C { [x: string]; }", | 7881 "class C { [x: string]; }", |
7882 "class C { [x: number]; }", | 7882 "class C { [x: number]; }", |
7883 "class C { [x: string] : boolean; }", | 7883 "class C { [x: string] : boolean; }", |
7884 "class C { [x: number] : boolean; }", | 7884 "class C { [x: number] : boolean; }", |
7885 "class C { constructor (x: number); constructor (x) {} }", | |
rossberg
2016/04/18 11:13:10
Also try in the opposite order.
nickie
2016/04/18 12:35:09
It is not 100% clear if that should be valid or no
| |
7886 "class C { f (x: number) : number; f (x) { return x; } }", | |
rossberg
2016/04/18 11:13:10
Same here.
| |
7885 NULL | 7887 NULL |
7886 }; | 7888 }; |
7887 | 7889 |
7888 const char* error_data[] = { | 7890 const char* error_data[] = { |
7889 "class C { f(x: number) : () {} }", | 7891 "class C { f(x: number) : () {} }", |
7890 "class D implements () {}", | 7892 "class D implements () {}", |
7891 "class E implements number[] {}", | 7893 "class E implements number[] {}", |
7892 "class F implements I<> {}", | 7894 "class F implements I<> {}", |
7893 "class E<> {}", | 7895 "class E<> {}", |
7894 "class C { x: (); }", | 7896 "class C { x: (); }", |
7895 "class C { [42]; }", | 7897 "class C { [42]; }", |
7896 "class C { [42] : number; }", | 7898 "class C { [42] : number; }", |
7897 "class C { [x: any]; }", | 7899 "class C { [x: any]; }", |
7898 "class C { [x: any] : any; }", | 7900 "class C { [x: any] : any; }", |
7899 "class C { static [x: number]; }", | 7901 "class C { static [x: number]; }", |
7902 "class C { constructor (x: number) : number; constructor (x) {} }", | |
7900 NULL | 7903 NULL |
7901 }; | 7904 }; |
7902 | 7905 |
7903 static const ParserFlag always_flags[] = {kAllowTypes}; | 7906 static const ParserFlag always_flags[] = {kAllowTypes}; |
7904 RunParserSyncTest(untyped_context_data, correct_data, kError, NULL, 0, | 7907 RunParserSyncTest(untyped_context_data, correct_data, kError, NULL, 0, |
7905 always_flags, arraysize(always_flags)); | 7908 always_flags, arraysize(always_flags)); |
7906 RunParserSyncTest(typed_context_data, correct_data, kSuccess, NULL, 0, | 7909 RunParserSyncTest(typed_context_data, correct_data, kSuccess, NULL, 0, |
7907 always_flags, arraysize(always_flags)); | 7910 always_flags, arraysize(always_flags)); |
7908 RunParserSyncTest(untyped_context_data, error_data, kError, NULL, 0, | 7911 RunParserSyncTest(untyped_context_data, error_data, kError, NULL, 0, |
7909 always_flags, arraysize(always_flags)); | 7912 always_flags, arraysize(always_flags)); |
(...skipping 24 matching lines...) Expand all Loading... | |
7934 static const ParserFlag always_flags[] = {kAllowTypes}; | 7937 static const ParserFlag always_flags[] = {kAllowTypes}; |
7935 RunParserSyncTest(untyped_context_data, correct_data, kError, NULL, 0, | 7938 RunParserSyncTest(untyped_context_data, correct_data, kError, NULL, 0, |
7936 always_flags, arraysize(always_flags)); | 7939 always_flags, arraysize(always_flags)); |
7937 RunParserSyncTest(typed_context_data, correct_data, kSuccess, NULL, 0, | 7940 RunParserSyncTest(typed_context_data, correct_data, kSuccess, NULL, 0, |
7938 always_flags, arraysize(always_flags)); | 7941 always_flags, arraysize(always_flags)); |
7939 RunParserSyncTest(untyped_context_data, error_data, kError, NULL, 0, | 7942 RunParserSyncTest(untyped_context_data, error_data, kError, NULL, 0, |
7940 always_flags, arraysize(always_flags)); | 7943 always_flags, arraysize(always_flags)); |
7941 RunParserSyncTest(typed_context_data, error_data, kError, NULL, 0, | 7944 RunParserSyncTest(typed_context_data, error_data, kError, NULL, 0, |
7942 always_flags, arraysize(always_flags)); | 7945 always_flags, arraysize(always_flags)); |
7943 } | 7946 } |
OLD | NEW |