This repository has been archived by the owner on Nov 1, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 64
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Cleanup: Make all ASTs lazy (no _AbstractCodeBuilder) (#12)
* Make all builders lazy, remove AST cloning. * Fix breakages due to bad refactor of FileBuilder * Small pubspec increment * Update pubspec to allow pub publish. * Add headers, upstream analyzer patch API * Address comments. * Fix outstanding lints.
- Loading branch information
1 parent
8dc8d48
commit 1fafa99
Showing
14 changed files
with
234 additions
and
122 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
// Copyright (c) 2016, the Dart project authors. Please see the AUTHORS file | ||
// for details. All rights reserved. Use of this source code is governed by a | ||
// BSD-style license that can be found in the LICENSE file. | ||
|
||
import 'package:analyzer/src/generated/java_core.dart'; | ||
|
||
/// Implements both old-API [PrintWriter] and new-API [StringBuffer]. | ||
/// | ||
/// This makes it easier to re-use our `pretty_printer` until analyzer updates. | ||
class PrintBuffer implements PrintWriter, StringBuffer { | ||
final StringBuffer _impl = new StringBuffer(); | ||
|
||
@override | ||
void clear() {} | ||
|
||
@override | ||
bool get isEmpty => _impl.isEmpty; | ||
|
||
@override | ||
bool get isNotEmpty => _impl.isNotEmpty; | ||
|
||
@override | ||
int get length => _impl.length; | ||
|
||
@override | ||
void newLine() { | ||
_impl.writeln(); | ||
} | ||
|
||
@override | ||
void print(x) { | ||
_impl.write(x); | ||
} | ||
|
||
@override | ||
void printf(String fmt, List args) => throw new UnimplementedError(); | ||
|
||
@override | ||
void println(String s) { | ||
_impl.writeln(s); | ||
} | ||
|
||
@override | ||
void write(Object obj) { | ||
_impl.write(obj); | ||
} | ||
|
||
@override | ||
void writeAll(Iterable objects, [String separator = ""]) { | ||
_impl.writeAll(objects); | ||
} | ||
|
||
@override | ||
void writeCharCode(int charCode) { | ||
_impl.writeCharCode(charCode); | ||
} | ||
|
||
@override | ||
void writeln([Object obj = ""]) { | ||
_impl.writeln(obj); | ||
} | ||
|
||
@override | ||
String toString() => _impl.toString(); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.