Improve environment #1
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
from smnp.error.function import FunctionNotFoundException
|
||||
from smnp.error.runtime import RuntimeException
|
||||
|
||||
|
||||
@@ -9,6 +10,15 @@ class Environment():
|
||||
self.customFunctions = {}
|
||||
self.callStack = [] #TODO remove
|
||||
|
||||
def invokeFunction(self, name, args):
|
||||
for function in self.functions: # TODO to działa tylko dla wbudowanych funkcji
|
||||
if function.name == name:
|
||||
ret = function.call(self, args)
|
||||
if ret is not None:
|
||||
return ret
|
||||
raise FunctionNotFoundException(name)
|
||||
# TODO raise nie znaleziono funkcji
|
||||
|
||||
def findVariable(self, name, type=None, pos=None):
|
||||
for scope in reversed(self.scopes):
|
||||
if name in scope:
|
||||
|
||||
Reference in New Issue
Block a user