language
stringlengths
0
24
filename
stringlengths
9
214
code
stringlengths
99
9.93M
Rust
hhvm/hphp/hack/src/hackc/print_expr/special_class_resolver.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::borrow::Cow; use crate::HhasBodyEnv; pub trait SpecialClassResolver { fn resolve<'a>(&self, env: Option<&'a HhasBodyEnv<'...
Rust
hhvm/hphp/hack/src/hackc/print_expr/write.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::fmt::Debug; use std::io; use std::io::Result; use std::io::Write; use thiserror::Error; #[derive(Error, Debug)] pub enum Error...
Rust
hhvm/hphp/hack/src/hackc/sem_diff/body.rs
use std::rc::Rc; use anyhow::bail; use anyhow::Context; use anyhow::Result; use ffi::Str; use hash::HashMap; use hhbc::AdataId; use hhbc::Instruct; use hhbc::Label; use hhbc::Local; use hhbc::Opcode; use hhbc::Pseudo; use hhbc::SrcLoc; use hhbc::TypedValue; use hhbc_gen::OpcodeData; use newtype::IdVec; use crate::cod...
TOML
hhvm/hphp/hack/src/hackc/sem_diff/Cargo.toml
# @generated by autocargo [package] name = "sem_diff" version = "0.0.0" edition = "2021" [lib] path = "lib.rs" test = false doctest = false [dependencies] anyhow = "1.0.71" ffi = { version = "0.0.0", path = "../../utils/ffi" } hash = { version = "0.0.0", path = "../../utils/hash" } hhbc = { version = "0.0.0", path =...
Rust
hhvm/hphp/hack/src/hackc/sem_diff/code_path.rs
use std::fmt; pub(crate) enum CodePath<'a> { Name(&'a str), Qualified(&'a CodePath<'a>, &'a str), IndexStr(&'a CodePath<'a>, &'a str), IndexN(&'a CodePath<'a>, i64), } impl<'a> CodePath<'a> { pub(crate) fn name(name: &'a str) -> Self { Self::Name(name) } pub(crate) fn index_str(&'...
Rust
hhvm/hphp/hack/src/hackc/sem_diff/helpers.rs
use std::fmt; use anyhow::bail; use anyhow::Result; use hash::HashMap; use hash::HashSet; use crate::code_path::CodePath; pub(crate) trait MapName { fn get_name(&self) -> &str; } impl MapName for hhbc::Adata<'_> { fn get_name(&self) -> &str { self.id.unsafe_as_str() } } impl MapName for hhbc::C...
Rust
hhvm/hphp/hack/src/hackc/sem_diff/instr_ptr.rs
use std::fmt; #[derive(Debug, Copy, Clone, Hash, Eq, PartialEq)] pub(crate) enum InstrPtr { None, Index(u32), } impl InstrPtr { pub(crate) fn from_usize(n: usize) -> InstrPtr { InstrPtr::Index(n as u32) } pub(crate) fn as_usize(&self) -> usize { match *self { InstrPtr:...
Rust
hhvm/hphp/hack/src/hackc/sem_diff/lib.rs
mod body; mod code_path; mod helpers; mod instr_ptr; mod local_info; mod node; mod sem_diff; mod sequence; mod state; mod value; mod work_queue; pub use sem_diff::sem_diff_unit;
Rust
hhvm/hphp/hack/src/hackc/sem_diff/local_info.rs
use hhbc::Local; use hhbc::LocalRange; use hhbc::Opcode; use hhbc::SilenceOp; use crate::node::NodeInstr; pub(crate) enum LocalInfo { None, Read(Local), Write(Local), Mutate(Local), ReadRange(LocalRange), } impl LocalInfo { pub(crate) fn is_none(&self) -> bool { matches!(self, LocalIn...
Rust
hhvm/hphp/hack/src/hackc/sem_diff/node.rs
use std::fmt; use std::rc::Rc; use hhbc::IncDecOp; use hhbc::Label; use hhbc::MOpMode; use hhbc::MemberKey; use hhbc::Opcode; use hhbc::QueryMOp; use hhbc::ReadonlyOp; use hhbc::SetOpOp; use hhbc::SetRangeOp; use hhbc::SrcLoc; use hhbc::Targets; use hhbc::TypedValue; #[derive(Debug, Eq, PartialEq, Clone, Hash)] pub(c...
Rust
hhvm/hphp/hack/src/hackc/sem_diff/sem_diff.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use anyhow::Result; use hash::HashMap; use hhbc::Adata; use hhbc::AdataId; use hhbc::Attribute; use hhbc::Body; use hhbc::Class; use hhb...
Rust
hhvm/hphp/hack/src/hackc/sem_diff/sequence.rs
use anyhow::bail; use anyhow::Result; use ffi::Slice; use hhbc::Opcode; use itertools::Itertools; use log::trace; use crate::code_path::CodePath; use crate::helpers::*; use crate::node::Input; use crate::node::Node; use crate::node::NodeInstr; pub(crate) struct Sequence<'arena> { pub(crate) debug_name: String, ...
Rust
hhvm/hphp/hack/src/hackc/sem_diff/state.rs
use std::collections::hash_map::Entry; use std::rc::Rc; use anyhow::anyhow; use anyhow::bail; use anyhow::Result; use ffi::Slice; use ffi::Str; use hash::HashMap; use hhbc::AdataId; use hhbc::ClassName; use hhbc::Dummy; use hhbc::FCallArgs; use hhbc::IncDecOp; use hhbc::Instruct; use hhbc::IterArgs; use hhbc::IterId; ...
Rust
hhvm/hphp/hack/src/hackc/sem_diff/value.rs
use std::fmt; use hash::HashMap; use crate::node::Input; use crate::node::NodeInstr; #[derive(Copy, Clone, Eq, PartialEq, Hash, Debug)] pub(crate) enum Value { Constant(u32), Defined(u32), Undefined, } impl Value { pub(crate) fn is_undefined(&self) -> bool { matches!(self, Value::Undefined) ...
Rust
hhvm/hphp/hack/src/hackc/sem_diff/work_queue.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use ffi::Maybe; use hash::HashMap; use hash::HashSet; use hhbc::AdataId; use hhbc::Local; use hhbc::TypedValue; use log::trace; use cra...
Hack
hhvm/hphp/hack/src/hackc/test/infer/async.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: define .async $root.test_async // CHECK: define .async $root.test_async($this: *void) : *HackInt { // CHECK: local $a: *void, $a2: *void, $b: *void // CHECK: #b0: // CHECK: n0 = $root.bar(null) // CHECK: n1 = $builtins.hhbc_await(n0) // CHECK: sto...
Hack
hhvm/hphp/hack/src/hackc/test/infer/basic.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-IGN: // CHECK: .source_language = "hack" // TEST-CHECK-BAL: define $root.main // CHECK: define $root.main($this: *void) : *void { // CHECK: #b0: // CHECK: n0 = $builtins.hhbc_print($builtins.hack_string("Hello, World!\n")) // CHECK: ret null // CHECK: }...
Hack
hhvm/hphp/hack/src/hackc/test/infer/basic_tc.hack
// Typecheck Helpers function f_bool(bool $_): void { } function f_float(float $_): void { } function sink(mixed $a): void { } class C { } const int GLOBAL_CONSTANT = 42;
Hack
hhvm/hphp/hack/src/hackc/test/infer/class.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: type C$static // CHECK: type C$static = .kind="class" .static { // CHECK: prop3: .public *HackFloat; // CHECK: prop4: .public .SomeAttribute *HackMixed; // CHECK: MY_CONSTANT: .public .__Infer_Constant__ *HackInt // CHECK: } // TEST-CHECK-BAL: "t...
Hack
hhvm/hphp/hack/src/hackc/test/infer/class1.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: define C._86pinit // CHECK: define C._86pinit($this: *C) : *HackMixed { // CHECK: #b0: // CHECK: ret null // CHECK: } class C { const A = 5; } // TEST-CHECK-BAL: define D._86pinit // CHECK: define D._86pinit($this: *D) : *HackMixed { // CHECK: #b0...
Hack
hhvm/hphp/hack/src/hackc/test/infer/class_static.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: type C$static // CHECK: type C$static = .kind="class" .static { // CHECK: a: .public *HackInt // CHECK: } // TEST-CHECK-BAL: define C$static.foo // CHECK: define C$static.foo($this: *C$static) : *void { // CHECK: #b0: // CHECK: n0 = $builtins.hhbc_...
Hack
hhvm/hphp/hack/src/hackc/test/infer/class_tc.hack
interface SomeAttribute extends HH\StaticPropertyAttribute { } class D { const int C = 5; } function sink(mixed $x): void { } function source(): mixed { return 0; }
Hack
hhvm/hphp/hack/src/hackc/test/infer/closure.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: define Closure$closure1.__invoke // CHECK: define Closure$closure1.__invoke($this: *Closure$closure1) : *HackMixed { // CHECK: local $x: *void // CHECK: #b0: // CHECK: n0: *HackMixed = load &$this // CHECK: n1: *HackMixed = load n0.?.x // CHECK: s...
Hack
hhvm/hphp/hack/src/hackc/test/infer/concurrent.hack
// RUN: %hackc compile-infer %s | FileCheck %s namespace Concurrent { async function genGetInt(): Awaitable<int> { return 42; } async function genGetString(): Awaitable<string> { return "Hello"; } async function genVoid1(): Awaitable<void> { return; } async function genVoid2(): Awaitable<v...
Hack
hhvm/hphp/hack/src/hackc/test/infer/constructor.hack
// RUN: %hackc compile-infer %s | FileCheck %s class A { public function a() : void {} } // TEST-CHECK-BAL: define $root.f1 // CHECK: define $root.f1($this: *void) : *void { // CHECK: local $0: *void, $1: *void, $2: *void // CHECK: #b0: // CHECK: jmp b1 // CHECK: #b1: // CHECK: n0 = __sil_lazy_class_initialize(...
Hack
hhvm/hphp/hack/src/hackc/test/infer/enum.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: "type A " // CHECK: type A extends HH::BuiltinEnum = .kind="class" { // CHECK: } // TEST-CHECK-BAL: define A$static._86sinit // CHECK: define A$static._86sinit($this: *A$static) : *HackMixed { // CHECK: #b0: // CHECK: n0: *A$static = load &$this // C...
Hack
hhvm/hphp/hack/src/hackc/test/infer/fcall.hack
// RUN: %hackc compile-infer %s | FileCheck %s class D extends B { // TEST-CHECK-BAL: define D.inst_fcall_self // CHECK: define D.inst_fcall_self($this: *D) : *void { // CHECK: #b0: // CHECK: n0: *D = load &$this // CHECK: n1 = D.bar(n0) // CHECK: ret null // CHECK: } public function inst_fcall_s...
Hack
hhvm/hphp/hack/src/hackc/test/infer/fcall_default.hack
// RUN: %hackc compile-infer %s | FileCheck %s class C { // TEST-CHECK-BAL: define C.myfn2($this: *C, $a: *HackInt) // CHECK: define C.myfn2($this: *C, $a: *HackInt) : *void { // CHECK: local $b: *void, $c: *void // CHECK: #b0: // CHECK: store &$b <- $builtins.hack_int(1): *HackMixed // CHECK: store &$...
Hack
hhvm/hphp/hack/src/hackc/test/infer/fcall_tc.hack
// Typecheck Helpers function f(mixed... $_): void { } class B { public static function bar(): void { } } class C { public function b(int $a, int $b, int $c): void { } public static function sb(int $a, int $b, int $c): void { } public static function f(mixed... $_): void { } public function g(): void { } }
Hack
hhvm/hphp/hack/src/hackc/test/infer/foreach.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: define $root.check_foreach // CHECK: define $root.check_foreach($this: *void, $x: *HackVec) : *void { // CHECK: local $index: *void, iter0: *void // CHECK: #b0: // CHECK: n0 = $builtins.hack_new_dict($builtins.hack_string("kind"), $builtins.hack_int(2...
Hack
hhvm/hphp/hack/src/hackc/test/infer/hierarchy.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: type A$static // CHECK: type A$static = .kind="class" .static { // CHECK: } // TEST-CHECK-BAL: "type A " // CHECK: type A = .kind="class" { // CHECK: } class A { } // TEST-CHECK-BAL: type I0$static // CHECK: type I0$static = .kind="interface" .static...
Hack
hhvm/hphp/hack/src/hackc/test/infer/instr.hack
// RUN: %hackc compile-infer %s | FileCheck %s // Random instruction tests. // TEST-CHECK-1: define $root.binops // CHECK: define $root.binops($this: *void, $a: *HackInt, $b: *HackInt) : *void { function binops(int $a, int $b): void { // TEST-CHECK-1*: $builtins.hhbc_add // CHECK: n2 = $builtins.hhbc_add(n1, n0...
Hack
hhvm/hphp/hack/src/hackc/test/infer/instr_tc.hack
// Typecheck Helpers function f(mixed... $_): void { } function a(): int { return 0; } function b(): int { return 0; }
Hack
hhvm/hphp/hack/src/hackc/test/infer/locals.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: define $root.no_locals // CHECK: define $root.no_locals($this: *void, $a: *HackInt) : *void { // CHECK: #b0: // CHECK: ret null // CHECK: } function no_locals(int $a) : void { } // TEST-CHECK-BAL: define $root.only_locals // CHECK: define $root.only_...
Hack
hhvm/hphp/hack/src/hackc/test/infer/member_op.hack
// RUN: %hackc compile-infer %s | FileCheck %s class D { public int $foo = 42; /* HH_FIXME[4055] No initial value */ public static D $bar; // TEST-CHECK-BAL: define D.mop_baseh_querym_pt // CHECK: define D.mop_baseh_querym_pt($this: *D) : *HackInt { // CHECK: #b0: // CHECK: n0: *HackMixed = load &$thi...
Hack
hhvm/hphp/hack/src/hackc/test/infer/member_op_tc.hack
class C { public int $foo = 42; } function ret_c(): C { return new C(); } function ret_vec(): vec<int> { return vec[]; } function ret_int(): int { return 42; } function ret_str(): string { return "hello"; }
Hack
hhvm/hphp/hack/src/hackc/test/infer/memo_keep.hack
// RUN: %hackc compile-infer --keep-memo %s | FileCheck %s class C { // TEST-CHECK-1: define C$static.memometh_static$memoize_impl // CHECK: define C$static.memometh_static$memoize_impl($this: *C$static, $a: *HackInt, $b: *HackInt) : *HackInt { // TEST-CHECK-1: define C$static.memometh_lsb$memoize_impl // CHE...
Hack
hhvm/hphp/hack/src/hackc/test/infer/memo_remove.hack
// RUN: %hackc compile-infer %s | FileCheck %s class C { // TEST-CHECK-BAL: define C.memometh_inst // CHECK: define C.memometh_inst($this: *C, $a: *HackInt, $b: *HackInt) : *HackInt { // CHECK: #b0: // CHECK: n0: *HackMixed = load &$b // CHECK: n1: *HackMixed = load &$a // CHECK: n2 = $builtins.hhbc_...
Hack
hhvm/hphp/hack/src/hackc/test/infer/null_check.hack
// RUN: %hackc compile-infer %s | FileCheck %s namespace NullCheck; class A { public function __construct(public string $prop1) {} } // TEST-CHECK-BAL: define $root.NullCheck::f1_nonnull // CHECK: define $root.NullCheck::f1_nonnull($this: *void, $arg: *NullCheck::A) : *HackString { // CHECK: #b0: // CHECK: n0: *...
Hack
hhvm/hphp/hack/src/hackc/test/infer/params.hack
// RUN: %hackc compile-infer --keep-going %s | FileCheck %s class Internal {} class InternalGeneric<T> {} // TEST-CHECK-BAL: define $root.internalClassParam // CHECK: define $root.internalClassParam($this: *void, $a: *HackInt, $b: *Internal) : *Internal { // CHECK: local $0: *void, $1: *void, $2: *void // CHECK: #b0...
Hack
hhvm/hphp/hack/src/hackc/test/infer/retm.hack
// RUN: %hackc compile-infer %s | FileCheck %s // Random instruction tests. // TEST-CHECK-BAL: define $root.multi_ret // CHECK: define $root.multi_ret($this: *void, $a: *HackInt) : *HackInt { // CHECK: #b0: // CHECK: store &$a <- $builtins.hack_int(7): *HackMixed // CHECK: n0 = $builtins.hhbc_is_type_int($builtin...
Hack
hhvm/hphp/hack/src/hackc/test/infer/sswitch.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: define C$static._86cinit // CHECK: define C$static._86cinit($this: *C$static, $constName: *HackMixed) : *HackMixed { // CHECK: #b0: // CHECK: n0: *HackMixed = load &$constName // CHECK: n1 = $builtins.hhbc_cmp_same($builtins.hack_string("CONST_REQUI...
Hack
hhvm/hphp/hack/src/hackc/test/infer/try_catch.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: define $root.main // CHECK: define $root.main($this: *void) : *void { // CHECK: local $e: *void, $x: *void // CHECK: #b0: // CHECK: n0 = $root.a(null, $builtins.hack_int(0)) // CHECK: jmp b1 // CHECK: #b1: // CHECK: n1 = $root.a(null, $builtins.ha...
Hack
hhvm/hphp/hack/src/hackc/test/infer/type_const.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: type C$static // CHECK: type C$static = .kind="class" .static { // CHECK: } abstract class C { <<__Enforceable>> abstract const type TMyShape; // TEST-CHECK-BAL: define C$static.check2 // CHECK: define C$static.check2($this: *C$static, $a: *Ha...
Python
hhvm/hphp/hack/src/hackc/test/infer/update.py
import argparse import json import os import subprocess import sys ### Script to rebuild test expect data. Tests are annotated with 'TEST-CHECK*' ### to describe how to update the CHECK data. ### ### Annotations look like: ### // TEST-CHECK*: phrase ### ### The phrase is matched based on the type of check and then an...
Hack
hhvm/hphp/hack/src/hackc/test/infer/var_cache.hack
// RUN: %hackc compile-infer %s | FileCheck %s // TEST-CHECK-BAL: define $root.check1 // CHECK: define $root.check1($this: *void, $a: *HackMixed, $b: *HackMixed, $c: *HackMixed) : *void { // CHECK: #b0: // CHECK: n0: *HackMixed = load &$a // CHECK: n1: *HackMixed = load &$b // CHECK: n2: *HackMixed = load &$c //...
Rust
hhvm/hphp/hack/src/hackc/types/lib.rs
#![feature(box_patterns)] pub mod readonly_check; pub mod readonly_nonlocal_infer; mod subtype; mod tyx;
Rust
hhvm/hphp/hack/src/hackc/types/readonly_check.rs
// Copyright (c) 2019, Facebook, Inc. // All rights reserved. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. //// Keep this file in sync with ../../parser/readonly_check.rs *except* for @HACKC_ADDED parts. //// TODO(T128733540): we sho...
Rust
hhvm/hphp/hack/src/hackc/types/readonly_nonlocal_infer.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. //// Design: //// - This module is concerned with inserting `readonly`s where needed at *call sites*, for which it uses decls and infe...
Rust
hhvm/hphp/hack/src/hackc/types/subtype.rs
use std::borrow::Borrow; use std::borrow::Cow; use crate::tyx::Tyx; pub(crate) fn join<'a>(ty1: Cow<'a, Tyx>, ty2: Cow<'a, Tyx>) -> Cow<'a, Tyx> { use Tyx::*; match (ty1.borrow(), ty2.borrow()) { (t1, t2) if equiv(t1, t2) => ty1, (Bottom, _) => ty2, (_, Bottom) => ty1, _ => Cow...
Rust
hhvm/hphp/hack/src/hackc/types/tyx.rs
use oxidized_by_ref::typing_defs; use oxidized_by_ref::typing_defs_core::Exact; #[derive(Clone, Debug, Eq, PartialEq)] pub(crate) enum Tyx { Fun(Box<FunType>), // Class{class_name: String}, Object { class_name: String, }, GiveUp, // We're not sure what the type is Todo, // should be g...
TOML
hhvm/hphp/hack/src/hackc/types/cargo/types/Cargo.toml
# @generated by autocargo [package] name = "types" version = "0.0.0" edition = "2021" [lib] path = "../../lib.rs" [dependencies] decl_provider = { version = "0.0.0", path = "../../../decl_provider" } hash = { version = "0.0.0", path = "../../../../utils/hash" } hh_autoimport_rust = { version = "0.0.0", path = "../.....
Rust
hhvm/hphp/hack/src/hackc/utils/stack_depth.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::collections::VecDeque; use ffi::Just; use hhbc::DefaultValue; use hhbc::Instruct; use hhbc::Label; use hhbc::Opcode; use hhbc:...
Rust
hhvm/hphp/hack/src/hackc/utils/string_utils.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::borrow::Cow; use std::cell::Cell; use bstr::BStr; use bstr::ByteSlice; use escaper::*; use lazy_static::lazy_static; use namin...
Rust
hhvm/hphp/hack/src/hackc/utils/unique_id_builder.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. pub type SMap<T> = std::collections::BTreeMap<String, T>; pub type SSet = std::collections::BTreeSet<String>; pub fn get_unique_id_for_...
TOML
hhvm/hphp/hack/src/hackc/utils/cargo/hhbc_string_utils/Cargo.toml
# @generated by autocargo [package] name = "hhbc_string_utils" version = "0.0.0" edition = "2021" [lib] path = "../../string_utils.rs" [dependencies] bstr = { version = "1.4.0", features = ["serde", "std", "unicode"] } escaper = { version = "0.0.0", path = "../../../../utils/escaper" } lazy_static = "1.4" libc = "0....
TOML
hhvm/hphp/hack/src/hackc/utils/cargo/stack_depth/Cargo.toml
# @generated by autocargo [package] name = "stack_depth" version = "0.0.0" edition = "2021" [lib] path = "../../stack_depth.rs" [dependencies] ffi = { version = "0.0.0", path = "../../../../utils/ffi" } hhbc = { version = "0.0.0", path = "../../../hhbc/cargo/hhbc" } hhbc-gen = { version = "0.0.0", path = "../../../....
TOML
hhvm/hphp/hack/src/hackc/utils/cargo/unique_id_builder/Cargo.toml
# @generated by autocargo [package] name = "unique_id_builder" version = "0.0.0" edition = "2021" [lib] path = "../../unique_id_builder.rs"
OCaml
hhvm/hphp/hack/src/hackfmt/boundaries.ml
(* * Copyright (c) 2017, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) module SourceText = Full_fidelity_source_text open Hh_prelude open Printf let get_line_boundaries text = let line...
OCaml
hhvm/hphp/hack/src/hackfmt/chunk.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude (* An atom is a substring of the original source which will be exactly * represented in the format...
OCaml
hhvm/hphp/hack/src/hackfmt/chunk_builder.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude module Env = Format_env type open_span = { open_span_start: int } type rule_state = | NoRule |...
OCaml
hhvm/hphp/hack/src/hackfmt/chunk_group.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude type t = { chunks: Chunk.t list; rule_map: Rule.t IMap.t; rule_dependency_map: int list IMap....
OCaml
hhvm/hphp/hack/src/hackfmt/cost.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) type t = | NoCost | Base | Moderate | High [@@deriving eq] let get_cost t = match t with | NoCost -> 0 ...
OCaml
hhvm/hphp/hack/src/hackfmt/doc.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude type t = (* Null case *) | Nothing (* List of concatenated nodes *) | Concat of t list (*...
hhvm/hphp/hack/src/hackfmt/dune
(library (name hackfmt_doc) (wrapped false) (modules cost doc rule) (preprocess (pps ppx_deriving.std)) (libraries core_kernel utils_core)) (library (name hackfmt_env) (wrapped false) (preprocess (pps ppx_deriving.std)) (modules format_env)) (library (name hackfmt) (wrapped false) (preprocess (pps p...
OCaml
hhvm/hphp/hack/src/hackfmt/format_env.ml
(* * Copyright (c) 2017, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) type t = { add_trailing_commas: bool; indent_width: int; indent_with_tabs: bool; line_width: int; format_g...
OCaml
hhvm/hphp/hack/src/hackfmt/hack_format.ml
(* * Copyright (c) 2018, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude module Env = Format_env module SourceText = Full_fidelity_source_text module Syntax = Full_fidelity_...
OCaml Interface
hhvm/hphp/hack/src/hackfmt/hack_format.mli
(* * Copyright (c) 2018, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) val transform : Format_env.t -> Full_fidelity_editable_syntax.t -> Doc.t
OCaml
hhvm/hphp/hack/src/hackfmt/interval.ml
(* * Copyright (c) 2017, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) (** Helpers for half-open intervals *) open Hh_prelude type t = int * int let pp fmt (st, ed) = Format.fprintf fm...
OCaml
hhvm/hphp/hack/src/hackfmt/libhackfmt.ml
(* * Copyright (c) 2017, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) module Env = Format_env open Hh_prelude open Noformat open Boundaries let env_from_config config = let env = Opti...
OCaml Interface
hhvm/hphp/hack/src/hackfmt/libhackfmt.mli
(* * Copyright (c) Meta Platforms, Inc. and affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) (** Format an entire file. *) val format_tree : ?config:Format_env.t -> Noformat.SyntaxTree.t -> string val format_doc : Fo...
OCaml
hhvm/hphp/hack/src/hackfmt/line_splitter.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) module Env = Format_env open Hh_prelude open Common let expand_state env state = let { Solve_state.chunk_group; r...
OCaml
hhvm/hphp/hack/src/hackfmt/nesting.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude type t = { id: int; indent: bool; parent: t option; skip_parent_if_nested: bool; } let dum...
OCaml
hhvm/hphp/hack/src/hackfmt/nesting_allocator.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) type t = { next_id: int; current_nesting: Nesting.t; } let make () = { next_id = 1; current_nesting = Nesting...
OCaml
hhvm/hphp/hack/src/hackfmt/noformat.ml
(* * Copyright (c) 2017, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) module SourceText = Full_fidelity_source_text module Syntax = Full_fidelity_positioned_syntax module SyntaxTree = ...
OCaml
hhvm/hphp/hack/src/hackfmt/rule.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude type kind = | Simple of Cost.t | Always | Parental [@@deriving eq] let is_always = function ...
OCaml
hhvm/hphp/hack/src/hackfmt/ruleSet.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) include Set.Make (Rule)
OCaml
hhvm/hphp/hack/src/hackfmt/rule_allocator.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude type t = { rule_map: Rule.t IMap.t; dependency_map: int list IMap.t; next_id: int; } let mak...
OCaml
hhvm/hphp/hack/src/hackfmt/solve_state.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) module Env = Format_env open Hh_prelude type t = { chunk_group: Chunk_group.t; lines: (int * ISet.t) list; (*...
OCaml
hhvm/hphp/hack/src/hackfmt/span.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) type t = { id: int } let id t = t.id
OCaml
hhvm/hphp/hack/src/hackfmt/span_allocator.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) type t = { next_id: int } let make () = { next_id = 0 } let make_span t = let id = t.next_id in ({ next_id = t...
OCaml
hhvm/hphp/hack/src/hackfmt/state_queue.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude module SolveStateKey = struct type t = Solve_state.t let compare = Solve_state.compare end in...
OCaml
hhvm/hphp/hack/src/hackfmt/subchunk.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) module Env = Format_env open Hh_prelude (* A subchunk is one of these variants, representing a substring of the fin...
OCaml
hhvm/hphp/hack/src/hackfmt/debug/hackfmt_debug.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) module SourceText = Full_fidelity_source_text module Syntax = Full_fidelity_positioned_syntax module SyntaxTree = Fu...
OCaml
hhvm/hphp/hack/src/hackfmt/error/hackfmt_error.ml
(* * Copyright (c) 2016, Facebook, Inc. * All rights reserved. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) exception InvalidSyntax exception InvalidCliArg of string exception InvalidDiff of string let get_exception_exit_...
OCaml
hhvm/hphp/hack/src/hackrs/compare_folded_decls_file.ml
(* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude open Direct_decl_parser let popt ~auto_namespace_map ~enable_xhp_class_modifier ~disable_xhp_elem...
OCaml
hhvm/hphp/hack/src/hackrs/compare_folded_decls_repo.ml
(** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude let purpose = "Compare Rust and OCaml Decl Folding on www repo" let usage = Printf.sprintf "Usage: %s <op...
Rust
hhvm/hphp/hack/src/hackrs/decl_file_rust.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::path::PathBuf; use std::sync::Arc; use clap::Parser; use decl_parser::DeclParser; use decl_parser::DeclParserOptions; use fo...
Rust
hhvm/hphp/hack/src/hackrs/decl_folded_class_ffi.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::cmp; use std::collections::BTreeMap; use std::path::Path; use std::path::PathBuf; use std::sync::Arc; use bumpalo::Bump; use de...
OCaml
hhvm/hphp/hack/src/hackrs/decl_folded_class_rupro.ml
(* * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) external fold_classes_in_files : root:string -> ParserOptions.t -> Relative_path.t list -> (Decl_defs.decl_class_type ...
OCaml
hhvm/hphp/hack/src/hackrs/decl_repo_ocaml.ml
(** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the "hack" directory of this source tree. * *) open Hh_prelude let purpose = "Profile Decl Folding on www repo" let usage = Printf.sprintf "Usage: %s <options> www-root...
Rust
hhvm/hphp/hack/src/hackrs/decl_repo_rust.rs
// Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. // Copyright (c) Facebook, Inc. and its affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file...
TOML
hhvm/hphp/hack/src/hackrs/cargo/decl_file_rust/Cargo.toml
# @generated by autocargo [package] name = "decl_file_rust" version = "0.0.0" edition = "2021" [[bin]] name = "decl_file_rust" path = "../../decl_file_rust.rs" [dependencies] clap = { version = "4.3.5", features = ["derive", "env", "string", "unicode", "wrap_help"] } decl_parser = { version = "0.0.0", path = "../../...
TOML
hhvm/hphp/hack/src/hackrs/cargo/decl_folded_class_ffi/Cargo.toml
# @generated by autocargo [package] name = "decl_folded_class_ffi" version = "0.0.0" edition = "2021" [lib] path = "../../decl_folded_class_ffi.rs" test = false doctest = false crate-type = ["lib", "staticlib"] [dependencies] bumpalo = { version = "3.11.1", features = ["collections"] } decl_parser = { version = "0.0...
TOML
hhvm/hphp/hack/src/hackrs/cargo/decl_repo_rust/Cargo.toml
# @generated by autocargo [package] name = "decl_repo_rust" version = "0.0.0" edition = "2021" [[bin]] name = "decl_repo_rust" path = "../../decl_repo_rust.rs" test = false [dependencies] clap = { version = "4.3.5", features = ["derive", "env", "string", "unicode", "wrap_help"] } decl_parser = { version = "0.0.0", p...
TOML
hhvm/hphp/hack/src/hackrs/datastore/Cargo.toml
# @generated by autocargo [package] name = "datastore" version = "0.0.0" edition = "2021" [lib] path = "datastore.rs" [dependencies] anyhow = "1.0.71" dashmap = { version = "5.4", features = ["rayon", "serde"] } hash = { version = "0.0.0", path = "../../utils/hash" } parking_lot = { version = "0.12.1", features = ["...
Rust
hhvm/hphp/hack/src/hackrs/datastore/changes_store.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::hash::Hash; use std::sync::Arc; use anyhow::Result; use dashmap::DashMap; use parking_lot::RwLock; use crate::Store; /// A...
Rust
hhvm/hphp/hack/src/hackrs/datastore/datastore.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. mod changes_store; mod delta_store; mod empty; mod non_evicting; use std::fmt::Debug; use anyhow::Result; pub use changes_store::Cha...
Rust
hhvm/hphp/hack/src/hackrs/datastore/delta_store.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use std::hash::Hash; use std::sync::Arc; use anyhow::Result; use crate::ReadonlyStore; use crate::Store; /// A mutable set of chang...
Rust
hhvm/hphp/hack/src/hackrs/datastore/empty.rs
// Copyright (c) Meta Platforms, Inc. and affiliates. // // This source code is licensed under the MIT license found in the // LICENSE file in the "hack" directory of this source tree. use anyhow::Result; /// A zero-sized store which retains no data, returns `false` for any call to /// `contains_key` and returns `Non...