| Index: pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
|
| diff --git a/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart b/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
|
| index fd31671ca100fa0f19435a7730c71d68fbac108f..ae053a198240ea4c5c64582a17befe21e4e12937 100644
|
| --- a/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
|
| +++ b/pkg/compiler/lib/src/js_emitter/old_emitter/reflection_data_parser.dart
|
| @@ -454,91 +454,6 @@ function $parseReflectionDataName(reflectionData) {
|
| 'needsStructuredMemberInfo': oldEmitter.needsStructuredMemberInfo});
|
| }
|
|
|
| -
|
| -List<jsAst.Statement> buildTearOffCode(JavaScriptBackend backend) {
|
| - Namer namer = backend.namer;
|
| - Compiler compiler = backend.compiler;
|
| -
|
| - Element closureFromTearOff = backend.findHelper('closureFromTearOff');
|
| - String tearOffAccessText;
|
| - jsAst.Expression tearOffAccessExpression;
|
| - String tearOffGlobalObjectName;
|
| - String tearOffGlobalObject;
|
| - if (closureFromTearOff != null) {
|
| - // We need both the AST that references [closureFromTearOff] and a string
|
| - // for the NoCsp version that constructs a function.
|
| - tearOffAccessExpression =
|
| - backend.emitter.staticFunctionAccess(closureFromTearOff);
|
| - tearOffAccessText =
|
| - jsAst.prettyPrint(tearOffAccessExpression, compiler).getText();
|
| - tearOffGlobalObjectName = tearOffGlobalObject =
|
| - namer.globalObjectFor(closureFromTearOff);
|
| - } else {
|
| - // Default values for mocked-up test libraries.
|
| - tearOffAccessText =
|
| - r'''function() { throw 'Helper \'closureFromTearOff\' missing.' }''';
|
| - tearOffAccessExpression = js(tearOffAccessText);
|
| - tearOffGlobalObjectName = 'MissingHelperFunction';
|
| - tearOffGlobalObject = '($tearOffAccessText())';
|
| - }
|
| -
|
| - jsAst.Statement tearOffGetter;
|
| - if (!compiler.useContentSecurityPolicy) {
|
| - // This template is uncached because it is constructed from code fragments
|
| - // that can change from compilation to compilation. Some of these could be
|
| - // avoided, except for the string literals that contain the compiled access
|
| - // path to 'closureFromTearOff'.
|
| - tearOffGetter = js.uncachedStatementTemplate('''
|
| - function tearOffGetter(funcs, reflectionInfo, name, isIntercepted) {
|
| - return isIntercepted
|
| - ? new Function("funcs", "reflectionInfo", "name",
|
| - "$tearOffGlobalObjectName", "c",
|
| - "return function tearOff_" + name + (functionCounter++)+ "(x) {" +
|
| - "if (c === null) c = $tearOffAccessText(" +
|
| - "this, funcs, reflectionInfo, false, [x], name);" +
|
| - "return new c(this, funcs[0], x, name);" +
|
| - "}")(funcs, reflectionInfo, name, $tearOffGlobalObject, null)
|
| - : new Function("funcs", "reflectionInfo", "name",
|
| - "$tearOffGlobalObjectName", "c",
|
| - "return function tearOff_" + name + (functionCounter++)+ "() {" +
|
| - "if (c === null) c = $tearOffAccessText(" +
|
| - "this, funcs, reflectionInfo, false, [], name);" +
|
| - "return new c(this, funcs[0], null, name);" +
|
| - "}")(funcs, reflectionInfo, name, $tearOffGlobalObject, null);
|
| - }''').instantiate([]);
|
| - } else {
|
| - tearOffGetter = js.statement('''
|
| - function tearOffGetter(funcs, reflectionInfo, name, isIntercepted) {
|
| - var cache = null;
|
| - return isIntercepted
|
| - ? function(x) {
|
| - if (cache === null) cache = #(
|
| - this, funcs, reflectionInfo, false, [x], name);
|
| - return new cache(this, funcs[0], x, name);
|
| - }
|
| - : function() {
|
| - if (cache === null) cache = #(
|
| - this, funcs, reflectionInfo, false, [], name);
|
| - return new cache(this, funcs[0], null, name);
|
| - };
|
| - }''', [tearOffAccessExpression, tearOffAccessExpression]);
|
| - }
|
| -
|
| - jsAst.Statement tearOff = js.statement('''
|
| - function tearOff(funcs, reflectionInfo, isStatic, name, isIntercepted) {
|
| - var cache;
|
| - return isStatic
|
| - ? function() {
|
| - if (cache === void 0) cache = #tearOff(
|
| - this, funcs, reflectionInfo, true, [], name).prototype;
|
| - return cache;
|
| - }
|
| - : tearOffGetter(funcs, reflectionInfo, name, isIntercepted);
|
| - }''', {'tearOff': tearOffAccessExpression});
|
| -
|
| - return <jsAst.Statement>[tearOffGetter, tearOff];
|
| -}
|
| -
|
| String readString(String array, String index) {
|
| return readChecked(
|
| array, index, 'result != null && typeof result != "string"', 'string');
|
|
|