Skip to content
This repository was archived by the owner on Mar 8, 2020. It is now read-only.

Commit 607206b

Browse files
author
Juanjo Alvarez
committed
Use the new Drop field
Signed-off-by: Juanjo Alvarez <[email protected]>
1 parent f6d9cfb commit 607206b

File tree

3 files changed

+72
-69
lines changed

3 files changed

+72
-69
lines changed

Gopkg.lock

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Gopkg.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# for detailed Gopkg.toml documentation.
33

44
[[constraint]]
5-
version = "2.14.x"
5+
version = "2.14.2"
66
name = "gopkg.in/bblfsh/sdk.v2"
77

88
[prune]

driver/normalizer/normalizer.go

Lines changed: 68 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ func mapIASTNameDerived(typ string) Mapping {
3333
return MapSemantic(typ, uast.Identifier{}, MapObj(
3434
Fields{
3535
{Name: "Name", Op: Var("name")},
36-
{Name: "ExpandedFromMacro", Optional: "optMacro", Op: Any()},
36+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
3737
},
3838
Obj{
3939
"Name": Var("name"),
@@ -159,10 +159,10 @@ var Normalizers = []Mapping{
159159
Fields{
160160
{Name: "Prop_Statements", Op: Var("statements")},
161161
// FIXME(juanjux): save all these once we have a way.
162-
{Name: "ExpandedFromMacro", Optional: "optMacro", Op: Any()},
163-
{Name: "LeadingComments", Optional: "optLeadingComments", Op: Any()},
164-
{Name: "FreestadingComments", Optional: "optFSComments", Op: Any()},
165-
{Name: "TrailingComments", Optional: "optTlComments", Op: Any()},
162+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
163+
{Name: "LeadingComments", Drop: true, Op: Any()},
164+
{Name: "FreestadingComments", Drop: true, Op: Any()},
165+
{Name: "TrailingComments", Drop: true, Op: Any()},
166166
},
167167
Obj{
168168
"Statements": Var("statements"),
@@ -173,9 +173,9 @@ var Normalizers = []Mapping{
173173
MapSemantic("CPPASTCompoundStatement", uast.Block{}, MapObj(
174174
Fields{
175175
// FIXME(juanjux): save all these once we have a way
176-
{Name: "LeadingComments", Optional: "optLeadingComments", Op: Any()},
177-
{Name: "FreestadingComments", Optional: "optFSComments", Op: Any()},
178-
{Name: "TrailingComments", Optional: "optTlComments", Op: Any()},
176+
{Name: "LeadingComments", Drop: true, Op: Any()},
177+
{Name: "FreestadingComments", Drop: true, Op: Any()},
178+
{Name: "TrailingComments", Drop: true, Op: Any()},
179179
},
180180
Obj{"Statements": Arr()},
181181
)),
@@ -217,7 +217,7 @@ var Normalizers = []Mapping{
217217
{Name: "IASTClass", Op: String("CPPASTName")},
218218
{Name: "Name", Op: String("")},
219219
// FIXME(juanjux): save this once we have a way.
220-
{Name: "ExpandedFromMacro", Optional: "optMacro", Op: Any()},
220+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
221221
},
222222
Is(nil),
223223
),
@@ -275,9 +275,9 @@ var Normalizers = []Mapping{
275275
))},
276276
{Name: "IsConversionOperator", Op: Bool(false)},
277277
// Ignored: already on AllSegments
278-
{Name: "Prop_Qualifier", Optional: "optPropQual", Op: Any()},
278+
{Name: "Prop_Qualifier", Drop: true, Op: Any()},
279279
// FIXME(juanjux): save these two once we've a way
280-
{Name: "ExpandedFromMacro", Optional: "optMacro1", Op: Any()},
280+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
281281
{Name: "IsFullyQualified", Op: Any()},
282282
// Same as Prop_AllSegments but in a single string ("foo::bar::baz") instead of a list
283283
{Name: "Name", Op: Any()},
@@ -303,7 +303,7 @@ var Normalizers = []Mapping{
303303
{Name: "IsDefaulted", Op: Any()},
304304
{Name: "IsDeleted", Op: Any()},
305305
// FIXME(juanjux): save this once we've a way
306-
{Name: "ExpandedFromMacro", Optional: "optMacro1", Op: Any()},
306+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
307307
{Name: "Prop_Body", Optional: "optBody", Op: Var("body")},
308308
{Name: "LeadingComments", Optional: "optLeadingComments", Op: Var("leadingComments")},
309309
{Name: "FreestadingComments", Optional: "optFSComments", Op: Var("fsComments")},
@@ -314,48 +314,48 @@ var Normalizers = []Mapping{
314314
Fields{
315315
{Name: uast.KeyType, Op: String("CPPASTSimpleDeclSpecifier")},
316316
{Name: uast.KeyPos, Op: Any()},
317-
{Name: "IsComplex", Op: Any()},
318-
{Name: "IsConst", Op: Any()},
319-
{Name: "IsConstExpr", Op: Any()},
320-
{Name: "IsExplicit", Op: Any()},
321-
{Name: "IsFriend", Op: Any()},
322-
{Name: "IsImaginary", Op: Any()},
323-
{Name: "IsInline", Op: Any()},
324-
{Name: "IsLong", Op: Any()},
325-
{Name: "IsLongLong", Op: Any()},
326-
{Name: "IsRestrict", Op: Any()},
327-
{Name: "IsShort", Op: Any()},
328-
{Name: "IsSigned", Op: Any()},
329-
{Name: "IsThreadLocal", Op: Any()},
330-
{Name: "IsUnsigned", Op: Any()},
331-
{Name: "IsVirtual", Op: Any()},
332-
{Name: "IsVolatile", Op: Any()},
333-
{Name: "StorageClass", Op: Any()},
334-
{Name: "ExpandedFromMacro", Optional: "optMacro2", Op: Any()},
317+
{Name: "IsComplex", Drop: true, Op: Any()},
318+
{Name: "IsConst", Drop: true, Op: Any()},
319+
{Name: "IsConstExpr", Drop: true, Op: Any()},
320+
{Name: "IsExplicit", Drop: true, Op: Any()},
321+
{Name: "IsFriend", Drop: true, Op: Any()},
322+
{Name: "IsImaginary", Drop: true, Op: Any()},
323+
{Name: "IsInline", Drop: true, Op: Any()},
324+
{Name: "IsLong", Drop: true, Op: Any()},
325+
{Name: "IsLongLong", Drop: true, Op: Any()},
326+
{Name: "IsRestrict", Drop: true, Op: Any()},
327+
{Name: "IsShort", Drop: true, Op: Any()},
328+
{Name: "IsSigned", Drop: true, Op: Any()},
329+
{Name: "IsThreadLocal", Drop: true, Op: Any()},
330+
{Name: "IsUnsigned", Drop: true, Op: Any()},
331+
{Name: "IsVirtual", Drop: true, Op: Any()},
332+
{Name: "IsVolatile", Drop: true, Op: Any()},
333+
{Name: "StorageClass", Drop: true, Op: Any()},
334+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
335335
{Name: "Type", Op: String("void")},
336336
},
337337
// unspecified (ie constructor/destructors)
338338
Fields{
339339
{Name: uast.KeyType, Op: String("CPPASTSimpleDeclSpecifier")},
340-
{Name: uast.KeyPos, Op: Any()},
341-
{Name: "IsComplex", Op: Any()},
342-
{Name: "IsConst", Op: Any()},
343-
{Name: "IsConstExpr", Op: Any()},
344-
{Name: "IsExplicit", Op: Any()},
345-
{Name: "IsFriend", Op: Any()},
346-
{Name: "IsImaginary", Op: Any()},
347-
{Name: "IsInline", Op: Any()},
348-
{Name: "IsLong", Op: Any()},
349-
{Name: "IsLongLong", Op: Any()},
350-
{Name: "IsRestrict", Op: Any()},
351-
{Name: "IsShort", Op: Any()},
352-
{Name: "IsSigned", Op: Any()},
353-
{Name: "IsThreadLocal", Op: Any()},
354-
{Name: "IsUnsigned", Op: Any()},
355-
{Name: "IsVirtual", Op: Any()},
356-
{Name: "IsVolatile", Op: Any()},
357-
{Name: "StorageClass", Op: Any()},
358-
{Name: "ExpandedFromMacro", Optional: "optMacro3", Op: Any()},
340+
{Name: uast.KeyPos, Drop: true, Op: Any()},
341+
{Name: "IsComplex", Drop: true, Op: Any()},
342+
{Name: "IsConst", Drop: true, Op: Any()},
343+
{Name: "IsConstExpr", Drop: true, Op: Any()},
344+
{Name: "IsExplicit", Drop: true, Op: Any()},
345+
{Name: "IsFriend", Drop: true, Op: Any()},
346+
{Name: "IsImaginary", Drop: true, Op: Any()},
347+
{Name: "IsInline", Drop: true, Op: Any()},
348+
{Name: "IsLong", Drop: true, Op: Any()},
349+
{Name: "IsLongLong", Drop: true, Op: Any()},
350+
{Name: "IsRestrict", Drop: true, Op: Any()},
351+
{Name: "IsShort", Drop: true, Op: Any()},
352+
{Name: "IsSigned", Drop: true, Op: Any()},
353+
{Name: "IsThreadLocal", Drop: true, Op: Any()},
354+
{Name: "IsUnsigned", Drop: true, Op: Any()},
355+
{Name: "IsVirtual", Drop: true, Op: Any()},
356+
{Name: "IsVolatile", Drop: true, Op: Any()},
357+
{Name: "StorageClass", Drop: true, Op: Any()},
358+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
359359
{Name: "Type", Op: String("unspecified")},
360360
},
361361
Fields{
@@ -379,7 +379,7 @@ var Normalizers = []Mapping{
379379
{Name: "IsVirtual", Op: Any()},
380380
{Name: "IsVolatile", Op: Any()},
381381
{Name: "StorageClass", Op: Var("StorageClass")},
382-
{Name: "ExpandedFromMacro", Optional: "optMacro4", Op: Any()},
382+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
383383
{Name: "Type", Op: Var("retType")},
384384
},
385385
Fields{
@@ -397,7 +397,7 @@ var Normalizers = []Mapping{
397397
{Name: "IsTypeName", Op: Any()},
398398
{Name: "IsVirtual", Op: Any()},
399399
{Name: "IsVolatile", Op: Any()},
400-
{Name: "ExpandedFromMacro", Optional: "optMacro5", Op: Any()},
400+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
401401
{Name: "Prop_Name", Op: Var("retType")},
402402
},
403403
)},
@@ -411,9 +411,9 @@ var Normalizers = []Mapping{
411411
{Name: "IsOverride", Op: Any()},
412412
{Name: "IsPureVirtual", Op: Any()},
413413
{Name: "IsVolatile", Op: Any()},
414-
{Name: "ExpandedFromMacro", Optional: "optMacro6", Op: Any()},
415-
{Name: "Prop_NoexceptExpression", Optional: "declNoExcept", Op: Any()},
416-
{Name: "Prop_VirtSpecifiers", Optional: "declVirtSpecs", Op: Any()},
414+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
415+
{Name: "Prop_NoexceptExpression", Drop: true, Op: Any()},
416+
{Name: "Prop_VirtSpecifiers", Drop: true, Op: Any()},
417417

418418
{Name: "Prop_Name", Op: Cases("caseName",
419419
// Empty identifier
@@ -434,31 +434,33 @@ var Normalizers = []Mapping{
434434
)},
435435

436436
{Name: "TakesVarArgs", Op: Cases("takesVarArgs", Bool(false), Bool(true))},
437-
{Name: "Prop_ConstructorChain", Optional: "optConsChain", Op: Any()},
438-
{Name: "Prop_PointerOperators", Optional: "optPointerOps", Op: Any()},
437+
{Name: "Prop_ConstructorChain", Drop: true, Op: Any()},
438+
{Name: "Prop_PointerOperators", Drop: true, Op: Any()},
439439

440440
{Name: "Prop_Parameters", Optional: "optArgs", Op: Each("args", Cases("caseParams",
441441
Fields{
442442
{Name: uast.KeyType, Op: String("CPPASTDeclarator")},
443443
{Name: uast.KeyPos, Op: Var("parampos")},
444444
{Name: "Prop_Name", Op: Var("aname")},
445445
{Name: "Prop_TypeNode", Op: Var("atype")},
446-
{Name: "DeclaresParameterPack", Op: Any()},
447-
{Name: "Prop_PointerOperators", Optional: "optPointerOps", Op: Any()},
448446
{Name: "Prop_Initializer", Optional: "optInitializer", Op: Var("ainit")},
449-
{Name: "ExpandedFromMacro", Optional: "optMacro", Op: Any()},
450-
{Name: "Prop_PointerOperators", Optional: "optPointerOps", Op: Any()},
447+
// FIXME(juanjux): save these once we've a way
448+
{Name: "DeclaresParameterPack", Drop: true, Op: Any()},
449+
{Name: "Prop_PointerOperators", Drop: true, Op: Any()},
450+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
451+
{Name: "Prop_PointerOperators", Drop: true, Op: Any()},
451452
},
452453
Fields{
453454
{Name: uast.KeyType, Op: String("CPPASTArrayDeclarator")},
454455
{Name: uast.KeyPos, Op: Var("parampos")},
455456
{Name: "Prop_Name", Op: Var("aname")},
456457
{Name: "Prop_TypeNode", Op: Var("atype")},
457-
{Name: "DeclaresParameterPack", Op: Any()},
458-
{Name: "Prop_ArrayModifiers", Op: Any()},
459458
{Name: "Prop_Initializer", Optional: "optInitializer", Op: Var("ainit")},
460-
{Name: "ExpandedFromMacro", Optional: "optMacro", Op: Any()},
461-
{Name: "Prop_PointerOperators", Optional: "optPointerOps", Op: Any()},
459+
// FIXME(juanjux): save these once we've a way
460+
{Name: "DeclaresParameterPack", Drop: true, Op: Any()},
461+
{Name: "Prop_ArrayModifiers", Drop: true, Op: Any()},
462+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
463+
{Name: "Prop_PointerOperators", Drop: true, Op: Any()},
462464
},
463465
Fields{
464466
{Name: uast.KeyType, Op: String("CPPASTElaboratedTypeSpecifier")},
@@ -476,7 +478,8 @@ var Normalizers = []Mapping{
476478
{Name: "IsVirtual", Op: Any()},
477479
{Name: "IsVolatile", Op: Any()},
478480
{Name: "StorageClass", Op: Any()},
479-
{Name: "ExpandedFromMacro", Optional: "optMacro", Op: Any()},
481+
// FIXME(juanjux): save these once we've a way
482+
{Name: "ExpandedFromMacro", Drop: true, Op: Any()},
480483
},
481484
))},
482485
}},

0 commit comments

Comments
 (0)