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

Side by Side Diff: pkg/analyzer/lib/src/dart/element/builder.dart

Issue 1842433002: When summarize AST, include local variables in loops and try-catch. (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/summarize_ast.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) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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.dart.element.builder; 5 library analyzer.src.dart.element.builder;
6 6
7 import 'dart:collection'; 7 import 'dart:collection';
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 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 @override 363 @override
364 Object visitCatchClause(CatchClause node) { 364 Object visitCatchClause(CatchClause node) {
365 SimpleIdentifier exceptionParameter = node.exceptionParameter; 365 SimpleIdentifier exceptionParameter = node.exceptionParameter;
366 if (exceptionParameter != null) { 366 if (exceptionParameter != null) {
367 // exception 367 // exception
368 LocalVariableElementImpl exception = 368 LocalVariableElementImpl exception =
369 new LocalVariableElementImpl.forNode(exceptionParameter); 369 new LocalVariableElementImpl.forNode(exceptionParameter);
370 if (node.exceptionType == null) { 370 if (node.exceptionType == null) {
371 exception.hasImplicitType = true; 371 exception.hasImplicitType = true;
372 } 372 }
373 exception.setVisibleRange(node.offset, node.length);
373 _currentHolder.addLocalVariable(exception); 374 _currentHolder.addLocalVariable(exception);
374 exceptionParameter.staticElement = exception; 375 exceptionParameter.staticElement = exception;
375 // stack trace 376 // stack trace
376 SimpleIdentifier stackTraceParameter = node.stackTraceParameter; 377 SimpleIdentifier stackTraceParameter = node.stackTraceParameter;
377 if (stackTraceParameter != null) { 378 if (stackTraceParameter != null) {
378 LocalVariableElementImpl stackTrace = 379 LocalVariableElementImpl stackTrace =
379 new LocalVariableElementImpl.forNode(stackTraceParameter); 380 new LocalVariableElementImpl.forNode(stackTraceParameter);
380 _setCodeRange(stackTrace, stackTraceParameter); 381 _setCodeRange(stackTrace, stackTraceParameter);
382 stackTrace.setVisibleRange(node.offset, node.length);
381 _currentHolder.addLocalVariable(stackTrace); 383 _currentHolder.addLocalVariable(stackTrace);
382 stackTraceParameter.staticElement = stackTrace; 384 stackTraceParameter.staticElement = stackTrace;
383 } 385 }
384 } 386 }
385 return super.visitCatchClause(node); 387 return super.visitCatchClause(node);
386 } 388 }
387 389
388 @override 390 @override
389 Object visitClassDeclaration(ClassDeclaration node) { 391 Object visitClassDeclaration(ClassDeclaration node) {
390 ElementHolder holder = new ElementHolder(); 392 ElementHolder holder = new ElementHolder();
(...skipping 1105 matching lines...) Expand 10 before | Expand all | Expand 10 after
1496 return null; 1498 return null;
1497 } 1499 }
1498 1500
1499 /** 1501 /**
1500 * Return the lexical identifiers associated with the given [identifiers]. 1502 * Return the lexical identifiers associated with the given [identifiers].
1501 */ 1503 */
1502 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) { 1504 static List<String> _getIdentifiers(NodeList<SimpleIdentifier> identifiers) {
1503 return identifiers.map((identifier) => identifier.name).toList(); 1505 return identifiers.map((identifier) => identifier.name).toList();
1504 } 1506 }
1505 } 1507 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/summary/summarize_ast.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698