Commit graph

296 commits

Author SHA1 Message Date
Manish Goregaokar
619da07a4f Webidl and basic implementation of XHR object 2014-05-03 14:00:20 +05:30
bors-servo
b36b779d24 auto merge of #2290 : saneyuki/servo/export, r=jdm
- Fix #2128
- Take over from #2220

I didn't change `InterfaceTypes.rs` to `type.rs` because `type` is very common name which might be troublesome.
2014-05-01 23:34:39 -04:00
Ms2ger
8c879c8bf8 Implement WebIDL codegen for ByteString. 2014-05-01 22:02:53 +02:00
Ms2ger
541d581c32 Change some isString() checks in the WebIDL codegen to isDOMString() checks. 2014-05-01 21:11:12 +02:00
Tetsuharu OHZEKI
78856c87a4 Remove the 'pub use self::BindingDeclarations::*;' export. 2014-05-01 18:49:16 +09:00
Ms2ger
844d48e0af Merge UnionConversions() into UnionTypes().
It's not very useful to have one but not the other, so it makes more sense
to deal with them together.
2014-04-29 21:33:27 +02:00
Ms2ger
c51879767e Reuse getTypes in UnionConversions().
This should be equivalent, except that the removed code ignores return
values (which we currently don't support).
2014-04-29 21:18:56 +02:00
Ms2ger
19166b2f53 Remove C++-specific union codegen code. 2014-04-29 21:17:52 +02:00
bors-servo
0bfbe06f4b auto merge of #2194 : Ms2ger/servo/typeerror-2, r=jdm 2014-04-28 13:19:36 -04:00
Ms2ger
505e7d472a Use more rustic names for ThrowTypeError and infrastructure. 2014-04-28 17:18:28 +02:00
Ms2ger
7ff9fff421 Move ThrowTypeError to error.rs. 2014-04-28 16:50:53 +02:00
bors-servo
32bceb3ae7 auto merge of #2244 : Ms2ger/servo/optional-rewrite, r=jdm
This moves all handling of `isOptional` (except `type.isCallback()`, which I believe @jdm is rewriting in #2204) into one place.
2014-04-28 10:46:46 -04:00
Ms2ger
bfde816da0 Throw a TypeError when too few arguments are passed. 2014-04-28 11:29:46 +02:00
Ms2ger
095ed61c94 Use handleOptional for callback interface conversion. 2014-04-28 10:44:11 +02:00
Ms2ger
08fce9a321 Use handleOptional for dictionary conversion.
This does not have any effect, as isOptional is always False for dictionaries.
This change is made only for consistency.
2014-04-28 10:38:44 +02:00
bors-servo
9f742a9462 auto merge of #2237 : Ms2ger/servo/union-fromjsvalconvertible, r=jdm
With bonus codegen tests.
2014-04-28 04:01:36 -04:00
Lars Bergstrom
948daf2422 This batch of changes upgrades Servo to work with the Rust upgrade as of
April 10, 2014. The main changes are to privacy, to work around the
issues with incorrect bounds on the libstd `Arc<Mutex<T>>`, and the
various API changes strewn throughout the libraries.
2014-04-27 15:46:12 -05:00
Ms2ger
54d2e8e235 Use handleOptional for interface conversion. 2014-04-27 20:55:21 +02:00
Ms2ger
7c3480de60 Move optional/nullable handling out of CastableObjectUnwrapper.
This puts the code that wraps the type in Option<> and the code that wraps
the expression in Some() into the same if block, which should clarify the
code.
2014-04-27 19:44:09 +02:00
Ms2ger
89d4fac36e Use handleOptional for the enumeration conversion. 2014-04-26 18:32:45 +02:00
Ms2ger
13e26e0fe0 Use handleOptional for the DOMString conversion. 2014-04-26 17:29:30 +02:00
Ms2ger
b73a87e955 Use handleOptional for the union conversion.
Note that unions didn't handle optional arguments correctly before.
2014-04-26 17:22:07 +02:00
Ms2ger
1e2be02eb8 Use handleOptional for the 'any' conversion. 2014-04-26 17:15:28 +02:00
Ms2ger
b264c65f2e Implement a cleaner way of dealing with optional arguments in codegen and use it for primitive types.
This puts the Some constructor outside the match, making the actual
generating code independent of the optionality of the argument.
2014-04-26 17:10:59 +02:00
Ms2ger
35f6a24de7 Use FromJSValConvertible's nullable conversion code. 2014-04-26 16:42:39 +02:00
Ms2ger
9cc5460dd6 Implement FromJSValConvertible for union types. 2014-04-26 16:42:39 +02:00
Ms2ger
06df422718 Remove the holderType return value of getJSToNativeConversionTemplate.
It is always None.
2014-04-25 16:24:21 +02:00
bors-servo
691d82a92f auto merge of #2228 : Ms2ger/servo/object-unwrapping-expressionify, r=jdm 2014-04-25 09:19:14 -04:00
Ms2ger
ee23074232 Remove unused function getUnionAccessorSignatureType. 2014-04-25 11:59:03 +02:00
Ms2ger
1d51e7d227 Rewrite dictionary codegen to initialize members directly into the struct. 2014-04-25 11:51:47 +02:00
Ms2ger
66c89f27aa Remove the 'retval' local variable from union TryConvertTo methods. 2014-04-25 11:33:18 +02:00
Ms2ger
05d0ba783f Move responsibility for assigning to ${declName} out of getJSToNativeConversionTemplate.
This commit does not make any change to the generated code.
2014-04-25 11:31:40 +02:00
Ms2ger
c5bf011d1e Rewrite the enumeration unwrapping to return an expression. 2014-04-25 10:55:16 +02:00
Ms2ger
2b9d1d6bc1 Rewrite the primitive unwrapping to return an expression. 2014-04-25 10:47:00 +02:00
Ms2ger
643ea874d1 Rewrite the any unwrapping to return an expression. 2014-04-25 10:47:00 +02:00
Ms2ger
1027801b04 Rewrite the DOMString unwrapping to return an expression. 2014-04-25 10:46:58 +02:00
Ms2ger
4905b22673 Rewrite the union unwrapping to return an expression. 2014-04-25 09:58:49 +02:00
Ms2ger
a9ffff9215 Rewrite the interface unwrapping to return an expression. 2014-04-25 09:58:49 +02:00
bors-servo
0745d656a3 auto merge of #2227 : Ms2ger/servo/assign-outside-match, r=jdm 2014-04-24 18:13:13 -04:00
Ms2ger
de8f123b1d Assign to 'this' immediately in CGAbstractBindingMethod.
This makes the generated code a bit more rustic.
2014-04-24 23:57:28 +02:00
Ms2ger
a6a06e0ffc Inline CGAbstractBindingMethod.getThis.
There's no good reason to keep this separate; it's only called once, and
inlining the function makes the code a little clearer.

This commit does not make any change to the generated code.
2014-04-24 23:52:27 +02:00
Ms2ger
82afae123e Move responsability for the assignment out of CastableObjectUnwrapper.
This is a second step towards making getJSToNativeConversionTemplate return an
expression, which will improve dictionary codegen in particular.

This commit does not make any change to the generated code.
2014-04-24 23:50:21 +02:00
Ms2ger
ab1b429aef Move assignments outside match expressions in getJSToNativeConversionTemplate.
This is a first step towards making getJSToNativeConversionTemplate return an
expression, which will improve dictionary codegen in particular.
2014-04-24 22:21:23 +02:00
Ms2ger
90f4d256cf Add support for dictionaries containing 'any'. 2014-04-24 21:50:20 +02:00
Josh Matthews
94dffca1e1 Remove all traces of WindowProxy. Implement basic browser context concept and outerizing of inner windows. 2014-04-22 10:57:25 -04:00
Ms2ger
4f9e119334 Remove JSPageInfo::js_compartment.
A js::rust::Compartment is little more than a glorified pointer to the
reflector of a window, so there's no good reason to use it. Instead, this
commit passes a JS<Window> directly when it's necessary.

This also means that we now have to use JS_DefineFunctions rather than
Compartment::define_functions; I believe the former is clearer to the reader
than the extra indirection involved in the latter calling through three
reopsitories.

This commit also simplifies ScriptTask::load to reuse the 'cx' local that is
in scope already, rather than refetching it through js_info.
2014-04-21 13:43:18 +02:00
Ms2ger
65ed97bab8 Introduce a get_dictionary_property function to reduce duplicated code in the dictionary conversion codegen.
This also explicitly disallows dictionary members without a default value, as
the code for those doesn't currently compile.

This is the second step of my planned rewrite of the dictionary initialization
that will remove the default values we currently use to initialize the
dictionary struct in the 'new' function.
2014-04-18 20:10:55 +02:00
Ms2ger
88c5e733b5 Merge the 'new' and 'Init' functions for dictionaries.
This moves the code in callers more in line with conversions for other types
and ensures the default values given to the dictionary fields (as defined by
the defaultValue function in CGDictionary.impl) do not escape the 'new'
method. The new code is also more in line with the code used by the
FromJSValConvertible trait.

This is the first step of my planned rewrite of the dictionary initialization
that will remove the default values entirely and reduce the code
duplication in the 'Init' (now 'new') function.
2014-04-18 17:12:20 +02:00
Ms2ger
8e596d142e Use 'exceptionCode' when converting to DOMString.
This change allows us to use the code even in cases where we return a
Result type rather than a JSBool. Interface, primitive and union types
already get this right.
2014-04-18 17:12:20 +02:00
bors-servo
58efe0bf75 auto merge of #2156 : Ms2ger/servo/codegen-deadcode, r=jdm 2014-04-18 10:28:11 -04:00