Moved C++ to optional_scalars2 and added some tests. (#6162)

* Moved C++ to optional_scalars2 and added some tests.

Also deleted unused optional_scalars_generated.lobster

* Fixed whitespece in C++ gencode & fixed BUILD file

* Moved C++ onto optional_scalars2 in the .bat file

Co-authored-by: Casper Neo <cneo@google.com>
This commit is contained in:
Casper
2020-10-07 09:46:09 -07:00
committed by GitHub
parent 187a4787f9
commit 3359e3042f
8 changed files with 968 additions and 230 deletions

View File

@@ -1,4 +1,4 @@
/*
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
@@ -1650,7 +1650,7 @@ class CppGenerator : public BaseGenerator {
const auto &type = field.value.type;
code_.SetValue("PARAM_VALUE", GetDefaultScalarValue(field, false));
if (field.IsScalarOptional())
code_.SetValue("PARAM_TYPE", GenOptionalDecl(type));
code_.SetValue("PARAM_TYPE", GenOptionalDecl(type) + " ");
else
code_.SetValue("PARAM_TYPE", GenTypeWire(type, " ", true));
}