Skip to content

Commit dfff771

Browse files
committed
Version 0.7.0.0
svn merge -r 26574:26775 https://dart.googlecode.com/svn/branches/bleeding_edge trunk git-svn-id: http://dart.googlecode.com/svn/trunk@26783 260f80e4-7a28-3924-810f-c04153c831b5
2 parents df6ae38 + f128a93 commit dfff771

File tree

403 files changed

+18749
-7852
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

403 files changed

+18749
-7852
lines changed

pkg/analyzer_experimental/bin/formatter.dart

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
// for details. All rights reserved. Use of this source code is governed by a
55
// BSD-style license that can be found in the LICENSE file.
66

7+
import 'dart:convert';
78
import 'dart:io';
89

910
import 'package:args/args.dart';

pkg/analyzer_experimental/lib/analyzer.dart

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ import 'src/generated/error.dart';
1414
import 'src/generated/parser.dart';
1515
import 'src/generated/scanner.dart';
1616
import 'src/generated/source_io.dart';
17+
import 'src/string_source.dart';
1718

1819
export 'src/error.dart';
1920
export 'src/generated/ast.dart';
@@ -46,6 +47,25 @@ CompilationUnit parseDartFile(String path) {
4647
return unit;
4748
}
4849

50+
/// Parses a string of Dart code into an AST.
51+
///
52+
/// If [name] is passed, it's used in error messages as the name of the code
53+
/// being parsed.
54+
CompilationUnit parseCompilationUnit(String contents, {String name}) {
55+
if (name == null) name = '<unknown source>';
56+
var source = new StringSource(contents, name);
57+
var errorCollector = new _ErrorCollector();
58+
var scanner = new StringScanner(source, contents, errorCollector);
59+
var token = scanner.tokenize();
60+
var parser = new Parser(source, errorCollector);
61+
var unit = parser.parseCompilationUnit(token);
62+
unit.lineInfo = new LineInfo(scanner.lineStarts);
63+
64+
if (errorCollector.hasErrors) throw errorCollector.group;
65+
66+
return unit;
67+
}
68+
4969
/// Converts an AST node representing a string literal into a [String].
5070
String stringLiteralToString(StringLiteral literal) {
5171
return literal.stringValue;

pkg/analyzer_experimental/lib/src/generated/java_core.dart

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,9 @@ bool isInstanceOf(o, Type t) {
3434
if (oTypeName.startsWith("HashMap") && tTypeName == "Map") {
3535
return true;
3636
}
37+
if (oTypeName.startsWith("LinkedHashMap") && tTypeName == "Map") {
38+
return true;
39+
}
3740
if (oTypeName.startsWith("List") && tTypeName == "List") {
3841
return true;
3942
}

0 commit comments

Comments
 (0)