mirror of
https://github.com/openappsec/openappsec.git
synced 2025-10-04 05:22:54 +03:00
Apr 27th Update
This commit is contained in:
18
external/graphqlparser/ast/c_impl.py
vendored
18
external/graphqlparser/ast/c_impl.py
vendored
@@ -15,13 +15,13 @@ class Printer(object):
|
||||
self._current_type = None
|
||||
|
||||
def start_file(self):
|
||||
print C_LICENSE_COMMENT + '''/** @generated */
|
||||
print(C_LICENSE_COMMENT + '''/** @generated */
|
||||
|
||||
#include "GraphQLAst.h"
|
||||
#include "../Ast.h"
|
||||
|
||||
using namespace facebook::graphql::ast; // NOLINT
|
||||
'''
|
||||
''')
|
||||
|
||||
def end_file(self):
|
||||
pass
|
||||
@@ -30,23 +30,23 @@ using namespace facebook::graphql::ast; // NOLINT
|
||||
self._current_type = name
|
||||
|
||||
def field(self, type, name, nullable, plural):
|
||||
print field_prototype(self._current_type, type, name, nullable, plural) + ' {'
|
||||
print ' const auto *realNode = reinterpret_cast<const %s *>(node);' % self._current_type
|
||||
print(field_prototype(self._current_type, type, name, nullable, plural) + ' {')
|
||||
print(' const auto *realNode = reinterpret_cast<const %s *>(node);' % self._current_type)
|
||||
title_name = title(name)
|
||||
call_get = 'realNode->get%s()' % title_name
|
||||
if plural:
|
||||
if nullable:
|
||||
print ' return %s ? %s->size() : 0;' % (call_get, call_get)
|
||||
print(' return %s ? %s->size() : 0;' % (call_get, call_get))
|
||||
else:
|
||||
print ' return %s.size();' % call_get
|
||||
print(' return %s.size();' % call_get)
|
||||
else:
|
||||
if type in ['string', 'OperationKind', 'boolean']:
|
||||
print ' return %s;' % call_get
|
||||
print(' return %s;' % call_get)
|
||||
else:
|
||||
fmt = ' return reinterpret_cast<const struct %s *>(%s%s);'
|
||||
print fmt % (struct_name(type), '' if nullable else '&', call_get)
|
||||
print(fmt % (struct_name(type), '' if nullable else '&', call_get))
|
||||
|
||||
print '}'
|
||||
print('}')
|
||||
|
||||
def end_type(self, name):
|
||||
pass
|
||||
|
Reference in New Issue
Block a user