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

Unified Diff: runtime/vm/kernel_binary.h

Issue 2860823002: Introduce classes for string and name indexes (Closed)
Patch Set: Created 3 years, 8 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « runtime/vm/kernel.h ('k') | runtime/vm/kernel_binary.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: runtime/vm/kernel_binary.h
diff --git a/runtime/vm/kernel_binary.h b/runtime/vm/kernel_binary.h
index 6c2be17e88951247bd0547089a1d158f290b532b..904e1e47b6da4e22f500d20d080d77c07245f8a4 100644
--- a/runtime/vm/kernel_binary.h
+++ b/runtime/vm/kernel_binary.h
@@ -493,7 +493,7 @@ class Reader {
// A canonical name reference of -1 indicates none (for optional names), not
// the root name as in the canonical name table.
- intptr_t ReadCanonicalNameReference() { return ReadUInt() - 1; }
+ NameIndex ReadCanonicalNameReference() { return NameIndex(ReadUInt() - 1); }
intptr_t offset() { return offset_; }
void set_offset(intptr_t offset) { offset_ = offset; }
@@ -507,24 +507,24 @@ class Reader {
string_data_offset_ = offset_;
}
- intptr_t StringLength(intptr_t string_index) {
- return string_offsets_[string_index + 1] - string_offsets_[string_index];
+ intptr_t StringLength(StringIndex index) {
+ return string_offsets_[index + 1] - string_offsets_[index];
}
- uint8_t CharacterAt(intptr_t string_index, intptr_t index) {
+ uint8_t CharacterAt(StringIndex string_index, intptr_t index) {
ASSERT(index < StringLength(string_index));
return buffer_[string_data_offset_ + string_offsets_[string_index] + index];
}
// The canonical name index of a canonical name's parent (-1 indicates that
// the parent is the root name).
- intptr_t CanonicalNameParent(intptr_t name_index) {
- return canonical_name_parents_[name_index];
+ NameIndex CanonicalNameParent(NameIndex index) {
+ return canonical_name_parents_[index];
}
// The string index of a canonical name's name string.
- intptr_t CanonicalNameString(intptr_t name_index) {
- return canonical_name_strings_[name_index];
+ StringIndex CanonicalNameString(NameIndex index) {
+ return canonical_name_strings_[index];
}
private:
@@ -545,8 +545,8 @@ class Reader {
intptr_t* string_offsets_;
// The canonical names are decoded.
- intptr_t* canonical_name_parents_;
- intptr_t* canonical_name_strings_;
+ NameIndex* canonical_name_parents_;
+ StringIndex* canonical_name_strings_;
friend class PositionScope;
friend class Program;
« no previous file with comments | « runtime/vm/kernel.h ('k') | runtime/vm/kernel_binary.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698