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

Side by Side Diff: pkg/analyzer/lib/src/dart/analysis/file_state.dart

Issue 2917183003: update the analyzer and analysis server perf tags (Closed)
Patch Set: updates for review comments Created 3 years, 6 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 unified diff | Download patch
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 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:convert'; 6 import 'dart:convert';
7 import 'dart:typed_data'; 7 import 'dart:typed_data';
8 8
9 import 'package:analyzer/dart/ast/ast.dart'; 9 import 'package:analyzer/dart/ast/ast.dart';
10 import 'package:analyzer/dart/ast/token.dart'; 10 import 'package:analyzer/dart/ast/token.dart';
(...skipping 363 matching lines...) Expand 10 before | Expand all | Expand 10 after
374 374
375 @override 375 @override
376 bool operator ==(Object other) { 376 bool operator ==(Object other) {
377 return other is FileState && other.uri == uri; 377 return other is FileState && other.uri == uri;
378 } 378 }
379 379
380 /** 380 /**
381 * Return a new parsed unresolved [CompilationUnit]. 381 * Return a new parsed unresolved [CompilationUnit].
382 */ 382 */
383 CompilationUnit parse(AnalysisErrorListener errorListener) { 383 CompilationUnit parse(AnalysisErrorListener errorListener) {
384 return PerformanceStatistics.parse.makeCurrentWhile(() {
385 return _parse(errorListener);
386 });
387 }
388
389 CompilationUnit _parse(AnalysisErrorListener errorListener) {
384 AnalysisOptions analysisOptions = _fsState._analysisOptions; 390 AnalysisOptions analysisOptions = _fsState._analysisOptions;
385 391
386 if (USE_FASTA_PARSER) { 392 if (USE_FASTA_PARSER) {
387 try { 393 try {
388 fasta.ScannerResult scanResult = fasta.scan(_contentBytes, 394 fasta.ScannerResult scanResult =
395 PerformanceStatistics.scan.makeCurrentWhile(() {
396 return fasta.scan(
397 _contentBytes,
389 includeComments: true, 398 includeComments: true,
390 scanGenericMethodComments: analysisOptions.strongMode); 399 scanGenericMethodComments: analysisOptions.strongMode,
400 );
401 });
391 402
392 var astBuilder = new fasta.AstBuilder( 403 var astBuilder = new fasta.AstBuilder(
393 new ErrorReporter(errorListener, source), 404 new ErrorReporter(errorListener, source),
394 null, 405 null,
395 null, 406 null,
396 new _FastaElementStoreProxy(), 407 new _FastaElementStoreProxy(),
397 new fasta.Scope.top(isModifiable: true), 408 new fasta.Scope.top(isModifiable: true),
398 uri); 409 uri);
399 astBuilder.parseGenericMethodComments = analysisOptions.strongMode; 410 astBuilder.parseGenericMethodComments = analysisOptions.strongMode;
400 411
401 var parser = new fasta.Parser(astBuilder); 412 var parser = new fasta.Parser(astBuilder);
402 astBuilder.parser = parser; 413 astBuilder.parser = parser;
403 parser.parseUnit(scanResult.tokens); 414 parser.parseUnit(scanResult.tokens);
404 var unit = astBuilder.pop() as CompilationUnit; 415 var unit = astBuilder.pop() as CompilationUnit;
405 416
406 LineInfo lineInfo = new LineInfo(scanResult.lineStarts); 417 LineInfo lineInfo = new LineInfo(scanResult.lineStarts);
407 unit.lineInfo = lineInfo; 418 unit.lineInfo = lineInfo;
408 return unit; 419 return unit;
409 } catch (e, st) { 420 } catch (e, st) {
410 print(e); 421 print(e);
411 print(st); 422 print(st);
412 rethrow; 423 rethrow;
413 } 424 }
414 } else { 425 } else {
415 CharSequenceReader reader = new CharSequenceReader(content); 426 CharSequenceReader reader = new CharSequenceReader(content);
416 Scanner scanner = new Scanner(source, reader, errorListener); 427 Scanner scanner = new Scanner(source, reader, errorListener);
417 scanner.scanGenericMethodComments = analysisOptions.strongMode; 428 scanner.scanGenericMethodComments = analysisOptions.strongMode;
418 Token token = scanner.tokenize(); 429 Token token = PerformanceStatistics.scan.makeCurrentWhile(() {
430 return scanner.tokenize();
431 });
419 LineInfo lineInfo = new LineInfo(scanner.lineStarts); 432 LineInfo lineInfo = new LineInfo(scanner.lineStarts);
420 433
421 Parser parser = new Parser(source, errorListener); 434 Parser parser = new Parser(source, errorListener);
422 parser.enableAssertInitializer = analysisOptions.enableAssertInitializer; 435 parser.enableAssertInitializer = analysisOptions.enableAssertInitializer;
423 parser.parseGenericMethodComments = analysisOptions.strongMode; 436 parser.parseGenericMethodComments = analysisOptions.strongMode;
424 CompilationUnit unit = parser.parseCompilationUnit(token); 437 CompilationUnit unit = parser.parseCompilationUnit(token);
425 unit.lineInfo = lineInfo; 438 unit.lineInfo = lineInfo;
426 return unit; 439 return unit;
427 } 440 }
428 } 441 }
(...skipping 502 matching lines...) Expand 10 before | Expand all | Expand 10 after
931 _FastaElementProxy operator [](fasta.Builder builder) => 944 _FastaElementProxy operator [](fasta.Builder builder) =>
932 _elements.putIfAbsent(builder, () => new _FastaElementProxy()); 945 _elements.putIfAbsent(builder, () => new _FastaElementProxy());
933 946
934 @override 947 @override
935 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 948 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
936 } 949 }
937 950
938 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType { 951 class _FastaInterfaceTypeProxy implements fasta.KernelInterfaceType {
939 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation); 952 noSuchMethod(Invocation invocation) => super.noSuchMethod(invocation);
940 } 953 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698