liyujie
2025-08-28 b3810562527858a3b3d98ffa6e9c9c5b0f4a9a8e
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
/*
 * Copyright 2014 Google Inc. All rights reserved.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
 
#define IN_FRUIT_CPP_FILE 1
 
#include <fruit/component.h>
 
#include <exception>
#include <iostream>
 
namespace fruit {
 
// TODO: reimplement this check somehow.
/*
EmptyPartialComponent::~EmptyPartialComponent() {
  // If the user of Fruit didn't cast the result of createComponent() (possibly after adding some bindings) to a
Component<>, we abort
  // because that's a misuse of the Fruit API. If we went ahead, there might be some PartialComponent<> instances that
point
  // to the ComponentStorage in this EmptyComponent, and any use of those would cause undefined behavior.
  // If an exception is in flight, don't abort; that's likely to be an unexpected flow so we don't want to alert the
user of Fruit,
  // and there can't be any leftover instances of PartialComponent<> referring to this EmptyComponent anyway.
  if (!already_converted_to_component && !std::uncaught_exception()) {
    std::cerr << "The result of fruit::createComponent() was not converted to a Component before the end of the
expression! "
        << "This is a misuse of the Fruit API. This is likely to cause undefined behavior, aborting now to be safe." <<
std::endl;
    std::abort();
  }
}
*/
 
// We need a LCOV_EXCL_BR_LINE below because for some reason gcov/lcov think there's a branch there.
} // namespace fruit LCOV_EXCL_BR_LINE