| OLD | NEW |
| 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 dev_compiler.src.codegen.nullability_inferrer; | 5 library dev_compiler.src.codegen.nullability_inferrer; |
| 6 | 6 |
| 7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; | 7 import 'package:analyzer/analyzer.dart' hide ConstantEvaluator; |
| 8 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; | 8 import 'package:analyzer/src/generated/ast.dart' hide ConstantEvaluator; |
| 9 import 'package:analyzer/src/generated/element.dart'; | 9 import 'package:analyzer/src/generated/element.dart'; |
| 10 import 'package:analyzer/src/generated/scanner.dart' | 10 import 'package:analyzer/dart/ast/token.dart' show Token, TokenType; |
| 11 show StringToken, Token, TokenType; | |
| 12 | 11 |
| 13 import 'assignments_index.dart'; | 12 import 'assignments_index.dart'; |
| 14 import 'js_codegen.dart' show TemporaryVariableElement; | 13 import 'js_codegen.dart' show TemporaryVariableElement; |
| 15 import '../utils.dart' show isInlineJS, DirectedGraph; | 14 import '../utils.dart' show isInlineJS, DirectedGraph; |
| 16 | 15 |
| 17 typedef bool NullableExpressionPredicate(Expression expr); | 16 typedef bool NullableExpressionPredicate(Expression expr); |
| 18 | 17 |
| 19 typedef DartType _StaticTypeGetter(Expression e); | 18 typedef DartType _StaticTypeGetter(Expression e); |
| 20 typedef bool _JSBuiltinTypePredicate(DartType t); | 19 typedef bool _JSBuiltinTypePredicate(DartType t); |
| 21 | 20 |
| (...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 156 }); | 155 }); |
| 157 var nullables = assignmentsGraph.getTransitiveClosure(trivialNullables); | 156 var nullables = assignmentsGraph.getTransitiveClosure(trivialNullables); |
| 158 | 157 |
| 159 bool isNullableLocal(LocalVariableElement e) { | 158 bool isNullableLocal(LocalVariableElement e) { |
| 160 // TODO(jmesserly): we should be able to make this work for temps too. | 159 // TODO(jmesserly): we should be able to make this work for temps too. |
| 161 return e is TemporaryVariableElement || nullables.contains(e); | 160 return e is TemporaryVariableElement || nullables.contains(e); |
| 162 } | 161 } |
| 163 return (Expression expr) => _isNullableExpression(expr, isNullableLocal); | 162 return (Expression expr) => _isNullableExpression(expr, isNullableLocal); |
| 164 } | 163 } |
| 165 } | 164 } |
| OLD | NEW |