| 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.DartAnnotation; | 10 import com.google.dart.compiler.ast.DartAnnotation; |
| 11 import com.google.dart.compiler.ast.DartArrayLiteral; | 11 import com.google.dart.compiler.ast.DartArrayLiteral; |
| 12 import com.google.dart.compiler.ast.DartAssertStatement; | 12 import com.google.dart.compiler.ast.DartAssertStatement; |
| 13 import com.google.dart.compiler.ast.DartBinaryExpression; | 13 import com.google.dart.compiler.ast.DartBinaryExpression; |
| 14 import com.google.dart.compiler.ast.DartBooleanLiteral; | 14 import com.google.dart.compiler.ast.DartBooleanLiteral; |
| 15 import com.google.dart.compiler.ast.DartClass; | 15 import com.google.dart.compiler.ast.DartClass; |
| 16 import com.google.dart.compiler.ast.DartComment; | 16 import com.google.dart.compiler.ast.DartComment; |
| 17 import com.google.dart.compiler.ast.DartExprStmt; | 17 import com.google.dart.compiler.ast.DartExprStmt; |
| 18 import com.google.dart.compiler.ast.DartExpression; | 18 import com.google.dart.compiler.ast.DartExpression; |
| 19 import com.google.dart.compiler.ast.DartField; | 19 import com.google.dart.compiler.ast.DartField; |
| 20 import com.google.dart.compiler.ast.DartFieldDefinition; | 20 import com.google.dart.compiler.ast.DartFieldDefinition; |
| 21 import com.google.dart.compiler.ast.DartFunctionExpression; | 21 import com.google.dart.compiler.ast.DartFunctionExpression; |
| 22 import com.google.dart.compiler.ast.DartIdentifier; | 22 import com.google.dart.compiler.ast.DartIdentifier; |
| 23 import com.google.dart.compiler.ast.DartImportDirective; |
| 23 import com.google.dart.compiler.ast.DartIntegerLiteral; | 24 import com.google.dart.compiler.ast.DartIntegerLiteral; |
| 24 import com.google.dart.compiler.ast.DartMapLiteral; | 25 import com.google.dart.compiler.ast.DartMapLiteral; |
| 25 import com.google.dart.compiler.ast.DartMethodDefinition; | 26 import com.google.dart.compiler.ast.DartMethodDefinition; |
| 26 import com.google.dart.compiler.ast.DartNode; | 27 import com.google.dart.compiler.ast.DartNode; |
| 27 import com.google.dart.compiler.ast.DartParameter; | 28 import com.google.dart.compiler.ast.DartParameter; |
| 28 import com.google.dart.compiler.ast.DartPropertyAccess; | 29 import com.google.dart.compiler.ast.DartPropertyAccess; |
| 29 import com.google.dart.compiler.ast.DartStatement; | 30 import com.google.dart.compiler.ast.DartStatement; |
| 30 import com.google.dart.compiler.ast.DartStringInterpolation; | 31 import com.google.dart.compiler.ast.DartStringInterpolation; |
| 31 import com.google.dart.compiler.ast.DartStringLiteral; | 32 import com.google.dart.compiler.ast.DartStringLiteral; |
| 32 import com.google.dart.compiler.ast.DartTryStatement; | 33 import com.google.dart.compiler.ast.DartTryStatement; |
| (...skipping 12 matching lines...) Expand all Loading... |
| 45 "library lib;", | 46 "library lib;", |
| 46 "export 'a.dart' show A, B hide C, D;")); | 47 "export 'a.dart' show A, B hide C, D;")); |
| 47 } | 48 } |
| 48 | 49 |
| 49 public void test_exportDirective_noCombinators() { | 50 public void test_exportDirective_noCombinators() { |
| 50 parseUnit("test.dart", Joiner.on("\n").join( | 51 parseUnit("test.dart", Joiner.on("\n").join( |
| 51 "library lib;", | 52 "library lib;", |
| 52 "export 'a.dart';")); | 53 "export 'a.dart';")); |
| 53 } | 54 } |
| 54 | 55 |
| 56 public void test_importDirective_noUri() { |
| 57 DartUnit unit = parseUnit("test.dart", Joiner.on("\n").join( |
| 58 "library lib;", |
| 59 "import;"), |
| 60 ParserErrorCode.EXPECTED_TOKEN, 2, 7); |
| 61 DartImportDirective dir = (DartImportDirective) unit.getDirectives().get(1); |
| 62 System.out.println(dir.toSource()); |
| 63 } |
| 64 |
| 55 public void test_getter() { | 65 public void test_getter() { |
| 56 parseUnit("getter.dart", Joiner.on("\n").join( | 66 parseUnit("getter.dart", Joiner.on("\n").join( |
| 57 "class G {", | 67 "class G {", |
| 58 " // Old getter syntax", | 68 " // Old getter syntax", |
| 59 " int get g1() => 1;", | 69 " int get g1() => 1;", |
| 60 " // New getter syntax", | 70 " // New getter syntax", |
| 61 " int get g2 => 2;", | 71 " int get g2 => 2;", |
| 62 "}")); | 72 "}")); |
| 63 } | 73 } |
| 64 | 74 |
| (...skipping 1499 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1564 "typedef func(var arg());", | 1574 "typedef func(var arg());", |
| 1565 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_VAR, 1, 18); | 1575 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_VAR, 1, 18); |
| 1566 } | 1576 } |
| 1567 | 1577 |
| 1568 public void test_finalInFunctionType() throws Exception { | 1578 public void test_finalInFunctionType() throws Exception { |
| 1569 parseUnit("phony_var_in_function_type.dart", | 1579 parseUnit("phony_var_in_function_type.dart", |
| 1570 "typedef func(final arg());", | 1580 "typedef func(final arg());", |
| 1571 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_FINAL, 1, 20); | 1581 ParserErrorCode.FUNCTION_TYPED_PARAMETER_IS_FINAL, 1, 20); |
| 1572 } | 1582 } |
| 1573 } | 1583 } |
| OLD | NEW |