Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(311)

Unified Diff: lib/compiler/implementation/compiler.dart

Issue 10867011: Deal with the JS helper separately from the 'native' keyword. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | lib/compiler/implementation/leg.dart » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: lib/compiler/implementation/compiler.dart
diff --git a/lib/compiler/implementation/compiler.dart b/lib/compiler/implementation/compiler.dart
index e17e661538d1e27f260fd11c35ca130b636c82b6..c9cea3c756ded4eaab1a287e17bd56525c34ceb7 100644
--- a/lib/compiler/implementation/compiler.dart
+++ b/lib/compiler/implementation/compiler.dart
@@ -525,9 +525,27 @@ class Compiler implements DiagnosticListener {
const SourceString('DART_CLOSURE_TO_JS'), library), this);
}
+ /** Enable the 'JS' helper for a library if needed. */
+ void maybeEnableJSHelper(library) {
+ String libraryName = library.uri.toString();
+ if (library.entryCompilationUnit.script.name.contains(
+ 'dart/tests/compiler/dart2js_native')
+ || libraryName == 'dart:isolate'
+ || libraryName == 'dart:math'
+ || libraryName == 'dart:html') {
+ library.addToScope(findHelper(const SourceString('JS')), this);
+ if (jsIndexingBehaviorInterface !== null) {
+ library.addToScope(jsIndexingBehaviorInterface, this);
+ }
+ }
+ }
+
void runCompiler(Uri uri) {
scanBuiltinLibraries();
mainApp = scanner.loadLibrary(uri, null, uri);
+ libraries.forEach((_, library) {
+ maybeEnableJSHelper(library);
+ });
final Element main = mainApp.find(MAIN);
if (main === null) {
reportFatalError('Could not find $MAIN', mainApp);
« no previous file with comments | « no previous file | lib/compiler/implementation/leg.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698