Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
C
capnproto
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
capnproto
Commits
3a01c67c
Commit
3a01c67c
authored
Jan 29, 2015
by
Kenton Varda
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
A 'using' alias for an annotation should not be required to start with a capital letter.
parent
80e97114
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
1 deletion
+35
-1
node-translator.c++
c++/src/capnp/compiler/node-translator.c++
+35
-1
No files found.
c++/src/capnp/compiler/node-translator.c++
View file @
3a01c67c
...
...
@@ -1418,6 +1418,22 @@ void NodeTranslator::compileNode(Declaration::Reader decl, schema::Node::Builder
builder
.
adoptAnnotations
(
compileAnnotationApplications
(
decl
.
getAnnotations
(),
targetsFlagName
));
}
static
kj
::
StringPtr
getExpressionTargetName
(
Expression
::
Reader
exp
)
{
kj
::
StringPtr
targetName
;
switch
(
exp
.
which
())
{
case
Expression
:
:
ABSOLUTE_NAME
:
return
exp
.
getAbsoluteName
().
getValue
();
case
Expression
:
:
RELATIVE_NAME
:
return
exp
.
getRelativeName
().
getValue
();
case
Expression
:
:
APPLICATION
:
return
getExpressionTargetName
(
exp
.
getApplication
().
getFunction
());
case
Expression
:
:
MEMBER
:
return
exp
.
getMember
().
getName
().
getValue
();
default
:
return
nullptr
;
}
}
void
NodeTranslator
::
DuplicateNameDetector
::
check
(
List
<
Declaration
>::
Reader
nestedDecls
,
Declaration
::
Which
parentKind
)
{
for
(
auto
decl
:
nestedDecls
)
{
...
...
@@ -1440,7 +1456,25 @@ void NodeTranslator::DuplicateNameDetector::check(
}
switch
(
decl
.
which
())
{
case
Declaration
:
:
USING
:
case
Declaration
:
:
USING
:
{
kj
::
StringPtr
targetName
=
getExpressionTargetName
(
decl
.
getUsing
().
getTarget
());
if
(
targetName
.
size
()
>
0
&&
targetName
[
0
]
>=
'a'
&&
targetName
[
0
]
<=
'z'
)
{
// Target starts with lower-case letter, so alias should too.
if
(
nameText
.
size
()
>
0
&&
(
nameText
[
0
]
<
'a'
||
nameText
[
0
]
>
'z'
))
{
errorReporter
.
addErrorOn
(
name
,
"Non-type names must begin with a lower-case letter."
);
}
}
else
{
// Target starts with capital or is not named (probably, an import). Require
// capitalization.
if
(
nameText
.
size
()
>
0
&&
(
nameText
[
0
]
<
'A'
||
nameText
[
0
]
>
'Z'
))
{
errorReporter
.
addErrorOn
(
name
,
"Type names must begin with a capital letter."
);
}
}
break
;
}
case
Declaration
:
:
ENUM
:
case
Declaration
:
:
STRUCT
:
case
Declaration
:
:
INTERFACE
:
...
...
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