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

Side by Side Diff: sdk/lib/_internal/compiler/implementation/patch_parser.dart

Issue 27510003: Scanner for UTF-8 byte arrays (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge/dart
Patch Set: Re-add ArrayBasedScanner, minor fixes. Created 7 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 | Annotate | Revision Log
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 /** 5 /**
6 * This library contains the infrastructure to parse and integrate patch files. 6 * This library contains the infrastructure to parse and integrate patch files.
7 * 7 *
8 * Three types of elements can be patched: [LibraryElement], [ClassElement], 8 * Three types of elements can be patched: [LibraryElement], [ClassElement],
9 * [FunctionElement]. Patches are introduced in patch libraries which are loaded 9 * [FunctionElement]. Patches are introduced in patch libraries which are loaded
10 * together with the corresponding origin library. Which libraries that are 10 * together with the corresponding origin library. Which libraries that are
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after
155 }); 155 });
156 }); 156 });
157 } 157 }
158 158
159 void scanLibraryElements( 159 void scanLibraryElements(
160 CompilationUnitElement compilationUnit, 160 CompilationUnitElement compilationUnit,
161 LinkBuilder<tree.LibraryTag> imports) { 161 LinkBuilder<tree.LibraryTag> imports) {
162 measure(() { 162 measure(() {
163 // TODO(lrn): Possibly recursively handle 'part' directives in patch. 163 // TODO(lrn): Possibly recursively handle 'part' directives in patch.
164 leg.Script script = compilationUnit.script; 164 leg.Script script = compilationUnit.script;
165 Token tokens = new StringScanner(script.text).tokenize(); 165 Token tokens = new Scanner(script.file).tokenize();
166 Function idGenerator = compiler.getNextFreeClassId; 166 Function idGenerator = compiler.getNextFreeClassId;
167 PatchListener patchListener = 167 PatchListener patchListener =
168 new PatchElementListener(compiler, 168 new PatchElementListener(compiler,
169 compilationUnit, 169 compilationUnit,
170 idGenerator, 170 idGenerator,
171 imports); 171 imports);
172 new PatchParser(patchListener).parseUnit(tokens); 172 new PatchParser(patchListener).parseUnit(tokens);
173 }); 173 });
174 } 174 }
175 175
(...skipping 373 matching lines...) Expand 10 before | Expand all | Expand 10 after
549 549
550 // TODO(johnniwinther): Add unittest when patch is (real) metadata. 550 // TODO(johnniwinther): Add unittest when patch is (real) metadata.
551 bool isPatchElement(Element element) { 551 bool isPatchElement(Element element) {
552 // TODO(lrn): More checks needed if we introduce metadata for real. 552 // TODO(lrn): More checks needed if we introduce metadata for real.
553 // In that case, it must have the identifier "native" as metadata. 553 // In that case, it must have the identifier "native" as metadata.
554 for (Link link = element.metadata; !link.isEmpty; link = link.tail) { 554 for (Link link = element.metadata; !link.isEmpty; link = link.tail) {
555 if (link.head is PatchMetadataAnnotation) return true; 555 if (link.head is PatchMetadataAnnotation) return true;
556 } 556 }
557 return false; 557 return false;
558 } 558 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698