Executing the code to know if there is a problem or not is not what I wish for. I really can't do it because in my case the context does not exist. I will try to create a 'fake' context in order to run the code, but I'm not sure it is a good idea..
Chip Norkus wrote: > > On Sun Aug 05, 2007; 12:51PM -0700, Ori wrote: >> >> Hello, >> >> I'm using the following code to compile python code: >> >> SystemState state = new SystemState(); >> MyCompilerSink sink = new MyCompilerSink(); >> CompilerContext context = new CompilerContext(string.Empty, sink); >> Parser parser = Parser.FromString(state, context, "my code"); >> parser.ParseFileInput(); >> >> it works find for finding syntax mistakes - but I also wan to know about >> invalid property names / method names. If for example the code uses the >> expression 'self.Name' I would like to see a compilation error if the >> object >> does not have a 'Name' property. >> > > Because objects are mutable Python by its nature does not resolve > member/property references until they occur within the code. Consider > the following example (which is valid functional Python): > > class foo(object): > setup = False > > f = foo() > > def bar(f): > if f.setup: > f.baz = "hi" > print f.baz > else: > f.setup = True > print "setup" > > bar(f) > bar(f) > > > >> Is there a way to do it? >> >> Thanks, >> Ori >> -- >> View this message in context: >> http://www.nabble.com/Compiler-error-for-invalid-field-access-tf4220967.html#a12007623 >> Sent from the IronPython mailing list archive at Nabble.com. >> >> _______________________________________________ >> Users mailing list >> Users@lists.ironpython.com >> http://lists.ironpython.com/listinfo.cgi/users-ironpython.com >> > -chip > -- > personal: chip norkus; irc: wd; [EMAIL PROTECTED] > info: finger [EMAIL PROTECTED] for plan or keys; http://telekinesis.org > _______________________________________________ > Users mailing list > Users@lists.ironpython.com > http://lists.ironpython.com/listinfo.cgi/users-ironpython.com > > -- View this message in context: http://www.nabble.com/Compiler-error-for-invalid-field-access-tf4220967.html#a12007689 Sent from the IronPython mailing list archive at Nabble.com. _______________________________________________ Users mailing list Users@lists.ironpython.com http://lists.ironpython.com/listinfo.cgi/users-ironpython.com