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

Side by Side Diff: lib/compiler/implementation/native_handler.dart

Issue 10536169: Move frog/tests/{leg,leg_only,frog_native} to tests/compiler/. (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « frog/tests/leg_only/while_test.dart ('k') | tests/compiler/dart2js/dart2js.status » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2012, 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 #library('native'); 5 #library('native');
6 #import('dart:uri'); 6 #import('dart:uri');
7 #import('leg.dart'); 7 #import('leg.dart');
8 #import('elements/elements.dart'); 8 #import('elements/elements.dart');
9 #import('scanner/scannerlib.dart'); 9 #import('scanner/scannerlib.dart');
10 #import('ssa/ssa.dart'); 10 #import('ssa/ssa.dart');
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 const SourceString('defineProperty'))); 69 const SourceString('defineProperty')));
70 world.registerStaticUse(compiler.findHelper( 70 world.registerStaticUse(compiler.findHelper(
71 const SourceString('toStringForNativeObject'))); 71 const SourceString('toStringForNativeObject')));
72 } 72 }
73 } 73 }
74 74
75 void maybeEnableNative(Compiler compiler, 75 void maybeEnableNative(Compiler compiler,
76 LibraryElement library, 76 LibraryElement library,
77 Uri uri) { 77 Uri uri) {
78 String libraryName = uri.toString(); 78 String libraryName = uri.toString();
79 if (library.script.name.contains('dart/frog/tests/frog_native') 79 if (library.script.name.contains('dart/tests/compiler/dart2js_native')
80 || libraryName == 'dart:dom_deprecated' 80 || libraryName == 'dart:dom_deprecated'
81 || libraryName == 'dart:isolate' 81 || libraryName == 'dart:isolate'
82 || libraryName == 'dart:html') { 82 || libraryName == 'dart:html') {
83 library.define(new ForeignElement( 83 library.define(new ForeignElement(
84 const SourceString('native'), library), compiler); 84 const SourceString('native'), library), compiler);
85 library.canUseNative = true; 85 library.canUseNative = true;
86 if (compiler.jsIndexingBehaviorInterface !== null) { 86 if (compiler.jsIndexingBehaviorInterface !== null) {
87 library.define(compiler.jsIndexingBehaviorInterface, compiler); 87 library.define(compiler.jsIndexingBehaviorInterface, compiler);
88 } 88 }
89 } 89 }
90 90
91 // Additionaly, if this is a test, we allow access to foreign functions. 91 // Additionaly, if this is a test, we allow access to foreign functions.
92 if (library.script.name.contains('dart/frog/tests/frog_native')) { 92 if (library.script.name.contains('dart/tests/compiler/dart2js_native')) {
93 library.define(compiler.findHelper(const SourceString('JS')), compiler); 93 library.define(compiler.findHelper(const SourceString('JS')), compiler);
94 } 94 }
95 } 95 }
96 96
97 void checkAllowedLibrary(ElementListener listener, Token token) { 97 void checkAllowedLibrary(ElementListener listener, Token token) {
98 LibraryElement currentLibrary = listener.compilationUnitElement.getLibrary(); 98 LibraryElement currentLibrary = listener.compilationUnitElement.getLibrary();
99 if (!currentLibrary.canUseNative) { 99 if (!currentLibrary.canUseNative) {
100 listener.recoverableError("Unexpected token", token: token); 100 listener.recoverableError("Unexpected token", token: token);
101 } 101 }
102 } 102 }
(...skipping 250 matching lines...) Expand 10 before | Expand all | Expand 10 after
353 String parameters) { 353 String parameters) {
354 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty"); 354 buffer.add(" if (Object.getPrototypeOf(this).hasOwnProperty");
355 buffer.add("('$methodName')) {\n"); 355 buffer.add("('$methodName')) {\n");
356 buffer.add(" $code"); 356 buffer.add(" $code");
357 buffer.add(" } else {\n"); 357 buffer.add(" } else {\n");
358 buffer.add(" return Object.prototype.$methodName.call(this"); 358 buffer.add(" return Object.prototype.$methodName.call(this");
359 buffer.add(parameters == '' ? '' : ', $parameters'); 359 buffer.add(parameters == '' ? '' : ', $parameters');
360 buffer.add(");\n"); 360 buffer.add(");\n");
361 buffer.add(" }\n"); 361 buffer.add(" }\n");
362 } 362 }
OLDNEW
« no previous file with comments | « frog/tests/leg_only/while_test.dart ('k') | tests/compiler/dart2js/dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698