Skip to content

Commit 3877e0c

Browse files
committed
Sync changes to upstream
1 parent f4b7010 commit 3877e0c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+1017
-1117
lines changed

.gitignore

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
_build
33
.DS_STORE
44
docs/_site/
5+
bin

CONTRIBUTING.md

-30
This file was deleted.

LICENSE

-30
This file was deleted.

Makefile

+18-7
Original file line numberDiff line numberDiff line change
@@ -19,12 +19,14 @@ ifeq ($(OS), Linux)
1919
FSNOTIFY=fsnotify_linux
2020
ELF=elf
2121
FRAMEWORKS=
22+
SECTCREATE=
2223
endif
2324
ifeq ($(OS), Darwin)
2425
INOTIFY=fsevents
2526
FSNOTIFY=fsnotify_darwin
2627
ELF=
2728
FRAMEWORKS=CoreServices CoreFoundation
29+
SECTCREATE=-cclib -sectcreate -cclib __text -cclib flowlib -cclib $(abspath bin/flowlib.tar.gz)
2830
endif
2931

3032
################################################################################
@@ -35,6 +37,7 @@ MODULES=\
3537
src/stubs\
3638
src/commands\
3739
src/common\
40+
src/embedded\
3841
src/dts\
3942
src/typing\
4043
src/parser\
@@ -60,6 +63,7 @@ MODULES=\
6063
hack/$(FSNOTIFY)
6164

6265
NATIVE_OBJECT_FILES=\
66+
src/embedded/flowlib_elf.o\
6367
hack/heap/hh_shared.o\
6468
hack/utils/realpath.o\
6569
hack/$(INOTIFY)/$(INOTIFY)_stubs.o\
@@ -89,29 +93,36 @@ EXTRA_INCLUDE_OPTS=$(foreach dir, $(EXTRA_INCLUDE_PATHS),-ccopt -I -ccopt $(dir)
8993
EXTRA_LIB_OPTS=$(foreach dir, $(EXTRA_LIB_PATHS),-cclib -L -cclib $(dir))
9094
FRAMEWORK_OPTS=$(foreach framework, $(FRAMEWORKS),-cclib -framework -cclib $(framework))
9195

92-
LINKER_FLAGS=$(NATIVE_OBJECT_FILES) $(NATIVE_LIB_OPTS) $(EXTRA_LIB_OPTS) $(FRAMEWORK_OPTS)
96+
LINKER_FLAGS=$(NATIVE_OBJECT_FILES) $(NATIVE_LIB_OPTS) $(EXTRA_LIB_OPTS) $(FRAMEWORK_OPTS) $(SECTCREATE)
9397

94-
all: build-flow copy-flow-files
98+
99+
all: build-flowlib-archive build-flow copy-flow-files
95100

96101
clean:
97102
ocamlbuild -clean
98103
rm -rf bin
99104
rm -f hack/utils/get_build_id.gen.c
100105

101-
build-flow: build-flow-native-deps
102-
ocamlbuild -no-links $(INCLUDE_OPTS) $(LIB_OPTS) -lflags "$(LINKER_FLAGS)" src/flow.native
106+
build-flow: build-flow-native-deps build-flowlib-archive
107+
ocamlbuild -no-links $(INCLUDE_OPTS) $(LIB_OPTS) -lflags "$(LINKER_FLAGS)" src/flow.native
103108

104109
build-flow-native-deps: build-flow-stubs
105-
ocamlbuild -cflags "$(EXTRA_INCLUDE_OPTS)" $(NATIVE_OBJECT_FILES)
110+
ocamlbuild -cflags "$(EXTRA_INCLUDE_OPTS)" $(NATIVE_OBJECT_FILES)
106111

107112
build-flow-stubs:
108113
echo 'const char* const BuildInfo_kRevision = "${SHA}";' > hack/utils/get_build_id.gen.c
109114

115+
build-flowlib-archive:
116+
mkdir -p bin
117+
tar czf bin/flowlib.tar.gz lib
118+
110119
copy-flow-files: build-flow $(FILES_TO_COPY)
111120
mkdir -p bin
121+
ifeq ($(OS), Linux)
122+
objcopy --add-section flowlib=bin/flowlib.tar.gz _build/src/flow.native bin/flow
123+
else
112124
cp _build/src/flow.native bin/flow
113-
mkdir -p bin/lib
114-
cp $(FILES_TO_COPY) bin/lib
125+
endif
115126

116127
test: build-flow copy-flow-files
117128
./runtests.sh bin/flow

PATENTS

-23
This file was deleted.

gentests.sh

-10
This file was deleted.

hack/utils/sysConfig.ml

-15
This file was deleted.

src/embedded/.depend

-3
This file was deleted.

src/parser/.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
lex_test
22
parse_test
33
lexer_flow.ml
4-
flow.js
4+
flow_parser.js
55
perf_test
66
pfff_test

src/parser/Makefile

+17-42
Original file line numberDiff line numberDiff line change
@@ -1,51 +1,26 @@
1-
TOP=../../..
1+
# Copyright (c) 2014, Facebook, Inc.
2+
# All rights reserved.
23

3-
SRC = spider_monkey_ast.ml parse_error.ml lexer_flow.ml parser_flow.ml
4+
all: build-parser
45

5-
INCLUDEDIRS=
6+
clean:
7+
ocamlbuild -clean
8+
rm -f flow_parser.js tools/native_test_files
69

7-
LIBS=
10+
build-parser:
11+
ocamlbuild -no-links parser_flow.cmxa
812

9-
OCAMLCFLAGS+=-w +a-4-6-29-35-44-48-27 -warn-error +a
13+
parserjs:
14+
ocamlbuild -use-ocamlfind -pkgs js_of_ocaml flow_parser_js.byte
15+
js_of_ocaml -opt 3 -o flow_parser.js flow_parser_js.byte
16+
rm flow_parser_js.byte
1017

11-
-include $(TOP)/Makefile.common
12-
13-
.PHONY:: tools test
14-
15-
all:: all.opt
16-
all.opt: parser_flow.cmxa flow.js
17-
all.bc: parser_flow.cma flow.js
18-
19-
test: all
18+
test: build-parser parserjs
2019
./test/run_esprima_tests.js
2120
./test/run_hardcoded_tests.js
2221

23-
tools: parser_flow.cmxa
24-
$(MAKE) -C tools all
25-
26-
lexer_flow.ml: lexer_flow.mll
27-
ocamllex $<
28-
29-
parser_flow.cma: $(OBJS) parser_flow.cmo
30-
$(OCAMLC) -a -o $@ $^
31-
32-
parser_flow.cmxa: $(OPTOBJS) parser_flow.cmx
33-
$(OCAMLOPT) -a -o $@ $^
34-
35-
# This lives in a different directory so that make depend works
36-
flow_js.cmo: $(OBJS) flow_js.ml
37-
ocamlfind ocamlc $(INCLUDES) -package js_of_ocaml -o flow_js.cmo $(SYSLIBS) -c $^
38-
39-
flow.js: $(LIBS) $(OBJS) flow_js.cmo
40-
ocamlfind ocamlc -ccopt -O3 $(INCLUDES) -package js_of_ocaml -linkpkg -o flow_js.bc $(SYSLIBS) $^
41-
js_of_ocaml -opt 3 -o $@ flow_js.bc
42-
43-
test_files: $(LIBS) $(OPTOBJS) native_test_files.ml
44-
ocamlopt $(INCLUDES) -o test/native_test_files $^
45-
46-
clean::
47-
rm -f flow.js lexer_flow.ml
48-
$(MAKE) -C tools clean
22+
tools: native_test_files
4923

50-
depend::
51-
$(MAKE) -C tools depend
24+
native_test_files:
25+
ocamlbuild tools/native_test_files.native
26+
mv native_test_files.native tools/native_test_files
File renamed without changes.

src/parser/test/esprima_test_runner.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
*/
44

55
var esprima = require("/var/www/scripts/third_party/esprima-fb/esprima.js");
6-
var flow = require("../flow.js");
6+
var flow = require("../flow_parser.js");
77
var util = require("util");
88
var ast_types = require("ast-types");
99

src/parser/test/hardcoded_test_runner.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
var flow = require("./../flow.js");
1+
var flow = require("./../flow_parser.js");
22
var util = require("util");
33
var ast_types = require("ast-types");
44

src/typing/constraint_js.ml

+4-4
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ module Type = struct
140140
| PredicateT of predicate * t
141141

142142
(* == *)
143-
| EqT of t
143+
| EqT of reason * t
144144

145145
(* operation on polymorphic types *)
146146
| SpecializeT of reason * t list * t
@@ -677,14 +677,14 @@ let rec reason_of_t = function
677677
prefix_reason "optional of " (reason_of_t t)
678678

679679
| RestT t ->
680-
prefix_reason "rest of " (reason_of_t t)
680+
prefix_reason "rest array of " (reason_of_t t)
681681

682682
| PredicateT (pred,t) -> prefix_reason
683683
((string_of_predicate pred) ^ " # ")
684684
(reason_of_t t)
685685

686-
| EqT t ->
687-
prefix_reason "non-strict (in)equality comparison with " (reason_of_t t)
686+
| EqT (reason, t) ->
687+
reason
688688

689689
| MarkupT(reason,_,_)
690690

src/typing/constraint_js.mli

+1-1
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ module Type :
8989
| ComparatorT of reason * t
9090

9191
| PredicateT of predicate * t
92-
| EqT of t
92+
| EqT of reason * t
9393

9494
| SpecializeT of reason * t list * t
9595

0 commit comments

Comments
 (0)