Commit graph

202 commits

Author SHA1 Message Date
bors-servo
48945b0fc1 Auto merge of #7397 - Manishearth:doublepointer-meet-fire, r=nox
Remove doublepointer in VirtualMethods, and from_borrowed_ref



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7397)
<!-- Reviewable:end -->
2015-08-26 15:01:12 -06:00
Manish Goregaokar
4678ec16bb remove to_borrowed_ref, fix Activatable 2015-08-27 02:27:42 +05:30
Manish Goregaokar
b33c5427bc Remove doublepointer in VirtualMethods, and from_borrowed_ref
Most of the heavy lifting done by:

```
$ ls *rs | xargs gawk -i inplace '/let .*: &&.*from_borrowed_ref/{sub("&&", "\\&");sub("_borrowed_","_");} {print $0}'
$ ls *rs | xargs gawk -i inplace "/impl.*VirtualMethods/{in_vm=1; sub(/<'a>/,\"\");sub(/&'a /,\"\")} /^}\$/{in_vm=0;} in_vm{\$0=gensub(/\\*self([^.])/,\"self\\\1\",\"g\"); sub(/from_borrowed_ref/,\"from_ref\")} {print}"
```
2015-08-27 02:14:48 +05:30
Corey Farwell
5bf262770f Don't use is operatory to compare Python strings
`is` checks identity. `==` checks value. I can't think of a reason why
we would want the former in these scenarios.

More info:

* http://stackoverflow.com/a/1504742
* https://docs.python.org/2/reference/expressions.html#is
2015-08-22 10:22:47 -04:00
Corey Farwell
2ab43bea5d Utilize Python context managers for opening/closing files
In some of these cases, files were not being closed
2015-08-21 11:15:17 -04:00
Corey Farwell
b11be4d253 Initial implementation of ownPropertyKeys proxy handler
Generates `SupportedPropertyNames` on DOM structs that should implement
it. Most of them are unimplemented now (which can be implemented in
later PRs), with the exception of `HTMLCollection`. Also added a couple
relevant WPT tests.

Closes #6390

Closes #2215
2015-08-20 11:58:42 -04:00
bors-servo
ef98e57429 Auto merge of #7230 - nox:required-dictionary-member, r=Ms2ger
Support required dictionary members (fixes #7216)



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7230)
<!-- Reviewable:end -->
2015-08-18 12:58:09 -06:00
bors-servo
a2978f2add Auto merge of #7236 - nox:dictionary-failure-code, r=Ms2ger
Fix dictionary member conversion failure (fixes #7231)



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7236)
<!-- Reviewable:end -->
2015-08-16 06:39:56 -06:00
Anthony Ramine
47e76ff4ab Fix dictionary member conversion failure (fixes #7231) 2015-08-16 14:32:54 +02:00
Anthony Ramine
44aabbe64d Support required dictionary members (fixes #7216) 2015-08-16 14:16:32 +02:00
Anthony Ramine
efe982392e Update WebIDL parser 2015-08-16 14:16:31 +02:00
Anthony Ramine
ec2a6b24b1 Support default values for restricted float members (fixes #7217) 2015-08-15 14:45:26 +02:00
bors-servo
2e1ca10eea Auto merge of #7199 - frewsxcv:codegen-if-let, r=Manishearth
Prefer if..let over if..is_some..unwrap in codegen



<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/7199)
<!-- Reviewable:end -->
2015-08-13 15:35:21 -06:00
Corey Farwell
43429abce4 Avoid marking codegen method bodies as unsafe twice
`CGAbstractMethod` takes a couple boolean parameters, among others:

* `extern`: will mark the method as `unsafe` and `extern`
* `unsafe`: will wrap the method body in an `unsafe` block

Passing both as `True` should not mark it as `unsafe` twice.

Example from a generated `HTMLCollectionBinding.rs`:

Before:

```
unsafe extern fn get_length(..) -> u8 {
    unsafe {
        // code here
    }
}
```

After

```
unsafe extern fn get_length(..) -> u8 {
    // code here
}
```
2015-08-13 16:50:17 -04:00
Corey Farwell
7a774a198c Prefer if..let over if..is_some..unwrap in codegen 2015-08-13 16:35:21 -04:00
Corey Farwell
a276bfa57c Remove dead Python code in binding generating code
Fixes #6956
2015-08-05 09:17:30 -04:00
Josh Matthews
8620fe5995 Start reporting memory usage for Window and all nodes in all DOM trees for frame treese in script tasks. 2015-08-03 23:05:00 -04:00
Ms2ger
e8cff1d2a2 Remove an obsolete comment I missed in #6804. 2015-07-30 09:36:47 +02:00
Ms2ger
efa12e6963 Remove unrooted_must_root annotation from unions (fixes #2661).
The unsafety was fixed as part of the SpiderMonkey upgrade; this removes the
now unused annotation.
2015-07-28 16:22:41 +02:00
Akos Kiss
fa86ea4f6f Add aarch64-unknown-linux-gnu support
* Adding dependencies
* Replacing `i8` with `libc::c_char` to build properly on platforms
  where char is unsigned.
2015-07-23 22:52:17 +00:00
snf
7f152b665d Add Clamp and EnforceRange support for webidl arguments. 2015-07-22 17:04:06 +02:00
bors-servo
a9f12da4f8 Auto merge of #6592 - frewsxcv:notimplementederror, r=Ms2ger
Use NotImplementedError for Python base class methods

From the Python docs:

https://docs.python.org/2/library/exceptions.html#exceptions.NotImplementedError

"In user defined base classes, abstract methods should raise this
exception when they require derived classes to override the method."

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6592)
<!-- Reviewable:end -->
2015-07-21 11:28:21 -06:00
Ms2ger
ce4d442941 Move away from the repeat().take().collect() pattern.
This was the preferred pattern between the deprecation of Vec::from_elem and
the addition of the count argument to the vec![] macro.
2015-07-14 16:19:30 +02:00
Corey Farwell
10296e77dc Use NotImplementedError for Python base class methods
From the Python docs:

https://docs.python.org/2/library/exceptions.html#exceptions.NotImplementedError

"In user defined base classes, abstract methods should raise this
exception when they require derived classes to override the method."
2015-07-11 07:41:44 +09:00
Corey Farwell
0ec2375cab Remove tidy blacklist for 'script/dom/bindings/*'
Recently, I found myself reading through the Python codegen scripts that
live in 'components/script/dom/bindings/*' and noticed that there were
many tidy violations: unnecessary semicolons, weird spacing, unused
variables, lack of license headers, etc. Considering these files are now
living in our tree and mostly maintained directly by contributors of
Servo (as opposed to being from upstream), I feel these files should not
be excluded from our normal tidy process. This commit removes the
blacklist on these files and fixes all tidy violations.

I added these subdirectories to the blacklist because they appear to be
maintained upstream somewhere else:

* "components/script/dom/bindings/codegen/parser/*",
* "components/script/dom/bindings/codegen/ply/*",

Also, I added a '# noqa' comment which tells us to ignore the
flake8 errors for that line. I chose to ignore this (instead of fixing
it) to make the work for this commit simpler for me.
2015-07-09 19:42:31 +09:00
Ms2ger
2f88b84e07 Remove *Cast::from_actual.
Since JSRef was removed, from_actual duplicates from_ref.
2015-07-04 12:55:01 +02:00
David Winslow
4cf46bff2d Refactor #[jstraceable] to #[derive(JSTraceable)]
fixes #6524
2015-07-01 18:27:06 -04:00
Mukilan Thiyagarajan
8f5265c131 CGImports must consider special operations to generate required 'use' items 2015-06-27 19:01:17 +05:30
Ms2ger
932aa06694 Use Rc::get_mut rather than deprecated rc::get_mut. 2015-06-26 17:17:18 +02:00
Ms2ger
28086f3c75 Use Box::into_raw rather than boxed::into_raw.
The latter is deprecated.
2015-06-25 23:03:54 +02:00
Joel Teichroeb
012be81eab Add support for NamedConstructor in webidls 2015-06-24 10:42:53 -07:00
Anthony Ramine
a90983553b Merge generic funs to share them across all bindings (fixes #2684) 2015-06-24 11:34:30 +02:00
Michael Wu
675267b782 Upgrade to SM 39 2015-06-19 18:42:48 -04:00
Jack Moffitt
07d95627ca Generate code into OUT_DIR.
This is necessary to ensure Cargo knows when to rebuild. Normally
.gitignore would be enough to exclude these from Cargo's freshness
calculation, but https://github.com/rust-lang/cargo/issues/1729 prevents
this currently. This is the new, correct way to do these thigns, just
like the style crate does.
2015-06-17 16:18:22 -06:00
Ms2ger
0607cd3fb5 Return Fallible from get_callable_property. 2015-06-14 20:08:06 +02:00
Mukilan Thiyagarajan
e5b8e81bf8 Fix codegen for overload resolution. Fixes #6300 2015-06-10 14:14:31 +05:30
bors-servo
ca6a34a1cd Auto merge of #6299 - GreenRecycleBin:#6271, r=Ms2ger
get_proto_or_iface_array now returns *mut ProtoOrIfaceArray

Fix #6271

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6299)
<!-- Reviewable:end -->
2015-06-07 10:47:14 -05:00
bors-servo
78665336e6 Auto merge of #6297 - brson:inline, r=jdm
This results in a 14% compile time improvement.

See https://gist.github.com/brson/b48dd03b06c406be68e6

I'm not suggesting you merge this as-is, but you might consider whether removing some of these is worth pursuing.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/6297)
<!-- Reviewable:end -->
2015-06-06 08:25:29 -05:00
Daniel Le
15c4f7fe2d Avoid casting in the callers
get_proto_or_iface_array now returns *mut ProtoOrIfaceArray

Fix #6271
2015-06-06 12:22:18 +08:00
Brian Anderson
172fbcad27 Convert inline(always) to inline in CodegenRust and jstraceable.
This results in a 14% compile time improvement.

See https://gist.github.com/brson/b48dd03b06c406be68e6
2015-06-05 14:56:11 -07:00
Josh Matthews
453679fd1f Trace the prototype array on the global object. 2015-06-01 18:36:57 -04:00
ecoal95
b3ac346749 Add WebGLContextAttributes support
This commit also:
* Allows to return non-rootable dictionaries from
Codegen.
* Merges the two context types in an enum type.
2015-06-01 15:29:38 +02:00
Philipp Hartwig
ab4059ca21 Use byte string instead of handcrafted byte array 2015-05-25 20:57:16 +02:00
Anthony Ramine
d9619853e2 Fix length value of interface methods 2015-05-14 19:11:10 +02:00
Anthony Ramine
cc5eee48a6 Generate forwarded setters 2015-05-07 16:04:25 +02:00
bors-servo
2c17779440 Auto merge of #5896 - nox:stringifier-proxy, r=jdm
The proxy stringifiers called through {}.toString.call() (obj_toString) shouldn't use the stringifier.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5896)
<!-- Reviewable:end -->
2015-04-30 04:33:32 -05:00
Anthony Ramine
2a2e8b176d Properly generate proxy stringifiers 2015-04-29 18:52:38 +02:00
Ms2ger
903305416a Implement Clone for Copy types. 2015-04-28 23:31:10 +02:00
bors-servo
01925f0f8f Auto merge of #5845 - snf:defineProperty_fix, r=jdm
This patch should get rid of #5223.

<!-- Reviewable:start -->
[<img src="https://reviewable.io/review_button.png" height=40 alt="Review on Reviewable"/>](https://reviewable.io/reviews/servo/servo/5845)
<!-- Reviewable:end -->
2015-04-28 07:51:31 -05:00
Anthony Ramine
7197052c0d Uniformise root() methods
They now live in traits Rootable, OptionalOptionalRootable, OptionalRootable
and ResultRootable.
2015-04-28 09:22:45 +02:00