Version 2.15.0-14.0.dev
Merge commit '8dc6c5ecb012b9e039d006bc37ac98a9f2a405a0' into 'dev'
diff --git a/pkg/_fe_analyzer_shared/lib/src/parser/type_info.dart b/pkg/_fe_analyzer_shared/lib/src/parser/type_info.dart
index 03a290d..04d8e48 100644
--- a/pkg/_fe_analyzer_shared/lib/src/parser/type_info.dart
+++ b/pkg/_fe_analyzer_shared/lib/src/parser/type_info.dart
@@ -387,7 +387,9 @@
'*',
'%',
'/',
- '~/'
+ '~/',
+ 'is',
+ 'as'
};
if (token.type == TokenType.EOF) {
// The spec doesn't have anything to say about this case, since an
diff --git a/pkg/analyzer/test/generated/function_reference_parser_test.dart b/pkg/analyzer/test/generated/function_reference_parser_test.dart
index c7cc214..e76a9a7 100644
--- a/pkg/analyzer/test/generated/function_reference_parser_test.dart
+++ b/pkg/analyzer/test/generated/function_reference_parser_test.dart
@@ -51,6 +51,13 @@
.leftOperand);
}
+ void test_followingToken_accepted_as() {
+ expect_f_a_b(
+ (parseExpression('f<a, b> as int', featureSet: constructorTearoffs)
+ as AsExpression)
+ .expression);
+ }
+
void test_followingToken_accepted_asterisk() {
expect_f_a_b(
(parseExpression('f<a, b> * 0', featureSet: constructorTearoffs)
@@ -113,6 +120,13 @@
.leftOperand);
}
+ void test_followingToken_accepted_is() {
+ expect_f_a_b(
+ (parseExpression('f<a, b> is int', featureSet: constructorTearoffs)
+ as IsExpression)
+ .expression);
+ }
+
void test_followingToken_accepted_not_equals() {
expect_f_a_b(
(parseExpression('f<a, b> != null', featureSet: constructorTearoffs)
diff --git a/pkg/front_end/parser_testcases/general/function_reference_following_token.dart b/pkg/front_end/parser_testcases/general/function_reference_following_token.dart
index d426546..dfe8eeb 100644
--- a/pkg/front_end/parser_testcases/general/function_reference_following_token.dart
+++ b/pkg/front_end/parser_testcases/general/function_reference_following_token.dart
@@ -13,6 +13,7 @@
// operators.
var typeArgs_ampersand = f<a, b> & 0;
+var typeArgs_as = f<a, b> as int;
var typeArgs_asterisk = f<a, b> * 0;
var typeArgs_bar = f<a, b> | 0;
var typeArgs_caret = f<a, b> ^ 0;
@@ -22,6 +23,7 @@
var typeArgs_colon = {f<a, b>: null};
var typeArgs_comma = [f<a, b>, null];
var typeArgs_equals = f<a, b> == null;
+var typeArgs_is = f<a, b> is int;
var typeArgs_not_equals = f<a, b> != null;
// This is a special case because when a `(` follows `<typeArguments>` it is
diff --git a/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.expect b/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.expect
index 1acd3c2..b960510 100644
--- a/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.expect
+++ b/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.expect
@@ -1,14 +1,14 @@
Problems reported:
-parser/general/function_reference_following_token:79:29: A comparison expression can't be an operand of another comparison expression.
+parser/general/function_reference_following_token:81:29: A comparison expression can't be an operand of another comparison expression.
var operators_lessThan = f<a><b>;
^
-parser/general/function_reference_following_token:79:33: Expected '[' before this.
+parser/general/function_reference_following_token:81:33: Expected '[' before this.
var operators_lessThan = f<a><b>;
^
-parser/general/function_reference_following_token:89:46: A comparison expression can't be an operand of another comparison expression.
+parser/general/function_reference_following_token:91:46: A comparison expression can't be an operand of another comparison expression.
var operators_openBracket_error = f(a<b,c>[d]>e);
^
@@ -44,6 +44,35 @@
beginTopLevelMember(var)
beginFields(;)
handleNoType(var)
+ handleIdentifier(typeArgs_as, topLevelVariableDeclaration)
+ beginFieldInitializer(=)
+ handleIdentifier(f, expression)
+ handleNoTypeArguments(<)
+ handleNoArguments(<)
+ handleSend(f, <)
+ beginTypeArguments(<)
+ handleIdentifier(a, typeReference)
+ handleNoTypeArguments(,)
+ handleType(a, null)
+ handleIdentifier(b, typeReference)
+ handleNoTypeArguments(>)
+ handleType(b, null)
+ endTypeArguments(2, <, >)
+ handleTypeArgumentApplication(<)
+ beginAsOperatorType(as)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(;)
+ handleType(int, null)
+ endAsOperatorType(as)
+ handleAsOperator(as)
+ endFieldInitializer(=, ;)
+ endTopLevelFields(null, null, null, null, var, 1, var, ;)
+ endTopLevelDeclaration(var)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ beginTopLevelMember(var)
+ beginFields(;)
+ handleNoType(var)
handleIdentifier(typeArgs_asterisk, topLevelVariableDeclaration)
beginFieldInitializer(=)
handleIdentifier(f, expression)
@@ -279,6 +308,35 @@
beginTopLevelMember(var)
beginFields(;)
handleNoType(var)
+ handleIdentifier(typeArgs_is, topLevelVariableDeclaration)
+ beginFieldInitializer(=)
+ handleIdentifier(f, expression)
+ handleNoTypeArguments(<)
+ handleNoArguments(<)
+ handleSend(f, <)
+ beginTypeArguments(<)
+ handleIdentifier(a, typeReference)
+ handleNoTypeArguments(,)
+ handleType(a, null)
+ handleIdentifier(b, typeReference)
+ handleNoTypeArguments(>)
+ handleType(b, null)
+ endTypeArguments(2, <, >)
+ handleTypeArgumentApplication(<)
+ beginIsOperatorType(is)
+ handleIdentifier(int, typeReference)
+ handleNoTypeArguments(;)
+ handleType(int, null)
+ endIsOperatorType(is)
+ handleIsOperator(is, null)
+ endFieldInitializer(=, ;)
+ endTopLevelFields(null, null, null, null, var, 1, var, ;)
+ endTopLevelDeclaration(var)
+ beginMetadataStar(var)
+ endMetadataStar(0)
+ beginTopLevelMember(var)
+ beginFields(;)
+ handleNoType(var)
handleIdentifier(typeArgs_not_equals, topLevelVariableDeclaration)
beginFieldInitializer(=)
handleIdentifier(f, expression)
@@ -1005,4 +1063,4 @@
endFieldInitializer(=, ;)
endTopLevelFields(null, null, null, null, var, 1, var, ;)
endTopLevelDeclaration()
-endCompilationUnit(34, )
+endCompilationUnit(36, )
diff --git a/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.intertwined.expect b/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.intertwined.expect
index c8fe425..9b580ea 100644
--- a/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.intertwined.expect
+++ b/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.intertwined.expect
@@ -53,6 +53,53 @@
listener: endMetadataStar(0)
parseTopLevelMemberImpl(;)
listener: beginTopLevelMember(var)
+ parseFields(;, null, null, null, null, null, var, var, Instance of 'NoType', typeArgs_as, DeclarationKind.TopLevel, null, false)
+ listener: beginFields(;)
+ listener: handleNoType(var)
+ ensureIdentifierPotentiallyRecovered(var, topLevelVariableDeclaration, false)
+ listener: handleIdentifier(typeArgs_as, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(typeArgs_as, typeArgs_as, null, null, null, var, DeclarationKind.TopLevel, null)
+ listener: beginFieldInitializer(=)
+ parseExpression(=)
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseSendOrFunctionLiteral(=, expression)
+ parseSend(=, expression)
+ isNextIdentifier(=)
+ ensureIdentifier(=, expression)
+ listener: handleIdentifier(f, expression)
+ listener: handleNoTypeArguments(<)
+ parseArgumentsOpt(f)
+ listener: handleNoArguments(<)
+ listener: handleSend(f, <)
+ listener: beginTypeArguments(<)
+ listener: handleIdentifier(a, typeReference)
+ listener: handleNoTypeArguments(,)
+ listener: handleType(a, null)
+ listener: handleIdentifier(b, typeReference)
+ listener: handleNoTypeArguments(>)
+ listener: handleType(b, null)
+ listener: endTypeArguments(2, <, >)
+ listener: handleTypeArgumentApplication(<)
+ parseAsOperatorRest(>)
+ listener: beginAsOperatorType(as)
+ computeTypeAfterIsOrAs(as)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(;)
+ listener: handleType(int, null)
+ listener: endAsOperatorType(as)
+ listener: handleAsOperator(as)
+ skipChainedAsIsOperators(int)
+ listener: endFieldInitializer(=, ;)
+ listener: endTopLevelFields(null, null, null, null, var, 1, var, ;)
+ listener: endTopLevelDeclaration(var)
+ parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+ parseMetadataStar(;)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(;)
+ listener: beginTopLevelMember(var)
parseFields(;, null, null, null, null, null, var, var, Instance of 'NoType', typeArgs_asterisk, DeclarationKind.TopLevel, null, false)
listener: beginFields(;)
listener: handleNoType(var)
@@ -481,6 +528,53 @@
listener: endMetadataStar(0)
parseTopLevelMemberImpl(;)
listener: beginTopLevelMember(var)
+ parseFields(;, null, null, null, null, null, var, var, Instance of 'NoType', typeArgs_is, DeclarationKind.TopLevel, null, false)
+ listener: beginFields(;)
+ listener: handleNoType(var)
+ ensureIdentifierPotentiallyRecovered(var, topLevelVariableDeclaration, false)
+ listener: handleIdentifier(typeArgs_is, topLevelVariableDeclaration)
+ parseFieldInitializerOpt(typeArgs_is, typeArgs_is, null, null, null, var, DeclarationKind.TopLevel, null)
+ listener: beginFieldInitializer(=)
+ parseExpression(=)
+ parsePrecedenceExpression(=, 1, true)
+ parseUnaryExpression(=, true)
+ parsePrimary(=, expression)
+ parseSendOrFunctionLiteral(=, expression)
+ parseSend(=, expression)
+ isNextIdentifier(=)
+ ensureIdentifier(=, expression)
+ listener: handleIdentifier(f, expression)
+ listener: handleNoTypeArguments(<)
+ parseArgumentsOpt(f)
+ listener: handleNoArguments(<)
+ listener: handleSend(f, <)
+ listener: beginTypeArguments(<)
+ listener: handleIdentifier(a, typeReference)
+ listener: handleNoTypeArguments(,)
+ listener: handleType(a, null)
+ listener: handleIdentifier(b, typeReference)
+ listener: handleNoTypeArguments(>)
+ listener: handleType(b, null)
+ listener: endTypeArguments(2, <, >)
+ listener: handleTypeArgumentApplication(<)
+ parseIsOperatorRest(>)
+ listener: beginIsOperatorType(is)
+ computeTypeAfterIsOrAs(is)
+ listener: handleIdentifier(int, typeReference)
+ listener: handleNoTypeArguments(;)
+ listener: handleType(int, null)
+ listener: endIsOperatorType(is)
+ listener: handleIsOperator(is, null)
+ skipChainedAsIsOperators(int)
+ listener: endFieldInitializer(=, ;)
+ listener: endTopLevelFields(null, null, null, null, var, 1, var, ;)
+ listener: endTopLevelDeclaration(var)
+ parseTopLevelDeclarationImpl(;, Instance of 'DirectiveContext')
+ parseMetadataStar(;)
+ listener: beginMetadataStar(var)
+ listener: endMetadataStar(0)
+ parseTopLevelMemberImpl(;)
+ listener: beginTopLevelMember(var)
parseFields(;, null, null, null, null, null, var, var, Instance of 'NoType', typeArgs_not_equals, DeclarationKind.TopLevel, null, false)
listener: beginFields(;)
listener: handleNoType(var)
@@ -1956,4 +2050,4 @@
listener: endTopLevelFields(null, null, null, null, var, 1, var, ;)
listener: endTopLevelDeclaration()
reportAllErrorTokens(var)
- listener: endCompilationUnit(34, )
+ listener: endCompilationUnit(36, )
diff --git a/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.parser.expect b/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.parser.expect
index becf1b6..0ccc331 100644
--- a/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.parser.expect
+++ b/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.parser.expect
@@ -1,6 +1,7 @@
NOTICE: Stream was rewritten by parser!
var typeArgs_ampersand = f<a, b> & 0;
+var typeArgs_as = f<a, b> as int;
var typeArgs_asterisk = f<a, b> * 0;
var typeArgs_bar = f<a, b> | 0;
var typeArgs_caret = f<a, b> ^ 0;
@@ -10,6 +11,7 @@
var typeArgs_colon = {f<a, b>: null};
var typeArgs_comma = [f<a, b>, null];
var typeArgs_equals = f<a, b> == null;
+var typeArgs_is = f<a, b> is int;
var typeArgs_not_equals = f<a, b> != null;
@@ -80,6 +82,7 @@
var[KeywordToken] typeArgs_ampersand[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] &[SimpleToken] 0[StringToken];[SimpleToken]
+var[KeywordToken] typeArgs_as[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] as[KeywordToken] int[StringToken];[SimpleToken]
var[KeywordToken] typeArgs_asterisk[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] *[SimpleToken] 0[StringToken];[SimpleToken]
var[KeywordToken] typeArgs_bar[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] |[SimpleToken] 0[StringToken];[SimpleToken]
var[KeywordToken] typeArgs_caret[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] ^[SimpleToken] 0[StringToken];[SimpleToken]
@@ -89,6 +92,7 @@
var[KeywordToken] typeArgs_colon[StringToken] =[SimpleToken] {[BeginToken]f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken]:[SimpleToken] null[KeywordToken]}[SimpleToken];[SimpleToken]
var[KeywordToken] typeArgs_comma[StringToken] =[SimpleToken] [[BeginToken]f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken],[SimpleToken] null[KeywordToken]][SimpleToken];[SimpleToken]
var[KeywordToken] typeArgs_equals[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] ==[SimpleToken] null[KeywordToken];[SimpleToken]
+var[KeywordToken] typeArgs_is[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] is[KeywordToken] int[StringToken];[SimpleToken]
var[KeywordToken] typeArgs_not_equals[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] !=[SimpleToken] null[KeywordToken];[SimpleToken]
diff --git a/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.scanner.expect b/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.scanner.expect
index 32ed486..44f7742 100644
--- a/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.scanner.expect
+++ b/pkg/front_end/parser_testcases/general/function_reference_following_token.dart.scanner.expect
@@ -1,4 +1,5 @@
var typeArgs_ampersand = f<a, b> & 0;
+var typeArgs_as = f<a, b> as int;
var typeArgs_asterisk = f<a, b> * 0;
var typeArgs_bar = f<a, b> | 0;
var typeArgs_caret = f<a, b> ^ 0;
@@ -8,6 +9,7 @@
var typeArgs_colon = {f<a, b>: null};
var typeArgs_comma = [f<a, b>, null];
var typeArgs_equals = f<a, b> == null;
+var typeArgs_is = f<a, b> is int;
var typeArgs_not_equals = f<a, b> != null;
@@ -78,6 +80,7 @@
var[KeywordToken] typeArgs_ampersand[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] &[SimpleToken] 0[StringToken];[SimpleToken]
+var[KeywordToken] typeArgs_as[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] as[KeywordToken] int[StringToken];[SimpleToken]
var[KeywordToken] typeArgs_asterisk[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] *[SimpleToken] 0[StringToken];[SimpleToken]
var[KeywordToken] typeArgs_bar[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] |[SimpleToken] 0[StringToken];[SimpleToken]
var[KeywordToken] typeArgs_caret[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] ^[SimpleToken] 0[StringToken];[SimpleToken]
@@ -87,6 +90,7 @@
var[KeywordToken] typeArgs_colon[StringToken] =[SimpleToken] {[BeginToken]f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken]:[SimpleToken] null[KeywordToken]}[SimpleToken];[SimpleToken]
var[KeywordToken] typeArgs_comma[StringToken] =[SimpleToken] [[BeginToken]f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken],[SimpleToken] null[KeywordToken]][SimpleToken];[SimpleToken]
var[KeywordToken] typeArgs_equals[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] ==[SimpleToken] null[KeywordToken];[SimpleToken]
+var[KeywordToken] typeArgs_is[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] is[KeywordToken] int[StringToken];[SimpleToken]
var[KeywordToken] typeArgs_not_equals[StringToken] =[SimpleToken] f[StringToken]<[BeginToken]a[StringToken],[SimpleToken] b[StringToken]>[SimpleToken] !=[SimpleToken] null[KeywordToken];[SimpleToken]
diff --git a/runtime/vm/class_id.h b/runtime/vm/class_id.h
index 5a41a68..eeb6d41 100644
--- a/runtime/vm/class_id.h
+++ b/runtime/vm/class_id.h
@@ -17,7 +17,9 @@
// Size of the class-id part of the object header. See UntaggedObject.
typedef uint16_t ClassIdTagType;
-#define CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY_NOR_MAP(V) \
+// Classes that are not subclasses of Instance and only handled by the VM,
+// but do not require any special handling other than being a predefined class.
+#define CLASS_LIST_INTERNAL_ONLY(V) \
V(Class) \
V(PatchClass) \
V(Function) \
@@ -55,7 +57,12 @@
V(ApiError) \
V(LanguageError) \
V(UnhandledException) \
- V(UnwindError) \
+ V(UnwindError)
+
+// Classes that are subclasses of Instance and neither part of a specific cid
+// grouping like strings, arrays, etc. nor require special handling outside of
+// being a predefined class.
+#define CLASS_LIST_INSTANCE_SINGLETONS(V) \
V(Instance) \
V(LibraryPrefix) \
V(TypeArguments) \
@@ -92,6 +99,9 @@
V(UserTag) \
V(TransferableTypedData)
+#define CLASS_LIST_NO_OBJECT_NOR_STRING_NOR_ARRAY_NOR_MAP(V) \
+ CLASS_LIST_INTERNAL_ONLY(V) CLASS_LIST_INSTANCE_SINGLETONS(V)
+
// TODO(http://dartbug.com/45908): Add ImmutableLinkedHashMap.
#define CLASS_LIST_MAPS(V) V(LinkedHashMap)
@@ -234,6 +244,7 @@
// Class Id predicates.
+bool IsInternalOnlyId(intptr_t index);
bool IsErrorClassId(intptr_t index);
bool IsNumberClassId(intptr_t index);
bool IsIntegerClassId(intptr_t index);
@@ -252,13 +263,38 @@
bool IsInternalVMdefinedClassId(intptr_t index);
bool IsImplicitFieldClassId(intptr_t index);
+// Should be used for looping over non-Object internal-only cids.
+constexpr intptr_t kFirstInternalOnlyCid = kClassCid;
+constexpr intptr_t kLastInternalOnlyCid = kUnwindErrorCid;
+// Use the currently surrounding cids to check that no new classes have been
+// added to the beginning or end of CLASS_LIST_INTERNAL_ONLY without adjusting
+// the above definitions.
+COMPILE_ASSERT(kFirstInternalOnlyCid == kObjectCid + 1);
+COMPILE_ASSERT(kInstanceCid == kLastInternalOnlyCid + 1);
+
+// Checks that the cids in CLASS_LIST_INTERNAL_ONLY come after kObjectCid.
+// Use with COMPILE_ASSERT where code assumes that Object immediately precedes
+// the other internal-only cids, so it can be adjusted if this changes.
+constexpr bool ObjectComesBeforeOtherInternalOnlyClasses() {
+ return kFirstInternalOnlyCid == kObjectCid + 1;
+}
+
+// Returns true for any class id that either does not correspond to a real
+// class, like kIllegalCid or kForwardingCorpse, or that is internal to the VM
+// and should not be exposed directly to user code.
+inline bool IsInternalOnlyId(intptr_t index) {
+ COMPILE_ASSERT(ObjectComesBeforeOtherInternalOnlyClasses());
+ return index <= kLastInternalOnlyCid;
+}
+
inline bool IsErrorClassId(intptr_t index) {
// Make sure this function is updated when new Error types are added.
- COMPILE_ASSERT(
- kApiErrorCid == kErrorCid + 1 && kLanguageErrorCid == kErrorCid + 2 &&
- kUnhandledExceptionCid == kErrorCid + 3 &&
- kUnwindErrorCid == kErrorCid + 4 && kInstanceCid == kErrorCid + 5);
- return (index >= kErrorCid && index < kInstanceCid);
+ COMPILE_ASSERT(kApiErrorCid == kErrorCid + 1 &&
+ kLanguageErrorCid == kErrorCid + 2 &&
+ kUnhandledExceptionCid == kErrorCid + 3 &&
+ kUnwindErrorCid == kErrorCid + 4 &&
+ kLastInternalOnlyCid == kUnwindErrorCid);
+ return (index >= kErrorCid && index <= kLastInternalOnlyCid);
}
inline bool IsNumberClassId(intptr_t index) {
diff --git a/runtime/vm/class_table.cc b/runtime/vm/class_table.cc
index b5491bb..d1f3df1 100644
--- a/runtime/vm/class_table.cc
+++ b/runtime/vm/class_table.cc
@@ -39,7 +39,8 @@
calloc(capacity_, sizeof(RelaxedAtomic<intptr_t>)));
// The following cids don't have a corresponding class object in Dart code.
// We therefore need to initialize them eagerly.
- for (intptr_t i = kObjectCid; i < kInstanceCid; i++) {
+ COMPILE_ASSERT(ObjectComesBeforeOtherInternalOnlyClasses());
+ for (intptr_t i = kObjectCid; i <= kLastInternalOnlyCid; i++) {
table[i] = vm_shared_class_table->SizeAt(i);
}
table[kTypeArgumentsCid] = vm_shared_class_table->SizeAt(kTypeArgumentsCid);
@@ -105,7 +106,8 @@
static_cast<ClassPtr*>(calloc(capacity_, sizeof(ClassPtr)));
// The following cids don't have a corresponding class object in Dart code.
// We therefore need to initialize them eagerly.
- for (intptr_t i = kObjectCid; i < kInstanceCid; i++) {
+ COMPILE_ASSERT(ObjectComesBeforeOtherInternalOnlyClasses());
+ for (intptr_t i = kObjectCid; i <= kLastInternalOnlyCid; i++) {
table[i] = vm_class_table->At(i);
}
table[kTypeArgumentsCid] = vm_class_table->At(kTypeArgumentsCid);
diff --git a/runtime/vm/clustered_snapshot.cc b/runtime/vm/clustered_snapshot.cc
index c531f98..40b0a98 100644
--- a/runtime/vm/clustered_snapshot.cc
+++ b/runtime/vm/clustered_snapshot.cc
@@ -5370,7 +5370,8 @@
"<empty subtype entries>");
ClassTable* table = s->isolate_group()->class_table();
- for (intptr_t cid = kClassCid; cid < kInstanceCid; cid++) {
+ for (intptr_t cid = kFirstInternalOnlyCid; cid <= kLastInternalOnlyCid;
+ cid++) {
// Error, CallSiteData has no class object.
if (cid != kErrorCid && cid != kCallSiteDataCid) {
ASSERT(table->HasValidClassAt(cid));
@@ -5477,7 +5478,8 @@
d->AddBaseObject(SubtypeTestCache::cached_array_);
ClassTable* table = d->isolate_group()->class_table();
- for (intptr_t cid = kClassCid; cid <= kUnwindErrorCid; cid++) {
+ for (intptr_t cid = kFirstInternalOnlyCid; cid <= kLastInternalOnlyCid;
+ cid++) {
// Error, CallSiteData has no class object.
if (cid != kErrorCid && cid != kCallSiteDataCid) {
ASSERT(table->HasValidClassAt(cid));
diff --git a/runtime/vm/compiler/backend/type_propagator.cc b/runtime/vm/compiler/backend/type_propagator.cc
index acb00ca..f6650b2 100644
--- a/runtime/vm/compiler/backend/type_propagator.cc
+++ b/runtime/vm/compiler/backend/type_propagator.cc
@@ -821,7 +821,7 @@
// VM-internal objects don't have a compile-type. Return dynamic-type
// in this case.
- if ((cid_ < kInstanceCid) || (cid_ == kTypeArgumentsCid)) {
+ if (IsInternalOnlyId(cid_) || cid_ == kTypeArgumentsCid) {
type_ = &Object::dynamic_type();
return type_;
}
diff --git a/runtime/vm/compiler/cha.cc b/runtime/vm/compiler/cha.cc
index 790c237..2668918 100644
--- a/runtime/vm/compiler/cha.cc
+++ b/runtime/vm/compiler/cha.cc
@@ -32,7 +32,7 @@
bool CHA::HasSubclasses(const Class& cls) {
ASSERT(!cls.IsNull());
- ASSERT(cls.id() >= kInstanceCid);
+ ASSERT(!IsInternalOnlyId(cls.id()));
// Can't track dependencies for classes on the VM heap since those are
// read-only.
// TODO(fschneider): Enable tracking of CHA dependent code for VM heap
diff --git a/runtime/vm/dart_api_impl.h b/runtime/vm/dart_api_impl.h
index cefda8b..59ce2aa 100644
--- a/runtime/vm/dart_api_impl.h
+++ b/runtime/vm/dart_api_impl.h
@@ -212,7 +212,7 @@
// Returns true if the handle holds a Dart Instance.
static bool IsInstance(Dart_Handle handle) {
- return (ClassId(handle) >= kInstanceCid);
+ return !IsInternalOnlyId(ClassId(handle));
}
// Returns true if the handle is non-dangling.
diff --git a/runtime/vm/heap/verifier.cc b/runtime/vm/heap/verifier.cc
index 15b26f5..095fc6f 100644
--- a/runtime/vm/heap/verifier.cc
+++ b/runtime/vm/heap/verifier.cc
@@ -117,7 +117,7 @@
// Therefore we disable the handle verification here.
const bool old_verify_flag = FLAG_verify_handles;
FLAG_verify_handles = false;
- if ((obj->GetClassId() >= kInstanceCid) &&
+ if (!IsInternalOnlyId(obj->GetClassId()) &&
(obj->GetClassId() != kTypeArgumentsCid)) {
if (obj->untag()->IsCanonical()) {
instanceHandle_ ^= obj;
diff --git a/runtime/vm/object.cc b/runtime/vm/object.cc
index e80fead..50cd146 100644
--- a/runtime/vm/object.cc
+++ b/runtime/vm/object.cc
@@ -2952,7 +2952,7 @@
result.set_num_type_arguments_unsafe(0);
result.set_num_native_fields(0);
result.set_state_bits(0);
- if ((FakeObject::kClassId < kInstanceCid) ||
+ if (IsInternalOnlyId(FakeObject::kClassId) ||
(FakeObject::kClassId == kTypeArgumentsCid)) {
// VM internal classes are done. There is no finalization needed or
// possible in this case.
@@ -4465,7 +4465,7 @@
const Array& arguments,
const TypeArguments& type_arguments) const {
ASSERT(Thread::Current()->IsMutatorThread());
- if (id() < kInstanceCid || id() == kTypeArgumentsCid) {
+ if (IsInternalOnlyId(id()) || (id() == kTypeArgumentsCid)) {
const Instance& exception = Instance::Handle(String::New(
"Expressions can be evaluated only with regular Dart instances"));
const Instance& stacktrace = Instance::Handle();
diff --git a/runtime/vm/object_graph.cc b/runtime/vm/object_graph.cc
index e05b2ef..f169091 100644
--- a/runtime/vm/object_graph.cc
+++ b/runtime/vm/object_graph.cc
@@ -24,7 +24,7 @@
static bool IsUserClass(intptr_t cid) {
if (cid == kContextCid) return true;
if (cid == kTypeArgumentsCid) return false;
- return cid >= kInstanceCid;
+ return !IsInternalOnlyId(cid);
}
// The state of a pre-order, depth-first traversal of an object graph.
diff --git a/runtime/vm/service.cc b/runtime/vm/service.cc
index b9552b5..71e0b48 100644
--- a/runtime/vm/service.cc
+++ b/runtime/vm/service.cc
@@ -2786,7 +2786,7 @@
isStatic = false;
}
if (!cls.IsTopLevel() &&
- (cls.id() < kInstanceCid || cls.id() == kTypeArgumentsCid)) {
+ (IsInternalOnlyId(cls.id()) || cls.id() == kTypeArgumentsCid)) {
js->PrintError(
kInvalidParams,
"Expressions can be evaluated only with regular Dart instances");
@@ -5170,7 +5170,8 @@
#define DEFINE_ADD_VALUE_F_CID(clazz) DEFINE_ADD_VALUE_F(k##clazz##Cid)
{
JSONArray internals(&map, "<VM Internals>");
- for (intptr_t id = kClassCid; id < kInstanceCid; ++id) {
+ for (intptr_t id = kFirstInternalOnlyCid; id <= kLastInternalOnlyCid;
+ ++id) {
DEFINE_ADD_VALUE_F(id);
}
DEFINE_ADD_VALUE_F_CID(LibraryPrefix);
diff --git a/runtime/vm/tagged_pointer.h b/runtime/vm/tagged_pointer.h
index ffd7d32..4265b03 100644
--- a/runtime/vm/tagged_pointer.h
+++ b/runtime/vm/tagged_pointer.h
@@ -109,7 +109,7 @@
bool IsStringInstance() const { return IsStringClassId(GetClassId()); }
bool IsRawNull() const { return GetClassId() == kNullCid; }
bool IsDartInstance() const {
- return (!IsHeapObject() || (GetClassId() >= kInstanceCid));
+ return (!IsHeapObject() || !IsInternalOnlyId(GetClassId()));
}
bool IsFreeListElement() const {
return ((GetClassId() == kFreeListElement));
diff --git a/tools/VERSION b/tools/VERSION
index 5a324e5..cd176dc 100644
--- a/tools/VERSION
+++ b/tools/VERSION
@@ -27,5 +27,5 @@
MAJOR 2
MINOR 15
PATCH 0
-PRERELEASE 13
+PRERELEASE 14
PRERELEASE_PATCH 0
\ No newline at end of file