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

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

Issue 1854213002: Add support for serializing 'target[index]' expressions. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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_const_expr.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/dart/element/element.dart'; 9 import 'package:analyzer/dart/element/element.dart';
10 import 'package:analyzer/src/dart/scanner/reader.dart'; 10 import 'package:analyzer/src/dart/scanner/reader.dart';
(...skipping 5868 matching lines...) Expand 10 before | Expand all | Expand 10 after
5879 0, 5879 0,
5880 0 5880 0
5881 ], strings: [ 5881 ], strings: [
5882 'f' 5882 'f'
5883 ], referenceValidators: [ 5883 ], referenceValidators: [
5884 (EntityRef r) => checkTypeRef(r, null, null, 'C', 5884 (EntityRef r) => checkTypeRef(r, null, null, 'C',
5885 expectedKind: ReferenceKind.classOrEnum) 5885 expectedKind: ReferenceKind.classOrEnum)
5886 ]); 5886 ]);
5887 } 5887 }
5888 5888
5889 test_expr_extractIndex_ofClassField() {
5890 if (skipNonConstInitializers) {
5891 return;
5892 }
5893 UnlinkedVariable variable = serializeVariableText('''
5894 class C {
5895 List<int> get items => null;
5896 }
5897 final v = new C().items[5];
5898 ''');
5899 _assertUnlinkedConst(variable.constExpr, operators: [
5900 UnlinkedConstOperation.invokeConstructor,
5901 UnlinkedConstOperation.extractProperty,
5902 UnlinkedConstOperation.pushInt,
5903 UnlinkedConstOperation.extractIndex,
5904 ], ints: [
5905 0,
5906 0,
5907 5
5908 ], strings: [
5909 'items'
5910 ], referenceValidators: [
5911 (EntityRef r) => checkTypeRef(r, null, null, 'C',
5912 expectedKind: ReferenceKind.classOrEnum)
5913 ]);
5914 }
5915
5889 test_field() { 5916 test_field() {
5890 UnlinkedClass cls = serializeClassText('class C { int i; }'); 5917 UnlinkedClass cls = serializeClassText('class C { int i; }');
5891 UnlinkedVariable variable = findVariable('i', variables: cls.fields); 5918 UnlinkedVariable variable = findVariable('i', variables: cls.fields);
5892 expect(variable, isNotNull); 5919 expect(variable, isNotNull);
5893 expect(variable.isConst, isFalse); 5920 expect(variable.isConst, isFalse);
5894 expect(variable.isStatic, isFalse); 5921 expect(variable.isStatic, isFalse);
5895 expect(variable.isFinal, isFalse); 5922 expect(variable.isFinal, isFalse);
5896 expect(variable.constExpr, isNull); 5923 expect(variable.constExpr, isNull);
5897 expect(findExecutable('i', executables: cls.executables), isNull); 5924 expect(findExecutable('i', executables: cls.executables), isNull);
5898 expect(findExecutable('i=', executables: cls.executables), isNull); 5925 expect(findExecutable('i=', executables: cls.executables), isNull);
(...skipping 2485 matching lines...) Expand 10 before | Expand all | Expand 10 after
8384 class _PrefixExpectation { 8411 class _PrefixExpectation {
8385 final ReferenceKind kind; 8412 final ReferenceKind kind;
8386 final String name; 8413 final String name;
8387 final String absoluteUri; 8414 final String absoluteUri;
8388 final String relativeUri; 8415 final String relativeUri;
8389 final int numTypeParameters; 8416 final int numTypeParameters;
8390 8417
8391 _PrefixExpectation(this.kind, this.name, 8418 _PrefixExpectation(this.kind, this.name,
8392 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); 8419 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0});
8393 } 8420 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_const_expr.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698