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

Side by Side Diff: pkg/analyzer/lib/src/generated/resolver.dart

Issue 1648923003: Fix an exception caused by malformed code (Closed) Base URL: https://github.com/dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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/string_source.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.generated.resolver; 5 library analyzer.src.generated.resolver;
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/visitor.dart'; 10 import 'package:analyzer/dart/ast/visitor.dart';
(...skipping 7659 matching lines...) Expand 10 before | Expand all | Expand 10 after
7670 _addPropagableVariables(node.variables.variables); 7670 _addPropagableVariables(node.variables.variables);
7671 _addStaticVariables(node.variables.variables); 7671 _addStaticVariables(node.variables.variables);
7672 return super.visitTopLevelVariableDeclaration(node); 7672 return super.visitTopLevelVariableDeclaration(node);
7673 } 7673 }
7674 7674
7675 /** 7675 /**
7676 * Add all of the [variables] with initializers to [propagableVariables]. 7676 * Add all of the [variables] with initializers to [propagableVariables].
7677 */ 7677 */
7678 void _addPropagableVariables(List<VariableDeclaration> variables) { 7678 void _addPropagableVariables(List<VariableDeclaration> variables) {
7679 for (VariableDeclaration variable in variables) { 7679 for (VariableDeclaration variable in variables) {
7680 if (variable.initializer != null) { 7680 if (variable.name.name.isNotEmpty && variable.initializer != null) {
7681 VariableElement element = variable.element; 7681 VariableElement element = variable.element;
7682 if (element.isConst || element.isFinal) { 7682 if (element.isConst || element.isFinal) {
7683 propagableVariables.add(element); 7683 propagableVariables.add(element);
7684 } 7684 }
7685 } 7685 }
7686 } 7686 }
7687 } 7687 }
7688 7688
7689 /** 7689 /**
7690 * Add all of the [variables] with initializers to the list of variables whose 7690 * Add all of the [variables] with initializers to the list of variables whose
7691 * type can be inferred. Technically, we only infer the types of variables 7691 * type can be inferred. Technically, we only infer the types of variables
7692 * that do not have a static type, but all variables with initializers 7692 * that do not have a static type, but all variables with initializers
7693 * potentially need to be re-resolved after inference because they might 7693 * potentially need to be re-resolved after inference because they might
7694 * refer to a field whose type was inferred. 7694 * refer to a field whose type was inferred.
7695 */ 7695 */
7696 void _addStaticVariables(List<VariableDeclaration> variables) { 7696 void _addStaticVariables(List<VariableDeclaration> variables) {
7697 for (VariableDeclaration variable in variables) { 7697 for (VariableDeclaration variable in variables) {
7698 if (variable.initializer != null) { 7698 if (variable.name.name.isNotEmpty && variable.initializer != null) {
7699 staticVariables.add(variable.element); 7699 staticVariables.add(variable.element);
7700 } 7700 }
7701 } 7701 }
7702 } 7702 }
7703 7703
7704 /** 7704 /**
7705 * Return `true` if the given function body should be skipped because it is 7705 * Return `true` if the given function body should be skipped because it is
7706 * the body of a top-level function, method or constructor. 7706 * the body of a top-level function, method or constructor.
7707 */ 7707 */
7708 bool _shouldBeSkipped(FunctionBody body) { 7708 bool _shouldBeSkipped(FunctionBody body) {
(...skipping 5876 matching lines...) Expand 10 before | Expand all | Expand 10 after
13585 nonFields.add(node); 13585 nonFields.add(node);
13586 return null; 13586 return null;
13587 } 13587 }
13588 13588
13589 @override 13589 @override
13590 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this); 13590 Object visitNode(AstNode node) => node.accept(TypeResolverVisitor_this);
13591 13591
13592 @override 13592 @override
13593 Object visitWithClause(WithClause node) => null; 13593 Object visitWithClause(WithClause node) => null;
13594 } 13594 }
OLDNEW
« no previous file with comments | « no previous file | pkg/analyzer/lib/src/string_source.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698