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

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

Issue 2062793003: Revert "Revert "Refactor strong mode to use standard Analyzer errors"" (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 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/options.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
(Empty)
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
3 // BSD-style license that can be found in the LICENSE file.
4
5 /// Properties that result from Strong Mode analysis on an AST.
6 ///
7 /// These properties are not public, but provided by use of back-ends such as
8 /// Dart Dev Compiler.
9
10 import 'package:analyzer/analyzer.dart';
11 import 'package:analyzer/dart/element/type.dart';
12
13 const String _implicitCast = '_implicitCast';
14 const String _hasImplicitCasts = '_hasImplicitCasts';
15 const String _isDynamicInvoke = '_isDynamicInvoke';
16
17 /// True if this compilation unit has any implicit casts, otherwise false.
18 ///
19 /// See also [getImplicitCast].
20 bool hasImplicitCasts(CompilationUnit node) {
21 return node.getProperty/*<bool>*/(_hasImplicitCasts) ?? false;
22 }
23
24 /// Sets [hasImplicitCasts] property for this compilation unit.
25 void setHasImplicitCasts(CompilationUnit node, bool value) {
26 node.setProperty(_hasImplicitCasts, value == true ? true : null);
27 }
28
29 /// If this expression has an implicit cast, returns the type it is coerced to,
30 /// otherwise returns null.
31 DartType getImplicitCast(Expression node) {
32 return node.getProperty/*<DartType>*/(_implicitCast);
33 }
34
35 /// Sets the result of [getImplicitCast] for this node.
36 void setImplicitCast(Expression node, DartType type) {
37 node.setProperty(_implicitCast, type);
38 }
39
40 /// True if this node is a dynamic operation that requires dispatch and/or
41 /// checking at runtime.
42 bool isDynamicInvoke(Expression node) {
43 return node.getProperty/*<bool>*/(_isDynamicInvoke) ?? false;
44 }
45
46 /// Sets [isDynamicInvoke] property for this expression
47 void setIsDynamicInvoke(Expression node, bool value) {
48 node.setProperty(_isDynamicInvoke, value == true ? true : null);
49 }
OLDNEW
« no previous file with comments | « pkg/analyzer/lib/src/task/options.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