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

Unified Diff: pkg/analyzer/test/src/context/context_test.dart

Issue 2167773007: Use local variable/function index in its enclosing executable as a part of the identifier. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 5 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 side-by-side diff with in-line comments
Download patch
Index: pkg/analyzer/test/src/context/context_test.dart
diff --git a/pkg/analyzer/test/src/context/context_test.dart b/pkg/analyzer/test/src/context/context_test.dart
index faed064af2962282f4ceb1ee6afbdeb97b0447aa..d0ec5b2caf846d1904e2f845397d03d38a043542 100644
--- a/pkg/analyzer/test/src/context/context_test.dart
+++ b/pkg/analyzer/test/src/context/context_test.dart
@@ -3801,7 +3801,7 @@ f1() {
_assertInvalid(a, LIBRARY_ERRORS_READY);
}
- void test_sequence_unitConstants() {
+ void test_sequence_unitConstants_addRemove() {
Source a = addSource(
'/a.dart',
r'''
@@ -3868,6 +3868,40 @@ baz() {
expect(newV3.evaluationResult.value.toIntValue(), 30);
}
+ void test_sequence_unitConstants_local_insertSpace() {
+ Source a = addSource(
+ '/a.dart',
+ r'''
+main() {
+ const C = 1;
+}
+''');
+ _performPendingAnalysisTasks();
+ LibrarySpecificUnit unitA = new LibrarySpecificUnit(a, a);
+ List<ConstantEvaluationTarget> oldConstants =
+ context.getResult(unitA, COMPILATION_UNIT_CONSTANTS);
+ expect(oldConstants, hasLength(1));
+ ConstVariableElement C = _findConstVariable(oldConstants, 'C');
+ expect(context.analysisCache.get(C), isNotNull);
+ // Insert a space before the name.
+ context.setContents(
+ a,
+ r'''
+main() {
+ const C = 1;
+}
+''');
+ List<ConstantEvaluationTarget> newConstants =
+ context.getResult(unitA, COMPILATION_UNIT_CONSTANTS);
+ expect(newConstants, hasLength(1));
+ expect(newConstants, contains(same(C)));
+ // Perform analysis, compute constant values.
+ _performPendingAnalysisTasks();
+ // Validate const variable values.
+ expect(context.analysisCache.get(C), isNotNull);
+ expect(C.evaluationResult.value.toIntValue(), 1);
+ }
+
void test_sequence_useAnyResolvedUnit() {
Source a = addSource(
'/a.dart',
« no previous file with comments | « pkg/analyzer/lib/src/generated/incremental_resolver.dart ('k') | pkg/analyzer/test/src/summary/resynthesize_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698