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

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

Issue 1434983006: tweak FunctionTypeImpl to support generic methods (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: format & sort Created 5 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
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.dart; 5 library analyzer.src.task.dart;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
8 8
9 import 'package:analyzer/src/context/cache.dart'; 9 import 'package:analyzer/src/context/cache.dart';
10 import 'package:analyzer/src/generated/ast.dart'; 10 import 'package:analyzer/src/generated/ast.dart';
(...skipping 3241 matching lines...) Expand 10 before | Expand all | Expand 10 after
3252 Source source = getRequiredSource(); 3252 Source source = getRequiredSource();
3253 LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT_NAME); 3253 LineInfo lineInfo = getRequiredInput(LINE_INFO_INPUT_NAME);
3254 int modificationTime = getRequiredInput(MODIFICATION_TIME_INPUT_NAME); 3254 int modificationTime = getRequiredInput(MODIFICATION_TIME_INPUT_NAME);
3255 Token tokenStream = getRequiredInput(TOKEN_STREAM_INPUT_NAME); 3255 Token tokenStream = getRequiredInput(TOKEN_STREAM_INPUT_NAME);
3256 3256
3257 RecordingErrorListener errorListener = new RecordingErrorListener(); 3257 RecordingErrorListener errorListener = new RecordingErrorListener();
3258 Parser parser = new Parser(source, errorListener); 3258 Parser parser = new Parser(source, errorListener);
3259 AnalysisOptions options = context.analysisOptions; 3259 AnalysisOptions options = context.analysisOptions;
3260 parser.parseFunctionBodies = options.analyzeFunctionBodiesPredicate(source); 3260 parser.parseFunctionBodies = options.analyzeFunctionBodiesPredicate(source);
3261 parser.parseGenericMethods = options.enableGenericMethods; 3261 parser.parseGenericMethods = options.enableGenericMethods;
3262 parser.parseGenericMethodComments = options.strongMode;
3262 CompilationUnit unit = parser.parseCompilationUnit(tokenStream); 3263 CompilationUnit unit = parser.parseCompilationUnit(tokenStream);
3263 unit.lineInfo = lineInfo; 3264 unit.lineInfo = lineInfo;
3264 3265
3265 bool hasNonPartOfDirective = false; 3266 bool hasNonPartOfDirective = false;
3266 bool hasPartOfDirective = false; 3267 bool hasPartOfDirective = false;
3267 HashSet<Source> explicitlyImportedSourceSet = new HashSet<Source>(); 3268 HashSet<Source> explicitlyImportedSourceSet = new HashSet<Source>();
3268 HashSet<Source> exportedSourceSet = new HashSet<Source>(); 3269 HashSet<Source> exportedSourceSet = new HashSet<Source>();
3269 HashSet<Source> includedSourceSet = new HashSet<Source>(); 3270 HashSet<Source> includedSourceSet = new HashSet<Source>();
3270 for (Directive directive in unit.directives) { 3271 for (Directive directive in unit.directives) {
3271 if (directive is PartOfDirective) { 3272 if (directive is PartOfDirective) {
(...skipping 1158 matching lines...) Expand 10 before | Expand all | Expand 10 after
4430 'Cannot scan scripts with multiple fragments'); 4431 'Cannot scan scripts with multiple fragments');
4431 } 4432 }
4432 ScriptFragment fragment = fragments[0]; 4433 ScriptFragment fragment = fragments[0];
4433 4434
4434 Scanner scanner = new Scanner( 4435 Scanner scanner = new Scanner(
4435 source, 4436 source,
4436 new SubSequenceReader(fragment.content, fragment.offset), 4437 new SubSequenceReader(fragment.content, fragment.offset),
4437 errorListener); 4438 errorListener);
4438 scanner.setSourceStart(fragment.line, fragment.column); 4439 scanner.setSourceStart(fragment.line, fragment.column);
4439 scanner.preserveComments = context.analysisOptions.preserveComments; 4440 scanner.preserveComments = context.analysisOptions.preserveComments;
4441 scanner.scanGenericMethodComments = context.analysisOptions.strongMode;
4440 4442
4441 outputs[TOKEN_STREAM] = scanner.tokenize(); 4443 outputs[TOKEN_STREAM] = scanner.tokenize();
4442 outputs[LINE_INFO] = new LineInfo(scanner.lineStarts); 4444 outputs[LINE_INFO] = new LineInfo(scanner.lineStarts);
4443 outputs[SCAN_ERRORS] = removeDuplicateErrors(errorListener.errors); 4445 outputs[SCAN_ERRORS] = removeDuplicateErrors(errorListener.errors);
4444 } else if (target is Source) { 4446 } else if (target is Source) {
4445 String content = getRequiredInput(CONTENT_INPUT_NAME); 4447 String content = getRequiredInput(CONTENT_INPUT_NAME);
4446 4448
4447 Scanner scanner = 4449 Scanner scanner =
4448 new Scanner(source, new CharSequenceReader(content), errorListener); 4450 new Scanner(source, new CharSequenceReader(content), errorListener);
4449 scanner.preserveComments = context.analysisOptions.preserveComments; 4451 scanner.preserveComments = context.analysisOptions.preserveComments;
4452 scanner.scanGenericMethodComments = context.analysisOptions.strongMode;
4450 4453
4451 outputs[TOKEN_STREAM] = scanner.tokenize(); 4454 outputs[TOKEN_STREAM] = scanner.tokenize();
4452 outputs[LINE_INFO] = new LineInfo(scanner.lineStarts); 4455 outputs[LINE_INFO] = new LineInfo(scanner.lineStarts);
4453 outputs[SCAN_ERRORS] = removeDuplicateErrors(errorListener.errors); 4456 outputs[SCAN_ERRORS] = removeDuplicateErrors(errorListener.errors);
4454 } else { 4457 } else {
4455 throw new AnalysisException( 4458 throw new AnalysisException(
4456 'Cannot scan Dart code from a ${target.runtimeType}'); 4459 'Cannot scan Dart code from a ${target.runtimeType}');
4457 } 4460 }
4458 } 4461 }
4459 4462
(...skipping 323 matching lines...) Expand 10 before | Expand all | Expand 10 after
4783 4786
4784 @override 4787 @override
4785 bool moveNext() { 4788 bool moveNext() {
4786 if (_newSources.isEmpty) { 4789 if (_newSources.isEmpty) {
4787 return false; 4790 return false;
4788 } 4791 }
4789 currentTarget = _newSources.removeLast(); 4792 currentTarget = _newSources.removeLast();
4790 return true; 4793 return true;
4791 } 4794 }
4792 } 4795 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698