Chromium Code Reviews| Index: dart/frog/leg/compiler.dart |
| diff --git a/dart/frog/leg/compiler.dart b/dart/frog/leg/compiler.dart |
| index 4f2cca124d263cc5fe6dccbb5b78eb0908152558..5203b9c02e6b5becdc207c68c425104526b24d79 100644 |
| --- a/dart/frog/leg/compiler.dart |
| +++ b/dart/frog/leg/compiler.dart |
| @@ -55,6 +55,13 @@ class Compiler implements DiagnosticListener { |
| LibraryElement mainApp; |
| ClassElement objectClass; |
| ClassElement closureClass; |
| + ClassElement dynamicClass; |
| + ClassElement boolClass; |
| + ClassElement numClass; |
| + ClassElement intClass; |
| + ClassElement doubleClass; |
| + ClassElement stringClass; |
| + ClassElement functionClass; |
| Element get currentElement() => _currentElement; |
| withCurrentElement(Element element, f()) { |
| @@ -86,6 +93,7 @@ class Compiler implements DiagnosticListener { |
| static final SourceString NO_SUCH_METHOD_EXCEPTION = |
| const SourceString('NoSuchMethodException'); |
| static final SourceString OBJECT = const SourceString('Object'); |
| + static final SourceString DYNAMIC = const SourceString('Dynamic'); |
|
ahe
2012/03/19 10:51:57
I think these constants are superfluous. I'll try
ahe
2012/03/19 15:31:09
Done.
|
| static final SourceString START_ROOT_ISOLATE = |
| const SourceString('startRootIsolate'); |
| static final SourceString CLOSURE = const SourceString('Closure'); |
| @@ -187,6 +195,11 @@ class Compiler implements DiagnosticListener { |
| if (uri.toString() == 'dart:isolate') { |
| enableIsolateSupport(library); |
| } |
| + if (dynamicClass !== null) { |
|
ahe
2012/03/19 10:51:57
dynamicClass is null while loading the built-in li
ahe
2012/03/19 15:31:09
Done.
|
| + withCurrentElement(library, () { |
| + library.define(dynamicClass, this); |
| + }); |
| + } |
| } |
| abstract LibraryElement scanBuiltinLibrary(String filename); |
| @@ -196,7 +209,16 @@ class Compiler implements DiagnosticListener { |
| jsHelperLibrary = scanBuiltinLibrary('js_helper.dart'); |
| coreLibrary = scanBuiltinLibrary('core.dart'); |
| objectClass = coreLibrary.find(OBJECT); |
| + boolClass = coreLibrary.find(const SourceString('bool')); |
| + numClass = coreLibrary.find(const SourceString('num')); |
| + intClass = coreLibrary.find(const SourceString('int')); |
| + doubleClass = coreLibrary.find(const SourceString('double')); |
| + stringClass = coreLibrary.find(const SourceString('String')); |
| + functionClass = coreLibrary.find(const SourceString('Function')); |
| + |
| closureClass = jsHelperLibrary.find(CLOSURE); |
| + dynamicClass = new ClassElement(DYNAMIC, coreLibrary); |
|
ngeoffray
2012/03/19 11:48:01
Wy don't we have a 'class Dynamic' in the core lib
ahe
2012/03/19 15:31:09
Done.
|
| + dynamicClass.isResolved = true; |
| // Since coreLibrary import the libraries "coreimpl", and |
| // "js_helper", coreLibrary is null when they are being built. So |
| // we add the implicit import of coreLibrary now. This can be |