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

Side by Side Diff: pkg/analyzer/test/src/dart/analysis/driver_test.dart

Issue 2489133002: Set initializer expressions for default values of parameters of local functions. (Closed)
Patch Set: Created 4 years, 1 month 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/generated/resolver.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) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.driver; 5 library analyzer.test.driver;
6 6
7 import 'dart:async'; 7 import 'dart:async';
8 import 'dart:convert'; 8 import 'dart:convert';
9 9
10 import 'package:analyzer/dart/ast/ast.dart'; 10 import 'package:analyzer/dart/ast/ast.dart';
(...skipping 383 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 394
395 var f = result.unit.declarations[0] as FunctionDeclaration; 395 var f = result.unit.declarations[0] as FunctionDeclaration;
396 expect(f.name.staticType.toString(), '() → int'); 396 expect(f.name.staticType.toString(), '() → int');
397 expect(f.returnType.type.toString(), 'int'); 397 expect(f.returnType.type.toString(), 'int');
398 398
399 // The same result is also received through the stream. 399 // The same result is also received through the stream.
400 await _waitForIdle(); 400 await _waitForIdle();
401 expect(allResults, [result]); 401 expect(allResults, [result]);
402 } 402 }
403 403
404 test_getResult_constants_defaultParameterValue_localFunction() async {
405 var a = _p('/test/bin/a.dart');
406 var b = _p('/test/bin/b.dart');
407 provider.newFile(a, 'const C = 42;');
408 provider.newFile(
409 b,
410 r'''
411 import 'a.dart';
412 main() {
413 foo({int p: C}) {}
414 foo();
415 }
416 ''');
417 driver.addFile(a);
418 driver.addFile(b);
419 await _waitForIdle();
420
421 AnalysisResult result = await driver.getResult(b);
422 expect(result.errors, isEmpty);
423 }
424
404 test_getResult_errors() async { 425 test_getResult_errors() async {
405 String content = 'main() { int vv; }'; 426 String content = 'main() { int vv; }';
406 _addTestFile(content, priority: true); 427 _addTestFile(content, priority: true);
407 428
408 AnalysisResult result = await driver.getResult(testFile); 429 AnalysisResult result = await driver.getResult(testFile);
409 expect(result.path, testFile); 430 expect(result.path, testFile);
410 expect(result.errors, hasLength(1)); 431 expect(result.errors, hasLength(1));
411 { 432 {
412 AnalysisError error = result.errors[0]; 433 AnalysisError error = result.errors[0];
413 expect(error.offset, 13); 434 expect(error.offset, 13);
(...skipping 722 matching lines...) Expand 10 before | Expand all | Expand 10 after
1136 @override 1157 @override
1137 List<int> get(String key) { 1158 List<int> get(String key) {
1138 return map[key]; 1159 return map[key];
1139 } 1160 }
1140 1161
1141 @override 1162 @override
1142 void put(String key, List<int> bytes) { 1163 void put(String key, List<int> bytes) {
1143 map[key] = bytes; 1164 map[key] = bytes;
1144 } 1165 }
1145 } 1166 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/generated/resolver.dart ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698