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

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

Issue 2424553002: Fix custom elements in startup emitter (Closed)
Patch Set: Created 4 years, 2 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
« no previous file with comments | « no previous file | tests/co19/co19-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) 2015, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2015, 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 part of dart2js.js_emitter.startup_emitter.model_emitter; 5 part of dart2js.js_emitter.startup_emitter.model_emitter;
6 6
7 /// The name of the property that stores the tear-off getter on a static 7 /// The name of the property that stores the tear-off getter on a static
8 /// function. 8 /// function.
9 /// 9 ///
10 /// This property is only used when isolates are used. 10 /// This property is only used when isolates are used.
(...skipping 1315 matching lines...) Expand 10 before | Expand all | Expand 10 after
1326 function (s) { 1326 function (s) {
1327 var o = {}; 1327 var o = {};
1328 o[s] = 1; 1328 o[s] = 1;
1329 return Object.keys(convertToFastObject(o))[0]; 1329 return Object.keys(convertToFastObject(o))[0];
1330 }""", 1330 }""",
1331 []))); 1331 [])));
1332 } 1332 }
1333 1333
1334 Map<String, js.Expression> interceptorsByTag = <String, js.Expression>{}; 1334 Map<String, js.Expression> interceptorsByTag = <String, js.Expression>{};
1335 Map<String, js.Expression> leafTags = <String, js.Expression>{}; 1335 Map<String, js.Expression> leafTags = <String, js.Expression>{};
1336 js.Statement subclassAssignment = new js.EmptyStatement(); 1336 List<js.Statement> subclassAssignments = <js.Statement>[];
1337 1337
1338 for (Library library in fragment.libraries) { 1338 for (Library library in fragment.libraries) {
1339 for (Class cls in library.classes) { 1339 for (Class cls in library.classes) {
1340 if (cls.nativeLeafTags != null) { 1340 if (cls.nativeLeafTags != null) {
1341 for (String tag in cls.nativeLeafTags) { 1341 for (String tag in cls.nativeLeafTags) {
1342 interceptorsByTag[tag] = classReference(cls); 1342 interceptorsByTag[tag] = classReference(cls);
1343 leafTags[tag] = new js.LiteralBool(true); 1343 leafTags[tag] = new js.LiteralBool(true);
1344 } 1344 }
1345 } 1345 }
1346 if (cls.nativeNonLeafTags != null) { 1346 if (cls.nativeNonLeafTags != null) {
1347 for (String tag in cls.nativeNonLeafTags) { 1347 for (String tag in cls.nativeNonLeafTags) {
1348 interceptorsByTag[tag] = classReference(cls); 1348 interceptorsByTag[tag] = classReference(cls);
1349 leafTags[tag] = new js.LiteralBool(false); 1349 leafTags[tag] = new js.LiteralBool(false);
1350 } 1350 }
1351 if (cls.nativeExtensions != null) { 1351 if (cls.nativeExtensions != null) {
1352 List<Class> subclasses = cls.nativeExtensions; 1352 List<Class> subclasses = cls.nativeExtensions;
1353 js.Expression value = js.string(cls.nativeNonLeafTags[0]); 1353 js.Expression base = js.string(cls.nativeNonLeafTags[0]);
1354
1354 for (Class subclass in subclasses) { 1355 for (Class subclass in subclasses) {
1355 value = js.js('#.# = #', [ 1356 subclassAssignments.add(js.js.statement('#.# = #;', [
1356 classReference(subclass), 1357 classReference(subclass),
1357 NATIVE_SUPERCLASS_TAG_NAME, 1358 NATIVE_SUPERCLASS_TAG_NAME,
1358 js.string(cls.nativeNonLeafTags[0]) 1359 base
1359 ]); 1360 ]));
1360 } 1361 }
1361 subclassAssignment = new js.ExpressionStatement(value);
1362 } 1362 }
1363 } 1363 }
1364 } 1364 }
1365 } 1365 }
1366 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);", 1366 statements.add(js.js.statement("setOrUpdateInterceptorsByTag(#);",
1367 js.objectLiteral(interceptorsByTag))); 1367 js.objectLiteral(interceptorsByTag)));
1368 statements.add( 1368 statements.add(
1369 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags))); 1369 js.js.statement("setOrUpdateLeafTags(#);", js.objectLiteral(leafTags)));
1370 statements.add(subclassAssignment); 1370 statements.addAll(subclassAssignments);
1371 1371
1372 return new js.Block(statements); 1372 return new js.Block(statements);
1373 } 1373 }
1374 } 1374 }
OLDNEW
« no previous file with comments | « no previous file | tests/co19/co19-dart2js.status » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698