зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1610570: Support the NoTaint attribute on method parameters with the passback value r=mccr8
Differential Revision: https://phabricator.services.mozilla.com/D108245
This commit is contained in:
Родитель
829a688630
Коммит
a693f1a809
|
@ -355,10 +355,11 @@ class MessageDecl(Node):
|
|||
|
||||
|
||||
class Param(Node):
|
||||
def __init__(self, loc, typespec, name):
|
||||
def __init__(self, loc, typespec, name, attributes={}):
|
||||
Node.__init__(self, loc)
|
||||
self.name = name
|
||||
self.typespec = typespec
|
||||
self.attributes = attributes
|
||||
|
||||
|
||||
class TypeSpec(Node):
|
||||
|
|
|
@ -633,8 +633,8 @@ def p_ParamList(p):
|
|||
|
||||
|
||||
def p_Param(p):
|
||||
"""Param : Type ID"""
|
||||
p[0] = Param(locFromTok(p, 1), p[1], p[2])
|
||||
"""Param : Attributes Type ID"""
|
||||
p[0] = Param(locFromTok(p, 2), p[2], p[3], p[1])
|
||||
|
||||
|
||||
def p_Type(p):
|
||||
|
|
|
@ -1297,9 +1297,24 @@ class GatherDecls(TcheckVisitor):
|
|||
|
||||
# replace inparam Param nodes with proper Decls
|
||||
def paramToDecl(param):
|
||||
self.checkAttributes(
|
||||
param.attributes,
|
||||
{
|
||||
"NoTaint": ("passback",)
|
||||
},
|
||||
)
|
||||
|
||||
ptname = param.typespec.basename()
|
||||
ploc = param.typespec.loc
|
||||
|
||||
if 'NoTaint' in param.attributes and 'Tainted' not in md.attributes:
|
||||
self.error(
|
||||
ploc,
|
||||
"argument typename `%s' of message `%s' has a NoTaint attribute, but the message lacks the Tainted attribute",
|
||||
ptname,
|
||||
msgname,
|
||||
)
|
||||
|
||||
ptdecl = self.symtab.lookup(ptname)
|
||||
if ptdecl is None:
|
||||
self.error(
|
||||
|
|
|
@ -0,0 +1,6 @@
|
|||
//error: argument typename `int' of message `foo' has a NoTaint attribute, but the message lacks the Tainted attribute
|
||||
|
||||
intr protocol PNoTaintWithoutTainted {
|
||||
child:
|
||||
async foo([NoTaint=passback] int id);
|
||||
};
|
|
@ -0,0 +1,4 @@
|
|||
intr protocol PMessageTaintedWithPassback {
|
||||
child:
|
||||
[Tainted] async foo([NoTaint=passback] int id);
|
||||
};
|
Загрузка…
Ссылка в новой задаче