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

Side by Side Diff: pkg/compiler/lib/src/closure.dart

Issue 2981673002: Register created closure class with the world. (Closed)
Patch Set: . Created 3 years, 5 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 | pkg/compiler/lib/src/js_model/closure.dart » ('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 import 'common/names.dart' show Identifiers; 5 import 'common/names.dart' show Identifiers;
6 import 'common/resolution.dart' show ParsingContext, Resolution; 6 import 'common/resolution.dart' show ParsingContext, Resolution;
7 import 'common/tasks.dart' show CompilerTask, Measurer; 7 import 'common/tasks.dart' show CompilerTask, Measurer;
8 import 'common.dart'; 8 import 'common.dart';
9 import 'compiler.dart' show Compiler; 9 import 'compiler.dart' show Compiler;
10 import 'constants/expressions.dart'; 10 import 'constants/expressions.dart';
(...skipping 1360 matching lines...) Expand 10 before | Expand all | Expand 10 after
1371 } 1371 }
1372 1372
1373 JavaScriptBackend get backend => compiler.backend; 1373 JavaScriptBackend get backend => compiler.backend;
1374 1374
1375 ClosureClassMap globalizeClosure( 1375 ClosureClassMap globalizeClosure(
1376 FunctionExpression node, LocalFunctionElement element) { 1376 FunctionExpression node, LocalFunctionElement element) {
1377 String closureName = computeClosureName(element); 1377 String closureName = computeClosureName(element);
1378 ClosureClassElement globalizedElement = 1378 ClosureClassElement globalizedElement =
1379 new ClosureClassElement(node, closureName, compiler, element); 1379 new ClosureClassElement(node, closureName, compiler, element);
1380 // Extend [globalizedElement] as an instantiated class in the closed world. 1380 // Extend [globalizedElement] as an instantiated class in the closed world.
1381 closedWorldRefiner.registerClosureClass(globalizedElement); 1381 closedWorldRefiner.registerClosureClass(globalizedElement, false);
1382 MethodElement callElement = new SynthesizedCallMethodElementX( 1382 MethodElement callElement = new SynthesizedCallMethodElementX(
1383 Identifiers.call, element, globalizedElement, node, elements); 1383 Identifiers.call, element, globalizedElement, node, elements);
1384 backend.mirrorsDataBuilder.maybeMarkClosureAsNeededForReflection( 1384 backend.mirrorsDataBuilder.maybeMarkClosureAsNeededForReflection(
1385 globalizedElement, callElement, element); 1385 globalizedElement, callElement, element);
1386 MemberElement enclosing = element.memberContext; 1386 MemberElement enclosing = element.memberContext;
1387 enclosing.nestedClosures.add(callElement); 1387 enclosing.nestedClosures.add(callElement);
1388 globalizedElement.addMember(callElement, reporter); 1388 globalizedElement.addMember(callElement, reporter);
1389 globalizedElement.computeAllClassMembers(compiler.resolution); 1389 globalizedElement.computeAllClassMembers(compiler.resolution);
1390 // The nested function's 'this' is the same as the one for the outer 1390 // The nested function's 'this' is the same as the one for the outer
1391 // function. It could be [null] if we are inside a static method. 1391 // function. It could be [null] if we are inside a static method.
(...skipping 148 matching lines...) Expand 10 before | Expand all | Expand 10 after
1540 /// 1540 ///
1541 /// Move the below classes to a JS model eventually. 1541 /// Move the below classes to a JS model eventually.
1542 /// 1542 ///
1543 abstract class JSEntity implements MemberEntity { 1543 abstract class JSEntity implements MemberEntity {
1544 Local get declaredEntity; 1544 Local get declaredEntity;
1545 } 1545 }
1546 1546
1547 abstract class PrivatelyNamedJSEntity implements JSEntity { 1547 abstract class PrivatelyNamedJSEntity implements JSEntity {
1548 Entity get rootOfScope; 1548 Entity get rootOfScope;
1549 } 1549 }
OLDNEW
« no previous file with comments | « no previous file | pkg/compiler/lib/src/js_model/closure.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698