Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
cduce
cduce
Commits
9f010430
Commit
9f010430
authored
Aug 17, 2015
by
lucas.coatanlem
Browse files
End of js_to_cduce for the strings, trying to work on numbers and objects now.
parent
1baf9c81
Changes
1
Hide whitespace changes
Inline
Side-by-side
runtime/cduce_js.ml
View file @
9f010430
...
...
@@ -76,9 +76,20 @@ let simple_js_to_cduce v =
let
js_to_cduce
e
=
let
open
Ns
in
let
js_get_properties
=
Js
.
Unsafe
.
get
Dom_html
.
window
(
Js
.
string
"js_get_properties"
)
in
let
_content
=
Js
.
Unsafe
.
fun_call
js_get_properties
[
|
(
Js
.
Unsafe
.
inject
e
)
|
]
in
assert
false
let
content
=
Js
.
Unsafe
.
fun_call
js_get_properties
[
|
(
Js
.
Unsafe
.
inject
e
)
|
]
in
let
res
=
ref
[]
in
let
size
=
Array
.
length
content
in
begin
for
i
=
0
to
size
-
1
do
let
(
n
,
v
)
=
content
.
(
i
)
in
match
simple_js_to_cduce
v
with
None
->
()
|
Some
vcduce
->
res
:=
(
Label
.
mk_ascii
(
Js
.
to_string
n
)
,
vcduce
)
::
!
res
done
;
Value
.
vrecord
!
res
end
(* initialiser une ref à [],
pour chaque ligne dans content (name : n, value : v),
match simple_js_to_cduce v with
...
...
@@ -108,7 +119,7 @@ let register_event id event handler =
let
define_prims
()
=
(* define js primitives one at the moment *)
(* define js primitives
(
one at the moment
)
*)
Js
.
Unsafe
.
eval_string
"
window.js_get_properties = function (o){
var res = [];
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment