Skip to content

Commit

Permalink
Version 0.7.0.0
Browse files Browse the repository at this point in the history
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
  • Loading branch information
ricowind committed May 27, 2015
2 parents df6ae38 + f128a93 commit dfff771
Show file tree
Hide file tree
Showing 403 changed files with 18,749 additions and 7,852 deletions.
1 change: 1 addition & 0 deletions pkg/analyzer_experimental/bin/formatter.dart
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
// 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 'dart:convert';
import 'dart:io';

import 'package:args/args.dart';
Expand Down
20 changes: 20 additions & 0 deletions pkg/analyzer_experimental/lib/analyzer.dart
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import 'src/generated/error.dart';
import 'src/generated/parser.dart';
import 'src/generated/scanner.dart';
import 'src/generated/source_io.dart';
import 'src/string_source.dart';

export 'src/error.dart';
export 'src/generated/ast.dart';
Expand Down Expand Up @@ -46,6 +47,25 @@ CompilationUnit parseDartFile(String path) {
return unit;
}

/// Parses a string of Dart code into an AST.
///
/// If [name] is passed, it's used in error messages as the name of the code
/// being parsed.
CompilationUnit parseCompilationUnit(String contents, {String name}) {
if (name == null) name = '<unknown source>';
var source = new StringSource(contents, name);
var errorCollector = new _ErrorCollector();
var scanner = new StringScanner(source, contents, errorCollector);
var token = scanner.tokenize();
var parser = new Parser(source, errorCollector);
var unit = parser.parseCompilationUnit(token);
unit.lineInfo = new LineInfo(scanner.lineStarts);

if (errorCollector.hasErrors) throw errorCollector.group;

return unit;
}

/// Converts an AST node representing a string literal into a [String].
String stringLiteralToString(StringLiteral literal) {
return literal.stringValue;
Expand Down
3 changes: 3 additions & 0 deletions pkg/analyzer_experimental/lib/src/generated/java_core.dart
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,9 @@ bool isInstanceOf(o, Type t) {
if (oTypeName.startsWith("HashMap") && tTypeName == "Map") {
return true;
}
if (oTypeName.startsWith("LinkedHashMap") && tTypeName == "Map") {
return true;
}
if (oTypeName.startsWith("List") && tTypeName == "List") {
return true;
}
Expand Down
Loading

0 comments on commit dfff771

Please sign in to comment.