[torque] Add linter rule for 'label' naming convention

R=tebbi@chromium.org

Bug: v8:7793
Change-Id: I6690ae59743054e8171bffbf722eb486f468ac48
Reviewed-on: https://chromium-review.googlesource.com/1228062
Reviewed-by: Tobias Tebbi <tebbi@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#55985}
This commit is contained in:
Simon Zünd 2018-09-17 17:06:44 +01:00 committed by Commit Bot
parent 9c702f4d3d
commit d898fa3ec1
2 changed files with 9 additions and 3 deletions

View File

@ -711,6 +711,9 @@ base::Optional<ParseResult> MakeForLoopStatement(
base::Optional<ParseResult> MakeLabelBlock(ParseResultIterator* child_results) {
auto label = child_results->NextAs<std::string>();
if (!IsUpperCamelCase(label)) {
NamingConventionError("Label", label, "UpperCamelCase");
}
auto parameters = child_results->NextAs<ParameterList>();
auto body = child_results->NextAs<Statement*>();
LabelBlock* result =
@ -840,6 +843,9 @@ base::Optional<ParseResult> MakeConditionalExpression(
base::Optional<ParseResult> MakeLabelAndTypes(
ParseResultIterator* child_results) {
auto name = child_results->NextAs<std::string>();
if (!IsUpperCamelCase(name)) {
NamingConventionError("Label", name, "UpperCamelCase");
}
auto types = child_results->NextAs<std::vector<TypeExpression*>>();
return ParseResult{LabelAndTypes{std::move(name), std::move(types)}};
}

View File

@ -1747,9 +1747,9 @@ module array {
sortState[kBailoutStatusIdx] = kSuccess;
try {
const a: JSArray = Cast<JSArray>(obj) otherwise slow;
const a: JSArray = Cast<JSArray>(obj) otherwise Slow;
const elementsKind: ElementsKind = map.elements_kind;
if (!IsFastElementsKind(elementsKind)) goto slow;
if (!IsFastElementsKind(elementsKind)) goto Slow;
// 3. Let len be ? ToLength(? Get(obj, "length")).
const len: Smi = a.length_fast;
@ -1771,7 +1771,7 @@ module array {
}
ArrayTimSort(context, sortState, nofNonUndefined);
}
label slow {
label Slow {
// 3. Let len be ? ToLength(? Get(obj, "length")).
const len: Number = GetLengthProperty(context, obj);