Drop raises annotations support.
R=blois@google.com Review URL: https://codereview.chromium.org//14150007 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@21725 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
+40
-56
@@ -33,7 +33,7 @@ interface TimeoutHandler {
|
||||
|
||||
[Supplemental]
|
||||
interface CanvasRenderingContext2D {
|
||||
[DartName=createImageDataFromImageData] ImageData createImageData(in ImageData imagedata) raises (DOMException);
|
||||
[DartName=createImageDataFromImageData] ImageData createImageData(in ImageData imagedata);
|
||||
};
|
||||
|
||||
[Supplemental]
|
||||
@@ -43,8 +43,8 @@ interface Console {
|
||||
};
|
||||
|
||||
interface HTMLCanvasElement {
|
||||
[Suppressed] DOMString toDataURL([TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] in DOMString type) raises(DOMException);
|
||||
[Custom] DOMString toDataURL([TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] in DOMString type, [Optional] in float quality) raises(DOMException);
|
||||
[Suppressed] DOMString toDataURL([TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] in DOMString type);
|
||||
[Custom] DOMString toDataURL([TreatNullAs=NullString, TreatUndefinedAs=NullString,Optional=DefaultIsUndefined] in DOMString type, [Optional] in float quality);
|
||||
|
||||
[Suppressed] any getContext(in DOMString contextId);
|
||||
[Custom] CanvasRenderingContext getContext(in DOMString contextId, [Optional] in Dictionary attrs);
|
||||
@@ -106,23 +106,23 @@ interface WebGLRenderingContext {
|
||||
//void compressedTexImage2D(in unsigned long target, in long level, in unsigned long internalformat, in unsigned long width, in unsigned long height, in long border, in unsigned long imageSize, const void* data);
|
||||
//void compressedTexSubImage2D(in unsigned long target, in long level, in long xoffset, in long yoffset, in unsigned long width, in unsigned long height, in unsigned long format, in unsigned long imageSize, const void* data);
|
||||
|
||||
[Custom] any getBufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
|
||||
[Custom] any getBufferParameter(in unsigned long target, in unsigned long pname);
|
||||
[Suppressed, StrictTypeChecking, Custom] void getBufferParameter();
|
||||
|
||||
[Custom] any getFramebufferAttachmentParameter(in unsigned long target, in unsigned long attachment, in unsigned long pname) raises(DOMException);
|
||||
[Custom] any getFramebufferAttachmentParameter(in unsigned long target, in unsigned long attachment, in unsigned long pname);
|
||||
[Suppressed, StrictTypeChecking, Custom] void getFramebufferAttachmentParameter();
|
||||
|
||||
[Custom] any getParameter(in unsigned long pname) raises(DOMException);
|
||||
[Custom] any getParameter(in unsigned long pname);
|
||||
[Suppressed, StrictTypeChecking, Custom] void getParameter();
|
||||
|
||||
[Custom] any getProgramParameter(in WebGLProgram program, in unsigned long pname) raises(DOMException);
|
||||
[Custom] any getProgramParameter(in WebGLProgram program, in unsigned long pname);
|
||||
[Suppressed, StrictTypeChecking, Custom] void getProgramParameter();
|
||||
|
||||
[Custom] any getRenderbufferParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
|
||||
[Custom] any getRenderbufferParameter(in unsigned long target, in unsigned long pname);
|
||||
[Suppressed, StrictTypeChecking, Custom] void getRenderbufferParameter();
|
||||
|
||||
[Custom] any getShaderParameter(in WebGLShader shader, in unsigned long pname) raises(DOMException);
|
||||
[Suppressed, StrictTypeChecking, Custom] void getShaderParameter() raises(DOMException);
|
||||
[Custom] any getShaderParameter(in WebGLShader shader, in unsigned long pname);
|
||||
[Suppressed, StrictTypeChecking, Custom] void getShaderParameter();
|
||||
|
||||
// TBD
|
||||
// void glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision);
|
||||
@@ -132,16 +132,15 @@ interface WebGLRenderingContext {
|
||||
[Custom] DOMString[] getSupportedExtensions();
|
||||
[Suppressed, StrictTypeChecking, Custom] void getSupportedExtensions();
|
||||
|
||||
[Custom] any getTexParameter(in unsigned long target, in unsigned long pname) raises(DOMException);
|
||||
[Custom] any getTexParameter(in unsigned long target, in unsigned long pname);
|
||||
[Suppressed, StrictTypeChecking, Custom] void getTexParameter();
|
||||
|
||||
[Custom] any getUniform(in WebGLProgram program, in WebGLUniformLocation location) raises(DOMException);
|
||||
[Custom] any getUniform(in WebGLProgram program, in WebGLUniformLocation location);
|
||||
[Suppressed, StrictTypeChecking, Custom] void getUniform();
|
||||
|
||||
[Custom] any getVertexAttrib(in unsigned long index, in unsigned long pname) raises(DOMException);
|
||||
[Custom] any getVertexAttrib(in unsigned long index, in unsigned long pname);
|
||||
[Suppressed, StrictTypeChecking, Custom] void getVertexAttrib();
|
||||
};
|
||||
|
||||
[Supplemental]
|
||||
interface CSSStyleDeclaration {
|
||||
void setProperty(in DOMString propertyName, in DOMString value, [Optional] in DOMString priority);
|
||||
@@ -214,20 +213,16 @@ interface DataView {
|
||||
// uint8_t getUint8(in unsigned long byteOffset);
|
||||
[Suppressed] any getInt8();
|
||||
[Suppressed] any getUint8();
|
||||
byte getInt8(in unsigned long byteOffset)
|
||||
raises (DOMException);
|
||||
octet getUint8(in unsigned long byteOffset)
|
||||
raises (DOMException);
|
||||
[RaisesException] byte getInt8(in unsigned long byteOffset);
|
||||
[RaisesException] octet getUint8(in unsigned long byteOffset);
|
||||
|
||||
// We have to use custom code because our code generator does not support uint8_t type.
|
||||
// void setInt8(in unsigned long byteOffset, in int8_t value);
|
||||
// void setUint8(in unsigned long byteOffset, in uint8_t value);
|
||||
[Suppressed] void setInt8();
|
||||
[Suppressed] void setUint8();
|
||||
void setInt8(in unsigned long byteOffset, in byte value)
|
||||
raises (DOMException);
|
||||
void setUint8(in unsigned long byteOffset, in octet value)
|
||||
raises (DOMException);
|
||||
[RaisesException] void setInt8(in unsigned long byteOffset, in byte value);
|
||||
[RaisesException] void setUint8(in unsigned long byteOffset, in octet value);
|
||||
};
|
||||
|
||||
// TODO(vsm): Define new names for these (see b/4436830).
|
||||
@@ -239,20 +234,17 @@ interface IDBCursor {
|
||||
interface IDBDatabase {
|
||||
// These variants are slated for removal from WebKit. Suppress to bring our
|
||||
// API in line with the most recent spec.
|
||||
[Suppressed, CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMStringList storeNames, in unsigned short mode)
|
||||
raises (IDBDatabaseException);
|
||||
[Suppressed, CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString[] storeNames, in unsigned short mode)
|
||||
raises (IDBDatabaseException);
|
||||
[Suppressed, CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString storeName, in unsigned short mode)
|
||||
raises (IDBDatabaseException);
|
||||
[Suppressed, CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMStringList storeNames, in unsigned short mode);
|
||||
[Suppressed, CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString[] storeNames, in unsigned short mode);
|
||||
[Suppressed, CallWith=ScriptExecutionContext] IDBTransaction transaction(in DOMString storeName, in unsigned short mode);
|
||||
};
|
||||
|
||||
[Supplemental]
|
||||
interface IDBKeyRange {
|
||||
[DartName=only_] static IDBKeyRange only(in any value) raises (IDBDatabaseException);
|
||||
[DartName=lowerBound_] static IDBKeyRange lowerBound(in any bound, [Optional] in boolean open) raises (IDBDatabaseException);
|
||||
[DartName=upperBound_] static IDBKeyRange upperBound(in any bound, [Optional] in boolean open) raises (IDBDatabaseException);
|
||||
[DartName=bound_] static IDBKeyRange bound(in any lower, in any upper, [Optional] in boolean lowerOpen, [Optional] in boolean upperOpen) raises (IDBDatabaseException);
|
||||
[DartName=only_] static IDBKeyRange only(in any value);
|
||||
[DartName=lowerBound_] static IDBKeyRange lowerBound(in any bound, [Optional] in boolean open);
|
||||
[DartName=upperBound_] static IDBKeyRange upperBound(in any bound, [Optional] in boolean open);
|
||||
[DartName=bound_] static IDBKeyRange bound(in any lower, in any upper, [Optional] in boolean lowerOpen, [Optional] in boolean upperOpen);
|
||||
};
|
||||
|
||||
interface EntrySync {
|
||||
@@ -298,8 +290,7 @@ interface SVGNumber {
|
||||
interface MutationObserver {
|
||||
// Rename 'observe' so we can define a new 'observe' API that calls the
|
||||
// original.
|
||||
[DartName=_observe] void observe(in Node target, in Dictionary options)
|
||||
raises(DOMException);
|
||||
[DartName=_observe] void observe(in Node target, in Dictionary options);
|
||||
};
|
||||
|
||||
[Supplemental,
|
||||
@@ -324,33 +315,26 @@ interface SQLResultSetRowList {
|
||||
interface WebSocket {
|
||||
// Suppress the default since it has non-standard return type and add
|
||||
// overrides.
|
||||
[Suppressed] boolean send(in ArrayBuffer data) raises(DOMException);
|
||||
[Suppressed] boolean send(in ArrayBufferView data) raises(DOMException);
|
||||
[Suppressed] boolean send(in Blob data) raises(DOMException);
|
||||
[Suppressed] boolean send(in DOMString data) raises(DOMException);
|
||||
[Suppressed] boolean send(in ArrayBuffer data);
|
||||
[Suppressed] boolean send(in ArrayBufferView data);
|
||||
[Suppressed] boolean send(in Blob data);
|
||||
[Suppressed] boolean send(in DOMString data);
|
||||
|
||||
[Custom] void send(DOMString data) raises(DOMException);
|
||||
[Custom] void send(Blob data) raises(DOMException);
|
||||
[Custom] void send(ArrayBuffer data) raises(DOMException);
|
||||
[Custom] void send(ArrayBufferView data) raises(DOMException);
|
||||
[Custom] void send(DOMString data);
|
||||
[Custom] void send(Blob data);
|
||||
[Custom] void send(ArrayBuffer data);
|
||||
[Custom] void send(ArrayBufferView data);
|
||||
};
|
||||
|
||||
[Supplemental]
|
||||
interface XMLHttpRequest {
|
||||
[Custom] void send()
|
||||
raises(DOMException);
|
||||
[Custom] void send(in ArrayBuffer data) // FIXME: this should be eventually deprecated.
|
||||
raises(DOMException);
|
||||
[Custom] void send(in ArrayBufferView data)
|
||||
raises(DOMException);
|
||||
[Custom] void send(in Blob data)
|
||||
raises(DOMException);
|
||||
[Custom] void send(in Document data)
|
||||
raises(DOMException);
|
||||
[Custom] void send([StrictTypeChecking] in DOMString data)
|
||||
raises(DOMException);
|
||||
[Custom] void send(in DOMFormData data)
|
||||
raises(DOMException);
|
||||
[Custom] void send();
|
||||
[Custom] void send(in ArrayBuffer data); // FIXME: this should be eventually deprecated.
|
||||
[Custom] void send(in ArrayBufferView data);
|
||||
[Custom] void send(in Blob data);
|
||||
[Custom] void send(in Document data);
|
||||
[Custom] void send([StrictTypeChecking] in DOMString data);
|
||||
[Custom] void send(in DOMFormData data);
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -165,10 +165,6 @@ class DartGenerator(object):
|
||||
continue
|
||||
interfaces.append(interface)
|
||||
|
||||
# TODO(sra): Use this list of exception names to generate information to
|
||||
# tell dart2js which exceptions can be passed from JS to Dart code.
|
||||
exceptions = self._CollectExceptions(interfaces)
|
||||
|
||||
# Render all interfaces into Dart and save them in files.
|
||||
for interface in self._PreOrderInterfaces(interfaces):
|
||||
interface_name = interface.id
|
||||
@@ -201,21 +197,6 @@ class DartGenerator(object):
|
||||
visit(interface)
|
||||
return ordered
|
||||
|
||||
def _CollectExceptions(self, interfaces):
|
||||
"""Returns the names of all exception classes raised."""
|
||||
exceptions = set()
|
||||
for interface in interfaces:
|
||||
for attribute in interface.attributes:
|
||||
if attribute.get_raises:
|
||||
exceptions.add(attribute.get_raises.id)
|
||||
if attribute.set_raises:
|
||||
exceptions.add(attribute.set_raises.id)
|
||||
for operation in interface.operations:
|
||||
if operation.raises:
|
||||
exceptions.add(operation.raises.id)
|
||||
return exceptions
|
||||
|
||||
|
||||
def FixEventTargets(self, database):
|
||||
for interface in database.GetInterfaces():
|
||||
# Create fake EventTarget parent interface for interfaces that have
|
||||
|
||||
@@ -1409,7 +1409,6 @@ _idl_type_registry = monitored.Dict('generator._idl_type_registry', {
|
||||
'void': TypeData(clazz='Primitive', dart_type='void'),
|
||||
|
||||
'CSSRule': TypeData(clazz='Interface', conversion_includes=['CSSImportRule']),
|
||||
'DOMException': TypeData(clazz='Interface', native_type='DOMCoreException'),
|
||||
'DOMStringMap': TypeData(clazz='Interface', dart_type='Map<String, String>'),
|
||||
'DOMWindow': TypeData(clazz='Interface', custom_to_dart=True),
|
||||
'Element': TypeData(clazz='Interface', merged_interface='HTMLElement',
|
||||
|
||||
@@ -468,7 +468,6 @@ class IDLOperation(IDLMember):
|
||||
IDLMember.__init__(self, ast, doc_js_interface_name)
|
||||
self.type = self._convert_first(ast, 'ReturnType', IDLType)
|
||||
self.arguments = self._convert_all(ast, 'Argument', IDLArgument)
|
||||
self.raises = self._convert_first(ast, 'Raises', IDLType)
|
||||
self.specials = self._find_all(ast, 'Special')
|
||||
self.is_stringifier = self._has(ast, 'Stringifier')
|
||||
def _extra_repr(self):
|
||||
@@ -481,15 +480,9 @@ class IDLAttribute(IDLMember):
|
||||
IDLMember.__init__(self, ast, doc_js_interface_name)
|
||||
self.is_read_only = self._has(ast, 'ReadOnly')
|
||||
# There are various ways to define exceptions for attributes:
|
||||
self.raises = self._convert_first(ast, 'Raises', IDLType)
|
||||
self.get_raises = self.raises \
|
||||
or self._convert_first(ast, 'GetRaises', IDLType)
|
||||
self.set_raises = self.raises \
|
||||
or self._convert_first(ast, 'SetRaises', IDLType)
|
||||
def _extra_repr(self):
|
||||
extra = []
|
||||
if self.is_read_only: extra.append('readonly')
|
||||
if self.raises: extra.append('raises')
|
||||
return extra
|
||||
|
||||
class IDLConstant(IDLMember):
|
||||
|
||||
@@ -175,23 +175,16 @@ class IDLParser(object):
|
||||
return syntax_switch(
|
||||
# Web IDL:
|
||||
[MAYBE(ExtAttrs), MAYBE(Stringifier), MAYBE(ReadOnly),
|
||||
'attribute', Type, Id, MAYBE(_AttrRaises), ';'],
|
||||
'attribute', Type, Id, ';'],
|
||||
# WebKit:
|
||||
[
|
||||
MAYBE(Stringifier),
|
||||
MAYBE(ExtAttrs), MAYBE(Static), MAYBE(ReadOnly), 'attribute', MAYBE(ExtAttrs),
|
||||
Type, Id, MAYBE(_AttrRaises), ';'],
|
||||
Type, Id, ';'],
|
||||
# FremontCut:
|
||||
[MAYBE(_Annotations), MAYBE(ExtAttrs),
|
||||
MAYBE(_AttrGetterSetter), MAYBE(Stringifier), MAYBE(ReadOnly),
|
||||
'attribute', Type, Id, MAYBE(_AttrRaises), ';'])
|
||||
|
||||
def _AttrRaises():
|
||||
return syntax_switch(
|
||||
# Web IDL:
|
||||
MANY(OR(GetRaises, SetRaises)),
|
||||
# WebKit:
|
||||
MANY(OR(GetRaises, SetRaises, Raises), separator=','))
|
||||
'attribute', Type, Id, ';'])
|
||||
|
||||
# Special fremontcut feature:
|
||||
def _AttrGetterSetter():
|
||||
@@ -206,35 +199,18 @@ class IDLParser(object):
|
||||
def ReadOnly():
|
||||
return 'readonly'
|
||||
|
||||
def GetRaises():
|
||||
return syntax_switch(
|
||||
# Web IDL:
|
||||
['getraises', '(', _ScopedNames, ')'],
|
||||
# WebKit:
|
||||
['getter', 'raises', '(', _ScopedNames, ')'])
|
||||
|
||||
def SetRaises():
|
||||
return syntax_switch(
|
||||
# Web IDL:
|
||||
['setraises', '(', _ScopedNames, ')'],
|
||||
# WebKit:
|
||||
['setter', 'raises', '(', _ScopedNames, ')'])
|
||||
|
||||
# Operation:
|
||||
def Operation():
|
||||
return syntax_switch(
|
||||
# Web IDL:
|
||||
[MAYBE(ExtAttrs), MAYBE(Static), MAYBE(Stringifier), MAYBE(_Specials),
|
||||
ReturnType, MAYBE(Id), '(', _Arguments, ')', MAYBE(Raises),
|
||||
';'],
|
||||
ReturnType, MAYBE(Id), '(', _Arguments, ')', ';'],
|
||||
# WebKit:
|
||||
[MAYBE(ExtAttrs), MAYBE(Static),
|
||||
ReturnType, MAYBE(Id), '(', _Arguments, ')',
|
||||
MAYBE(Raises), ';'],
|
||||
ReturnType, MAYBE(Id), '(', _Arguments, ')', ';'],
|
||||
# FremontCut:
|
||||
[MAYBE(_Annotations), MAYBE(ExtAttrs), MAYBE(Static), MAYBE(Stringifier),
|
||||
MAYBE(_Specials), ReturnType, MAYBE(Id), '(', _Arguments, ')',
|
||||
MAYBE(Raises), ';'])
|
||||
MAYBE(_Specials), ReturnType, MAYBE(Id), '(', _Arguments, ')', ';'])
|
||||
|
||||
def Static():
|
||||
return 'static'
|
||||
@@ -248,9 +224,6 @@ class IDLParser(object):
|
||||
def Stringifier():
|
||||
return 'stringifier'
|
||||
|
||||
def Raises():
|
||||
return ['raises', '(', _ScopedNames, ')']
|
||||
|
||||
# Operation arguments:
|
||||
def _Arguments():
|
||||
return MAYBE(MANY(Argument, ','))
|
||||
|
||||
@@ -91,7 +91,7 @@ ERROR : %s''' % (all_syntaxes[syntax], content, expected, actual, error))
|
||||
self._run_test(
|
||||
idlparser.WEBKIT_SYNTAX,
|
||||
'''interface I {
|
||||
attribute boolean A setter raises (E), getter raises (E);
|
||||
attribute boolean A;
|
||||
};''',
|
||||
[('Interface', [('Id', 'I'), ('Attribute', [('Type', [('BooleanType', None)]), ('Id', 'A'), ('SetRaises', [('ScopedName', 'E')]), ('GetRaises', [('ScopedName', 'E')])])])])
|
||||
|
||||
|
||||
@@ -153,13 +153,6 @@ def render(idl_node, indent_str=' '):
|
||||
w('?')
|
||||
w(' ')
|
||||
w(node.id)
|
||||
if node.raises:
|
||||
w(' raises (%s)' % node.raises.id)
|
||||
else:
|
||||
if node.get_raises:
|
||||
w(' getraises (%s)' % node.get_raises.id)
|
||||
if node.set_raises:
|
||||
w(' setraises (%s)' % node.set_raises.id)
|
||||
wln(';')
|
||||
elif isinstance(node, IDLConstant):
|
||||
wsp(node.annotations)
|
||||
@@ -181,8 +174,6 @@ def render(idl_node, indent_str=' '):
|
||||
w('(')
|
||||
w(node.arguments, ', ')
|
||||
w(')')
|
||||
if node.raises:
|
||||
w(' raises (%s)' % node.raises.id)
|
||||
wln(';')
|
||||
elif isinstance(node, IDLArgument):
|
||||
wsp(node.ext_attrs)
|
||||
|
||||
@@ -357,7 +357,7 @@ class DartiumBackend(HtmlDartGenerator):
|
||||
[],
|
||||
attr.type.id,
|
||||
attr.type.nullable,
|
||||
attr.get_raises or 'GetterRaisesException' in attr.ext_attrs)
|
||||
'GetterRaisesException' in attr.ext_attrs)
|
||||
|
||||
def _AddSetter(self, attr, html_name):
|
||||
type_info = self._TypeInfo(attr.type.id)
|
||||
@@ -387,7 +387,7 @@ class DartiumBackend(HtmlDartGenerator):
|
||||
[attr],
|
||||
'void',
|
||||
False,
|
||||
attr.set_raises or 'SetterRaisesException' in attr.ext_attrs)
|
||||
'SetterRaisesException' in attr.ext_attrs)
|
||||
|
||||
def AddIndexer(self, element_type):
|
||||
"""Adds all the methods required to complete implementation of List."""
|
||||
@@ -531,7 +531,7 @@ class DartiumBackend(HtmlDartGenerator):
|
||||
arguments,
|
||||
operation.type.id,
|
||||
operation.type.nullable,
|
||||
operation.raises or 'RaisesException' in operation.ext_attrs)
|
||||
'RaisesException' in operation.ext_attrs)
|
||||
|
||||
def _GenerateNativeCallback(self,
|
||||
callback_name,
|
||||
|
||||
Reference in New Issue
Block a user