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

Side by Side Diff: runtime/vm/token_descriptor.cc

Issue 1644793002: Replace intptr_t with TokenDescriptor (Closed) Base URL: git@github.com:dart-lang/sdk.git@master
Patch Set: Created 4 years, 10 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
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 #include "vm/token_descriptor.h"
6
7 #include "vm/object.h"
8
9 namespace dart {
10
11
12 TokenDescriptor TokenDescriptor::SnapshotDecode(int32_t value) {
13 return TokenDescriptor(static_cast<intptr_t>(value));
14 }
15
16
17 int32_t TokenDescriptor::SnapshotEncode() {
18 return static_cast<int32_t>(value_);
19 }
20
21
22 bool TokenDescriptor::IsSynthetic() const {
23 if (value_ >= kMinSourcePos) {
24 return false;
25 }
26 if (value_ < kLast.value()) {
27 return true;
28 }
29 return false;
30 }
31
32
33 #define DEFINE_VALUES(name, value) \
34 const TokenDescriptor TokenDescriptor::k##name = TokenDescriptor(value);
35 SENTINEL_TOKEN_DESCRIPTORS(DEFINE_VALUES);
36 #undef DEFINE_VALUES
37 const TokenDescriptor TokenDescriptor::kMinSource =
38 TokenDescriptor(kMinSourcePos);
39
40 const TokenDescriptor TokenDescriptor::kMaxSource =
41 TokenDescriptor(kMaxSourcePos);
42
43
44 const char* TokenDescriptor::ToCString() const {
45 switch (value_) {
46 #define DEFINE_CASE(name, value) \
47 case value: return #name;
48 SENTINEL_TOKEN_DESCRIPTORS(DEFINE_CASE);
49 #undef DEFINE_CASE
50 default:
51 return "Non-Classifying token position";
52 }
53 }
54
55 } // namespace dart
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698