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

Side by Side Diff: pkg/analyzer/lib/src/task/options.dart

Issue 2488043002: Enable generic method support by default (Closed)
Patch Set: clean up 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/task/dart.dart ('k') | pkg/analyzer/test/generated/package_test.dart » ('j') | 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.src.task.options; 5 library analyzer.src.task.options;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
10 import 'package:analyzer/plugin/options.dart'; 10 import 'package:analyzer/plugin/options.dart';
(...skipping 496 matching lines...) Expand 10 before | Expand all | Expand 10 after
507 } 507 }
508 } 508 }
509 if (feature == AnalyzerOptions.enableSuperMixins) { 509 if (feature == AnalyzerOptions.enableSuperMixins) {
510 if (isTrue(value)) { 510 if (isTrue(value)) {
511 AnalysisOptionsImpl options = 511 AnalysisOptionsImpl options =
512 new AnalysisOptionsImpl.from(context.analysisOptions); 512 new AnalysisOptionsImpl.from(context.analysisOptions);
513 options.enableSuperMixins = true; 513 options.enableSuperMixins = true;
514 context.analysisOptions = options; 514 context.analysisOptions = options;
515 } 515 }
516 } 516 }
517 if (feature == AnalyzerOptions.enableGenericMethods) {
518 if (isTrue(value)) {
519 AnalysisOptionsImpl options =
520 new AnalysisOptionsImpl.from(context.analysisOptions);
521 options.enableGenericMethods = true;
522 context.analysisOptions = options;
523 }
524 }
525 } 517 }
526 518
527 void setLanguageOptions(AnalysisContext context, Object configs) { 519 void setLanguageOptions(AnalysisContext context, Object configs) {
528 if (configs is YamlMap) { 520 if (configs is YamlMap) {
529 configs.nodes.forEach((k, v) { 521 configs.nodes.forEach((k, v) {
530 if (k is YamlScalar && v is YamlScalar) { 522 if (k is YamlScalar && v is YamlScalar) {
531 String feature = k.value?.toString(); 523 String feature = k.value?.toString();
532 setLanguageOption(context, feature, v.value); 524 setLanguageOption(context, feature, v.value);
533 } 525 }
534 }); 526 });
(...skipping 28 matching lines...) Expand all
563 void _applyLanguageOption( 555 void _applyLanguageOption(
564 AnalysisOptionsImpl options, Object feature, Object value) { 556 AnalysisOptionsImpl options, Object feature, Object value) {
565 bool boolValue = toBool(value); 557 bool boolValue = toBool(value);
566 if (boolValue != null) { 558 if (boolValue != null) {
567 if (feature == AnalyzerOptions.enableAssertInitializer) { 559 if (feature == AnalyzerOptions.enableAssertInitializer) {
568 options.enableAssertInitializer = boolValue; 560 options.enableAssertInitializer = boolValue;
569 } else if (feature == AnalyzerOptions.enableInitializingFormalAccess) { 561 } else if (feature == AnalyzerOptions.enableInitializingFormalAccess) {
570 options.enableInitializingFormalAccess = boolValue; 562 options.enableInitializingFormalAccess = boolValue;
571 } else if (feature == AnalyzerOptions.enableSuperMixins) { 563 } else if (feature == AnalyzerOptions.enableSuperMixins) {
572 options.enableSuperMixins = boolValue; 564 options.enableSuperMixins = boolValue;
573 } else if (feature == AnalyzerOptions.enableGenericMethods) {
574 options.enableGenericMethods = boolValue;
575 } 565 }
576 } 566 }
577 } 567 }
578 568
579 void _applyLanguageOptions(AnalysisOptionsImpl options, Object configs) { 569 void _applyLanguageOptions(AnalysisOptionsImpl options, Object configs) {
580 if (configs is YamlMap) { 570 if (configs is YamlMap) {
581 configs.nodes.forEach((key, value) { 571 configs.nodes.forEach((key, value) {
582 if (key is YamlScalar && value is YamlScalar) { 572 if (key is YamlScalar && value is YamlScalar) {
583 String feature = key.value?.toString(); 573 String feature = key.value?.toString();
584 _applyLanguageOption(options, feature, value.value); 574 _applyLanguageOption(options, feature, value.value);
(...skipping 27 matching lines...) Expand all
612 } 602 }
613 }); 603 });
614 } else if (config is Map) { 604 } else if (config is Map) {
615 options.strongMode = true; 605 options.strongMode = true;
616 config.forEach((k, v) => _applyStrongModeOption(options, k, v)); 606 config.forEach((k, v) => _applyStrongModeOption(options, k, v));
617 } else { 607 } else {
618 options.strongMode = config is bool ? config : false; 608 options.strongMode = config is bool ? config : false;
619 } 609 }
620 } 610 }
621 } 611 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/dart.dart ('k') | pkg/analyzer/test/generated/package_test.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698