Chromium Code Reviews| Index: pkg/compiler/lib/src/native/behavior.dart |
| diff --git a/pkg/compiler/lib/src/native/behavior.dart b/pkg/compiler/lib/src/native/behavior.dart |
| index 9f825de381c324302e01e65ad72c6238acfae0d6..742cf0d8e9eb7f9725deb32398f093e2af864b3d 100644 |
| --- a/pkg/compiler/lib/src/native/behavior.dart |
| +++ b/pkg/compiler/lib/src/native/behavior.dart |
| @@ -31,6 +31,22 @@ class NativeThrowBehavior { |
| bool get canThrow => this != NEVER; |
| + /// Does this behavior always throw a noSuchMethod check on a null first |
| + /// argument before any side effect or other exception? |
| + // TODO(sra): Extend NativeThrowBehavior with the concept of NSM guard |
| + // followed by other potential behavior. |
| + bool get isNullNSMGuard => this == MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS; |
| + |
| + /// Does this behavior always act as a null noSuchMethod check, and has no |
| + /// other throwing behavior? |
| + bool get onlyNullNSMGuard => this == MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS; |
|
floitsch
2015/04/13 08:07:14
nit: isOnlyNullNSMGuard
sra1
2015/04/13 23:59:05
Done.
|
| + |
| + /// Returns the behavior if we assume the first argument is not null. |
| + NativeThrowBehavior get onNonNull { |
| + if (this == MAY_THROW_ONLY_ON_FIRST_ARGUMENT_ACCESS) return NEVER; |
| + return this; |
| + } |
| + |
| String toString() { |
| if (this == NEVER) return 'never'; |
| if (this == MAY) return 'may'; |