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

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

Issue 2933753002: Run the sorter to reduce code churn (Closed)
Patch Set: 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
« no previous file with comments | « pkg/analyzer/lib/src/task/driver.dart ('k') | pkg/analyzer/lib/src/task/strong/checker.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) 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 /// Properties that result from Strong Mode analysis on an AST. 5 /// Properties that result from Strong Mode analysis on an AST.
6 /// 6 ///
7 /// These properties are not public, but provided by use of back-ends such as 7 /// These properties are not public, but provided by use of back-ends such as
8 /// Dart Dev Compiler. 8 /// Dart Dev Compiler.
9
10 import 'package:analyzer/analyzer.dart'; 9 import 'package:analyzer/analyzer.dart';
11 import 'package:analyzer/dart/element/type.dart'; 10 import 'package:analyzer/dart/element/type.dart';
12 11
12 const String _hasImplicitCasts = '_hasImplicitCasts';
13 const String _implicitAssignmentCast = '_implicitAssignmentCast'; 13 const String _implicitAssignmentCast = '_implicitAssignmentCast';
14 const String _implicitCast = '_implicitCast'; 14 const String _implicitCast = '_implicitCast';
15 const String _hasImplicitCasts = '_hasImplicitCasts';
16 const String _isDynamicInvoke = '_isDynamicInvoke'; 15 const String _isDynamicInvoke = '_isDynamicInvoke';
17 16
18 /// True if this compilation unit has any implicit casts, otherwise false. 17 /// If this op-assign has an implicit cast on the assignment, returns the type
19 /// 18 /// it is coerced to, otherwise returns null.
20 /// See also [getImplicitCast]. 19 DartType getImplicitAssignmentCast(Expression node) {
21 bool hasImplicitCasts(CompilationUnit node) { 20 return node.getProperty/*<DartType>*/(_implicitAssignmentCast);
22 return node.getProperty/*<bool>*/(_hasImplicitCasts) ?? false;
23 }
24
25 /// Sets [hasImplicitCasts] property for this compilation unit.
26 void setHasImplicitCasts(CompilationUnit node, bool value) {
27 node.setProperty(_hasImplicitCasts, value == true ? true : null);
28 } 21 }
29 22
30 /// If this expression has an implicit cast, returns the type it is coerced to, 23 /// If this expression has an implicit cast, returns the type it is coerced to,
31 /// otherwise returns null. 24 /// otherwise returns null.
32 DartType getImplicitCast(Expression node) { 25 DartType getImplicitCast(Expression node) {
33 return node.getProperty/*<DartType>*/(_implicitCast); 26 return node.getProperty/*<DartType>*/(_implicitCast);
34 } 27 }
35 28
36 /// Sets the result of [getImplicitCast] for this node. 29 /// True if this compilation unit has any implicit casts, otherwise false.
37 void setImplicitCast(Expression node, DartType type) { 30 ///
38 node.setProperty(_implicitCast, type); 31 /// See also [getImplicitCast].
32 bool hasImplicitCasts(CompilationUnit node) {
33 return node.getProperty/*<bool>*/(_hasImplicitCasts) ?? false;
39 } 34 }
40 35
41 /// If this op-assign has an implicit cast on the assignment, returns the type 36 /// True if this node is a dynamic operation that requires dispatch and/or
42 /// it is coerced to, otherwise returns null. 37 /// checking at runtime.
43 DartType getImplicitAssignmentCast(Expression node) { 38 bool isDynamicInvoke(Expression node) {
44 return node.getProperty/*<DartType>*/(_implicitAssignmentCast); 39 return node.getProperty/*<bool>*/(_isDynamicInvoke) ?? false;
40 }
41
42 /// Sets [hasImplicitCasts] property for this compilation unit.
43 void setHasImplicitCasts(CompilationUnit node, bool value) {
44 node.setProperty(_hasImplicitCasts, value == true ? true : null);
45 } 45 }
46 46
47 /// Sets the result of [getImplicitAssignmentCast] for this node. 47 /// Sets the result of [getImplicitAssignmentCast] for this node.
48 void setImplicitAssignmentCast(Expression node, DartType type) { 48 void setImplicitAssignmentCast(Expression node, DartType type) {
49 node.setProperty(_implicitAssignmentCast, type); 49 node.setProperty(_implicitAssignmentCast, type);
50 } 50 }
51 51
52 /// True if this node is a dynamic operation that requires dispatch and/or 52 /// Sets the result of [getImplicitCast] for this node.
53 /// checking at runtime. 53 void setImplicitCast(Expression node, DartType type) {
54 bool isDynamicInvoke(Expression node) { 54 node.setProperty(_implicitCast, type);
55 return node.getProperty/*<bool>*/(_isDynamicInvoke) ?? false;
56 } 55 }
57 56
58 /// Sets [isDynamicInvoke] property for this expression 57 /// Sets [isDynamicInvoke] property for this expression
59 void setIsDynamicInvoke(Expression node, bool value) { 58 void setIsDynamicInvoke(Expression node, bool value) {
60 node.setProperty(_isDynamicInvoke, value == true ? true : null); 59 node.setProperty(_isDynamicInvoke, value == true ? true : null);
61 } 60 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/driver.dart ('k') | pkg/analyzer/lib/src/task/strong/checker.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698