Skip to content

Commit

Permalink
info about importing libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
sam-mccall committed May 7, 2012
1 parent d112d0c commit 9348ddc
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 0 deletions.
11 changes: 11 additions & 0 deletions README.md
Expand Up @@ -37,6 +37,17 @@ environment variables DART_SOURCES and DART_SDK.

# Limitations and workarounds

## You can't import libraries

>> #import('mylib.dart');
Exception: 'console_declaration_3': Error: line 3 pos 1: unexpected token '#import'

Workaround: `dart:io` is already loaded under the prefix `io`.

Workaround: edit lib/sandbox.dart and add your imports to `_BASE`

This is easy to fix, I just haven't done it yet...

## You can't "overwrite" a declared name.

>> foo() => 1;
Expand Down
7 changes: 7 additions & 0 deletions test/test_sandbox.dart
Expand Up @@ -88,4 +88,11 @@ get TESTS() => {
sandbox.execute('foo();');
Expect.equals(42, sandbox.eval('bar()'));
}),

'importFails': test((sandbox) { // Documented issue
Expect.throws(() => sandbox.import('bar.dart'));
}),
'ioAvailable': test((sandbox) { // Documented workaround
Expect.isNotNull(sandbox.eval('io.stdout'));
}),
};

0 comments on commit 9348ddc

Please sign in to comment.