| OLD | NEW |
| 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 #include "vm/token_position.h" | 5 #include "vm/token_position.h" |
| 6 | 6 |
| 7 #include "vm/object.h" | 7 #include "vm/object.h" |
| 8 | 8 |
| 9 namespace dart { | 9 namespace dart { |
| 10 | 10 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 24 return false; | 24 return false; |
| 25 } | 25 } |
| 26 if (value_ < kLast.value()) { | 26 if (value_ < kLast.value()) { |
| 27 return true; | 27 return true; |
| 28 } | 28 } |
| 29 return false; | 29 return false; |
| 30 } | 30 } |
| 31 | 31 |
| 32 | 32 |
| 33 #define DEFINE_VALUES(name, value) \ | 33 #define DEFINE_VALUES(name, value) \ |
| 34 const TokenPosition TokenPosition::k##name = TokenPosition(value); | 34 const TokenPosition TokenPosition::k##name = TokenPosition(value); |
| 35 SENTINEL_TOKEN_DESCRIPTORS(DEFINE_VALUES); | 35 SENTINEL_TOKEN_DESCRIPTORS(DEFINE_VALUES); |
| 36 #undef DEFINE_VALUES | 36 #undef DEFINE_VALUES |
| 37 const TokenPosition TokenPosition::kMinSource = | 37 const TokenPosition TokenPosition::kMinSource = TokenPosition(kMinSourcePos); |
| 38 TokenPosition(kMinSourcePos); | |
| 39 | 38 |
| 40 const TokenPosition TokenPosition::kMaxSource = | 39 const TokenPosition TokenPosition::kMaxSource = TokenPosition(kMaxSourcePos); |
| 41 TokenPosition(kMaxSourcePos); | |
| 42 | 40 |
| 43 | 41 |
| 44 const char* TokenPosition::ToCString() const { | 42 const char* TokenPosition::ToCString() const { |
| 45 switch (value_) { | 43 switch (value_) { |
| 46 #define DEFINE_CASE(name, value) \ | 44 #define DEFINE_CASE(name, value) \ |
| 47 case value: return #name; | 45 case value: \ |
| 46 return #name; |
| 48 SENTINEL_TOKEN_DESCRIPTORS(DEFINE_CASE); | 47 SENTINEL_TOKEN_DESCRIPTORS(DEFINE_CASE); |
| 49 #undef DEFINE_CASE | 48 #undef DEFINE_CASE |
| 50 default: { | 49 default: { |
| 51 Zone* zone = Thread::Current()->zone(); | 50 Zone* zone = Thread::Current()->zone(); |
| 52 ASSERT(zone != NULL); | 51 ASSERT(zone != NULL); |
| 53 if (IsSynthetic()) { | 52 if (IsSynthetic()) { |
| 54 // TODO(johnmccutchan): Print synthetic positions differently. | 53 // TODO(johnmccutchan): Print synthetic positions differently. |
| 55 return FromSynthetic().ToCString(); | 54 return FromSynthetic().ToCString(); |
| 56 } else { | 55 } else { |
| 57 return OS::SCreate(zone, "%d", value_); | 56 return OS::SCreate(zone, "%d", value_); |
| 58 } | 57 } |
| 59 } | 58 } |
| 60 } | 59 } |
| 61 } | 60 } |
| 62 | 61 |
| 63 } // namespace dart | 62 } // namespace dart |
| OLD | NEW |