| 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 package com.google.dart.compiler.parser; | 4 package com.google.dart.compiler.parser; |
| 5 | 5 |
| 6 import com.google.common.base.Joiner; | 6 import com.google.common.base.Joiner; |
| 7 import com.google.dart.compiler.CompilerTestCase; | 7 import com.google.dart.compiler.CompilerTestCase; |
| 8 import com.google.dart.compiler.ast.DartClass; | 8 import com.google.dart.compiler.ast.DartClass; |
| 9 import com.google.dart.compiler.ast.DartIdentifier; | 9 import com.google.dart.compiler.ast.DartIdentifier; |
| 10 import com.google.dart.compiler.ast.DartMethodDefinition; | 10 import com.google.dart.compiler.ast.DartMethodDefinition; |
| (...skipping 459 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 470 "var b = -1;", | 470 "var b = -1;", |
| 471 "var c = +1;", | 471 "var c = +1;", |
| 472 "var d = -a;", | 472 "var d = -a;", |
| 473 "var e = +a;", | 473 "var e = +a;", |
| 474 "var f = + 1;", | 474 "var f = + 1;", |
| 475 ""), | 475 ""), |
| 476 errEx(ParserErrorCode.NO_UNARY_PLUS_OPERATOR, 6, 9, 1), | 476 errEx(ParserErrorCode.NO_UNARY_PLUS_OPERATOR, 6, 9, 1), |
| 477 errEx(ParserErrorCode.NO_SPACE_AFTER_PLUS, 7, 9, 1)); | 477 errEx(ParserErrorCode.NO_SPACE_AFTER_PLUS, 7, 9, 1)); |
| 478 } | 478 } |
| 479 | 479 |
| 480 public void test_functionDeclaration_name() { | |
| 481 parseExpectWarnings( | |
| 482 Joiner.on("\n").join( | |
| 483 "// filler filler filler filler filler filler filler filler filler f
iller", | |
| 484 "foo() {", | |
| 485 " f1(p){};", // function declaration as statement, has name | |
| 486 " (p){}", // function declaration as statement, should have name | |
| 487 " var f2 = (p){};", // variable declaration, name of function liter
al is not required | |
| 488 "}", | |
| 489 ""), | |
| 490 errEx(ParserErrorCode.MISSING_FUNCTION_NAME, 4, 3, 5)); | |
| 491 } | |
| 492 | |
| 493 /** | 480 /** |
| 494 * Separate test for invocation of function literal which has both return type
and name. | 481 * Separate test for invocation of function literal which has both return type
and name. |
| 495 */ | 482 */ |
| 496 public void test_invokeFunctionLiteral_returnType_name() { | 483 public void test_invokeFunctionLiteral_returnType_name() { |
| 497 DartParserRunner parserRunner = | 484 DartParserRunner parserRunner = |
| 498 parseExpectErrors(Joiner.on("\n").join( | 485 parseExpectErrors(Joiner.on("\n").join( |
| 499 "// filler filler filler filler filler filler filler filler filler f
iller", | 486 "// filler filler filler filler filler filler filler filler filler f
iller", |
| 500 "topLevelFunctionWithVeryLongNameToForceLineWrapping() {", | 487 "topLevelFunctionWithVeryLongNameToForceLineWrapping() {", |
| 501 " int f(p){}(0);", // invocation of function literal in statement,
has type and name | 488 " int f(p){}(0);", // invocation of function literal in statement,
has type and name |
| 502 "}", | 489 "}", |
| (...skipping 529 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1032 public void test_qualifiedType_inForIn() { | 1019 public void test_qualifiedType_inForIn() { |
| 1033 parseExpectErrors(Joiner.on("\n").join( | 1020 parseExpectErrors(Joiner.on("\n").join( |
| 1034 "// filler filler filler filler filler filler filler filler filler fille
r", | 1021 "// filler filler filler filler filler filler filler filler filler fille
r", |
| 1035 "foo() {", | 1022 "foo() {", |
| 1036 " for (pref.A a in elements) {", | 1023 " for (pref.A a in elements) {", |
| 1037 " }", | 1024 " }", |
| 1038 "}", | 1025 "}", |
| 1039 "")); | 1026 "")); |
| 1040 } | 1027 } |
| 1041 } | 1028 } |
| OLD | NEW |