OLD | NEW |
---|---|
(Empty) | |
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 | |
3 // BSD-style license that can be found in the LICENSE file. | |
4 | |
5 #library('repl'); | |
6 #import('node.dart'); | |
7 | |
8 typedef void ReplEvalCallback(var ignore, var result); | |
9 typedef void ReplEvalFunction(String cmd, ReplEvalCallback callback); | |
10 | |
11 class repl native "require('repl')" { | |
Jennifer Messerly
2012/01/21 01:00:31
interesting :)
this gives us a JS REPL, I presume?
| |
12 static REPLServer start([String prompt, ReadWriteStream stream, | |
13 ReplEvalFunction evalFn, bool useGlobal, bool ignoreUndefined]) native; | |
14 static REPLServer startStdio([String prompt, ReplEvalFunction evalFn, | |
15 bool useGlobal, bool ignoreUndefined]) | |
16 native "return this.start(prompt, evalFn, useGlobal, ignoreUndefined);"; | |
17 static bool disableColors; | |
18 } | |
19 | |
20 class REPLServer native 'repl.REPLServer'{ | |
21 REPLServerMap get context() => new REPLServerMap(this); | |
22 } | |
23 | |
24 class REPLServerMap { | |
25 REPLServer _server; | |
26 const REPLServerMap(this._server); | |
27 void operator[]=(String key, var value) native | |
28 "this._server.context[key] = value;"; | |
29 var operator[](String key) native "return this._server.context[key];"; | |
30 } | |
OLD | NEW |