| OLD | NEW |
| 1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2014, 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 library analyzer.test.generated.parser_test; | 5 library analyzer.test.generated.parser_test; |
| 6 | 6 |
| 7 import 'package:analyzer/dart/ast/ast.dart'; | 7 import 'package:analyzer/dart/ast/ast.dart'; |
| 8 import 'package:analyzer/dart/ast/token.dart'; | 8 import 'package:analyzer/dart/ast/token.dart'; |
| 9 import 'package:analyzer/dart/ast/visitor.dart'; | 9 import 'package:analyzer/dart/ast/visitor.dart'; |
| 10 import 'package:analyzer/src/dart/ast/token.dart'; | 10 import 'package:analyzer/src/dart/ast/token.dart'; |
| (...skipping 7076 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 7087 } | 7087 } |
| 7088 | 7088 |
| 7089 void test_parseConstructor() { | 7089 void test_parseConstructor() { |
| 7090 // TODO(brianwilkerson) Implement tests for this method. | 7090 // TODO(brianwilkerson) Implement tests for this method. |
| 7091 // parse("parseConstructor", new Class[] {Parser.CommentAndMetadata.class, | 7091 // parse("parseConstructor", new Class[] {Parser.CommentAndMetadata.class, |
| 7092 // Token.class, Token.class, SimpleIdentifier.class, Token.class, | 7092 // Token.class, Token.class, SimpleIdentifier.class, Token.class, |
| 7093 // SimpleIdentifier.class, FormalParameterList.class}, new Object[] {empt
yCommentAndMetadata(), | 7093 // SimpleIdentifier.class, FormalParameterList.class}, new Object[] {empt
yCommentAndMetadata(), |
| 7094 // null, null, null, null, null, null}, ""); | 7094 // null, null, null, null, null, null}, ""); |
| 7095 } | 7095 } |
| 7096 | 7096 |
| 7097 void test_parseConstructor_assert() { |
| 7098 ClassMember classMember = parse("parseClassMember", <Object>["C"], |
| 7099 "C(x, y) : _x = x, assert (x < y), _y = y;"); |
| 7100 expect(classMember, new isInstanceOf<ConstructorDeclaration>()); |
| 7101 ConstructorDeclaration constructor = classMember as ConstructorDeclaration; |
| 7102 NodeList<ConstructorInitializer> initializers = constructor.initializers; |
| 7103 expect(initializers, hasLength(2)); |
| 7104 } |
| 7105 |
| 7097 void test_parseConstructor_with_pseudo_function_literal() { | 7106 void test_parseConstructor_with_pseudo_function_literal() { |
| 7098 // "(b) {}" should not be misinterpreted as a function literal even though | 7107 // "(b) {}" should not be misinterpreted as a function literal even though |
| 7099 // it looks like one. | 7108 // it looks like one. |
| 7100 ClassMember classMember = | 7109 ClassMember classMember = |
| 7101 parse("parseClassMember", <Object>["C"], "C() : a = (b) {}"); | 7110 parse("parseClassMember", <Object>["C"], "C() : a = (b) {}"); |
| 7102 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorDeclaration, | 7111 EngineTestCase.assertInstanceOf((obj) => obj is ConstructorDeclaration, |
| 7103 ConstructorDeclaration, classMember); | 7112 ConstructorDeclaration, classMember); |
| 7104 ConstructorDeclaration constructor = classMember as ConstructorDeclaration; | 7113 ConstructorDeclaration constructor = classMember as ConstructorDeclaration; |
| 7105 NodeList<ConstructorInitializer> initializers = constructor.initializers; | 7114 NodeList<ConstructorInitializer> initializers = constructor.initializers; |
| 7106 expect(initializers, hasLength(1)); | 7115 expect(initializers, hasLength(1)); |
| (...skipping 4223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11330 new Scanner(null, new CharSequenceReader(source), listener); | 11339 new Scanner(null, new CharSequenceReader(source), listener); |
| 11331 Token tokenStream = scanner.tokenize(); | 11340 Token tokenStream = scanner.tokenize(); |
| 11332 // | 11341 // |
| 11333 // Parse the source. | 11342 // Parse the source. |
| 11334 // | 11343 // |
| 11335 Parser parser = new Parser(null, listener); | 11344 Parser parser = new Parser(null, listener); |
| 11336 return invokeParserMethodImpl( | 11345 return invokeParserMethodImpl( |
| 11337 parser, methodName, <Object>[tokenStream], tokenStream) as Token; | 11346 parser, methodName, <Object>[tokenStream], tokenStream) as Token; |
| 11338 } | 11347 } |
| 11339 } | 11348 } |
| OLD | NEW |