Merge pull request #865 from centricular/test-project-lang-arrays

Test arrays in languages for the project() method
pull/852/head
Jussi Pakkanen 8 years ago committed by GitHub
commit 7ecdf59130
  1. 22
      mesonbuild/interpreter.py
  2. 5
      test cases/common/1 trivial/meson.build

@ -1129,6 +1129,12 @@ class Interpreter():
self.sanity_check_ast() self.sanity_check_ast()
self.variables = {} self.variables = {}
self.builtin = {} self.builtin = {}
self.generators = []
self.visited_subdirs = {}
self.global_args_frozen = False
self.subprojects = {}
self.subproject_stack = []
self.build_func_dict()
self.parse_project() self.parse_project()
self.builtin['build_machine'] = BuildMachine(self.coredata.compilers) self.builtin['build_machine'] = BuildMachine(self.coredata.compilers)
if not self.build.environment.is_cross_build(): if not self.build.environment.is_cross_build():
@ -1145,13 +1151,7 @@ class Interpreter():
else: else:
self.builtin['target_machine'] = self.builtin['host_machine'] self.builtin['target_machine'] = self.builtin['host_machine']
self.builtin['meson'] = MesonMain(build, self) self.builtin['meson'] = MesonMain(build, self)
self.build_func_dict()
self.build_def_files = [os.path.join(self.subdir, environment.build_filename)] self.build_def_files = [os.path.join(self.subdir, environment.build_filename)]
self.generators = []
self.visited_subdirs = {}
self.global_args_frozen = False
self.subprojects = {}
self.subproject_stack = []
def build_func_dict(self): def build_func_dict(self):
self.funcs = {'project' : self.func_project, self.funcs = {'project' : self.func_project,
@ -1203,9 +1203,7 @@ class Interpreter():
Parses project() and initializes languages, compilers etc. Do this Parses project() and initializes languages, compilers etc. Do this
early because we need this before we parse the rest of the AST. early because we need this before we parse the rest of the AST.
""" """
project = self.ast.lines[0] self.evaluate_codeblock(self.ast, end=1)
args, kwargs = self.reduce_arguments(project.args)
self.func_project(project, args, kwargs)
def module_method_callback(self, invalues): def module_method_callback(self, invalues):
unwrap_single = False unwrap_single = False
@ -1282,7 +1280,7 @@ class Interpreter():
self.evaluate_codeblock(self.ast, start=1) self.evaluate_codeblock(self.ast, start=1)
mlog.log('Build targets in project:', mlog.bold(str(len(self.build.targets)))) mlog.log('Build targets in project:', mlog.bold(str(len(self.build.targets))))
def evaluate_codeblock(self, node, start=0): def evaluate_codeblock(self, node, start=0, end=None):
if node is None: if node is None:
return return
if not isinstance(node, mparser.CodeBlockNode): if not isinstance(node, mparser.CodeBlockNode):
@ -1290,8 +1288,8 @@ class Interpreter():
e.lineno = node.lineno e.lineno = node.lineno
e.colno = node.colno e.colno = node.colno
raise e raise e
statements = node.lines statements = node.lines[start:end]
i = start i = 0
while i < len(statements): while i < len(statements):
cur = statements[i] cur = statements[i]
try: try:

@ -1,5 +1,8 @@
# Comment on the first line # Comment on the first line
project('trivial test', 'c', meson_version : '>=0.27.0') project('trivial test',
# Comment inside a function call + array for language list
['c'],
meson_version : '>=0.27.0')
#this is a comment #this is a comment
sources = 'trivial.c' sources = 'trivial.c'

Loading…
Cancel
Save