OLD | NEW |
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2012, 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 package com.google.dart.compiler.parser; | 5 package com.google.dart.compiler.parser; |
6 | 6 |
7 import com.google.common.base.Joiner; | 7 import com.google.common.base.Joiner; |
8 import com.google.dart.compiler.DartCompilerListener; | 8 import com.google.dart.compiler.DartCompilerListener; |
9 import com.google.dart.compiler.DartSourceTest; | 9 import com.google.dart.compiler.DartSourceTest; |
10 import com.google.dart.compiler.ast.DartArrayLiteral; | 10 import com.google.dart.compiler.ast.DartArrayLiteral; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
56 public void test_index_literalMap() { | 56 public void test_index_literalMap() { |
57 parseUnit("test.dart", Joiner.on('\n').join( | 57 parseUnit("test.dart", Joiner.on('\n').join( |
58 "main() {", | 58 "main() {", |
59 " try { {'1' : 1, '2' : 2}['1']++; } catch(var e) {}", | 59 " try { {'1' : 1, '2' : 2}['1']++; } catch(var e) {}", |
60 "}")); | 60 "}")); |
61 } | 61 } |
62 | 62 |
63 public void test_setter() { | 63 public void test_setter() { |
64 parseUnit("setter.dart", Joiner.on("\n").join( | 64 parseUnit("setter.dart", Joiner.on("\n").join( |
65 "class G {", | 65 "class G {", |
66 " // Old setter syntax", | |
67 " void set g1(int v) {}", | 66 " void set g1(int v) {}", |
68 " // New setter syntax", | |
69 " void set g2=(int v) {}", | |
70 "}")); | 67 "}")); |
71 } | 68 } |
72 | 69 |
73 public void test_cascade() { | 70 public void test_cascade() { |
74 parseUnit("cascade.dart", Joiner.on("\n").join( | 71 parseUnit("cascade.dart", Joiner.on("\n").join( |
75 "class C {", | 72 "class C {", |
76 " var f = g..m1()..m2()..f.a;", | 73 " var f = g..m1()..m2()..f.a;", |
77 " var f = g..[3].x()..y()();", | 74 " var f = g..[3].x()..y()();", |
78 "}")); | 75 "}")); |
79 } | 76 } |
(...skipping 1054 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1134 "typedef func(var arg());", | 1131 "typedef func(var arg());", |
1135 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_VAR, 1, 18); | 1132 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_VAR, 1, 18); |
1136 } | 1133 } |
1137 | 1134 |
1138 public void test_finalInFunctionType() throws Exception { | 1135 public void test_finalInFunctionType() throws Exception { |
1139 parseUnit("phony_var_in_function_type.dart", | 1136 parseUnit("phony_var_in_function_type.dart", |
1140 "typedef func(final arg());", | 1137 "typedef func(final arg());", |
1141 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_FINAL, 1, 20); | 1138 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_FINAL, 1, 20); |
1142 } | 1139 } |
1143 } | 1140 } |
OLD | NEW |