aboutsummaryrefslogtreecommitdiff
path: root/src/deps/skia/include/sksl/DSLBlock.h
blob: 3fcbb34c896ddc6daf127eb2623817d63ba686c1 (plain) (blame)
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
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Copyright 2021 Google LLC.
 *
 * Use of this source code is governed by a BSD-style license that can be
 * found in the LICENSE file.
 */

#ifndef SKSL_DSL_BLOCK
#define SKSL_DSL_BLOCK

#include "include/private/SkSLDefines.h"
#include "include/sksl/DSLExpression.h"
#include "include/sksl/DSLStatement.h"

#include <memory>

namespace SkSL {

class Block;
class SymbolTable;

namespace dsl {

class DSLBlock {
public:
    template<class... Statements>
    DSLBlock(Statements... statements) {
        fStatements.reserve_back(sizeof...(statements));
        // in C++17, we could just do:
        // (fStatements.push_back(DSLStatement(statements.release()).release()), ...);
        int unused[] =
            {0,
            (static_cast<void>(fStatements.push_back(DSLStatement(statements.release()).release())),
             0)...};
        static_cast<void>(unused);
    }

    DSLBlock(DSLBlock&& other) = default;

    DSLBlock(SkSL::StatementArray statements, std::shared_ptr<SymbolTable> symbols = nullptr);

    DSLBlock(SkTArray<DSLStatement> statements, std::shared_ptr<SymbolTable> symbols = nullptr);

    ~DSLBlock();

    DSLBlock& operator=(DSLBlock&& other) {
        fStatements = std::move(other.fStatements);
        return *this;
    }

    void append(DSLStatement stmt);

    std::unique_ptr<SkSL::Block> release();

private:
    SkSL::StatementArray fStatements;
    std::shared_ptr<SkSL::SymbolTable> fSymbols;

    friend class DSLStatement;
    friend class DSLFunction;
};

} // namespace dsl

} // namespace SkSL

#endif
3' height='13' alt='Gravatar' /> Jérôme Benoit 6-15/+75 2023-10-16Fix use before define bug in sqliteGravatar Ashcon Partovi 2-5/+5 2023-10-16fix(jest): fix toStrictEqual on same URLs (#6528)Gravatar João Alisson 2-13/+16 2023-10-16Fix `toHaveBeenCalled` having wrong error signatureGravatar Ashcon Partovi 1-2/+2 2023-10-16Fix formattingGravatar Ashcon Partovi 1-2/+1 2023-10-16Add `reusePort` to `Bun.serve` typesGravatar Ashcon Partovi 1-0/+9 2023-10-16Fix `request.url` having incorrect portGravatar Ashcon Partovi 4-1/+92 2023-10-16Remove uWebSockets header from Bun.serve responsesGravatar Ashcon Partovi 1-6/+6 2023-10-16Rename some testsGravatar Ashcon Partovi 3-0/+0 2023-10-16Fix #6467Gravatar Ashcon Partovi 2-3/+10 2023-10-16Update InternalModuleRegistryConstants.hGravatar Dylan Conway 1-3/+3 2023-10-16Development -> Contributing (#6538)Gravatar Colin McDonnell 2-1/+1 2023-10-14fix(net/tls) fix pg hang on end + hanging on query (#6487)Gravatar Ciro Spaciari 3-8/+36 2023-10-13fix installing dependencies that match workspace versions (#6494)Gravatar Dylan Conway 4-2/+64 2023-10-13fix lockfile struct padding (#6495)Gravatar Dylan Conway 3-3/+18