Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(96)

Side by Side Diff: pkg/analyzer/test/src/summary/summary_common.dart

Issue 2736373004: Gracefully degrade summarization when an annotation is not a valid const expression (issue 28992) (Closed)
Patch Set: Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_ast.dart ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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.src.summary.summary_common; 5 library analyzer.test.src.summary.summary_common;
6 6
7 import 'package:analyzer/analyzer.dart'; 7 import 'package:analyzer/analyzer.dart';
8 import 'package:analyzer/dart/ast/ast.dart'; 8 import 'package:analyzer/dart/ast/ast.dart';
9 import 'package:analyzer/error/listener.dart'; 9 import 'package:analyzer/error/listener.dart';
10 import 'package:analyzer/src/dart/scanner/reader.dart'; 10 import 'package:analyzer/src/dart/scanner/reader.dart';
11 import 'package:analyzer/src/dart/scanner/scanner.dart'; 11 import 'package:analyzer/src/dart/scanner/scanner.dart';
12 import 'package:analyzer/src/generated/parser.dart'; 12 import 'package:analyzer/src/generated/parser.dart';
13 import 'package:analyzer/src/generated/source.dart'; 13 import 'package:analyzer/src/generated/source.dart';
14 import 'package:analyzer/src/generated/source_io.dart'; 14 import 'package:analyzer/src/generated/source_io.dart';
15 import 'package:analyzer/src/summary/base.dart'; 15 import 'package:analyzer/src/summary/base.dart';
16 import 'package:analyzer/src/summary/idl.dart'; 16 import 'package:analyzer/src/summary/idl.dart';
17 import 'package:analyzer/src/summary/public_namespace_computer.dart' 17 import 'package:analyzer/src/summary/public_namespace_computer.dart'
18 as public_namespace; 18 as public_namespace;
19 import 'package:path/path.dart' show posix; 19 import 'package:path/path.dart' show posix;
20 import 'package:test/test.dart'; 20 import 'package:test/test.dart';
21 import 'package:test_reflective_loader/test_reflective_loader.dart';
21 22
22 import '../context/mock_sdk.dart'; 23 import '../context/mock_sdk.dart';
23 24
24 /** 25 /**
25 * Convert the given Posix style file [path] to the corresponding absolute URI. 26 * Convert the given Posix style file [path] to the corresponding absolute URI.
26 */ 27 */
27 String absUri(String path) { 28 String absUri(String path) {
28 String absolutePath = posix.absolute(path); 29 String absolutePath = posix.absolute(path);
29 return posix.toUri(absolutePath).toString(); 30 return posix.toUri(absolutePath).toString();
30 } 31 }
(...skipping 3451 matching lines...) Expand 10 before | Expand all | Expand 10 after
3482 assertUnlinkedConst(variable.initializer.bodyExpr, 3483 assertUnlinkedConst(variable.initializer.bodyExpr,
3483 operators: [UnlinkedExprOperation.pushString], strings: ['abc']); 3484 operators: [UnlinkedExprOperation.pushString], strings: ['abc']);
3484 } 3485 }
3485 3486
3486 test_constExpr_pushTrue() { 3487 test_constExpr_pushTrue() {
3487 UnlinkedVariable variable = serializeVariableText('const v = true;'); 3488 UnlinkedVariable variable = serializeVariableText('const v = true;');
3488 assertUnlinkedConst(variable.initializer.bodyExpr, 3489 assertUnlinkedConst(variable.initializer.bodyExpr,
3489 operators: [UnlinkedExprOperation.pushTrue]); 3490 operators: [UnlinkedExprOperation.pushTrue]);
3490 } 3491 }
3491 3492
3493 test_constExpression_invalidAssignable() {
3494 // Verify that the following does not produce an exception.
3495 serializeLibraryText('@a(-b=""c');
scheglov 2017/03/09 20:24:54 May be worth to move to other test_metadata_invali
Brian Wilkerson 2017/03/09 22:32:51 I'm happy to rename the test, but I have no idea h
Brian Wilkerson 2017/03/09 22:51:13 Done
3496 }
3497
3492 test_constructor() { 3498 test_constructor() {
3493 String text = 'class C { C(); }'; 3499 String text = 'class C { C(); }';
3494 UnlinkedExecutable executable = 3500 UnlinkedExecutable executable =
3495 findExecutable('', executables: serializeClassText(text).executables); 3501 findExecutable('', executables: serializeClassText(text).executables);
3496 expect(executable.kind, UnlinkedExecutableKind.constructor); 3502 expect(executable.kind, UnlinkedExecutableKind.constructor);
3497 expect(executable.returnType, isNull); 3503 expect(executable.returnType, isNull);
3498 expect(executable.isAsynchronous, isFalse); 3504 expect(executable.isAsynchronous, isFalse);
3499 expect(executable.isExternal, isFalse); 3505 expect(executable.isExternal, isFalse);
3500 expect(executable.isGenerator, isFalse); 3506 expect(executable.isGenerator, isFalse);
3501 if (includeInformative) { 3507 if (includeInformative) {
(...skipping 7190 matching lines...) Expand 10 before | Expand all | Expand 10 after
10692 */ 10698 */
10693 class _PrefixExpectation { 10699 class _PrefixExpectation {
10694 final ReferenceKind kind; 10700 final ReferenceKind kind;
10695 final String name; 10701 final String name;
10696 final String absoluteUri; 10702 final String absoluteUri;
10697 final int numTypeParameters; 10703 final int numTypeParameters;
10698 10704
10699 _PrefixExpectation(this.kind, this.name, 10705 _PrefixExpectation(this.kind, this.name,
10700 {this.absoluteUri, this.numTypeParameters: 0}); 10706 {this.absoluteUri, this.numTypeParameters: 0});
10701 } 10707 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_ast.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698