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

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

Issue 1528083002: Reserve element 0 in the references table for `dynamic`. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 5 years 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_test; 5 library analyzer.test.src.summary.summary_test;
6 6
7 import 'package:analyzer/dart/element/element.dart'; 7 import 'package:analyzer/dart/element/element.dart';
8 import 'package:analyzer/src/generated/engine.dart'; 8 import 'package:analyzer/src/generated/engine.dart';
9 import 'package:analyzer/src/generated/java_engine_io.dart'; 9 import 'package:analyzer/src/generated/java_engine_io.dart';
10 import 'package:analyzer/src/generated/source.dart'; 10 import 'package:analyzer/src/generated/source.dart';
(...skipping 210 matching lines...) Expand 10 before | Expand all | Expand 10 after
221 bool allowTypeParameters: false, 221 bool allowTypeParameters: false,
222 PrelinkedReferenceKind expectedKind: PrelinkedReferenceKind.classOrEnum, 222 PrelinkedReferenceKind expectedKind: PrelinkedReferenceKind.classOrEnum,
223 int expectedTargetUnit: 0, 223 int expectedTargetUnit: 0,
224 PrelinkedUnit sourceUnit}) { 224 PrelinkedUnit sourceUnit}) {
225 sourceUnit ??= definingUnit; 225 sourceUnit ??= definingUnit;
226 expect(typeRef, new isInstanceOf<UnlinkedTypeRef>()); 226 expect(typeRef, new isInstanceOf<UnlinkedTypeRef>());
227 expect(typeRef.paramReference, 0); 227 expect(typeRef.paramReference, 0);
228 int index = typeRef.reference; 228 int index = typeRef.reference;
229 UnlinkedReference reference = sourceUnit.unlinked.references[index]; 229 UnlinkedReference reference = sourceUnit.unlinked.references[index];
230 PrelinkedReference referenceResolution = sourceUnit.references[index]; 230 PrelinkedReference referenceResolution = sourceUnit.references[index];
231 if (index == 0) {
232 // Index 0 is reserved for "dynamic".
233 expect(reference.name, isEmpty);
234 expect(reference.prefix, 0);
235 }
231 if (absoluteUri == null) { 236 if (absoluteUri == null) {
232 expect(referenceResolution.dependency, 0); 237 expect(referenceResolution.dependency, 0);
233 } else { 238 } else {
234 checkDependency(referenceResolution.dependency, absoluteUri, relativeUri); 239 checkDependency(referenceResolution.dependency, absoluteUri, relativeUri);
235 } 240 }
236 if (!allowTypeParameters) { 241 if (!allowTypeParameters) {
237 expect(typeRef.typeArguments, isEmpty); 242 expect(typeRef.typeArguments, isEmpty);
238 } 243 }
239 if (expectedName == null) { 244 if (expectedName == null) {
240 expect(reference.name, isEmpty); 245 expect(reference.name, isEmpty);
(...skipping 1727 matching lines...) Expand 10 before | Expand all | Expand 10 after
1968 serializeClassText('class C { static int i; }').fields[0]; 1973 serializeClassText('class C { static int i; }').fields[0];
1969 expect(variable.isStatic, isTrue); 1974 expect(variable.isStatic, isTrue);
1970 } 1975 }
1971 1976
1972 test_variable_type() { 1977 test_variable_type() {
1973 UnlinkedVariable variable = 1978 UnlinkedVariable variable =
1974 serializeVariableText('int i;', variableName: 'i'); 1979 serializeVariableText('int i;', variableName: 'i');
1975 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int'); 1980 checkTypeRef(variable.type, 'dart:core', 'dart:core', 'int');
1976 } 1981 }
1977 } 1982 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/summary/summarize_elements.dart ('k') | pkg/analyzer/tool/summary/idl.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698