Commit d898fa3e authored by Simon Zünd's avatar Simon Zünd Committed by Commit Bot

[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/1228062Reviewed-by: 's avatarTobias Tebbi <tebbi@chromium.org>
Commit-Queue: Simon Zünd <szuend@google.com>
Cr-Commit-Position: refs/heads/master@{#55985}
parent 9c702f4d
......@@ -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)}};
}
......
......@@ -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);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment