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. > > Is there a way to do it? >
Python does not generate 'compile' errors for these sorts of problems. Python is dynamically typed, so it doesn't know about the type of objects at compile time - instead errors will be generated at runtime. As well as catching errors at compilation (syntax errors) you will also need to catch potential errors where these objects are used. This is the joy and the pain of using a dynamically typed language. All the best, Michael Foord http://www.ironpython.info/ > Thanks, > Ori > _______________________________________________ Users mailing list [email protected] http://lists.ironpython.com/listinfo.cgi/users-ironpython.com
