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

Side by Side Diff: pkg/compiler/lib/src/js_emitter/class_stub_generator.dart

Issue 2809203003: Remove Compiler/JavaScriptBackend from metadata_collector (Closed)
Patch Set: Created 3 years, 8 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
OLDNEW
1 // Copyright (c) 2014, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2014, 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 dart2js.js_emitter.class_stub_generator; 5 library dart2js.js_emitter.class_stub_generator;
6 6
7 import '../common/names.dart' show Identifiers; 7 import '../common/names.dart' show Identifiers;
8 import '../compiler.dart' show Compiler; 8 import '../compiler.dart' show Compiler;
9 import '../elements/entities.dart'; 9 import '../elements/entities.dart';
10 import '../js/js.dart' as jsAst; 10 import '../js/js.dart' as jsAst;
(...skipping 240 matching lines...) Expand 10 before | Expand all | Expand 10 after
251 // Default values for mocked-up test libraries. 251 // Default values for mocked-up test libraries.
252 tearOffAccessExpression = 252 tearOffAccessExpression =
253 js(r'''function() { throw "Helper 'closureFromTearOff' missing." }'''); 253 js(r'''function() { throw "Helper 'closureFromTearOff' missing." }''');
254 tearOffGlobalObjectString = js.string('MissingHelperFunction'); 254 tearOffGlobalObjectString = js.string('MissingHelperFunction');
255 tearOffGlobalObject = js( 255 tearOffGlobalObject = js(
256 r'''(function() { throw "Helper 'closureFromTearOff' missing." })()'''); 256 r'''(function() { throw "Helper 'closureFromTearOff' missing." })()''');
257 } 257 }
258 258
259 jsAst.Statement tearOffGetter; 259 jsAst.Statement tearOffGetter;
260 if (!compiler.options.useContentSecurityPolicy) { 260 if (!compiler.options.useContentSecurityPolicy) {
261 jsAst.Expression tearOffAccessText = 261 jsAst.Expression tearOffAccessText = new jsAst.UnparsedNode(
262 new jsAst.UnparsedNode(tearOffAccessExpression, compiler, false); 262 tearOffAccessExpression, compiler.options, false);
263 tearOffGetter = js.statement( 263 tearOffGetter = js.statement(
264 ''' 264 '''
265 function tearOffGetter(funcs, reflectionInfo, name, isIntercepted) { 265 function tearOffGetter(funcs, reflectionInfo, name, isIntercepted) {
266 return isIntercepted 266 return isIntercepted
267 ? new Function("funcs", "reflectionInfo", "name", 267 ? new Function("funcs", "reflectionInfo", "name",
268 #tearOffGlobalObjectString, "c", 268 #tearOffGlobalObjectString, "c",
269 "return function tearOff_" + name + (functionCounter++) + "(x) {" + 269 "return function tearOff_" + name + (functionCounter++) + "(x) {" +
270 "if (c === null) c = " + #tearOffAccessText + "(" + 270 "if (c === null) c = " + #tearOffAccessText + "(" +
271 "this, funcs, reflectionInfo, false, [x], name);" + 271 "this, funcs, reflectionInfo, false, [x], name);" +
272 "return new c(this, funcs[0], x, name);" + 272 "return new c(this, funcs[0], x, name);" +
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after
313 if (cache === void 0) cache = #tearOff( 313 if (cache === void 0) cache = #tearOff(
314 this, funcs, reflectionInfo, true, [], name).prototype; 314 this, funcs, reflectionInfo, true, [], name).prototype;
315 return cache; 315 return cache;
316 } 316 }
317 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted); 317 : tearOffGetter(funcs, reflectionInfo, name, isIntercepted);
318 }''', 318 }''',
319 {'tearOff': tearOffAccessExpression}); 319 {'tearOff': tearOffAccessExpression});
320 320
321 return <jsAst.Statement>[tearOffGetter, tearOff]; 321 return <jsAst.Statement>[tearOffGetter, tearOff];
322 } 322 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698