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

Side by Side Diff: lib/compiler/implementation/compiler.dart

Issue 10332315: Add a draft of traversing visitor which will analyse function. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Next iteration Created 8 years, 6 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | lib/compiler/implementation/dart_backend/backend.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 class WorkItem { 5 class WorkItem {
6 final Element element; 6 final Element element;
7 TreeElements resolutionTree; 7 TreeElements resolutionTree;
8 bool allowSpeculativeOptimization = true; 8 bool allowSpeculativeOptimization = true;
9 List<HTypeGuard> guards = const <HTypeGuard>[]; 9 List<HTypeGuard> guards = const <HTypeGuard>[];
10 10
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
64 64
65 void processNativeClasses(world, libraries) { 65 void processNativeClasses(world, libraries) {
66 native.processNativeClasses(world, emitter, libraries); 66 native.processNativeClasses(world, emitter, libraries);
67 } 67 }
68 68
69 void assembleProgram() { 69 void assembleProgram() {
70 emitter.assembleProgram(); 70 emitter.assembleProgram();
71 } 71 }
72 } 72 }
73 73
74 class DartBackend extends Backend {
75 DartBackend(Compiler compiler) : super(compiler);
76 final List<CompilerTask> tasks = const <CompilerTask>[];
77 }
78
79 class Compiler implements DiagnosticListener { 74 class Compiler implements DiagnosticListener {
80 final Map<String, LibraryElement> libraries; 75 final Map<String, LibraryElement> libraries;
81 int nextFreeClassId = 0; 76 int nextFreeClassId = 0;
82 World world; 77 World world;
83 String assembledCode; 78 String assembledCode;
84 Namer namer; 79 Namer namer;
85 Types types; 80 Types types;
86 final bool enableTypeAssertions; 81 final bool enableTypeAssertions;
87 82
88 final Tracer tracer; 83 final Tracer tracer;
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 namer = new Namer(this); 151 namer = new Namer(this);
157 constantHandler = new ConstantHandler(this); 152 constantHandler = new ConstantHandler(this);
158 scanner = new ScannerTask(this); 153 scanner = new ScannerTask(this);
159 dietParser = new DietParserTask(this); 154 dietParser = new DietParserTask(this);
160 parser = new ParserTask(this); 155 parser = new ParserTask(this);
161 validator = new TreeValidatorTask(this); 156 validator = new TreeValidatorTask(this);
162 unparseValidator = new UnparseValidator(this, validateUnparse); 157 unparseValidator = new UnparseValidator(this, validateUnparse);
163 resolver = new ResolverTask(this); 158 resolver = new ResolverTask(this);
164 checker = new TypeCheckerTask(this); 159 checker = new TypeCheckerTask(this);
165 backend = emitJavascript ? 160 backend = emitJavascript ?
166 new JavaScriptBackend(this) : new DartBackend(this); 161 new JavaScriptBackend(this) : new dart_backend.DartBackend(this);
167 enqueuer = new EnqueueTask(this); 162 enqueuer = new EnqueueTask(this);
168 tasks = [scanner, dietParser, parser, resolver, checker, 163 tasks = [scanner, dietParser, parser, resolver, checker,
169 unparseValidator, constantHandler, enqueuer]; 164 unparseValidator, constantHandler, enqueuer];
170 tasks.addAll(backend.tasks); 165 tasks.addAll(backend.tasks);
171 } 166 }
172 167
173 Universe get codegenWorld() => enqueuer.codegen.universe; 168 Universe get codegenWorld() => enqueuer.codegen.universe;
174 169
175 int getNextFreeClassId() => nextFreeClassId++; 170 int getNextFreeClassId() => nextFreeClassId++;
176 171
(...skipping 418 matching lines...) Expand 10 before | Expand all | Expand 10 after
595 // invariant that endOffset > beginOffset, but for EOF the 590 // invariant that endOffset > beginOffset, but for EOF the
596 // charoffset of the next token may be [beginOffset]. This can 591 // charoffset of the next token may be [beginOffset]. This can
597 // also happen for synthetized tokens that are produced during 592 // also happen for synthetized tokens that are produced during
598 // error handling. 593 // error handling.
599 final endOffset = 594 final endOffset =
600 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1); 595 Math.max((end.next !== null) ? end.next.charOffset : 0, beginOffset + 1);
601 assert(endOffset > beginOffset); 596 assert(endOffset > beginOffset);
602 return f(beginOffset, endOffset); 597 return f(beginOffset, endOffset);
603 } 598 }
604 } 599 }
OLDNEW
« no previous file with comments | « no previous file | lib/compiler/implementation/dart_backend/backend.dart » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698