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

Side by Side Diff: pkg/compiler/lib/src/kernel/element_map_impl.dart

Issue 2897273002: Add FunctionEntity.asyncMarker and refactor SourceInformationStrategy to avoid ResolvedAst (Closed)
Patch Set: Created 3 years, 7 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) 2017, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2017, 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.kernel.element_map; 5 library dart2js.kernel.element_map;
6 6
7 import 'package:kernel/ast.dart' as ir; 7 import 'package:kernel/ast.dart' as ir;
8 import 'package:kernel/clone.dart'; 8 import 'package:kernel/clone.dart';
9 import 'package:kernel/type_algebra.dart'; 9 import 'package:kernel/type_algebra.dart';
10 10
(...skipping 281 matching lines...) Expand 10 before | Expand all | Expand 10 after
292 enclosingClass = _getClass(node.enclosingClass); 292 enclosingClass = _getClass(node.enclosingClass);
293 library = enclosingClass.library; 293 library = enclosingClass.library;
294 } else { 294 } else {
295 library = _getLibrary(node.enclosingLibrary); 295 library = _getLibrary(node.enclosingLibrary);
296 } 296 }
297 Name name = getName(node.name); 297 Name name = getName(node.name);
298 bool isStatic = node.isStatic; 298 bool isStatic = node.isStatic;
299 bool isExternal = node.isExternal; 299 bool isExternal = node.isExternal;
300 bool isAbstract = node.isAbstract; 300 bool isAbstract = node.isAbstract;
301 KFunction function; 301 KFunction function;
302 AsyncMarker asyncMarker;
303 switch (node.function.asyncMarker) {
304 case ir.AsyncMarker.Async:
305 asyncMarker = AsyncMarker.ASYNC;
306 break;
307 case ir.AsyncMarker.AsyncStar:
308 asyncMarker = AsyncMarker.ASYNC_STAR;
309 break;
310 case ir.AsyncMarker.Sync:
311 asyncMarker = AsyncMarker.SYNC;
312 break;
313 case ir.AsyncMarker.SyncStar:
314 asyncMarker = AsyncMarker.SYNC_STAR;
315 break;
316 case ir.AsyncMarker.SyncYielding:
317 throw new UnsupportedError(
318 "Async marker ${node.function.asyncMarker} is not supported.");
319 }
302 switch (node.kind) { 320 switch (node.kind) {
303 case ir.ProcedureKind.Factory: 321 case ir.ProcedureKind.Factory:
304 throw new UnsupportedError("Cannot create method from factory."); 322 throw new UnsupportedError("Cannot create method from factory.");
305 case ir.ProcedureKind.Getter: 323 case ir.ProcedureKind.Getter:
306 function = new KGetter(memberIndex, library, enclosingClass, name, 324 function = new KGetter(
325 memberIndex, library, enclosingClass, name, asyncMarker,
307 isStatic: isStatic, 326 isStatic: isStatic,
308 isExternal: isExternal, 327 isExternal: isExternal,
309 isAbstract: isAbstract); 328 isAbstract: isAbstract);
310 break; 329 break;
311 case ir.ProcedureKind.Method: 330 case ir.ProcedureKind.Method:
312 case ir.ProcedureKind.Operator: 331 case ir.ProcedureKind.Operator:
313 function = new KMethod(memberIndex, library, enclosingClass, name, 332 function = new KMethod(memberIndex, library, enclosingClass, name,
314 _getParameterStructure(node.function), 333 _getParameterStructure(node.function), asyncMarker,
315 isStatic: isStatic, 334 isStatic: isStatic,
316 isExternal: isExternal, 335 isExternal: isExternal,
317 isAbstract: isAbstract); 336 isAbstract: isAbstract);
318 break; 337 break;
319 case ir.ProcedureKind.Setter: 338 case ir.ProcedureKind.Setter:
339 assert(asyncMarker == AsyncMarker.SYNC);
320 function = new KSetter( 340 function = new KSetter(
321 memberIndex, library, enclosingClass, getName(node.name).setter, 341 memberIndex, library, enclosingClass, getName(node.name).setter,
322 isStatic: isStatic, 342 isStatic: isStatic,
323 isExternal: isExternal, 343 isExternal: isExternal,
324 isAbstract: isAbstract); 344 isAbstract: isAbstract);
325 break; 345 break;
326 } 346 }
327 _memberList.add(new _FunctionData(node, node.function)); 347 _memberList.add(new _FunctionData(node, node.function));
328 return function; 348 return function;
329 }); 349 });
(...skipping 1182 matching lines...) Expand 10 before | Expand all | Expand 10 after
1512 return node.isExternal && 1532 return node.isExternal &&
1513 !elementMap.isForeignLibrary(node.enclosingLibrary); 1533 !elementMap.isForeignLibrary(node.enclosingLibrary);
1514 } 1534 }
1515 1535
1516 @override 1536 @override
1517 bool isJsInteropMember(MemberEntity element) { 1537 bool isJsInteropMember(MemberEntity element) {
1518 // TODO(johnniwinther): Compute this. 1538 // TODO(johnniwinther): Compute this.
1519 return false; 1539 return false;
1520 } 1540 }
1521 } 1541 }
OLDNEW
« no previous file with comments | « pkg/compiler/lib/src/js_backend/impact_transformer.dart ('k') | pkg/compiler/lib/src/kernel/elements.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698