@@ -280,83 +280,3 @@ parser.yy.parseError = (message, {token}) ->
280280  #  from the lexer.
281281  helpers .throwSyntaxError  " unexpected #{ errorText} " 
282282
283- #  Based on http://v8.googlecode.com/svn/branches/bleeding_edge/src/messages.js
284- #  Modified to handle sourceMap
285- formatSourcePosition  =  (frame , getSourceMapping ) -> 
286-   fileName  =  undefined 
287-   fileLocation  =  ' ' 
288- 
289-   if  frame .isNative ()
290-     fileLocation  =  " native" 
291-   else 
292-     if  frame .isEval ()
293-       fileName  =  frame .getScriptNameOrSourceURL ()
294-       fileLocation  =  " #{ frame .getEvalOrigin ()} " unless  fileName
295-     else 
296-       fileName  =  frame .getFileName ()
297- 
298-     fileName  or=  " <anonymous>" 
299- 
300-     line  =  frame .getLineNumber ()
301-     column  =  frame .getColumnNumber ()
302- 
303-     #  Check for a sourceMap position
304-     source  =  getSourceMapping  fileName, line, column
305-     fileLocation  = 
306-       if  source
307-         " #{ fileName} #{ source[0 ]} #{ source[1 ]} " 
308-       else 
309-         " #{ fileName} #{ line} #{ column} " 
310- 
311-   functionName  =  frame .getFunctionName ()
312-   isConstructor  =  frame .isConstructor ()
313-   isMethodCall  =  not  (frame .isToplevel () or  isConstructor)
314- 
315-   if  isMethodCall
316-     methodName  =  frame .getMethodName ()
317-     typeName  =  frame .getTypeName ()
318- 
319-     if  functionName
320-       tp  =  as  =  ' ' 
321-       if  typeName and  functionName .indexOf  typeName
322-         tp  =  " #{ typeName} " 
323-       if  methodName and  functionName .indexOf (" .#{ methodName} " isnt  functionName .length  -  methodName .length  -  1 
324-         as  =  "  [as #{ methodName} " 
325- 
326-       " #{ tp}#{ functionName}#{ as } #{ fileLocation} " 
327-     else 
328-       " #{ typeName} #{ methodName or  ' <anonymous>' } #{ fileLocation} " 
329-   else  if  isConstructor
330-     " new #{ functionName or  ' <anonymous>' } #{ fileLocation} " 
331-   else  if  functionName
332-     " #{ functionName} #{ fileLocation} " 
333-   else 
334-     fileLocation
335- 
336- #  Map of filenames -> sourceMap object.
337- sourceMaps  =  {}
338- 
339- #  Generates the source map for a coffee file and stores it in the local cache variable.
340- getSourceMap  =  (filename ) -> 
341-   return  sourceMaps[filename] if  sourceMaps[filename]
342-   for  ext in  exports .FILE_EXTENSIONS 
343-     if  helpers .ends  filename, ext
344-       answer  =  exports ._compileFile  filename, true 
345-       return  sourceMaps[filename] =  answer .sourceMap 
346-   return  null 
347- 
348- #  Based on [michaelficarra/CoffeeScriptRedux](http://goo.gl/ZTx1p)
349- #  NodeJS / V8 have no support for transforming positions in stack traces using
350- #  sourceMap, so we must monkey-patch Error to display CoffeeScript source
351- #  positions.
352- Error .prepareStackTrace  =  (err , stack ) -> 
353-   getSourceMapping  =  (filename , line , column ) -> 
354-     sourceMap  =  getSourceMap  filename
355-     answer  =  sourceMap .sourceLocation  [line -  1 , column -  1 ] if  sourceMap
356-     if  answer then  [answer[0 ] +  1 , answer[1 ] +  1 ] else  null 
357- 
358-   frames  =  for  frame in  stack
359-     break  if  frame .getFunction () is  exports .run 
360-     "   at #{ formatSourcePosition  frame, getSourceMapping} " 
361- 
362-   " #{ err .toString ()} \n #{ frames .join  ' \n ' } \n " 
0 commit comments