aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xinterpreter.py16
-rw-r--r--test cases/13 pch/builder.txt3
-rw-r--r--test cases/14 cxx pch/builder.txt3
-rw-r--r--test cases/15 mixed pch/builder.txt5
4 files changed, 15 insertions, 12 deletions
diff --git a/interpreter.py b/interpreter.py
index 4f8ff59..981e6a9 100755
--- a/interpreter.py
+++ b/interpreter.py
@@ -153,7 +153,6 @@ class BuildTarget(InterpreterObject):
self.external_deps = []
self.include_dirs = []
self.methods.update({'add_dep': self.add_dep_method,
- 'pch' : self.pch_method,
'add_include_dirs': self.add_include_dirs_method,
'add_compiler_args' : self.add_compiler_args_method,
})
@@ -171,6 +170,10 @@ class BuildTarget(InterpreterObject):
llist = [llist]
for linktarget in llist:
self.link(linktarget)
+ pchlist = kwargs.get('pch', [])
+ if not isinstance(pchlist, list):
+ pchlist = [pchlist]
+ self.add_pch(pchlist)
def get_subdir(self):
return self.subdir
@@ -223,10 +226,8 @@ class BuildTarget(InterpreterObject):
raise InvalidArguments('Link target is not library.')
self.link_targets.append(target)
- def pch_method(self, args):
- if len(args) == 0:
- raise InvalidArguments('Pch requires arguments.')
- for a in args:
+ def add_pch(self, pchlist):
+ for a in pchlist:
self.pch.append(a)
def add_include_dirs_method(self, args):
@@ -593,6 +594,7 @@ class Interpreter():
def assignment(self, node):
var_name = node.var_name
+ print(node.value)
if not isinstance(var_name, nodes.AtomExpression):
raise InvalidArguments('Line %d: Tried to assign value to a non-variable.' % node.lineno())
var_name = var_name.get_value()
@@ -682,7 +684,9 @@ class Interpreter():
raise InvalidCode('You broke me.')
def evaluate_arraystatement(self, cur):
- arguments = self.reduce_arguments(cur.get_args())
+ (arguments, kwargs) = self.reduce_arguments(cur.get_args())
+ if len(kwargs) > 0:
+ raise InvalidCode('Line %d: Keyword arguments are invalid in array construction.' % cur.lineno())
return arguments
if __name__ == '__main__':
diff --git a/test cases/13 pch/builder.txt b/test cases/13 pch/builder.txt
index a95aafb..9632cc5 100644
--- a/test cases/13 pch/builder.txt
+++ b/test cases/13 pch/builder.txt
@@ -1,4 +1,3 @@
project('pch test', 'c')
-exe = executable('prog', 'prog.c')
-exe.pch('pch/prog.h')
+exe = executable('prog', 'prog.c', pch : 'pch/prog.h')
diff --git a/test cases/14 cxx pch/builder.txt b/test cases/14 cxx pch/builder.txt
index e79f137..966979b 100644
--- a/test cases/14 cxx pch/builder.txt
+++ b/test cases/14 cxx pch/builder.txt
@@ -1,3 +1,2 @@
project('c++ pch test', 'cxx')
-exe = executable('prog', 'prog.cc')
-exe.pch('pch/prog.hh')
+exe = executable('prog', 'prog.cc', pch : 'pch/prog.hh')
diff --git a/test cases/15 mixed pch/builder.txt b/test cases/15 mixed pch/builder.txt
index acf9c3b..7438042 100644
--- a/test cases/15 mixed pch/builder.txt
+++ b/test cases/15 mixed pch/builder.txt
@@ -1,4 +1,5 @@
project('mixed C and C++ pch test', 'cxx', 'c')
-exe = executable('prog', 'main.cc', 'func.c')
-exe.pch('pch/main.hh', 'pch/func.h')
+pch = ['pch/main.hh', 'pch/func.h']
+
+exe = executable('prog', 'main.cc', 'func.c', pch : pch)