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

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

Issue 2439573003: Experiment with new function-type syntax.
Patch Set: Change a few more typedefs. 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
OLDNEW
1 // Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file 1 // Copyright (c) 2016, 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.md file. 3 // BSD-style license that can be found in the LICENSE.md file.
4 4
5 import 'dart:async'; 5 import 'dart:async';
6 import 'dart:collection' show Queue; 6 import 'dart:collection' show Queue;
7 7
8 import 'package:kernel/ast.dart' as ir; 8 import 'package:kernel/ast.dart' as ir;
9 import 'package:kernel/checks.dart' show CheckParentPointers; 9 import 'package:kernel/checks.dart' show CheckParentPointers;
10 10
(...skipping 15 matching lines...) Expand all
26 FunctionElement, 26 FunctionElement,
27 ImportElement, 27 ImportElement,
28 LibraryElement, 28 LibraryElement,
29 LocalFunctionElement, 29 LocalFunctionElement,
30 MixinApplicationElement, 30 MixinApplicationElement,
31 TypeVariableElement; 31 TypeVariableElement;
32 import '../elements/modelx.dart' show ErroneousFieldElementX; 32 import '../elements/modelx.dart' show ErroneousFieldElementX;
33 import '../tree/tree.dart' show FunctionExpression, Node; 33 import '../tree/tree.dart' show FunctionExpression, Node;
34 import 'kernel_visitor.dart' show IrFunction, KernelVisitor; 34 import 'kernel_visitor.dart' show IrFunction, KernelVisitor;
35 35
36 typedef void WorkAction();
37
38 class WorkItem { 36 class WorkItem {
39 final Element element; 37 final Element element;
40 final WorkAction action; 38 final () -> void action;
41 39
42 WorkItem(this.element, this.action); 40 WorkItem(this.element, this.action);
43 } 41 }
44 42
45 class Kernel { 43 class Kernel {
46 final Compiler compiler; 44 final Compiler compiler;
47 45
48 final Map<LibraryElement, ir.Library> libraries = 46 final Map<LibraryElement, ir.Library> libraries =
49 <LibraryElement, ir.Library>{}; 47 <LibraryElement, ir.Library>{};
50 48
(...skipping 20 matching lines...) Expand all
71 69
72 final Map<ir.Node, Element> nodeToElement = <ir.Node, Element>{}; 70 final Map<ir.Node, Element> nodeToElement = <ir.Node, Element>{};
73 final Map<ir.Node, Node> nodeToAst = <ir.Node, Node>{}; 71 final Map<ir.Node, Node> nodeToAst = <ir.Node, Node>{};
74 72
75 /// FIFO queue of work that needs to be completed before the returned AST 73 /// FIFO queue of work that needs to be completed before the returned AST
76 /// nodes are correct. 74 /// nodes are correct.
77 final Queue<WorkItem> workQueue = new Queue<WorkItem>(); 75 final Queue<WorkItem> workQueue = new Queue<WorkItem>();
78 76
79 Kernel(this.compiler); 77 Kernel(this.compiler);
80 78
81 void addWork(Element element, WorkAction action) { 79 void addWork(Element element, () -> void action) {
82 workQueue.addLast(new WorkItem(element, action)); 80 workQueue.addLast(new WorkItem(element, action));
83 } 81 }
84 82
85 void checkMember(Element key, ir.TreeNode value) { 83 void checkMember(Element key, ir.TreeNode value) {
86 if (!checkedNodes.add(value)) return; 84 if (!checkedNodes.add(value)) return;
87 if (value.parent == null) { 85 if (value.parent == null) {
88 internalError(key, "Missing parent on IR node."); 86 internalError(key, "Missing parent on IR node.");
89 } 87 }
90 try { 88 try {
91 CheckParentPointers.check(value); 89 CheckParentPointers.check(value);
(...skipping 578 matching lines...) Expand 10 before | Expand all | Expand 10 after
670 } 668 }
671 669
672 class ConstructorTarget { 670 class ConstructorTarget {
673 final ConstructorElement element; 671 final ConstructorElement element;
674 final DartType type; 672 final DartType type;
675 673
676 ConstructorTarget(this.element, this.type); 674 ConstructorTarget(this.element, this.type);
677 675
678 String toString() => "ConstructorTarget($element, $type)"; 676 String toString() => "ConstructorTarget($element, $type)";
679 } 677 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698