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

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

Issue 1859493002: Replace 'length' with more generic 'extractProperty' operation. (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
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 154 matching lines...) Expand 10 before | Expand all | Expand 10 after
165 */ 165 */
166 LinkedLibrary get linked; 166 LinkedLibrary get linked;
167 167
168 /** 168 /**
169 * `true` if the linked portion of the summary only contains prelinked data. 169 * `true` if the linked portion of the summary only contains prelinked data.
170 * This happens because we don't yet have a full linker; only a prelinker. 170 * This happens because we don't yet have a full linker; only a prelinker.
171 */ 171 */
172 bool get skipFullyLinkedData; 172 bool get skipFullyLinkedData;
173 173
174 /** 174 /**
175 * `true` if non-const variable initializers are not serialized.
176 */
177 bool get skipNonConstInitializers;
178
179 /**
175 * `true` if the linked portion of the summary contains the result of strong 180 * `true` if the linked portion of the summary contains the result of strong
176 * mode analysis. 181 * mode analysis.
177 */ 182 */
178 bool get strongMode; 183 bool get strongMode;
179 184
180 /** 185 /**
181 * Get access to the unlinked compilation unit summaries that result from 186 * Get access to the unlinked compilation unit summaries that result from
182 * serializing and deserializing the library under test. 187 * serializing and deserializing the library under test.
183 */ 188 */
184 List<UnlinkedUnit> get unlinkedUnits; 189 List<UnlinkedUnit> get unlinkedUnits;
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
504 * serializer can record unresolved information. 509 * serializer can record unresolved information.
505 */ 510 */
506 UnlinkedReference checkReferenceIndex(int referenceIndex, String absoluteUri, 511 UnlinkedReference checkReferenceIndex(int referenceIndex, String absoluteUri,
507 String relativeUri, String expectedName, 512 String relativeUri, String expectedName,
508 {ReferenceKind expectedKind: ReferenceKind.classOrEnum, 513 {ReferenceKind expectedKind: ReferenceKind.classOrEnum,
509 int expectedTargetUnit: 0, 514 int expectedTargetUnit: 0,
510 LinkedUnit linkedSourceUnit, 515 LinkedUnit linkedSourceUnit,
511 UnlinkedUnit unlinkedSourceUnit, 516 UnlinkedUnit unlinkedSourceUnit,
512 int numTypeParameters: 0, 517 int numTypeParameters: 0,
513 bool checkAstDerivedDataOverride: false, 518 bool checkAstDerivedDataOverride: false,
514 int localIndex: 0}) { 519 int localIndex: 0,
520 bool unresolvedHasName: false}) {
515 linkedSourceUnit ??= definingUnit; 521 linkedSourceUnit ??= definingUnit;
516 unlinkedSourceUnit ??= unlinkedUnits[0]; 522 unlinkedSourceUnit ??= unlinkedUnits[0];
517 LinkedReference referenceResolution = 523 LinkedReference referenceResolution =
518 linkedSourceUnit.references[referenceIndex]; 524 linkedSourceUnit.references[referenceIndex];
519 String name; 525 String name;
520 UnlinkedReference reference; 526 UnlinkedReference reference;
521 if (referenceIndex < unlinkedSourceUnit.references.length) { 527 if (referenceIndex < unlinkedSourceUnit.references.length) {
522 // This is an explicit reference, so its name and prefix should be in 528 // This is an explicit reference, so its name and prefix should be in
523 // [UnlinkedUnit.references]. 529 // [UnlinkedUnit.references].
524 expect(referenceResolution.name, isEmpty); 530 expect(referenceResolution.name, isEmpty);
(...skipping 14 matching lines...) Expand all
539 if (absoluteUri == null) { 545 if (absoluteUri == null) {
540 expect(referenceResolution.dependency, 0); 546 expect(referenceResolution.dependency, 0);
541 } else { 547 } else {
542 checkDependency(referenceResolution.dependency, absoluteUri, relativeUri); 548 checkDependency(referenceResolution.dependency, absoluteUri, relativeUri);
543 } 549 }
544 if (expectedKind == ReferenceKind.unresolved && 550 if (expectedKind == ReferenceKind.unresolved &&
545 !checkAstDerivedData && 551 !checkAstDerivedData &&
546 !checkAstDerivedDataOverride) { 552 !checkAstDerivedDataOverride) {
547 // summarize_elements.dart isn't yet able to record the name of 553 // summarize_elements.dart isn't yet able to record the name of
548 // unresolved references. TODO(paulberry): fix this. 554 // unresolved references. TODO(paulberry): fix this.
549 expect(name, '*unresolved*'); 555 expect(name, unresolvedHasName ? expectedName : '*unresolved*');
550 } else { 556 } else {
551 if (expectedName == null) { 557 if (expectedName == null) {
552 expect(name, isEmpty); 558 expect(name, isEmpty);
553 } else { 559 } else {
554 expect(name, expectedName); 560 expect(name, expectedName);
555 } 561 }
556 } 562 }
557 expect(referenceResolution.kind, expectedKind); 563 expect(referenceResolution.kind, expectedKind);
558 expect(referenceResolution.unit, expectedTargetUnit); 564 expect(referenceResolution.unit, expectedTargetUnit);
559 expect(referenceResolution.numTypeParameters, numTypeParameters); 565 expect(referenceResolution.numTypeParameters, numTypeParameters);
(...skipping 21 matching lines...) Expand all
581 void checkTypeRef(EntityRef typeRef, String absoluteUri, String relativeUri, 587 void checkTypeRef(EntityRef typeRef, String absoluteUri, String relativeUri,
582 String expectedName, 588 String expectedName,
583 {String expectedPrefix, 589 {String expectedPrefix,
584 List<_PrefixExpectation> prefixExpectations, 590 List<_PrefixExpectation> prefixExpectations,
585 bool allowTypeParameters: false, 591 bool allowTypeParameters: false,
586 ReferenceKind expectedKind: ReferenceKind.classOrEnum, 592 ReferenceKind expectedKind: ReferenceKind.classOrEnum,
587 int expectedTargetUnit: 0, 593 int expectedTargetUnit: 0,
588 LinkedUnit linkedSourceUnit, 594 LinkedUnit linkedSourceUnit,
589 UnlinkedUnit unlinkedSourceUnit, 595 UnlinkedUnit unlinkedSourceUnit,
590 int numTypeParameters: 0, 596 int numTypeParameters: 0,
591 bool checkAstDerivedDataOverride: false}) { 597 bool checkAstDerivedDataOverride: false,
598 bool unresolvedHasName: false}) {
592 linkedSourceUnit ??= definingUnit; 599 linkedSourceUnit ??= definingUnit;
593 expect(typeRef, new isInstanceOf<EntityRef>()); 600 expect(typeRef, new isInstanceOf<EntityRef>());
594 expect(typeRef.paramReference, 0); 601 expect(typeRef.paramReference, 0);
595 int index = typeRef.reference; 602 int index = typeRef.reference;
596 if (!allowTypeParameters) { 603 if (!allowTypeParameters) {
597 expect(typeRef.typeArguments, isEmpty); 604 expect(typeRef.typeArguments, isEmpty);
598 } 605 }
599 UnlinkedReference reference = checkReferenceIndex( 606 UnlinkedReference reference = checkReferenceIndex(
600 index, absoluteUri, relativeUri, expectedName, 607 index, absoluteUri, relativeUri, expectedName,
601 expectedKind: expectedKind, 608 expectedKind: expectedKind,
602 expectedTargetUnit: expectedTargetUnit, 609 expectedTargetUnit: expectedTargetUnit,
603 linkedSourceUnit: linkedSourceUnit, 610 linkedSourceUnit: linkedSourceUnit,
604 unlinkedSourceUnit: unlinkedSourceUnit, 611 unlinkedSourceUnit: unlinkedSourceUnit,
605 numTypeParameters: numTypeParameters, 612 numTypeParameters: numTypeParameters,
606 checkAstDerivedDataOverride: checkAstDerivedDataOverride); 613 checkAstDerivedDataOverride: checkAstDerivedDataOverride,
614 unresolvedHasName: unresolvedHasName);
607 expect(reference, isNotNull, 615 expect(reference, isNotNull,
608 reason: 'Unlinked type refs must refer to an explicit reference'); 616 reason: 'Unlinked type refs must refer to an explicit reference');
609 if (expectedKind == ReferenceKind.unresolved && 617 if (expectedKind == ReferenceKind.unresolved &&
610 !checkAstDerivedData && 618 !checkAstDerivedData &&
611 !checkAstDerivedDataOverride) { 619 !checkAstDerivedDataOverride &&
620 !unresolvedHasName) {
612 // summarize_elements.dart isn't yet able to record the prefix of 621 // summarize_elements.dart isn't yet able to record the prefix of
613 // unresolved references. TODO(paulberry): fix this. 622 // unresolved references. TODO(paulberry): fix this.
614 expect(reference.prefixReference, 0); 623 expect(reference.prefixReference, 0);
615 } else if (expectedPrefix != null) { 624 } else if (expectedPrefix != null) {
616 checkPrefix(reference.prefixReference, expectedPrefix); 625 checkPrefix(reference.prefixReference, expectedPrefix);
617 } else if (prefixExpectations != null) { 626 } else if (prefixExpectations != null) {
618 for (_PrefixExpectation expectation in prefixExpectations) { 627 for (_PrefixExpectation expectation in prefixExpectations) {
619 expect(reference.prefixReference, isNot(0)); 628 expect(reference.prefixReference, isNot(0));
620 reference = checkReferenceIndex(reference.prefixReference, 629 reference = checkReferenceIndex(reference.prefixReference,
621 expectation.absoluteUri, expectation.relativeUri, expectation.name, 630 expectation.absoluteUri, expectation.relativeUri, expectation.name,
(...skipping 1629 matching lines...) Expand 10 before | Expand all | Expand 10 after
2251 2260
2252 test_constExpr_length_identifierTarget() { 2261 test_constExpr_length_identifierTarget() {
2253 UnlinkedVariable variable = serializeVariableText(''' 2262 UnlinkedVariable variable = serializeVariableText('''
2254 const String a = 'aaa'; 2263 const String a = 'aaa';
2255 const int v = a.length; 2264 const int v = a.length;
2256 '''); 2265 ''');
2257 _assertUnlinkedConst(variable.constExpr, operators: [ 2266 _assertUnlinkedConst(variable.constExpr, operators: [
2258 UnlinkedConstOperation.pushReference 2267 UnlinkedConstOperation.pushReference
2259 ], referenceValidators: [ 2268 ], referenceValidators: [
2260 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2269 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2261 expectedKind: ReferenceKind.length, 2270 expectedKind: ReferenceKind.unresolved,
2271 unresolvedHasName: true,
2262 prefixExpectations: [ 2272 prefixExpectations: [
2263 new _PrefixExpectation( 2273 new _PrefixExpectation(
2264 ReferenceKind.topLevelPropertyAccessor, 'a') 2274 ReferenceKind.topLevelPropertyAccessor, 'a')
2265 ]) 2275 ])
2266 ]); 2276 ]);
2267 } 2277 }
2268 2278
2269 test_constExpr_length_identifierTarget_classConstField() { 2279 test_constExpr_length_identifierTarget_classConstField() {
2270 UnlinkedVariable variable = serializeVariableText(''' 2280 UnlinkedVariable variable = serializeVariableText('''
2271 class C { 2281 class C {
2272 static const String F = ''; 2282 static const String F = '';
2273 } 2283 }
2274 const int v = C.F.length; 2284 const int v = C.F.length;
2275 '''); 2285 ''');
2276 _assertUnlinkedConst(variable.constExpr, operators: [ 2286 _assertUnlinkedConst(variable.constExpr, operators: [
2277 UnlinkedConstOperation.pushReference 2287 UnlinkedConstOperation.pushReference
2278 ], referenceValidators: [ 2288 ], referenceValidators: [
2279 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2289 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2280 expectedKind: ReferenceKind.length, 2290 expectedKind: ReferenceKind.unresolved,
2291 unresolvedHasName: true,
2281 prefixExpectations: [ 2292 prefixExpectations: [
2282 new _PrefixExpectation(ReferenceKind.propertyAccessor, 'F'), 2293 new _PrefixExpectation(ReferenceKind.propertyAccessor, 'F'),
2283 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'), 2294 new _PrefixExpectation(ReferenceKind.classOrEnum, 'C'),
2284 ]) 2295 ])
2285 ]); 2296 ]);
2286 } 2297 }
2287 2298
2288 test_constExpr_length_identifierTarget_imported() { 2299 test_constExpr_length_identifierTarget_imported() {
2289 addNamedSource( 2300 addNamedSource(
2290 '/a.dart', 2301 '/a.dart',
2291 ''' 2302 '''
2292 const String a = 'aaa'; 2303 const String a = 'aaa';
2293 '''); 2304 ''');
2294 UnlinkedVariable variable = serializeVariableText(''' 2305 UnlinkedVariable variable = serializeVariableText('''
2295 import 'a.dart'; 2306 import 'a.dart';
2296 const int v = a.length; 2307 const int v = a.length;
2297 '''); 2308 ''');
2298 _assertUnlinkedConst(variable.constExpr, operators: [ 2309 _assertUnlinkedConst(variable.constExpr, operators: [
2299 UnlinkedConstOperation.pushReference 2310 UnlinkedConstOperation.pushReference
2300 ], referenceValidators: [ 2311 ], referenceValidators: [
2301 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2312 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2302 expectedKind: ReferenceKind.length, 2313 expectedKind: ReferenceKind.unresolved,
2314 unresolvedHasName: true,
2303 prefixExpectations: [ 2315 prefixExpectations: [
2304 new _PrefixExpectation( 2316 new _PrefixExpectation(
2305 ReferenceKind.topLevelPropertyAccessor, 'a', 2317 ReferenceKind.topLevelPropertyAccessor, 'a',
2306 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart') 2318 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart')
2307 ]) 2319 ])
2308 ]); 2320 ]);
2309 } 2321 }
2310 2322
2311 test_constExpr_length_identifierTarget_imported_withPrefix() { 2323 test_constExpr_length_identifierTarget_imported_withPrefix() {
2312 addNamedSource( 2324 addNamedSource(
2313 '/a.dart', 2325 '/a.dart',
2314 ''' 2326 '''
2315 const String a = 'aaa'; 2327 const String a = 'aaa';
2316 '''); 2328 ''');
2317 UnlinkedVariable variable = serializeVariableText(''' 2329 UnlinkedVariable variable = serializeVariableText('''
2318 import 'a.dart' as p; 2330 import 'a.dart' as p;
2319 const int v = p.a.length; 2331 const int v = p.a.length;
2320 '''); 2332 ''');
2321 _assertUnlinkedConst(variable.constExpr, operators: [ 2333 _assertUnlinkedConst(variable.constExpr, operators: [
2322 UnlinkedConstOperation.pushReference 2334 UnlinkedConstOperation.pushReference
2323 ], referenceValidators: [ 2335 ], referenceValidators: [
2324 (EntityRef r) => checkTypeRef(r, null, null, 'length', 2336 (EntityRef r) => checkTypeRef(r, null, null, 'length',
2325 expectedKind: ReferenceKind.length, 2337 expectedKind: ReferenceKind.unresolved,
2338 unresolvedHasName: true,
2326 prefixExpectations: [ 2339 prefixExpectations: [
2327 new _PrefixExpectation( 2340 new _PrefixExpectation(
2328 ReferenceKind.topLevelPropertyAccessor, 'a', 2341 ReferenceKind.topLevelPropertyAccessor, 'a',
2329 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'), 2342 absoluteUri: absUri('/a.dart'), relativeUri: 'a.dart'),
2330 new _PrefixExpectation(ReferenceKind.prefix, 'p') 2343 new _PrefixExpectation(ReferenceKind.prefix, 'p')
2331 ]) 2344 ])
2332 ]); 2345 ]);
2333 } 2346 }
2334 2347
2335 test_constExpr_length_parenthesizedBinaryTarget() { 2348 test_constExpr_length_parenthesizedBinaryTarget() {
2336 UnlinkedVariable variable = 2349 UnlinkedVariable variable =
2337 serializeVariableText('const v = ("abc" + "edf").length;'); 2350 serializeVariableText('const v = ("abc" + "edf").length;');
2338 _assertUnlinkedConst(variable.constExpr, operators: [ 2351 _assertUnlinkedConst(variable.constExpr, operators: [
2339 UnlinkedConstOperation.pushString, 2352 UnlinkedConstOperation.pushString,
2340 UnlinkedConstOperation.pushString, 2353 UnlinkedConstOperation.pushString,
2341 UnlinkedConstOperation.add, 2354 UnlinkedConstOperation.add,
2342 UnlinkedConstOperation.length 2355 UnlinkedConstOperation.extractProperty
2343 ], strings: [ 2356 ], strings: [
2344 'abc', 2357 'abc',
2345 'edf' 2358 'edf',
2359 'length'
2346 ]); 2360 ]);
2347 } 2361 }
2348 2362
2349 test_constExpr_length_parenthesizedStringTarget() { 2363 test_constExpr_length_parenthesizedStringTarget() {
2350 UnlinkedVariable variable = 2364 UnlinkedVariable variable =
2351 serializeVariableText('const v = ("abc").length;'); 2365 serializeVariableText('const v = ("abc").length;');
2352 _assertUnlinkedConst(variable.constExpr, operators: [ 2366 _assertUnlinkedConst(variable.constExpr, operators: [
2353 UnlinkedConstOperation.pushString, 2367 UnlinkedConstOperation.pushString,
2354 UnlinkedConstOperation.length 2368 UnlinkedConstOperation.extractProperty
2355 ], strings: [ 2369 ], strings: [
2356 'abc' 2370 'abc',
2371 'length'
2357 ]); 2372 ]);
2358 } 2373 }
2359 2374
2360 test_constExpr_length_stringLiteralTarget() { 2375 test_constExpr_length_stringLiteralTarget() {
2361 UnlinkedVariable variable = 2376 UnlinkedVariable variable =
2362 serializeVariableText('const v = "abc".length;'); 2377 serializeVariableText('const v = "abc".length;');
2363 _assertUnlinkedConst(variable.constExpr, operators: [ 2378 _assertUnlinkedConst(variable.constExpr, operators: [
2364 UnlinkedConstOperation.pushString, 2379 UnlinkedConstOperation.pushString,
2365 UnlinkedConstOperation.length 2380 UnlinkedConstOperation.extractProperty
2366 ], strings: [ 2381 ], strings: [
2367 'abc' 2382 'abc',
2383 'length'
2368 ]); 2384 ]);
2369 } 2385 }
2370 2386
2371 test_constExpr_makeSymbol() { 2387 test_constExpr_makeSymbol() {
2372 UnlinkedVariable variable = serializeVariableText('const v = #a.bb.ccc;'); 2388 UnlinkedVariable variable = serializeVariableText('const v = #a.bb.ccc;');
2373 _assertUnlinkedConst(variable.constExpr, 2389 _assertUnlinkedConst(variable.constExpr,
2374 operators: [UnlinkedConstOperation.makeSymbol], strings: ['a.bb.ccc']); 2390 operators: [UnlinkedConstOperation.makeSymbol], strings: ['a.bb.ccc']);
2375 } 2391 }
2376 2392
2377 test_constExpr_makeTypedList() { 2393 test_constExpr_makeTypedList() {
(...skipping 3461 matching lines...) Expand 10 before | Expand all | Expand 10 after
5839 expect(getter, isNotNull); 5855 expect(getter, isNotNull);
5840 checkExportName(getter, absUri('/a.dart'), 'a.dart', 'v', 5856 checkExportName(getter, absUri('/a.dart'), 'a.dart', 'v',
5841 ReferenceKind.topLevelPropertyAccessor); 5857 ReferenceKind.topLevelPropertyAccessor);
5842 LinkedExportName setter = 5858 LinkedExportName setter =
5843 linked.exportNames.firstWhere((e) => e.name == 'v='); 5859 linked.exportNames.firstWhere((e) => e.name == 'v=');
5844 expect(setter, isNotNull); 5860 expect(setter, isNotNull);
5845 checkExportName(setter, absUri('/a.dart'), 'a.dart', 'v=', 5861 checkExportName(setter, absUri('/a.dart'), 'a.dart', 'v=',
5846 ReferenceKind.topLevelPropertyAccessor); 5862 ReferenceKind.topLevelPropertyAccessor);
5847 } 5863 }
5848 5864
5865 test_expr_extractProperty_ofInvokeConstructor() {
5866 if (skipNonConstInitializers) {
5867 return;
5868 }
5869 UnlinkedVariable variable = serializeVariableText('''
5870 class C {
5871 int f = 0;
5872 }
5873 final v = new C().f;
5874 ''');
5875 _assertUnlinkedConst(variable.constExpr, operators: [
5876 UnlinkedConstOperation.invokeConstructor,
5877 UnlinkedConstOperation.extractProperty,
5878 ], ints: [
5879 0,
5880 0
5881 ], strings: [
5882 'f'
5883 ], referenceValidators: [
5884 (EntityRef r) => checkTypeRef(r, null, null, 'C',
5885 expectedKind: ReferenceKind.classOrEnum)
5886 ]);
5887 }
5888
5849 test_field() { 5889 test_field() {
5850 UnlinkedClass cls = serializeClassText('class C { int i; }'); 5890 UnlinkedClass cls = serializeClassText('class C { int i; }');
5851 UnlinkedVariable variable = findVariable('i', variables: cls.fields); 5891 UnlinkedVariable variable = findVariable('i', variables: cls.fields);
5852 expect(variable, isNotNull); 5892 expect(variable, isNotNull);
5853 expect(variable.isConst, isFalse); 5893 expect(variable.isConst, isFalse);
5854 expect(variable.isStatic, isFalse); 5894 expect(variable.isStatic, isFalse);
5855 expect(variable.isFinal, isFalse); 5895 expect(variable.isFinal, isFalse);
5856 expect(variable.constExpr, isNull); 5896 expect(variable.constExpr, isNull);
5857 expect(findExecutable('i', executables: cls.executables), isNull); 5897 expect(findExecutable('i', executables: cls.executables), isNull);
5858 expect(findExecutable('i=', executables: cls.executables), isNull); 5898 expect(findExecutable('i=', executables: cls.executables), isNull);
(...skipping 2389 matching lines...) Expand 10 before | Expand all | Expand 10 after
8248 code.indexOf(visibleEnd) - expectedVisibleOffset + 1; 8288 code.indexOf(visibleEnd) - expectedVisibleOffset + 1;
8249 expect(p.visibleOffset, expectedVisibleOffset); 8289 expect(p.visibleOffset, expectedVisibleOffset);
8250 expect(p.visibleLength, expectedVisibleLength); 8290 expect(p.visibleLength, expectedVisibleLength);
8251 } 8291 }
8252 8292
8253 void _assertParameterZeroVisibleRange(UnlinkedParam p) { 8293 void _assertParameterZeroVisibleRange(UnlinkedParam p) {
8254 expect(p.visibleOffset, isZero); 8294 expect(p.visibleOffset, isZero);
8255 expect(p.visibleLength, isZero); 8295 expect(p.visibleLength, isZero);
8256 } 8296 }
8257 8297
8298 /**
8299 * TODO(scheglov) rename "Const" to "Expr" everywhere
8300 */
8258 void _assertUnlinkedConst(UnlinkedConst constExpr, 8301 void _assertUnlinkedConst(UnlinkedConst constExpr,
8259 {bool isInvalid: false, 8302 {bool isInvalid: false,
8260 List<UnlinkedConstOperation> operators: const <UnlinkedConstOperation>[], 8303 List<UnlinkedConstOperation> operators: const <UnlinkedConstOperation>[],
8261 List<int> ints: const <int>[], 8304 List<int> ints: const <int>[],
8262 List<double> doubles: const <double>[], 8305 List<double> doubles: const <double>[],
8263 List<String> strings: const <String>[], 8306 List<String> strings: const <String>[],
8264 List<_EntityRefValidator> referenceValidators: 8307 List<_EntityRefValidator> referenceValidators:
8265 const <_EntityRefValidator>[]}) { 8308 const <_EntityRefValidator>[]}) {
8266 expect(constExpr, isNotNull); 8309 expect(constExpr, isNotNull);
8267 expect(constExpr.isInvalid, isInvalid); 8310 expect(constExpr.isInvalid, isInvalid);
(...skipping 23 matching lines...) Expand all
8291 class _PrefixExpectation { 8334 class _PrefixExpectation {
8292 final ReferenceKind kind; 8335 final ReferenceKind kind;
8293 final String name; 8336 final String name;
8294 final String absoluteUri; 8337 final String absoluteUri;
8295 final String relativeUri; 8338 final String relativeUri;
8296 final int numTypeParameters; 8339 final int numTypeParameters;
8297 8340
8298 _PrefixExpectation(this.kind, this.name, 8341 _PrefixExpectation(this.kind, this.name,
8299 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0}); 8342 {this.absoluteUri, this.relativeUri, this.numTypeParameters: 0});
8300 } 8343 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698