(self, code, sourceContextCookie, startLineNumber, bWantResult, flags)
| 313 | return self.ApplyInScriptedSection(codeBlock, function, args) |
| 314 | |
| 315 | def DoParseScriptText(self, code, sourceContextCookie, startLineNumber, bWantResult, flags): |
| 316 | code = framework.RemoveCR(code) + "\n" |
| 317 | if flags & SCRIPTTEXT_ISEXPRESSION: |
| 318 | name = "Script Expression" |
| 319 | exec_type = "eval" |
| 320 | else: |
| 321 | name = "Script Block" |
| 322 | exec_type = "exec" |
| 323 | num = self._GetNextCodeBlockNumber() |
| 324 | if num==1: num="" |
| 325 | name = "%s %s" % (name, num) |
| 326 | codeBlock = AXScriptCodeBlock(name, code, sourceContextCookie, startLineNumber, flags) |
| 327 | self._AddScriptCodeBlock(codeBlock) |
| 328 | globs = self.globalNameSpaceModule.__dict__ |
| 329 | if bWantResult: # always immediate. |
| 330 | if self.CompileInScriptedSection(codeBlock, exec_type): |
| 331 | if flags & SCRIPTTEXT_ISEXPRESSION: |
| 332 | return self.EvalInScriptedSection(codeBlock, globs) |
| 333 | else: |
| 334 | return self.ExecInScriptedSection(codeBlock, globs) |
| 335 | |
| 336 | # else compile failed, but user chose to keep running... |
| 337 | else: |
| 338 | if flags & SCRIPTTEXT_FORCEEXECUTION: |
| 339 | if self.CompileInScriptedSection(codeBlock, exec_type): |
| 340 | self.ExecInScriptedSection(codeBlock, globs) |
| 341 | else: |
| 342 | self.codeBlocks.append(codeBlock) |
| 343 | |
| 344 | def GetNamedItemClass(self): |
| 345 | return ScriptItem |
no test coverage detected