20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
|
# File 'lib/traceur_compiler.rb', line 20
def self.context
return @context unless @context.nil?
@context = ExecJS.compile(contents)
@context.exec " console = {\n error: function () { },\n log: function () { }\n };\n stubs\n @context.exec <<-compile\n compile = function (contents, options) {\n for (var key in options) {\n traceur.options[key] = options[key];\n }\n\n var project = new traceur.semantics.symbols.Project(''),\n reporter = new traceur.util.ErrorReporter();\n reporter.reportMessageInternal = function (location, format, args) {\n throw new Error(traceur.util.ErrorReporter.format(location, format, args));\n };\n\n project.addFile(new traceur.syntax.SourceFile('unknown', contents));\n var response = traceur.codegeneration.Compiler.compile(reporter, project, false);\n return traceur.outputgeneration.ProjectWriter.write(response, {});\n }\n compile\n @context\nend\n"
|