Skip to content

Commit

Permalink
Compiler#source_map takes an optional source_file reference
Browse files Browse the repository at this point in the history
  • Loading branch information
adambeynon committed Oct 30, 2013
1 parent 2c8c27d commit 33d698c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions lib/opal/compiler.rb
Expand Up @@ -78,22 +78,22 @@ def compile(source, options = {})
@result = @fragments.map(&:code).join('')
end

def source_map
Opal::SourceMap.new(@fragments, '(file)')
def source_map(source_file = nil)
Opal::SourceMap.new(@fragments, source_file || self.file)
end

# This is called when a parsing/processing error occurs. This
# method simply appends the filename and curent line number onto
# the message and raises it.
def error(msg)
raise SyntaxError, "#{msg} :#{@file}:#{@line}"
raise SyntaxError, "#{msg} :#{file}:#{@line}"
end

# This is called when a parsing/processing warning occurs. This
# method simply appends the filename and curent line number onto
# the message and issues a warning.
def warning(msg)
warn "#{msg} :#{@file}:#{@line}"
warn "#{msg} :#{file}:#{@line}"
end

# Instances of `Scope` can use this to determine the current
Expand Down

0 comments on commit 33d698c

Please sign in to comment.