Chromium Code Reviews| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 231 Joiner.on("\n").join( | 231 Joiner.on("\n").join( |
| 232 "class A {", | 232 "class A {", |
| 233 " pref.A foo() {", | 233 " pref.A foo() {", |
| 234 " return new pref.A();", | 234 " return new pref.A();", |
| 235 " }", | 235 " }", |
| 236 "}")); | 236 "}")); |
| 237 List<DartNode> nodes = unit.getTopLevelNodes(); | 237 List<DartNode> nodes = unit.getTopLevelNodes(); |
| 238 assertEquals(1, nodes.size()); | 238 assertEquals(1, nodes.size()); |
| 239 } | 239 } |
| 240 | 240 |
| 241 public void testMultipleLabels() { | |
| 242 DartUnit unit = parseUnit ("multiple_labels.dart", | |
| 243 Joiner.on("\n").join( | |
| 244 "class A {", | |
| 245 " void foo() {", | |
| 246 " a: b: foo();", | |
|
zundel
2012/06/08 21:29:05
In the Resolver, there is more handling for labels
| |
| 247 " }", | |
| 248 "}")); | |
| 249 } | |
| 250 | |
| 241 public void testAdjacentStrings1() { | 251 public void testAdjacentStrings1() { |
| 242 DartUnit unit = parseUnit ("phony_adjacent_strings_1.dart", | 252 DartUnit unit = parseUnit ("phony_adjacent_strings_1.dart", |
| 243 Joiner.on("\n").join( | 253 Joiner.on("\n").join( |
| 244 "var a = \"\" \"\";", | 254 "var a = \"\" \"\";", |
| 245 "var b = \"1\" \"2\" \"3\";")); | 255 "var b = \"1\" \"2\" \"3\";")); |
| 246 List<DartNode> nodes = unit.getTopLevelNodes(); | 256 List<DartNode> nodes = unit.getTopLevelNodes(); |
| 247 assertEquals(2, nodes.size()); | 257 assertEquals(2, nodes.size()); |
| 248 DartStringLiteral varA = (DartStringLiteral)((DartFieldDefinition)nodes.get( 0)) | 258 DartStringLiteral varA = (DartStringLiteral)((DartFieldDefinition)nodes.get( 0)) |
| 249 .getFields().get(0).getValue(); | 259 .getFields().get(0).getValue(); |
| 250 assertEquals("", varA.getValue()); | 260 assertEquals("", varA.getValue()); |
| (...skipping 274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 525 " }", | 535 " }", |
| 526 "}"), | 536 "}"), |
| 527 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 5, 13, | 537 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 5, 13, |
| 528 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 7, 14, | 538 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 7, 14, |
| 529 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 9, 13, | 539 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 9, 13, |
| 530 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 11, 13, | 540 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 11, 13, |
| 531 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 13, 14, | 541 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 13, 14, |
| 532 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 15, 13); | 542 ParserErrorCode.SUPER_CANNOT_BE_USED_AS_THE_SECOND_OPERAND, 15, 13); |
| 533 } | 543 } |
| 534 } | 544 } |
| OLD | NEW |