| OLD | NEW |
| 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file | 1 // Copyright (c) 2011, the Dart project authors. Please see the AUTHORS file |
| 2 // for details. All rights reserved. Use of this source code is governed by a | 2 // for details. All rights reserved. Use of this source code is governed by a |
| 3 // BSD-style license that can be found in the LICENSE file. | 3 // BSD-style license that can be found in the LICENSE file. |
| 4 | 4 |
| 5 | 5 |
| 6 #import('file_system.dart'); | 6 #import('file_system.dart'); |
| 7 #import('lang.dart'); | 7 #import('lang.dart'); |
| 8 | 8 |
| 9 interface JsEvaluator { | 9 interface JsEvaluator { |
| 10 var eval(String source); | 10 var eval(String source); |
| 11 } | 11 } |
| 12 | 12 |
| 13 class Evaluator { | 13 class Evaluator { |
| 14 JsEvaluator _jsEvaluator; | 14 JsEvaluator _jsEvaluator; |
| 15 static Set<String> _marked; | 15 static Set<String> _marked; |
| 16 Library _lib; | 16 Library _lib; |
| 17 | 17 |
| 18 static void initWorld(String homedir, List<String> args, FileSystem files) { | 18 static void initWorld(String homedir, List<String> args, FileSystem files) { |
| 19 parseOptions(homedir, args, files); | 19 parseOptions(homedir, args, files); |
| 20 initializeWorld(files); | 20 initializeWorld(files); |
| 21 world.process(); | 21 world.process(); |
| 22 world.resolveAll(); | 22 world.resolveAll(); |
| 23 | 23 |
| 24 _marked = new Set(); | 24 _marked = new Set(); |
| 25 | 25 |
| 26 world.gen = new WorldGenerator(null, new CodeWriter()); | 26 world.gen = new WorldGenerator(null, new CodeWriter()); |
| 27 _markAllUsed(world.corelib); | 27 _markAllUsed(world.corelib); |
| 28 world.gen.writeTypes(world.coreimpl); | 28 world.gen.writeTypes(world.coreimpl); |
| 29 world.gen.writeTypes(world.corelib); | 29 world.gen.writeTypes(world.corelib); |
| 30 world.gen.writeGlobals(); |
| 30 | 31 |
| 31 // Set these here so that we can compile the corelib without its errors | 32 // Set these here so that we can compile the corelib without its errors |
| 32 // killing us | 33 // killing us |
| 33 options.throwOnErrors = true; | 34 options.throwOnErrors = true; |
| 34 options.throwOnFatal = true; | 35 options.throwOnFatal = true; |
| 35 } | 36 } |
| 36 | 37 |
| 37 // TODO(jimhug): Should be calling world.genMethod - but I'm scared to | 38 // TODO(jimhug): Should be calling world.genMethod - but I'm scared to |
| 38 // make the change myself because we don't have any test coverage here. | 39 // make the change myself because we don't have any test coverage here. |
| 39 static void _markMethodUsed(Member m) { | 40 static void _markMethodUsed(Member m) { |
| (...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 145 gen.writeType(type); | 146 gen.writeType(type); |
| 146 code = gen.writer.text; | 147 code = gen.writer.text; |
| 147 } else { | 148 } else { |
| 148 parsed.visit(methGen); | 149 parsed.visit(methGen); |
| 149 code = methGen.writer.text; | 150 code = methGen.writer.text; |
| 150 } | 151 } |
| 151 | 152 |
| 152 return this._jsEvaluator.eval(code); | 153 return this._jsEvaluator.eval(code); |
| 153 } | 154 } |
| 154 } | 155 } |
| OLD | NEW |