Changeset 16
- Timestamp:
- 10/28/05 14:31:05 (3 years ago)
- Files:
-
- jsolait/trunk/jsolait/jsolait.js (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
jsolait/trunk/jsolait/jsolait.js
r15 r16 273 273 if(this.trace){ 274 274 if(this.trace.toTraceString){ 275 s+= '\n\n'+ this.trace.toTraceString(indent + 8);275 s+=('\n\nbecause:\n'+ this.trace.toTraceString(indent + 4)); 276 276 }else{ 277 s+=(this.trace +'\n').indent(indent );277 s+=(this.trace +'\n').indent(indent+4); 278 278 } 279 279 } … … 407 407 **/ 408 408 publ.__init__=function(sourceURI, trace){ 409 supr.__init__.call(this, "Failed to load file: '%s'".format(sourceURI ), trace);409 supr.__init__.call(this, "Failed to load file: '%s'".format(sourceURI.indent(2)), trace); 410 410 this.sourceURI = sourceURI; 411 411 }; … … 457 457 458 458 try{//interpret the script 459 var srcURI = src.__sourceURI__; 459 460 src = 'Module.currentURI="%s";\n%s\nModule.currentURI=null;\n'.format(src.__sourceURI__.replace(/\\/g, '\\\\'), src); 460 461 var f=new Function("",src); //todo should it use globalEval ? 461 462 f(); 462 463 }catch(e){ 463 throw new mod.ImportFailed(name, [src .__sourceURI__], e);464 throw new mod.ImportFailed(name, [srcURI], e); 464 465 } 465 466 … … 480 481 **/ 481 482 publ.__init__=function(moduleName, moduleURIs, trace){ 482 supr.__init__.call(this, "Failed to import module: '%s' from:\n%s".format(moduleName, moduleURIs.join(',\n') ), trace);483 supr.__init__.call(this, "Failed to import module: '%s' from:\n%s".format(moduleName, moduleURIs.join(',\n').indent(2)), trace); 483 484 this.moduleName = moduleName; 484 485 this.moduleURIs = moduleURIs; … … 755 756 var s=this.split('\n'); 756 757 for(var i=0;i<s.length;i++){ 757 var pr=''; 758 for(var k=0;k<indent;k++){ 759 pr +=' '; 760 } 761 out.push(pr + s[i]); 758 out.push(' '.mul(indent) + s[i]); 762 759 } 763 760 return out.join('\n'); 764 761 }; 762 763 String.prototype.mul=function(l){ 764 var a=new Array(l+1); 765 return a.join(this); 766 } 765 767 766 768 ///Tests the module. … … 770 772 }); 771 773 772
