New analyzer snapshot.
No 'isInstanceOf' changes yet. Just current state with changes required to adopt to the API changes in Java. R=brianwilkerson@google.com BUG= Review URL: https://codereview.chromium.org//184893003 git-svn-id: https://dart.googlecode.com/svn/branches/bleeding_edge/dart@33176 260f80e4-7a28-3924-810f-c04153c831b5
This commit is contained in:
@@ -26,8 +26,8 @@ main(List<String> args) {
|
||||
DartSdk sdk = DirectoryBasedDartSdk.defaultSdk;
|
||||
|
||||
AnalysisContext context = AnalysisEngine.instance.createAnalysisContext();
|
||||
context.sourceFactory = new SourceFactory.con2([new DartUriResolver(sdk), new FileUriResolver()]);
|
||||
Source source = new FileBasedSource.con1(context.sourceFactory.contentCache, new JavaFile(args[1]));
|
||||
context.sourceFactory = new SourceFactory([new DartUriResolver(sdk), new FileUriResolver()]);
|
||||
Source source = new FileBasedSource.con1(new JavaFile(args[1]));
|
||||
//
|
||||
ChangeSet changeSet = new ChangeSet();
|
||||
changeSet.added(source);
|
||||
|
||||
@@ -25,7 +25,7 @@ export 'src/generated/utilities_dart.dart';
|
||||
CompilationUnit parseDartFile(String path) {
|
||||
String contents = new File(path).readAsStringSync();
|
||||
var errorCollector = new _ErrorCollector();
|
||||
var sourceFactory = new SourceFactory.con2([new FileUriResolver()]);
|
||||
var sourceFactory = new SourceFactory([new FileUriResolver()]);
|
||||
|
||||
var absolutePath = pathos.absolute(path);
|
||||
var source = sourceFactory.forUri(pathos.toUri(absolutePath).toString());
|
||||
|
||||
@@ -52,7 +52,7 @@ class AnalyzerImpl {
|
||||
}
|
||||
var sourceFile = new JavaFile(sourcePath);
|
||||
var uriKind = getUriKind(sourceFile);
|
||||
var librarySource = new FileBasedSource.con2(contentCache, sourceFile, uriKind);
|
||||
var librarySource = new FileBasedSource.con2(sourceFile, uriKind);
|
||||
// prepare context
|
||||
prepareAnalysisContext(sourceFile);
|
||||
// don't try to analyzer parts
|
||||
@@ -101,7 +101,7 @@ class AnalyzerImpl {
|
||||
resolvers.add(new PackageUriResolver([packageDirectory]));
|
||||
}
|
||||
}
|
||||
sourceFactory = new SourceFactory.con1(contentCache, resolvers);
|
||||
sourceFactory = new SourceFactory(resolvers);
|
||||
context = AnalysisEngine.instance.createAnalysisContext();
|
||||
context.sourceFactory = sourceFactory;
|
||||
|
||||
|
||||
@@ -44,17 +44,16 @@ class AnalyzerError implements Exception {
|
||||
|
||||
String toString() {
|
||||
var builder = new StringBuffer();
|
||||
var receiver = new _ContentReceiver();
|
||||
error.source.getContents(receiver);
|
||||
var beforeError = receiver.result.substring(0, error.offset);
|
||||
var content = error.source.contents.data;
|
||||
var beforeError = content.substring(0, error.offset);
|
||||
var lineNumber = "\n".allMatches(beforeError).length + 1;
|
||||
builder.writeln("Error on line $lineNumber of ${error.source.fullName}: "
|
||||
"${error.message}");
|
||||
|
||||
var errorLineIndex = beforeError.lastIndexOf("\n") + 1;
|
||||
var errorEndOfLineIndex = receiver.result.indexOf("\n", error.offset);
|
||||
if (errorEndOfLineIndex == -1) errorEndOfLineIndex = receiver.result.length;
|
||||
var errorLine = receiver.result.substring(
|
||||
var errorEndOfLineIndex = content.indexOf("\n", error.offset);
|
||||
if (errorEndOfLineIndex == -1) errorEndOfLineIndex = content.length;
|
||||
var errorLine = content.substring(
|
||||
errorLineIndex, errorEndOfLineIndex);
|
||||
var errorColumn = error.offset - errorLineIndex;
|
||||
var errorLength = error.length;
|
||||
|
||||
@@ -10093,6 +10093,11 @@ class SimpleStringLiteral extends StringLiteral {
|
||||
*/
|
||||
String _value;
|
||||
|
||||
/**
|
||||
* The toolkit specific element associated with this literal, or `null`.
|
||||
*/
|
||||
Element _toolkitElement;
|
||||
|
||||
/**
|
||||
* Initialize a newly created simple string literal.
|
||||
*
|
||||
@@ -10109,6 +10114,13 @@ class SimpleStringLiteral extends StringLiteral {
|
||||
|
||||
Token get endToken => literal;
|
||||
|
||||
/**
|
||||
* Return the toolkit specific, non-Dart, element associated with this literal, or `null`.
|
||||
*
|
||||
* @return the element associated with this literal
|
||||
*/
|
||||
Element get toolkitElement => _toolkitElement;
|
||||
|
||||
/**
|
||||
* Return the value of the literal.
|
||||
*
|
||||
@@ -10156,6 +10168,15 @@ class SimpleStringLiteral extends StringLiteral {
|
||||
|
||||
bool get isSynthetic => literal.isSynthetic;
|
||||
|
||||
/**
|
||||
* Set the toolkit specific, non-Dart, element associated with this literal.
|
||||
*
|
||||
* @param element the toolkit specific element to be associated with this literal
|
||||
*/
|
||||
void set toolkitElement(Element element) {
|
||||
_toolkitElement = element;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the value of the literal to the given string.
|
||||
*
|
||||
@@ -12176,6 +12197,7 @@ class ConstantEvaluator extends GeneralizingASTVisitor<Object> {
|
||||
} else if (leftOperand is double && rightOperand is double) {
|
||||
return leftOperand ~/ rightOperand;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -12258,6 +12280,7 @@ class ConstantEvaluator extends GeneralizingASTVisitor<Object> {
|
||||
} else if (operand is double) {
|
||||
return -operand;
|
||||
}
|
||||
} else {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -517,11 +517,12 @@ class ConstantVisitor extends UnifyingASTVisitor<EvaluationResultImpl> {
|
||||
return leftResult.divide(_typeProvider, node, rightResult);
|
||||
} else if (operatorType == TokenType.TILDE_SLASH) {
|
||||
return leftResult.integerDivide(_typeProvider, node, rightResult);
|
||||
} else {
|
||||
// TODO(brianwilkerson) Figure out which error to report.
|
||||
return error(node, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// TODO(brianwilkerson) Figure out which error to report.
|
||||
return error(node, null);
|
||||
}
|
||||
|
||||
EvaluationResultImpl visitBooleanLiteral(BooleanLiteral node) => valid2(_typeProvider.boolType, BoolState.from(node.value));
|
||||
@@ -724,11 +725,12 @@ class ConstantVisitor extends UnifyingASTVisitor<EvaluationResultImpl> {
|
||||
return operand.bitNot(_typeProvider, node);
|
||||
} else if (node.operator.type == TokenType.MINUS) {
|
||||
return operand.negated(_typeProvider, node);
|
||||
} else {
|
||||
// TODO(brianwilkerson) Figure out which error to report.
|
||||
return error(node, null);
|
||||
}
|
||||
break;
|
||||
}
|
||||
// TODO(brianwilkerson) Figure out which error to report.
|
||||
return error(node, null);
|
||||
}
|
||||
|
||||
EvaluationResultImpl visitPropertyAccess(PropertyAccess node) => getConstantValue(node, node.propertyName.staticElement);
|
||||
|
||||
@@ -15,7 +15,7 @@ import 'source.dart';
|
||||
import 'scanner.dart' show Keyword;
|
||||
import 'ast.dart';
|
||||
import 'sdk.dart' show DartSdk;
|
||||
import 'html.dart' show XmlTagNode;
|
||||
import 'html.dart' show XmlAttributeNode, XmlTagNode;
|
||||
import 'engine.dart' show AnalysisContext;
|
||||
import 'constant.dart' show EvaluationResultImpl;
|
||||
import 'utilities_dart.dart';
|
||||
@@ -157,9 +157,11 @@ abstract class ClassElement implements Element {
|
||||
InterfaceType get supertype;
|
||||
|
||||
/**
|
||||
* Return an array containing all of the toolkit specific objects attached to this class.
|
||||
* Return an array containing all of the toolkit specific objects associated with this class. The
|
||||
* array will be empty if the class does not have any toolkit specific objects or if the
|
||||
* compilation unit containing the class has not yet had toolkit references resolved.
|
||||
*
|
||||
* @return the toolkit objects attached to this class
|
||||
* @return the toolkit objects associated with this class
|
||||
*/
|
||||
List<ToolkitObjectElement> get toolkitObjects;
|
||||
|
||||
@@ -211,6 +213,14 @@ abstract class ClassElement implements Element {
|
||||
*/
|
||||
bool get isAbstract;
|
||||
|
||||
/**
|
||||
* Return `true` if this class [isProxy], or if it inherits the proxy annotation
|
||||
* from a supertype.
|
||||
*
|
||||
* @return `true` if this class defines or inherits a proxy
|
||||
*/
|
||||
bool get isOrInheritsProxy;
|
||||
|
||||
/**
|
||||
* Return `true` if this element has an annotation of the form '@proxy'.
|
||||
*
|
||||
@@ -339,6 +349,15 @@ abstract class CompilationUnitElement implements Element, UriReferencedElement {
|
||||
*/
|
||||
List<PropertyAccessorElement> get accessors;
|
||||
|
||||
/**
|
||||
* Return an array containing all of the Angular views defined in this compilation unit. The array
|
||||
* will be empty if the element does not have any Angular views or if the compilation unit has not
|
||||
* yet had toolkit references resolved.
|
||||
*
|
||||
* @return the Angular views defined in this compilation unit.
|
||||
*/
|
||||
List<AngularViewElement> get angularViews;
|
||||
|
||||
/**
|
||||
* Return the library in which this compilation unit is defined.
|
||||
*
|
||||
@@ -413,7 +432,9 @@ abstract class ConstructorElement implements ClassMemberElement, ExecutableEleme
|
||||
ConstructorDeclaration get node;
|
||||
|
||||
/**
|
||||
* Return the constructor to which this constructor is redirecting.
|
||||
* Return the constructor to which this constructor is redirecting, or `null` if this constructor
|
||||
* does not redirect to another constructor or if the library containing this constructor has
|
||||
* not yet been resolved.
|
||||
*
|
||||
* @return the constructor to which this constructor is redirecting
|
||||
*/
|
||||
@@ -556,7 +577,9 @@ abstract class Element {
|
||||
ElementLocation get location;
|
||||
|
||||
/**
|
||||
* Return an array containing all of the metadata associated with this element.
|
||||
* Return an array containing all of the metadata associated with this element. The array will be
|
||||
* empty if the element does not have any metadata or if the library containing this element has
|
||||
* not yet been resolved.
|
||||
*
|
||||
* @return the metadata associated with this element
|
||||
*/
|
||||
@@ -626,6 +649,13 @@ abstract class Element {
|
||||
*/
|
||||
bool get isDeprecated;
|
||||
|
||||
/**
|
||||
* Return `true` if this element has an annotation of the form '@override'.
|
||||
*
|
||||
* @return `true` if this element is overridden
|
||||
*/
|
||||
bool get isOverride;
|
||||
|
||||
/**
|
||||
* Return `true` if this element is private. Private elements are visible only within the
|
||||
* library in which they are declared.
|
||||
@@ -717,57 +747,61 @@ class ElementKind extends Enum<ElementKind> {
|
||||
|
||||
static final ElementKind ANGULAR_PROPERTY = new ElementKind('ANGULAR_PROPERTY', 4, "Angular property");
|
||||
|
||||
static final ElementKind ANGULAR_SELECTOR = new ElementKind('ANGULAR_SELECTOR', 5, "Angular selector");
|
||||
static final ElementKind ANGULAR_SCOPE_PROPERTY = new ElementKind('ANGULAR_SCOPE_PROPERTY', 5, "Angular scope property");
|
||||
|
||||
static final ElementKind CLASS = new ElementKind('CLASS', 6, "class");
|
||||
static final ElementKind ANGULAR_SELECTOR = new ElementKind('ANGULAR_SELECTOR', 6, "Angular selector");
|
||||
|
||||
static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT', 7, "compilation unit");
|
||||
static final ElementKind ANGULAR_VIEW = new ElementKind('ANGULAR_VIEW', 7, "Angular view");
|
||||
|
||||
static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 8, "constructor");
|
||||
static final ElementKind CLASS = new ElementKind('CLASS', 8, "class");
|
||||
|
||||
static final ElementKind DYNAMIC = new ElementKind('DYNAMIC', 9, "<dynamic>");
|
||||
static final ElementKind COMPILATION_UNIT = new ElementKind('COMPILATION_UNIT', 9, "compilation unit");
|
||||
|
||||
static final ElementKind EMBEDDED_HTML_SCRIPT = new ElementKind('EMBEDDED_HTML_SCRIPT', 10, "embedded html script");
|
||||
static final ElementKind CONSTRUCTOR = new ElementKind('CONSTRUCTOR', 10, "constructor");
|
||||
|
||||
static final ElementKind ERROR = new ElementKind('ERROR', 11, "<error>");
|
||||
static final ElementKind DYNAMIC = new ElementKind('DYNAMIC', 11, "<dynamic>");
|
||||
|
||||
static final ElementKind EXPORT = new ElementKind('EXPORT', 12, "export directive");
|
||||
static final ElementKind EMBEDDED_HTML_SCRIPT = new ElementKind('EMBEDDED_HTML_SCRIPT', 12, "embedded html script");
|
||||
|
||||
static final ElementKind EXTERNAL_HTML_SCRIPT = new ElementKind('EXTERNAL_HTML_SCRIPT', 13, "external html script");
|
||||
static final ElementKind ERROR = new ElementKind('ERROR', 13, "<error>");
|
||||
|
||||
static final ElementKind FIELD = new ElementKind('FIELD', 14, "field");
|
||||
static final ElementKind EXPORT = new ElementKind('EXPORT', 14, "export directive");
|
||||
|
||||
static final ElementKind FUNCTION = new ElementKind('FUNCTION', 15, "function");
|
||||
static final ElementKind EXTERNAL_HTML_SCRIPT = new ElementKind('EXTERNAL_HTML_SCRIPT', 15, "external html script");
|
||||
|
||||
static final ElementKind GETTER = new ElementKind('GETTER', 16, "getter");
|
||||
static final ElementKind FIELD = new ElementKind('FIELD', 16, "field");
|
||||
|
||||
static final ElementKind HTML = new ElementKind('HTML', 17, "html");
|
||||
static final ElementKind FUNCTION = new ElementKind('FUNCTION', 17, "function");
|
||||
|
||||
static final ElementKind IMPORT = new ElementKind('IMPORT', 18, "import directive");
|
||||
static final ElementKind GETTER = new ElementKind('GETTER', 18, "getter");
|
||||
|
||||
static final ElementKind LABEL = new ElementKind('LABEL', 19, "label");
|
||||
static final ElementKind HTML = new ElementKind('HTML', 19, "html");
|
||||
|
||||
static final ElementKind LIBRARY = new ElementKind('LIBRARY', 20, "library");
|
||||
static final ElementKind IMPORT = new ElementKind('IMPORT', 20, "import directive");
|
||||
|
||||
static final ElementKind LOCAL_VARIABLE = new ElementKind('LOCAL_VARIABLE', 21, "local variable");
|
||||
static final ElementKind LABEL = new ElementKind('LABEL', 21, "label");
|
||||
|
||||
static final ElementKind METHOD = new ElementKind('METHOD', 22, "method");
|
||||
static final ElementKind LIBRARY = new ElementKind('LIBRARY', 22, "library");
|
||||
|
||||
static final ElementKind NAME = new ElementKind('NAME', 23, "<name>");
|
||||
static final ElementKind LOCAL_VARIABLE = new ElementKind('LOCAL_VARIABLE', 23, "local variable");
|
||||
|
||||
static final ElementKind PARAMETER = new ElementKind('PARAMETER', 24, "parameter");
|
||||
static final ElementKind METHOD = new ElementKind('METHOD', 24, "method");
|
||||
|
||||
static final ElementKind PREFIX = new ElementKind('PREFIX', 25, "import prefix");
|
||||
static final ElementKind NAME = new ElementKind('NAME', 25, "<name>");
|
||||
|
||||
static final ElementKind SETTER = new ElementKind('SETTER', 26, "setter");
|
||||
static final ElementKind PARAMETER = new ElementKind('PARAMETER', 26, "parameter");
|
||||
|
||||
static final ElementKind TOP_LEVEL_VARIABLE = new ElementKind('TOP_LEVEL_VARIABLE', 27, "top level variable");
|
||||
static final ElementKind PREFIX = new ElementKind('PREFIX', 27, "import prefix");
|
||||
|
||||
static final ElementKind FUNCTION_TYPE_ALIAS = new ElementKind('FUNCTION_TYPE_ALIAS', 28, "function type alias");
|
||||
static final ElementKind SETTER = new ElementKind('SETTER', 28, "setter");
|
||||
|
||||
static final ElementKind TYPE_PARAMETER = new ElementKind('TYPE_PARAMETER', 29, "type parameter");
|
||||
static final ElementKind TOP_LEVEL_VARIABLE = new ElementKind('TOP_LEVEL_VARIABLE', 29, "top level variable");
|
||||
|
||||
static final ElementKind UNIVERSE = new ElementKind('UNIVERSE', 30, "<universe>");
|
||||
static final ElementKind FUNCTION_TYPE_ALIAS = new ElementKind('FUNCTION_TYPE_ALIAS', 30, "function type alias");
|
||||
|
||||
static final ElementKind TYPE_PARAMETER = new ElementKind('TYPE_PARAMETER', 31, "type parameter");
|
||||
|
||||
static final ElementKind UNIVERSE = new ElementKind('UNIVERSE', 32, "<universe>");
|
||||
|
||||
static final List<ElementKind> values = [
|
||||
ANGULAR_FILTER,
|
||||
@@ -775,7 +809,9 @@ class ElementKind extends Enum<ElementKind> {
|
||||
ANGULAR_CONTROLLER,
|
||||
ANGULAR_DIRECTIVE,
|
||||
ANGULAR_PROPERTY,
|
||||
ANGULAR_SCOPE_PROPERTY,
|
||||
ANGULAR_SELECTOR,
|
||||
ANGULAR_VIEW,
|
||||
CLASS,
|
||||
COMPILATION_UNIT,
|
||||
CONSTRUCTOR,
|
||||
@@ -862,8 +898,12 @@ abstract class ElementVisitor<R> {
|
||||
|
||||
R visitAngularPropertyElement(AngularPropertyElement element);
|
||||
|
||||
R visitAngularScopePropertyElement(AngularScopePropertyElement element);
|
||||
|
||||
R visitAngularSelectorElement(AngularSelectorElement element);
|
||||
|
||||
R visitAngularViewElement(AngularViewElement element);
|
||||
|
||||
R visitClassElement(ClassElement element);
|
||||
|
||||
R visitCompilationUnitElement(CompilationUnitElement element);
|
||||
@@ -1348,7 +1388,8 @@ abstract class LibraryElement implements Element {
|
||||
bool hasExtUri();
|
||||
|
||||
/**
|
||||
* Return `true` if this library is created for Angular analysis.
|
||||
* Return `true` if this library is created for Angular analysis. If this library has not
|
||||
* yet had toolkit references resolved, then `false` will be returned.
|
||||
*
|
||||
* @return `true` if this library is created for Angular analysis
|
||||
*/
|
||||
@@ -1479,6 +1520,23 @@ abstract class MultiplyDefinedElement implements Element {
|
||||
Type2 get type;
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface [MultiplyInheritedExecutableElement] defines all of the behavior of an
|
||||
* [ExecutableElement], with the additional information of an array of
|
||||
* [ExecutableElement]s from which this element was composed.
|
||||
*
|
||||
* @coverage dart.engine.element
|
||||
*/
|
||||
abstract class MultiplyInheritedExecutableElement implements ExecutableElement {
|
||||
/**
|
||||
* Return an array containing all of the executable elements defined within this executable
|
||||
* element.
|
||||
*
|
||||
* @return the elements defined within this executable element
|
||||
*/
|
||||
List<ExecutableElement> get inheritedElements;
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface `NamespaceCombinator` defines the behavior common to objects that control how
|
||||
* namespaces are combined.
|
||||
@@ -1827,12 +1885,18 @@ abstract class VariableElement implements Element {
|
||||
*
|
||||
* @coverage dart.engine.element
|
||||
*/
|
||||
abstract class AngularComponentElement implements AngularHasSelectorElement {
|
||||
abstract class AngularComponentElement implements AngularHasSelectorElement, AngularHasTemplateElement {
|
||||
/**
|
||||
* Return an array containing all of the properties declared by this component.
|
||||
*/
|
||||
List<AngularPropertyElement> get properties;
|
||||
|
||||
/**
|
||||
* Return an array containing all of the scope properties set in the implementation of this
|
||||
* component.
|
||||
*/
|
||||
List<AngularScopePropertyElement> get scopeProperties;
|
||||
|
||||
/**
|
||||
* Returns the CSS file URI.
|
||||
*/
|
||||
@@ -1844,23 +1908,6 @@ abstract class AngularComponentElement implements AngularHasSelectorElement {
|
||||
* @return the offset of the style URI
|
||||
*/
|
||||
int get styleUriOffset;
|
||||
|
||||
/**
|
||||
* Returns the HTML template [Source], `null` if not resolved.
|
||||
*/
|
||||
Source get templateSource;
|
||||
|
||||
/**
|
||||
* Returns the HTML template URI.
|
||||
*/
|
||||
String get templateUri;
|
||||
|
||||
/**
|
||||
* Return the offset of the [getTemplateUri] in the [getSource].
|
||||
*
|
||||
* @return the offset of the template URI
|
||||
*/
|
||||
int get templateUriOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1901,6 +1948,13 @@ abstract class AngularElement implements ToolkitObjectElement {
|
||||
* An empty array of angular elements.
|
||||
*/
|
||||
static final List<AngularElement> EMPTY_ARRAY = new List<AngularElement>(0);
|
||||
|
||||
/**
|
||||
* Returns the [AngularApplication] this element is used in.
|
||||
*
|
||||
* @return the [AngularApplication] this element is used in
|
||||
*/
|
||||
AngularApplication get application;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1912,6 +1966,18 @@ abstract class AngularElement implements ToolkitObjectElement {
|
||||
abstract class AngularFilterElement implements AngularElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* [AngularSelectorElement] based on presence of attribute.
|
||||
*/
|
||||
abstract class AngularHasAttributeSelectorElement implements AngularSelectorElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* [AngularSelectorElement] based on presence of a class.
|
||||
*/
|
||||
abstract class AngularHasClassSelectorElement implements AngularSelectorElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface `AngularElement` defines the behavior of objects representing information
|
||||
* about an Angular element which is applied conditionally using some [AngularSelectorElement].
|
||||
@@ -1927,6 +1993,31 @@ abstract class AngularHasSelectorElement implements AngularElement {
|
||||
AngularSelectorElement get selector;
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface `AngularHasTemplateElement` defines common behavior for
|
||||
* [AngularElement] that have template URI / [Source].
|
||||
*
|
||||
* @coverage dart.engine.element
|
||||
*/
|
||||
abstract class AngularHasTemplateElement implements AngularElement {
|
||||
/**
|
||||
* Returns the HTML template [Source], `null` if not resolved.
|
||||
*/
|
||||
Source get templateSource;
|
||||
|
||||
/**
|
||||
* Returns the HTML template URI.
|
||||
*/
|
||||
String get templateUri;
|
||||
|
||||
/**
|
||||
* Return the offset of the [getTemplateUri] in the [getSource].
|
||||
*
|
||||
* @return the offset of the template URI
|
||||
*/
|
||||
int get templateUriOffset;
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface `AngularPropertyElement` defines a single property in
|
||||
* [AngularComponentElement].
|
||||
@@ -1947,7 +2038,8 @@ abstract class AngularPropertyElement implements AngularElement {
|
||||
FieldElement get field;
|
||||
|
||||
/**
|
||||
* Return the offset of the field name of this property in the property map.
|
||||
* Return the offset of the field name of this property in the property map, or `-1` if
|
||||
* property was created using annotation on [FieldElement].
|
||||
*
|
||||
* @return the offset of the field name of this property
|
||||
*/
|
||||
@@ -2021,6 +2113,26 @@ class AngularPropertyKind_TWO_WAY extends AngularPropertyKind {
|
||||
bool callsGetter() => true;
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface `AngularScopeVariableElement` defines the Angular <code>Scope</code>
|
||||
* property. They are created for every <code>scope['property'] = value;</code> code snippet.
|
||||
*
|
||||
* @coverage dart.engine.element
|
||||
*/
|
||||
abstract class AngularScopePropertyElement implements AngularElement {
|
||||
/**
|
||||
* An empty array of scope property elements.
|
||||
*/
|
||||
static final List<AngularScopePropertyElement> EMPTY_ARRAY = [];
|
||||
|
||||
/**
|
||||
* Returns the type of this property, not `null`, maybe <code>dynamic</code>.
|
||||
*
|
||||
* @return the type of this property.
|
||||
*/
|
||||
Type2 get type;
|
||||
}
|
||||
|
||||
/**
|
||||
* [AngularSelectorElement] is used to decide when Angular object should be applied.
|
||||
*
|
||||
@@ -2037,6 +2149,25 @@ abstract class AngularSelectorElement implements AngularElement {
|
||||
bool apply(XmlTagNode node);
|
||||
}
|
||||
|
||||
/**
|
||||
* [AngularSelectorElement] based on tag name.
|
||||
*/
|
||||
abstract class AngularTagSelectorElement implements AngularSelectorElement {
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface `AngularViewElement` defines the Angular view defined using invocation like
|
||||
* <code>view('views/create.html')</code>.
|
||||
*
|
||||
* @coverage dart.engine.element
|
||||
*/
|
||||
abstract class AngularViewElement implements AngularHasTemplateElement {
|
||||
/**
|
||||
* An empty array of view elements.
|
||||
*/
|
||||
static final List<AngularViewElement> EMPTY_ARRAY = new List<AngularViewElement>(0);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instances of the class `GeneralizingElementVisitor` implement an element visitor that will
|
||||
* recursively visit all of the elements in an element model (like instances of the class
|
||||
@@ -2109,8 +2240,12 @@ class GeneralizingElementVisitor<R> implements ElementVisitor<R> {
|
||||
|
||||
R visitAngularPropertyElement(AngularPropertyElement element) => visitAngularElement(element);
|
||||
|
||||
R visitAngularScopePropertyElement(AngularScopePropertyElement element) => visitAngularElement(element);
|
||||
|
||||
R visitAngularSelectorElement(AngularSelectorElement element) => visitAngularElement(element);
|
||||
|
||||
R visitAngularViewElement(AngularViewElement element) => visitAngularElement(element);
|
||||
|
||||
R visitClassElement(ClassElement element) => visitElement(element);
|
||||
|
||||
R visitCompilationUnitElement(CompilationUnitElement element) => visitElement(element);
|
||||
@@ -2220,11 +2355,21 @@ class RecursiveElementVisitor<R> implements ElementVisitor<R> {
|
||||
return null;
|
||||
}
|
||||
|
||||
R visitAngularScopePropertyElement(AngularScopePropertyElement element) {
|
||||
element.visitChildren(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
R visitAngularSelectorElement(AngularSelectorElement element) {
|
||||
element.visitChildren(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
R visitAngularViewElement(AngularViewElement element) {
|
||||
element.visitChildren(this);
|
||||
return null;
|
||||
}
|
||||
|
||||
R visitClassElement(ClassElement element) {
|
||||
element.visitChildren(this);
|
||||
return null;
|
||||
@@ -2355,8 +2500,12 @@ class SimpleElementVisitor<R> implements ElementVisitor<R> {
|
||||
|
||||
R visitAngularPropertyElement(AngularPropertyElement element) => null;
|
||||
|
||||
R visitAngularScopePropertyElement(AngularScopePropertyElement element) => null;
|
||||
|
||||
R visitAngularSelectorElement(AngularSelectorElement element) => null;
|
||||
|
||||
R visitAngularViewElement(AngularViewElement element) => null;
|
||||
|
||||
R visitClassElement(ClassElement element) => null;
|
||||
|
||||
R visitCompilationUnitElement(CompilationUnitElement element) => null;
|
||||
@@ -2489,7 +2638,7 @@ class ClassElementImpl extends ElementImpl implements ClassElement {
|
||||
List<TypeParameterElement> _typeParameters = TypeParameterElementImpl.EMPTY_ARRAY;
|
||||
|
||||
/**
|
||||
* An empty array of type elements.
|
||||
* An empty array of class elements.
|
||||
*/
|
||||
static List<ClassElement> EMPTY_ARRAY = new List<ClassElement>(0);
|
||||
|
||||
@@ -2654,6 +2803,8 @@ class ClassElementImpl extends ElementImpl implements ClassElement {
|
||||
|
||||
bool get isAbstract => hasModifier(Modifier.ABSTRACT);
|
||||
|
||||
bool get isOrInheritsProxy => isOrInheritsProxy2(this, new Set<ClassElement>());
|
||||
|
||||
bool get isProxy {
|
||||
for (ElementAnnotation annotation in metadata) {
|
||||
if (annotation.isProxy) {
|
||||
@@ -2914,6 +3065,31 @@ class ClassElementImpl extends ElementImpl implements ClassElement {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool isOrInheritsProxy2(ClassElement classElt, Set<ClassElement> visitedClassElts) {
|
||||
if (visitedClassElts.contains(classElt)) {
|
||||
return false;
|
||||
}
|
||||
visitedClassElts.add(classElt);
|
||||
if (classElt.isProxy) {
|
||||
return true;
|
||||
} else if (classElt.supertype != null && isOrInheritsProxy2(classElt.supertype.element, visitedClassElts)) {
|
||||
return true;
|
||||
}
|
||||
List<InterfaceType> supertypes = classElt.interfaces;
|
||||
for (int i = 0; i < supertypes.length; i++) {
|
||||
if (isOrInheritsProxy2(supertypes[i].element, visitedClassElts)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
supertypes = classElt.mixins;
|
||||
for (int i = 0; i < supertypes.length; i++) {
|
||||
if (isOrInheritsProxy2(supertypes[i].element, visitedClassElts)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -2970,6 +3146,11 @@ class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE
|
||||
*/
|
||||
String uri;
|
||||
|
||||
/**
|
||||
* An array containing all of the Angular views contained in this compilation unit.
|
||||
*/
|
||||
List<AngularViewElement> _angularViews = AngularViewElement.EMPTY_ARRAY;
|
||||
|
||||
/**
|
||||
* Initialize a newly created compilation unit element to have the given name.
|
||||
*
|
||||
@@ -2983,6 +3164,8 @@ class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE
|
||||
|
||||
List<PropertyAccessorElement> get accessors => _accessors;
|
||||
|
||||
List<AngularViewElement> get angularViews => _angularViews;
|
||||
|
||||
ElementImpl getChild(String identifier) {
|
||||
//
|
||||
// The casts in this method are safe because the set methods would have thrown a CCE if any of
|
||||
@@ -3054,6 +3237,18 @@ class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE
|
||||
this._accessors = accessors;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the Angular views defined in this compilation unit.
|
||||
*
|
||||
* @param angularViews the Angular views defined in this compilation unit
|
||||
*/
|
||||
void set angularViews(List<AngularViewElement> angularViews) {
|
||||
for (AngularViewElement view in angularViews) {
|
||||
(view as AngularViewElementImpl).enclosingElement = this;
|
||||
}
|
||||
this._angularViews = angularViews;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the top-level functions contained in this compilation unit to the given functions.
|
||||
*
|
||||
@@ -3109,6 +3304,7 @@ class CompilationUnitElementImpl extends ElementImpl implements CompilationUnitE
|
||||
safelyVisitChildren(_typeAliases, visitor);
|
||||
safelyVisitChildren(_types, visitor);
|
||||
safelyVisitChildren(_variables, visitor);
|
||||
safelyVisitChildren(_angularViews, visitor);
|
||||
}
|
||||
|
||||
void appendTo(JavaStringBuilder builder) {
|
||||
@@ -3241,7 +3437,16 @@ class ConstructorElementImpl extends ExecutableElementImpl implements Constructo
|
||||
*
|
||||
* @param name the name of this element
|
||||
*/
|
||||
ConstructorElementImpl(Identifier name) : super.con1(name);
|
||||
ConstructorElementImpl.con1(Identifier name) : super.con1(name);
|
||||
|
||||
/**
|
||||
* Initialize a newly created constructor element to have the given name.
|
||||
*
|
||||
* @param name the name of this element
|
||||
* @param nameOffset the offset of the name of this element in the file that contains the
|
||||
* declaration of this element
|
||||
*/
|
||||
ConstructorElementImpl.con2(String name, int nameOffset) : super.con2(name, nameOffset);
|
||||
|
||||
accept(ElementVisitor visitor) => visitor.visitConstructorElement(this);
|
||||
|
||||
@@ -3621,6 +3826,15 @@ abstract class ElementImpl implements Element {
|
||||
return false;
|
||||
}
|
||||
|
||||
bool get isOverride {
|
||||
for (ElementAnnotation annotation in metadata) {
|
||||
if (annotation.isOverride) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool get isPrivate {
|
||||
String name = displayName;
|
||||
if (name == null) {
|
||||
@@ -4862,13 +5076,14 @@ class LibraryElementImpl extends ElementImpl implements LibraryElement {
|
||||
static bool isUpToDate(LibraryElement library, int timeStamp, Set<LibraryElement> visitedLibraries) {
|
||||
if (!visitedLibraries.contains(library)) {
|
||||
visitedLibraries.add(library);
|
||||
AnalysisContext context = library.context;
|
||||
// Check the defining compilation unit.
|
||||
if (timeStamp < library.definingCompilationUnit.source.modificationStamp) {
|
||||
if (timeStamp < context.getModificationStamp(library.definingCompilationUnit.source)) {
|
||||
return false;
|
||||
}
|
||||
// Check the parted compilation units.
|
||||
for (CompilationUnitElement element in library.parts) {
|
||||
if (timeStamp < element.source.modificationStamp) {
|
||||
if (timeStamp < context.getModificationStamp(element.source)) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -5584,6 +5799,8 @@ class MultiplyDefinedElementImpl implements MultiplyDefinedElement {
|
||||
|
||||
bool get isDeprecated => false;
|
||||
|
||||
bool get isOverride => false;
|
||||
|
||||
bool get isPrivate {
|
||||
String name = displayName;
|
||||
if (name == null) {
|
||||
@@ -5614,6 +5831,54 @@ class MultiplyDefinedElementImpl implements MultiplyDefinedElement {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface [MultiplyInheritedMethodElementImpl] defines all of the behavior of an
|
||||
* [MethodElementImpl], with the additional information of an array of
|
||||
* [ExecutableElement]s from which this element was composed.
|
||||
*
|
||||
* @coverage dart.engine.element
|
||||
*/
|
||||
class MultiplyInheritedMethodElementImpl extends MethodElementImpl implements MultiplyInheritedExecutableElement {
|
||||
/**
|
||||
* An array the array of executable elements that were used to compose this element.
|
||||
*/
|
||||
List<ExecutableElement> _elements = MethodElementImpl.EMPTY_ARRAY;
|
||||
|
||||
MultiplyInheritedMethodElementImpl(Identifier name) : super.con1(name) {
|
||||
synthetic = true;
|
||||
}
|
||||
|
||||
List<ExecutableElement> get inheritedElements => _elements;
|
||||
|
||||
void set inheritedElements(List<ExecutableElement> elements) {
|
||||
this._elements = elements;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* The interface [MultiplyInheritedPropertyAccessorElementImpl] defines all of the behavior of
|
||||
* an [PropertyAccessorElementImpl], with the additional information of an array of
|
||||
* [ExecutableElement]s from which this element was composed.
|
||||
*
|
||||
* @coverage dart.engine.element
|
||||
*/
|
||||
class MultiplyInheritedPropertyAccessorElementImpl extends PropertyAccessorElementImpl implements MultiplyInheritedExecutableElement {
|
||||
/**
|
||||
* An array the array of executable elements that were used to compose this element.
|
||||
*/
|
||||
List<ExecutableElement> _elements = PropertyAccessorElementImpl.EMPTY_ARRAY;
|
||||
|
||||
MultiplyInheritedPropertyAccessorElementImpl(Identifier name) : super.con1(name) {
|
||||
synthetic = true;
|
||||
}
|
||||
|
||||
List<ExecutableElement> get inheritedElements => _elements;
|
||||
|
||||
void set inheritedElements(List<ExecutableElement> elements) {
|
||||
this._elements = elements;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instances of the class `ParameterElementImpl` implement a `ParameterElement`.
|
||||
*
|
||||
@@ -5777,6 +6042,7 @@ class ParameterElementImpl extends VariableElementImpl implements ParameterEleme
|
||||
} else if (parameterKind == ParameterKind.POSITIONAL) {
|
||||
left = "[";
|
||||
right = "]";
|
||||
} else if (parameterKind == ParameterKind.REQUIRED) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -6189,8 +6455,8 @@ abstract class VariableElementImpl extends ElementImpl implements VariableElemen
|
||||
|
||||
/**
|
||||
* Return the result of evaluating this variable's initializer as a compile-time constant
|
||||
* expression, or `null` if this variable is not a 'const' variable or does not have an
|
||||
* initializer.
|
||||
* expression, or `null` if this variable is not a 'const' variable, if it does not have an
|
||||
* initializer, or if the compilation unit containing the variable has not been resolved.
|
||||
*
|
||||
* @return the result of evaluating this variable's initializer
|
||||
*/
|
||||
@@ -6205,8 +6471,9 @@ abstract class VariableElementImpl extends ElementImpl implements VariableElemen
|
||||
bool get isFinal => hasModifier(Modifier.FINAL);
|
||||
|
||||
/**
|
||||
* Return `true` if this variable is potentially mutated somewhere in closure. This
|
||||
* information is only available for local variables (including parameters).
|
||||
* Return `true` if this variable is potentially mutated somewhere in a closure. This
|
||||
* information is only available for local variables (including parameters) and only after the
|
||||
* compilation unit containing the variable has been resolved.
|
||||
*
|
||||
* @return `true` if this variable is potentially mutated somewhere in closure
|
||||
*/
|
||||
@@ -6214,7 +6481,8 @@ abstract class VariableElementImpl extends ElementImpl implements VariableElemen
|
||||
|
||||
/**
|
||||
* Return `true` if this variable is potentially mutated somewhere in its scope. This
|
||||
* information is only available for local variables (including parameters).
|
||||
* information is only available for local variables (including parameters) and only after the
|
||||
* compilation unit containing the variable has been resolved.
|
||||
*
|
||||
* @return `true` if this variable is potentially mutated somewhere in its scope
|
||||
*/
|
||||
@@ -6272,6 +6540,28 @@ abstract class VariableElementImpl extends ElementImpl implements VariableElemen
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Information about Angular application.
|
||||
*/
|
||||
class AngularApplication {
|
||||
final Source entryPoint;
|
||||
|
||||
Set<Source> _librarySources;
|
||||
|
||||
final List<AngularElement> elements;
|
||||
|
||||
final List<Source> elementSources;
|
||||
|
||||
AngularApplication(this.entryPoint, Set<Source> librarySources, this.elements, this.elementSources) {
|
||||
this._librarySources = librarySources;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if this application depends on the library with the given [Source].
|
||||
*/
|
||||
bool dependsOn(Source librarySource) => _librarySources.contains(librarySource);
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of `AngularComponentElement`.
|
||||
*
|
||||
@@ -6288,6 +6578,11 @@ class AngularComponentElementImpl extends AngularHasSelectorElementImpl implemen
|
||||
*/
|
||||
List<AngularPropertyElement> _properties = AngularPropertyElement.EMPTY_ARRAY;
|
||||
|
||||
/**
|
||||
* The array containing all of the scope properties set by this component.
|
||||
*/
|
||||
List<AngularScopePropertyElement> _scopeProperties = AngularScopePropertyElement.EMPTY_ARRAY;
|
||||
|
||||
/**
|
||||
* The the CSS file URI.
|
||||
*/
|
||||
@@ -6330,6 +6625,8 @@ class AngularComponentElementImpl extends AngularHasSelectorElementImpl implemen
|
||||
|
||||
List<AngularPropertyElement> get properties => _properties;
|
||||
|
||||
List<AngularScopePropertyElement> get scopeProperties => _scopeProperties;
|
||||
|
||||
/**
|
||||
* Set an array containing all of the properties declared by this component.
|
||||
*
|
||||
@@ -6342,8 +6639,21 @@ class AngularComponentElementImpl extends AngularHasSelectorElementImpl implemen
|
||||
this._properties = properties;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set an array containing all of the scope properties declared by this component.
|
||||
*
|
||||
* @param properties the properties to set
|
||||
*/
|
||||
void set scopeProperties(List<AngularScopePropertyElement> properties) {
|
||||
for (AngularScopePropertyElement property in properties) {
|
||||
encloseElement(property as AngularScopePropertyElementImpl);
|
||||
}
|
||||
this._scopeProperties = properties;
|
||||
}
|
||||
|
||||
void visitChildren(ElementVisitor visitor) {
|
||||
safelyVisitChildren(_properties, visitor);
|
||||
safelyVisitChildren(_scopeProperties, visitor);
|
||||
super.visitChildren(visitor);
|
||||
}
|
||||
|
||||
@@ -6434,6 +6744,11 @@ class AngularDirectiveElementImpl extends AngularHasSelectorElementImpl implemen
|
||||
* @coverage dart.engine.element
|
||||
*/
|
||||
abstract class AngularElementImpl extends ToolkitObjectElementImpl implements AngularElement {
|
||||
/**
|
||||
* The [AngularApplication] this element is used in.
|
||||
*/
|
||||
AngularApplication _application;
|
||||
|
||||
/**
|
||||
* Initialize a newly created Angular element to have the given name.
|
||||
*
|
||||
@@ -6442,6 +6757,15 @@ abstract class AngularElementImpl extends ToolkitObjectElementImpl implements An
|
||||
* declaration of this element
|
||||
*/
|
||||
AngularElementImpl(String name, int nameOffset) : super(name, nameOffset);
|
||||
|
||||
AngularApplication get application => _application;
|
||||
|
||||
/**
|
||||
* Set the [AngularApplication] this element is used in.
|
||||
*/
|
||||
void set application(AngularApplication application) {
|
||||
this._application = application;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -6464,6 +6788,34 @@ class AngularFilterElementImpl extends AngularElementImpl implements AngularFilt
|
||||
ElementKind get kind => ElementKind.ANGULAR_FILTER;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of [AngularSelectorElement] based on presence of a class.
|
||||
*/
|
||||
class AngularHasClassSelectorElementImpl extends AngularSelectorElementImpl implements AngularHasClassSelectorElement {
|
||||
AngularHasClassSelectorElementImpl(String name, int offset) : super(name, offset);
|
||||
|
||||
bool apply(XmlTagNode node) {
|
||||
XmlAttributeNode attribute = node.getAttribute("class");
|
||||
if (attribute != null) {
|
||||
String text = attribute.text;
|
||||
if (text != null) {
|
||||
String name = this.name;
|
||||
for (String className in StringUtils.split(text)) {
|
||||
if (className == name) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
void appendTo(JavaStringBuilder builder) {
|
||||
builder.append(".");
|
||||
builder.append(name);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of `AngularSelectorElement`.
|
||||
*
|
||||
@@ -6534,6 +6886,31 @@ class AngularPropertyElementImpl extends AngularElementImpl implements AngularPr
|
||||
ElementKind get kind => ElementKind.ANGULAR_PROPERTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of `AngularScopePropertyElement`.
|
||||
*
|
||||
* @coverage dart.engine.element
|
||||
*/
|
||||
class AngularScopePropertyElementImpl extends AngularElementImpl implements AngularScopePropertyElement {
|
||||
/**
|
||||
* The type of the property
|
||||
*/
|
||||
final Type2 type;
|
||||
|
||||
/**
|
||||
* Initialize a newly created Angular scope property to have the given name.
|
||||
*
|
||||
* @param name the name of this element
|
||||
* @param nameOffset the offset of the name of this element in the file that contains the
|
||||
* declaration of this element
|
||||
*/
|
||||
AngularScopePropertyElementImpl(String name, int nameOffset, this.type) : super(name, nameOffset);
|
||||
|
||||
accept(ElementVisitor visitor) => visitor.visitAngularScopePropertyElement(this);
|
||||
|
||||
ElementKind get kind => ElementKind.ANGULAR_SCOPE_PROPERTY;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of `AngularFilterElement`.
|
||||
*
|
||||
@@ -6554,10 +6931,57 @@ abstract class AngularSelectorElementImpl extends AngularElementImpl implements
|
||||
ElementKind get kind => ElementKind.ANGULAR_SELECTOR;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of [AngularSelectorElement] based on tag name.
|
||||
*/
|
||||
class AngularTagSelectorElementImpl extends AngularSelectorElementImpl implements AngularTagSelectorElement {
|
||||
AngularTagSelectorElementImpl(String name, int offset) : super(name, offset);
|
||||
|
||||
bool apply(XmlTagNode node) {
|
||||
String tagName = name;
|
||||
return node.tag == tagName;
|
||||
}
|
||||
|
||||
AngularApplication get application => (enclosingElement as AngularElementImpl).application;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of `AngularViewElement`.
|
||||
*
|
||||
* @coverage dart.engine.element
|
||||
*/
|
||||
class AngularViewElementImpl extends AngularElementImpl implements AngularViewElement {
|
||||
/**
|
||||
* The HTML template URI.
|
||||
*/
|
||||
final String templateUri;
|
||||
|
||||
/**
|
||||
* The offset of the [templateUri] in the [getSource].
|
||||
*/
|
||||
final int templateUriOffset;
|
||||
|
||||
/**
|
||||
* The HTML template source.
|
||||
*/
|
||||
Source templateSource;
|
||||
|
||||
/**
|
||||
* Initialize a newly created Angular view.
|
||||
*/
|
||||
AngularViewElementImpl(this.templateUri, this.templateUriOffset) : super(null, -1);
|
||||
|
||||
accept(ElementVisitor visitor) => visitor.visitAngularViewElement(this);
|
||||
|
||||
ElementKind get kind => ElementKind.ANGULAR_VIEW;
|
||||
|
||||
String get identifier => "AngularView@${templateUriOffset}";
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of [AngularSelectorElement] based on presence of attribute.
|
||||
*/
|
||||
class HasAttributeSelectorElementImpl extends AngularSelectorElementImpl {
|
||||
class HasAttributeSelectorElementImpl extends AngularSelectorElementImpl implements AngularHasAttributeSelectorElement {
|
||||
HasAttributeSelectorElementImpl(String attributeName, int offset) : super(attributeName, offset);
|
||||
|
||||
bool apply(XmlTagNode node) {
|
||||
@@ -6565,11 +6989,15 @@ class HasAttributeSelectorElementImpl extends AngularSelectorElementImpl {
|
||||
return node.getAttribute(attributeName) != null;
|
||||
}
|
||||
|
||||
String get displayName => "[${super.displayName}]";
|
||||
void appendTo(JavaStringBuilder builder) {
|
||||
builder.append("[");
|
||||
builder.append(name);
|
||||
builder.append("]");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Combination of [IsTagSelectorElementImpl] and [HasAttributeSelectorElementImpl].
|
||||
* Combination of [AngularTagSelectorElementImpl] and [HasAttributeSelectorElementImpl].
|
||||
*/
|
||||
class IsTagHasAttributeSelectorElementImpl extends AngularSelectorElementImpl {
|
||||
final String tagName;
|
||||
@@ -6581,18 +7009,6 @@ class IsTagHasAttributeSelectorElementImpl extends AngularSelectorElementImpl {
|
||||
bool apply(XmlTagNode node) => node.tag == tagName && node.getAttribute(attributeName) != null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Implementation of [AngularSelectorElement] based on tag name.
|
||||
*/
|
||||
class IsTagSelectorElementImpl extends AngularSelectorElementImpl {
|
||||
IsTagSelectorElementImpl(String name, int offset) : super(name, offset);
|
||||
|
||||
bool apply(XmlTagNode node) {
|
||||
String tagName = name;
|
||||
return node.tag == tagName;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instances of the class `ConstructorMember` represent a constructor element defined in a
|
||||
* parameterized type where the values of the type parameters are known.
|
||||
@@ -6887,6 +7303,8 @@ abstract class Member implements Element {
|
||||
|
||||
bool get isDeprecated => _baseElement.isDeprecated;
|
||||
|
||||
bool get isOverride => _baseElement.isOverride;
|
||||
|
||||
bool get isPrivate => _baseElement.isPrivate;
|
||||
|
||||
bool get isPublic => _baseElement.isPublic;
|
||||
@@ -7136,6 +7554,7 @@ class ParameterMember extends VariableMember implements ParameterElement {
|
||||
} else if (baseElement.parameterKind == ParameterKind.POSITIONAL) {
|
||||
left = "[";
|
||||
right = "]";
|
||||
} else if (baseElement.parameterKind == ParameterKind.REQUIRED) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -210,12 +210,12 @@ class AngularCode extends Enum<AngularCode> implements ErrorCode {
|
||||
*/
|
||||
AngularCode.con2(String name, int ordinal, String message, ErrorSeverity severity) : super(name, ordinal) {
|
||||
this._message = message;
|
||||
this._severity = severity;
|
||||
this._severity = ErrorSeverity.INFO;
|
||||
}
|
||||
|
||||
String get correction => null;
|
||||
|
||||
ErrorSeverity get errorSeverity => ErrorSeverity.INFO;
|
||||
ErrorSeverity get errorSeverity => _severity;
|
||||
|
||||
String get message => _message;
|
||||
|
||||
@@ -656,7 +656,22 @@ class HintCode extends Enum<HintCode> implements ErrorCode {
|
||||
*
|
||||
* @param returnType the name of the declared return type
|
||||
*/
|
||||
static final HintCode MISSING_RETURN = new HintCode.con2('MISSING_RETURN', 10, "This function declares a return type of '%s', but does not end with a return statement.", "Either add a return statement or change the return type to 'void'.");
|
||||
static final HintCode MISSING_RETURN = new HintCode.con2('MISSING_RETURN', 10, "This function declares a return type of '%s', but does not end with a return statement", "Either add a return statement or change the return type to 'void'");
|
||||
|
||||
/**
|
||||
* A getter with the override annotation does not override an existing getter.
|
||||
*/
|
||||
static final HintCode OVERRIDE_ON_NON_OVERRIDING_GETTER = new HintCode.con1('OVERRIDE_ON_NON_OVERRIDING_GETTER', 11, "Getter does not override an inherited getter");
|
||||
|
||||
/**
|
||||
* A method with the override annotation does not override an existing method.
|
||||
*/
|
||||
static final HintCode OVERRIDE_ON_NON_OVERRIDING_METHOD = new HintCode.con1('OVERRIDE_ON_NON_OVERRIDING_METHOD', 12, "Method does not override an inherited method");
|
||||
|
||||
/**
|
||||
* A setter with the override annotation does not override an existing setter.
|
||||
*/
|
||||
static final HintCode OVERRIDE_ON_NON_OVERRIDING_SETTER = new HintCode.con1('OVERRIDE_ON_NON_OVERRIDING_SETTER', 13, "Setter does not override an inherited setter");
|
||||
|
||||
/**
|
||||
* It is not in best practice to declare a private method that happens to override the method in a
|
||||
@@ -667,24 +682,24 @@ class HintCode extends Enum<HintCode> implements ErrorCode {
|
||||
* @param memberName some private member name
|
||||
* @param className the class name where the member is overriding the functionality
|
||||
*/
|
||||
static final HintCode OVERRIDDING_PRIVATE_MEMBER = new HintCode.con1('OVERRIDDING_PRIVATE_MEMBER', 11, "The %s '%s' does not override the definition from '%s' because it is private and in a different library");
|
||||
static final HintCode OVERRIDDING_PRIVATE_MEMBER = new HintCode.con1('OVERRIDDING_PRIVATE_MEMBER', 14, "The %s '%s' does not override the definition from '%s' because it is private and in a different library");
|
||||
|
||||
/**
|
||||
* Hint for classes that override equals, but not hashCode.
|
||||
*
|
||||
* @param className the name of the current class
|
||||
*/
|
||||
static final HintCode OVERRIDE_EQUALS_BUT_NOT_HASH_CODE = new HintCode.con1('OVERRIDE_EQUALS_BUT_NOT_HASH_CODE', 12, "The class '%s' overrides 'operator==', but not 'get hashCode'");
|
||||
static final HintCode OVERRIDE_EQUALS_BUT_NOT_HASH_CODE = new HintCode.con1('OVERRIDE_EQUALS_BUT_NOT_HASH_CODE', 15, "The class '%s' overrides 'operator==', but not 'get hashCode'");
|
||||
|
||||
/**
|
||||
* Type checks of the type `x is! Null` should be done with `x != null`.
|
||||
*/
|
||||
static final HintCode TYPE_CHECK_IS_NOT_NULL = new HintCode.con1('TYPE_CHECK_IS_NOT_NULL', 13, "Tests for non-null should be done with '!= null'");
|
||||
static final HintCode TYPE_CHECK_IS_NOT_NULL = new HintCode.con1('TYPE_CHECK_IS_NOT_NULL', 16, "Tests for non-null should be done with '!= null'");
|
||||
|
||||
/**
|
||||
* Type checks of the type `x is Null` should be done with `x == null`.
|
||||
*/
|
||||
static final HintCode TYPE_CHECK_IS_NULL = new HintCode.con1('TYPE_CHECK_IS_NULL', 14, "Tests for null should be done with '== null'");
|
||||
static final HintCode TYPE_CHECK_IS_NULL = new HintCode.con1('TYPE_CHECK_IS_NULL', 17, "Tests for null should be done with '== null'");
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_GETTER] or
|
||||
@@ -696,7 +711,7 @@ class HintCode extends Enum<HintCode> implements ErrorCode {
|
||||
* @see StaticTypeWarningCode#UNDEFINED_GETTER
|
||||
* @see StaticWarningCode#UNDEFINED_GETTER
|
||||
*/
|
||||
static final HintCode UNDEFINED_GETTER = new HintCode.con1('UNDEFINED_GETTER', 15, StaticTypeWarningCode.UNDEFINED_GETTER.message);
|
||||
static final HintCode UNDEFINED_GETTER = new HintCode.con1('UNDEFINED_GETTER', 18, StaticTypeWarningCode.UNDEFINED_GETTER.message);
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_METHOD] would
|
||||
@@ -706,7 +721,7 @@ class HintCode extends Enum<HintCode> implements ErrorCode {
|
||||
* @param typeName the resolved type name that the method lookup is happening on
|
||||
* @see StaticTypeWarningCode#UNDEFINED_METHOD
|
||||
*/
|
||||
static final HintCode UNDEFINED_METHOD = new HintCode.con1('UNDEFINED_METHOD', 16, StaticTypeWarningCode.UNDEFINED_METHOD.message);
|
||||
static final HintCode UNDEFINED_METHOD = new HintCode.con1('UNDEFINED_METHOD', 19, StaticTypeWarningCode.UNDEFINED_METHOD.message);
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_OPERATOR]
|
||||
@@ -716,7 +731,7 @@ class HintCode extends Enum<HintCode> implements ErrorCode {
|
||||
* @param enclosingType the name of the enclosing type where the operator is being looked for
|
||||
* @see StaticTypeWarningCode#UNDEFINED_OPERATOR
|
||||
*/
|
||||
static final HintCode UNDEFINED_OPERATOR = new HintCode.con1('UNDEFINED_OPERATOR', 17, StaticTypeWarningCode.UNDEFINED_OPERATOR.message);
|
||||
static final HintCode UNDEFINED_OPERATOR = new HintCode.con1('UNDEFINED_OPERATOR', 20, StaticTypeWarningCode.UNDEFINED_OPERATOR.message);
|
||||
|
||||
/**
|
||||
* This hint is generated anywhere where the [StaticTypeWarningCode#UNDEFINED_SETTER] or
|
||||
@@ -728,27 +743,27 @@ class HintCode extends Enum<HintCode> implements ErrorCode {
|
||||
* @see StaticTypeWarningCode#UNDEFINED_SETTER
|
||||
* @see StaticWarningCode#UNDEFINED_SETTER
|
||||
*/
|
||||
static final HintCode UNDEFINED_SETTER = new HintCode.con1('UNDEFINED_SETTER', 18, StaticTypeWarningCode.UNDEFINED_SETTER.message);
|
||||
static final HintCode UNDEFINED_SETTER = new HintCode.con1('UNDEFINED_SETTER', 21, StaticTypeWarningCode.UNDEFINED_SETTER.message);
|
||||
|
||||
/**
|
||||
* Unnecessary cast.
|
||||
*/
|
||||
static final HintCode UNNECESSARY_CAST = new HintCode.con1('UNNECESSARY_CAST', 19, "Unnecessary cast");
|
||||
static final HintCode UNNECESSARY_CAST = new HintCode.con1('UNNECESSARY_CAST', 22, "Unnecessary cast");
|
||||
|
||||
/**
|
||||
* Unnecessary type checks, the result is always true.
|
||||
*/
|
||||
static final HintCode UNNECESSARY_TYPE_CHECK_FALSE = new HintCode.con1('UNNECESSARY_TYPE_CHECK_FALSE', 20, "Unnecessary type check, the result is always false");
|
||||
static final HintCode UNNECESSARY_TYPE_CHECK_FALSE = new HintCode.con1('UNNECESSARY_TYPE_CHECK_FALSE', 23, "Unnecessary type check, the result is always false");
|
||||
|
||||
/**
|
||||
* Unnecessary type checks, the result is always false.
|
||||
*/
|
||||
static final HintCode UNNECESSARY_TYPE_CHECK_TRUE = new HintCode.con1('UNNECESSARY_TYPE_CHECK_TRUE', 21, "Unnecessary type check, the result is always true");
|
||||
static final HintCode UNNECESSARY_TYPE_CHECK_TRUE = new HintCode.con1('UNNECESSARY_TYPE_CHECK_TRUE', 24, "Unnecessary type check, the result is always true");
|
||||
|
||||
/**
|
||||
* Unused imports are imports which are never not used.
|
||||
*/
|
||||
static final HintCode UNUSED_IMPORT = new HintCode.con1('UNUSED_IMPORT', 22, "Unused import");
|
||||
static final HintCode UNUSED_IMPORT = new HintCode.con1('UNUSED_IMPORT', 25, "Unused import");
|
||||
|
||||
/**
|
||||
* Hint for cases where the source expects a method or function to return a non-void result, but
|
||||
@@ -756,7 +771,7 @@ class HintCode extends Enum<HintCode> implements ErrorCode {
|
||||
*
|
||||
* @param name the name of the method or function that returns void
|
||||
*/
|
||||
static final HintCode USE_OF_VOID_RESULT = new HintCode.con1('USE_OF_VOID_RESULT', 23, "The result of '%s' is being used, even though it is declared to be 'void'");
|
||||
static final HintCode USE_OF_VOID_RESULT = new HintCode.con1('USE_OF_VOID_RESULT', 26, "The result of '%s' is being used, even though it is declared to be 'void'");
|
||||
|
||||
static final List<HintCode> values = [
|
||||
DEAD_CODE,
|
||||
@@ -770,6 +785,9 @@ class HintCode extends Enum<HintCode> implements ErrorCode {
|
||||
IS_NOT_DOUBLE,
|
||||
IS_NOT_INT,
|
||||
MISSING_RETURN,
|
||||
OVERRIDE_ON_NON_OVERRIDING_GETTER,
|
||||
OVERRIDE_ON_NON_OVERRIDING_METHOD,
|
||||
OVERRIDE_ON_NON_OVERRIDING_SETTER,
|
||||
OVERRIDDING_PRIVATE_MEMBER,
|
||||
OVERRIDE_EQUALS_BUT_NOT_HASH_CODE,
|
||||
TYPE_CHECK_IS_NOT_NULL,
|
||||
@@ -2421,7 +2439,7 @@ class StaticWarningCode extends Enum<StaticWarningCode> implements ErrorCode {
|
||||
* to be thrown, because no setter is defined for it. The assignment will also give rise to a
|
||||
* static warning for the same reason.
|
||||
*/
|
||||
static final StaticWarningCode ASSIGNMENT_TO_FINAL = new StaticWarningCode.con1('ASSIGNMENT_TO_FINAL', 3, "Final variables cannot be assigned a value");
|
||||
static final StaticWarningCode ASSIGNMENT_TO_FINAL = new StaticWarningCode.con1('ASSIGNMENT_TO_FINAL', 3, "'%s' cannot be used as a setter, it is final");
|
||||
|
||||
/**
|
||||
* 12.18 Assignment: Let <i>T</i> be the static type of <i>e<sub>1</sub></i>. It is a static type
|
||||
@@ -2871,7 +2889,7 @@ class StaticWarningCode extends Enum<StaticWarningCode> implements ErrorCode {
|
||||
* @param memberName the name of the fourth member
|
||||
* @param additionalCount the number of additional missing members that aren't listed
|
||||
*/
|
||||
static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS', 49, "Missing inherited members: '%s', '%s', '%s', '%s' and %d more");
|
||||
static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FIVE_PLUS', 49, "Missing concrete implementation of '%s', '%s', '%s', '%s' and %d more");
|
||||
|
||||
/**
|
||||
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
|
||||
@@ -2890,7 +2908,7 @@ class StaticWarningCode extends Enum<StaticWarningCode> implements ErrorCode {
|
||||
* @param memberName the name of the third member
|
||||
* @param memberName the name of the fourth member
|
||||
*/
|
||||
static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR', 50, "Missing inherited members: '%s', '%s', '%s' and '%s'");
|
||||
static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_FOUR', 50, "Missing concrete implementation of '%s', '%s', '%s' and '%s'");
|
||||
|
||||
/**
|
||||
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
|
||||
@@ -2906,7 +2924,7 @@ class StaticWarningCode extends Enum<StaticWarningCode> implements ErrorCode {
|
||||
*
|
||||
* @param memberName the name of the member
|
||||
*/
|
||||
static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', 51, "Missing inherited member '%s'");
|
||||
static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_ONE', 51, "Missing concrete implementation of '%s'");
|
||||
|
||||
/**
|
||||
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
|
||||
@@ -2924,7 +2942,7 @@ class StaticWarningCode extends Enum<StaticWarningCode> implements ErrorCode {
|
||||
* @param memberName the name of the second member
|
||||
* @param memberName the name of the third member
|
||||
*/
|
||||
static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE', 52, "Missing inherited members: '%s', '%s' and '%s'");
|
||||
static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_THREE', 52, "Missing concrete implementation of '%s', '%s' and '%s'");
|
||||
|
||||
/**
|
||||
* 7.9.1 Inheritance and Overriding: It is a static warning if a non-abstract class inherits an
|
||||
@@ -2941,7 +2959,7 @@ class StaticWarningCode extends Enum<StaticWarningCode> implements ErrorCode {
|
||||
* @param memberName the name of the first member
|
||||
* @param memberName the name of the second member
|
||||
*/
|
||||
static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', 53, "Missing inherited members: '%s' and '%s'");
|
||||
static final StaticWarningCode NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO = new StaticWarningCode.con1('NON_ABSTRACT_CLASS_INHERITS_ABSTRACT_MEMBER_TWO', 53, "Missing concrete implementation of '%s' and '%s'");
|
||||
|
||||
/**
|
||||
* 13.11 Try: An on-catch clause of the form <i>on T catch (p<sub>1</sub>, p<sub>2</sub>) s</i> or
|
||||
@@ -3389,7 +3407,7 @@ class StaticTypeWarningCode extends Enum<StaticTypeWarningCode> implements Error
|
||||
* * Otherwise none of the members <i>m<sub>1</sub>, …, m<sub>k</sub></i> is inherited.
|
||||
* </ol>
|
||||
*/
|
||||
static final StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = new StaticTypeWarningCode.con1('INCONSISTENT_METHOD_INHERITANCE', 3, "'%s' is inherited by at least two interfaces inconsistently");
|
||||
static final StaticTypeWarningCode INCONSISTENT_METHOD_INHERITANCE = new StaticTypeWarningCode.con1('INCONSISTENT_METHOD_INHERITANCE', 3, "'%s' is inherited by at least two interfaces inconsistently, from %s");
|
||||
|
||||
/**
|
||||
* 12.15.1 Ordinary Invocation: It is a static type warning if <i>T</i> does not have an
|
||||
|
||||
@@ -165,29 +165,6 @@ class RawXmlExpression extends XmlExpression {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instances of `HtmlParseResult` hold the result of parsing an HTML file.
|
||||
*
|
||||
* @coverage dart.engine.html
|
||||
*/
|
||||
class HtmlParseResult extends HtmlScanResult {
|
||||
/**
|
||||
* The unit containing the parsed information (not `null`).
|
||||
*/
|
||||
HtmlUnit _unit;
|
||||
|
||||
HtmlParseResult(int modificationTime, Token token, List<int> lineStarts, HtmlUnit unit) : super(modificationTime, token, lineStarts) {
|
||||
this._unit = unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Answer the unit generated by parsing the source
|
||||
*
|
||||
* @return the unit (not `null`)
|
||||
*/
|
||||
HtmlUnit get htmlUnit => _unit;
|
||||
}
|
||||
|
||||
/**
|
||||
* Instances of the class `RecursiveXmlVisitor` implement an XML visitor that will recursively
|
||||
* visit all of the nodes in an XML structure. For example, using an instance of this class to visit
|
||||
@@ -975,30 +952,6 @@ abstract class AbstractScanner {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instances of `HtmlScanResult` hold the result of scanning an HTML file.
|
||||
*
|
||||
* @coverage dart.engine.html
|
||||
*/
|
||||
class HtmlScanResult {
|
||||
/**
|
||||
* The time at which the contents of the source were last set.
|
||||
*/
|
||||
final int modificationTime;
|
||||
|
||||
/**
|
||||
* The first token in the token stream (not `null`).
|
||||
*/
|
||||
final Token token;
|
||||
|
||||
/**
|
||||
* The line start information that was produced.
|
||||
*/
|
||||
final List<int> lineStarts;
|
||||
|
||||
HtmlScanResult(this.modificationTime, this.token, this.lineStarts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instances of the class `StringScanner` implement a scanner that reads from a string. The
|
||||
* scanning logic is in the superclass.
|
||||
@@ -1365,65 +1318,6 @@ class XmlExpression_Reference {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Instances of `HtmlScanner` receive and scan HTML content from a [Source].<br/>
|
||||
* For example, the following code scans HTML source and returns the result:
|
||||
*
|
||||
* <pre>
|
||||
* HtmlScanner scanner = new HtmlScanner(source);
|
||||
* source.getContents(scanner);
|
||||
* return scanner.getResult();
|
||||
* </pre>
|
||||
*
|
||||
* @coverage dart.engine.html
|
||||
*/
|
||||
class HtmlScanner implements Source_ContentReceiver {
|
||||
List<String> _SCRIPT_TAG = <String> ["script"];
|
||||
|
||||
/**
|
||||
* The source being scanned (not `null`)
|
||||
*/
|
||||
Source _source;
|
||||
|
||||
/**
|
||||
* The time at which the contents of the source were last set.
|
||||
*/
|
||||
int _modificationTime = 0;
|
||||
|
||||
/**
|
||||
* The scanner used to scan the source
|
||||
*/
|
||||
AbstractScanner _scanner;
|
||||
|
||||
/**
|
||||
* The first token in the token stream.
|
||||
*/
|
||||
Token _token;
|
||||
|
||||
/**
|
||||
* Construct a new instance to scan the specified source.
|
||||
*
|
||||
* @param source the source to be scanned (not `null`)
|
||||
*/
|
||||
HtmlScanner(Source source) {
|
||||
this._source = source;
|
||||
}
|
||||
|
||||
void accept(String contents, int modificationTime) {
|
||||
this._modificationTime = modificationTime;
|
||||
_scanner = new StringScanner(_source, contents);
|
||||
_scanner.passThroughElements = _SCRIPT_TAG;
|
||||
_token = _scanner.tokenize();
|
||||
}
|
||||
|
||||
/**
|
||||
* Answer the result of scanning the source
|
||||
*
|
||||
* @return the result (not `null`)
|
||||
*/
|
||||
HtmlScanResult get result => new HtmlScanResult(_modificationTime, _token, _scanner.lineStarts);
|
||||
}
|
||||
|
||||
/**
|
||||
* Instances of the class `XmlParser` are used to parse tokens into a AST structure comprised
|
||||
* of [XmlNode]s.
|
||||
@@ -1491,22 +1385,20 @@ class XmlParser {
|
||||
List<XmlTagNode> parseTopTagNodes(Token firstToken) {
|
||||
_currentToken = firstToken;
|
||||
List<XmlTagNode> tagNodes = new List<XmlTagNode>();
|
||||
while (true) {
|
||||
while (true) {
|
||||
if (_currentToken.type == TokenType.LT) {
|
||||
tagNodes.add(parseTagNode());
|
||||
} else if (_currentToken.type == TokenType.DECLARATION || _currentToken.type == TokenType.DIRECTIVE || _currentToken.type == TokenType.COMMENT) {
|
||||
// ignored tokens
|
||||
_currentToken = _currentToken.next;
|
||||
} else if (_currentToken.type == TokenType.EOF) {
|
||||
return tagNodes;
|
||||
} else {
|
||||
reportUnexpectedToken();
|
||||
_currentToken = _currentToken.next;
|
||||
}
|
||||
break;
|
||||
TokenType type = _currentToken.type;
|
||||
while (type != TokenType.EOF) {
|
||||
if (identical(type, TokenType.LT)) {
|
||||
tagNodes.add(parseTagNode());
|
||||
} else if (identical(type, TokenType.DECLARATION) || identical(type, TokenType.DIRECTIVE) || identical(type, TokenType.COMMENT)) {
|
||||
// ignored tokens
|
||||
_currentToken = _currentToken.next;
|
||||
} else {
|
||||
reportUnexpectedToken();
|
||||
_currentToken = _currentToken.next;
|
||||
}
|
||||
type = _currentToken.type;
|
||||
}
|
||||
return tagNodes;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1572,19 +1464,16 @@ class XmlParser {
|
||||
return XmlTagNode.NO_ATTRIBUTES;
|
||||
}
|
||||
List<XmlAttributeNode> attributes = new List<XmlAttributeNode>();
|
||||
while (true) {
|
||||
while (true) {
|
||||
if (_currentToken.type == TokenType.GT || _currentToken.type == TokenType.SLASH_GT || _currentToken.type == TokenType.EOF) {
|
||||
return attributes;
|
||||
} else if (_currentToken.type == TokenType.TAG) {
|
||||
attributes.add(parseAttribute());
|
||||
} else {
|
||||
reportUnexpectedToken();
|
||||
_currentToken = _currentToken.next;
|
||||
}
|
||||
break;
|
||||
while (type != TokenType.GT && type != TokenType.SLASH_GT && type != TokenType.EOF) {
|
||||
if (identical(type, TokenType.TAG)) {
|
||||
attributes.add(parseAttribute());
|
||||
} else {
|
||||
reportUnexpectedToken();
|
||||
_currentToken = _currentToken.next;
|
||||
}
|
||||
type = _currentToken.type;
|
||||
}
|
||||
return attributes;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1599,22 +1488,19 @@ class XmlParser {
|
||||
return XmlTagNode.NO_TAG_NODES;
|
||||
}
|
||||
List<XmlTagNode> nodes = new List<XmlTagNode>();
|
||||
while (true) {
|
||||
while (true) {
|
||||
if (_currentToken.type == TokenType.LT) {
|
||||
nodes.add(parseTagNode());
|
||||
} else if (_currentToken.type == TokenType.LT_SLASH || _currentToken.type == TokenType.EOF) {
|
||||
return nodes;
|
||||
} else if (_currentToken.type == TokenType.COMMENT) {
|
||||
// ignored token
|
||||
_currentToken = _currentToken.next;
|
||||
} else {
|
||||
reportUnexpectedToken();
|
||||
_currentToken = _currentToken.next;
|
||||
}
|
||||
break;
|
||||
while (type != TokenType.LT_SLASH && type != TokenType.EOF) {
|
||||
if (identical(type, TokenType.LT)) {
|
||||
nodes.add(parseTagNode());
|
||||
} else if (identical(type, TokenType.COMMENT)) {
|
||||
// ignored token
|
||||
_currentToken = _currentToken.next;
|
||||
} else {
|
||||
reportUnexpectedToken();
|
||||
_currentToken = _currentToken.next;
|
||||
}
|
||||
type = _currentToken.type;
|
||||
}
|
||||
return nodes;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1997,30 +1883,16 @@ class HtmlParser extends XmlParser {
|
||||
}
|
||||
|
||||
/**
|
||||
* Parse the tokens specified by the given scan result.
|
||||
* Parse the given tokens.
|
||||
*
|
||||
* @param scanResult the result of scanning an HTML source (not `null`)
|
||||
* @param token the first token in the stream of tokens to be parsed
|
||||
* @param lineInfo the line information created by the scanner
|
||||
* @return the parse result (not `null`)
|
||||
*/
|
||||
HtmlParseResult parse(HtmlScanResult scanResult) {
|
||||
List<int> lineStarts = scanResult.lineStarts;
|
||||
_lineInfo = new LineInfo(lineStarts);
|
||||
Token firstToken = scanResult.token;
|
||||
List<XmlTagNode> tagNodes = parseTopTagNodes(firstToken);
|
||||
HtmlUnit unit = new HtmlUnit(firstToken, tagNodes, currentToken);
|
||||
return new HtmlParseResult(scanResult.modificationTime, firstToken, scanResult.lineStarts, unit);
|
||||
}
|
||||
|
||||
/**
|
||||
* Scan then parse the specified source.
|
||||
*
|
||||
* @param source the source to be scanned and parsed (not `null`)
|
||||
* @return the parse result (not `null`)
|
||||
*/
|
||||
HtmlParseResult parse2(Source source) {
|
||||
HtmlScanner scanner = new HtmlScanner(source);
|
||||
source.getContents(scanner);
|
||||
return parse(scanner.result);
|
||||
HtmlUnit parse(Token token, LineInfo lineInfo) {
|
||||
this._lineInfo = lineInfo;
|
||||
List<XmlTagNode> tagNodes = parseTopTagNodes(token);
|
||||
return new HtmlUnit(token, tagNodes, currentToken);
|
||||
}
|
||||
|
||||
XmlAttributeNode createAttributeNode(Token name, Token equals, Token value) => new XmlAttributeNode(name, equals, value);
|
||||
|
||||
@@ -1212,6 +1212,16 @@ abstract class IndexConstants {
|
||||
* location (the right operand). This is used for methods.
|
||||
*/
|
||||
static final Relationship IS_INVOKED_BY_UNQUALIFIED = Relationship.getRelationship("is-invoked-by-unqualified");
|
||||
|
||||
/**
|
||||
* Reference to some [AngularElement].
|
||||
*/
|
||||
static final Relationship ANGULAR_REFERENCE = Relationship.getRelationship("angular-reference");
|
||||
|
||||
/**
|
||||
* Reference to some closing tag of an XML element.
|
||||
*/
|
||||
static final Relationship ANGULAR_CLOSING_TAG_REFERENCE = Relationship.getRelationship("angular-closing-tag-reference");
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -1248,7 +1258,7 @@ class AngularHtmlIndexContributor extends ExpressionVisitor {
|
||||
SimpleIdentifier identifier = expression;
|
||||
Element element = identifier.bestElement;
|
||||
if (element is AngularElement) {
|
||||
_store.recordRelationship(element, IndexConstants.IS_REFERENCED_BY, createLocation(identifier));
|
||||
_store.recordRelationship(element, IndexConstants.ANGULAR_REFERENCE, createLocation(identifier));
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -1268,7 +1278,7 @@ class AngularHtmlIndexContributor extends ExpressionVisitor {
|
||||
if (element != null) {
|
||||
ht.Token nameToken = node.nameToken;
|
||||
Location location = createLocation2(nameToken);
|
||||
_store.recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location);
|
||||
_store.recordRelationship(element, IndexConstants.ANGULAR_REFERENCE, location);
|
||||
}
|
||||
return super.visitXmlAttributeNode(node);
|
||||
}
|
||||
@@ -1276,9 +1286,18 @@ class AngularHtmlIndexContributor extends ExpressionVisitor {
|
||||
Object visitXmlTagNode(ht.XmlTagNode node) {
|
||||
Element element = node.element;
|
||||
if (element != null) {
|
||||
ht.Token tagToken = node.tagToken;
|
||||
Location location = createLocation2(tagToken);
|
||||
_store.recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location);
|
||||
// tag
|
||||
{
|
||||
ht.Token tagToken = node.tagToken;
|
||||
Location location = createLocation2(tagToken);
|
||||
_store.recordRelationship(element, IndexConstants.ANGULAR_REFERENCE, location);
|
||||
}
|
||||
// maybe add closing tag range
|
||||
ht.Token closingTag = node.closingTag;
|
||||
if (closingTag != null) {
|
||||
Location location = createLocation2(closingTag);
|
||||
_store.recordRelationship(element, IndexConstants.ANGULAR_CLOSING_TAG_REFERENCE, location);
|
||||
}
|
||||
}
|
||||
return super.visitXmlTagNode(node);
|
||||
}
|
||||
@@ -1299,7 +1318,7 @@ class IndexContributor_AngularHtmlIndexContributor extends IndexContributor {
|
||||
AngularElement angularElement = AngularHtmlUnitResolver.getAngularElement(element);
|
||||
if (angularElement != null) {
|
||||
element = angularElement;
|
||||
relationship = IndexConstants.IS_REFERENCED_BY;
|
||||
relationship = IndexConstants.ANGULAR_REFERENCE;
|
||||
}
|
||||
super.recordRelationship(element, relationship, location);
|
||||
}
|
||||
@@ -1564,13 +1583,17 @@ class IndexContributor extends GeneralizingASTVisitor<Object> {
|
||||
Element usedElement = null;
|
||||
if (parent is PrefixedIdentifier) {
|
||||
PrefixedIdentifier prefixed = parent;
|
||||
usedElement = prefixed.staticElement;
|
||||
info._periodEnd = prefixed.period.end;
|
||||
if (identical(prefixed.prefix, prefixNode)) {
|
||||
usedElement = prefixed.staticElement;
|
||||
info._periodEnd = prefixed.period.end;
|
||||
}
|
||||
}
|
||||
if (parent is MethodInvocation) {
|
||||
MethodInvocation invocation = parent;
|
||||
usedElement = invocation.methodName.staticElement;
|
||||
info._periodEnd = invocation.period.end;
|
||||
if (identical(invocation.target, prefixNode)) {
|
||||
usedElement = invocation.methodName.staticElement;
|
||||
info._periodEnd = invocation.period.end;
|
||||
}
|
||||
}
|
||||
// we need used Element
|
||||
if (usedElement == null) {
|
||||
@@ -1740,6 +1763,14 @@ class IndexContributor extends GeneralizingASTVisitor<Object> {
|
||||
return location;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return `true` if given "node" is part of an import [Combinator].
|
||||
*/
|
||||
static bool isIdentifierInImportCombinator(SimpleIdentifier node) {
|
||||
ASTNode parent = node.parent;
|
||||
return parent is Combinator;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return `true` if given "node" is part of [PrefixedIdentifier] "prefix.node".
|
||||
*/
|
||||
@@ -1923,6 +1954,11 @@ class IndexContributor extends GeneralizingASTVisitor<Object> {
|
||||
|
||||
Object visitConstructorName(ConstructorName node) {
|
||||
ConstructorElement element = node.staticElement;
|
||||
// in 'class B = A;' actually A constructors are invoked
|
||||
if (element != null && element.isSynthetic && element.redirectedConstructor != null) {
|
||||
element = element.redirectedConstructor;
|
||||
}
|
||||
// prepare location
|
||||
Location location;
|
||||
if (node.name != null) {
|
||||
int start = node.period.offset;
|
||||
@@ -1932,6 +1968,7 @@ class IndexContributor extends GeneralizingASTVisitor<Object> {
|
||||
int start = node.type.end;
|
||||
location = createLocation4(start, 0);
|
||||
}
|
||||
// record relationship
|
||||
recordRelationship(element, IndexConstants.IS_REFERENCED_BY, location);
|
||||
return super.visitConstructorName(node);
|
||||
}
|
||||
@@ -2240,6 +2277,9 @@ class IndexContributor extends GeneralizingASTVisitor<Object> {
|
||||
* top-level element and not qualified with import prefix.
|
||||
*/
|
||||
void recordImportElementReferenceWithoutPrefix(SimpleIdentifier node) {
|
||||
if (isIdentifierInImportCombinator(node)) {
|
||||
return;
|
||||
}
|
||||
if (isIdentifierInPrefixedIdentifier(node)) {
|
||||
return;
|
||||
}
|
||||
@@ -2559,11 +2599,17 @@ class AngularDartIndexContributor extends GeneralizingASTVisitor<Object> {
|
||||
indexProperties(directive.properties);
|
||||
}
|
||||
|
||||
/**
|
||||
* Index [FieldElement] references from [AngularPropertyElement]s.
|
||||
*/
|
||||
void indexProperties(List<AngularPropertyElement> properties) {
|
||||
for (AngularPropertyElement property in properties) {
|
||||
FieldElement field = property.field;
|
||||
if (field != null) {
|
||||
int offset = property.fieldNameOffset;
|
||||
if (offset == -1) {
|
||||
continue;
|
||||
}
|
||||
int length = field.name.length;
|
||||
Location location = new Location(property, offset, length);
|
||||
// getter reference
|
||||
|
||||
@@ -284,7 +284,7 @@ class PrintStringWriter extends PrintWriter {
|
||||
}
|
||||
|
||||
class StringUtils {
|
||||
static List<String> split(String s, String pattern) => s.split(pattern);
|
||||
static List<String> split(String s, [String pattern = '']) => s.split(pattern);
|
||||
static String replace(String s, String from, String to) => s.replaceAll(from, to);
|
||||
static String repeat(String s, int n) {
|
||||
StringBuffer sb = new StringBuffer();
|
||||
|
||||
@@ -4,7 +4,7 @@ import 'java_core.dart';
|
||||
|
||||
class StringUtilities {
|
||||
static const String EMPTY = '';
|
||||
static const List<String> EMPTY_ARRAY = const <String> [];
|
||||
static const List<String> EMPTY_ARRAY = const <String>[];
|
||||
static String intern(String s) => s;
|
||||
static bool isTagName(String s) {
|
||||
if (s == null || s.length == 0) {
|
||||
@@ -43,50 +43,37 @@ class StringUtilities {
|
||||
}
|
||||
static endsWith3(String str, int c1, int c2, int c3) {
|
||||
var length = str.length;
|
||||
return length >= 3 &&
|
||||
str.codeUnitAt(length - 3) == c1 &&
|
||||
str.codeUnitAt(length - 2) == c2 &&
|
||||
str.codeUnitAt(length - 1) == c3;
|
||||
return length >= 3 && str.codeUnitAt(length - 3) == c1 && str.codeUnitAt(
|
||||
length - 2) == c2 && str.codeUnitAt(length - 1) == c3;
|
||||
}
|
||||
|
||||
static startsWithChar(String str, int c) {
|
||||
return str.length != 0 && str.codeUnitAt(0) == c;
|
||||
}
|
||||
static startsWith2(String str, int start, int c1, int c2) {
|
||||
return str.length - start >= 2 &&
|
||||
str.codeUnitAt(start) == c1 &&
|
||||
return str.length - start >= 2 && str.codeUnitAt(start) == c1 &&
|
||||
str.codeUnitAt(start + 1) == c2;
|
||||
}
|
||||
static startsWith3(String str, int start, int c1, int c2, int c3) {
|
||||
return str.length - start >= 3 &&
|
||||
str.codeUnitAt(start) == c1 &&
|
||||
str.codeUnitAt(start + 1) == c2 &&
|
||||
str.codeUnitAt(start + 2) == c3;
|
||||
return str.length - start >= 3 && str.codeUnitAt(start) == c1 &&
|
||||
str.codeUnitAt(start + 1) == c2 && str.codeUnitAt(start + 2) == c3;
|
||||
}
|
||||
static startsWith4(String str, int start, int c1, int c2, int c3, int c4) {
|
||||
return str.length - start >= 4 &&
|
||||
str.codeUnitAt(start) == c1 &&
|
||||
str.codeUnitAt(start + 1) == c2 &&
|
||||
str.codeUnitAt(start + 2) == c3 &&
|
||||
return str.length - start >= 4 && str.codeUnitAt(start) == c1 &&
|
||||
str.codeUnitAt(start + 1) == c2 && str.codeUnitAt(start + 2) == c3 &&
|
||||
str.codeUnitAt(start + 3) == c4;
|
||||
}
|
||||
static startsWith5(String str, int start, int c1, int c2, int c3, int c4,
|
||||
int c5) {
|
||||
return str.length - start >= 5 &&
|
||||
str.codeUnitAt(start) == c1 &&
|
||||
str.codeUnitAt(start + 1) == c2 &&
|
||||
str.codeUnitAt(start + 2) == c3 &&
|
||||
str.codeUnitAt(start + 3) == c4 &&
|
||||
str.codeUnitAt(start + 4) == c5;
|
||||
static startsWith5(String str, int start, int c1, int c2, int c3, int c4, int
|
||||
c5) {
|
||||
return str.length - start >= 5 && str.codeUnitAt(start) == c1 &&
|
||||
str.codeUnitAt(start + 1) == c2 && str.codeUnitAt(start + 2) == c3 &&
|
||||
str.codeUnitAt(start + 3) == c4 && str.codeUnitAt(start + 4) == c5;
|
||||
}
|
||||
static startsWith6(String str, int start, int c1, int c2, int c3, int c4,
|
||||
int c5, int c6) {
|
||||
return str.length - start >= 6 &&
|
||||
str.codeUnitAt(start) == c1 &&
|
||||
str.codeUnitAt(start + 1) == c2 &&
|
||||
str.codeUnitAt(start + 2) == c3 &&
|
||||
str.codeUnitAt(start + 3) == c4 &&
|
||||
str.codeUnitAt(start + 4) == c5 &&
|
||||
static startsWith6(String str, int start, int c1, int c2, int c3, int c4, int
|
||||
c5, int c6) {
|
||||
return str.length - start >= 6 && str.codeUnitAt(start) == c1 &&
|
||||
str.codeUnitAt(start + 1) == c2 && str.codeUnitAt(start + 2) == c3 &&
|
||||
str.codeUnitAt(start + 3) == c4 && str.codeUnitAt(start + 4) == c5 &&
|
||||
str.codeUnitAt(start + 5) == c6;
|
||||
}
|
||||
static int indexOf1(String str, int start, int c) {
|
||||
@@ -111,29 +98,26 @@ class StringUtilities {
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
static int indexOf4(String string, int start, int c1, int c2, int c3, int c4) {
|
||||
static int indexOf4(String string, int start, int c1, int c2, int c3, int c4)
|
||||
{
|
||||
int index = start;
|
||||
int last = string.length - 3;
|
||||
while (index < last) {
|
||||
if (string.codeUnitAt(index) == c1 &&
|
||||
string.codeUnitAt(index + 1) == c2 &&
|
||||
string.codeUnitAt(index + 2) == c3 &&
|
||||
string.codeUnitAt(index + 3) == c4) {
|
||||
if (string.codeUnitAt(index) == c1 && string.codeUnitAt(index + 1) == c2
|
||||
&& string.codeUnitAt(index + 2) == c3 && string.codeUnitAt(index + 3) == c4) {
|
||||
return index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
static int indexOf5(String str, int start, int c1, int c2, int c3, int c4,
|
||||
int c5) {
|
||||
static int indexOf5(String str, int start, int c1, int c2, int c3, int c4, int
|
||||
c5) {
|
||||
int index = start;
|
||||
int last = str.length - 4;
|
||||
while (index < last) {
|
||||
if (str.codeUnitAt(index) == c1 &&
|
||||
str.codeUnitAt(index + 1) == c2 &&
|
||||
str.codeUnitAt(index + 2) == c3 &&
|
||||
str.codeUnitAt(index + 3) == c4 &&
|
||||
if (str.codeUnitAt(index) == c1 && str.codeUnitAt(index + 1) == c2 &&
|
||||
str.codeUnitAt(index + 2) == c3 && str.codeUnitAt(index + 3) == c4 &&
|
||||
str.codeUnitAt(index + 4) == c5) {
|
||||
return index;
|
||||
}
|
||||
@@ -151,6 +135,24 @@ class StringUtilities {
|
||||
}
|
||||
return str.substring(0, pos);
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the index of the first not letter/digit character in the [string]
|
||||
* that is at or after the [startIndex]. Return the length of the [string] if
|
||||
* all characters to the end are letters/digits.
|
||||
*/
|
||||
static int indexOfFirstNotLetterDigit(String string, int startIndex) {
|
||||
int index = startIndex;
|
||||
int last = string.length;
|
||||
while (index < last) {
|
||||
int c = string.codeUnitAt(index);
|
||||
if (!Character.isLetterOrDigit(c)) {
|
||||
return index;
|
||||
}
|
||||
index++;
|
||||
}
|
||||
return last;
|
||||
}
|
||||
}
|
||||
|
||||
class FileNameUtilities {
|
||||
|
||||
@@ -308,7 +308,11 @@ class IncrementalParseDispatcher implements ASTVisitor<ASTNode> {
|
||||
} else if (identical(_oldNode, node.implementsClause)) {
|
||||
return _parser.parseImplementsClause();
|
||||
} else if (node.members.contains(_oldNode)) {
|
||||
return _parser.parseClassMember(node.name.name);
|
||||
ClassMember member = _parser.parseClassMember(node.name.name);
|
||||
if (member == null) {
|
||||
throw new InsufficientContextException();
|
||||
}
|
||||
return member;
|
||||
}
|
||||
return notAChild(node);
|
||||
}
|
||||
@@ -1692,6 +1696,14 @@ class Parser {
|
||||
return parseOperator(commentAndMetadata, modifiers.externalKeyword, null);
|
||||
}
|
||||
reportError14(ParserErrorCode.EXPECTED_CLASS_MEMBER, _currentToken, []);
|
||||
if (commentAndMetadata.comment != null || !commentAndMetadata.metadata.isEmpty) {
|
||||
//
|
||||
// We appear to have found an incomplete declaration at the end of the class. At this point
|
||||
// it consists of a metadata, which we don't want to loose, so we'll treat it as a method
|
||||
// declaration with a missing name, parameters and empty body.
|
||||
//
|
||||
return new MethodDeclaration(commentAndMetadata.comment, commentAndMetadata.metadata, null, null, null, null, null, createSyntheticIdentifier(), new FormalParameterList(null, new List<FormalParameter>(), null, null, null), new EmptyFunctionBody(createSyntheticToken2(TokenType.SEMICOLON)));
|
||||
}
|
||||
return null;
|
||||
} else if (matches4(peek(), TokenType.PERIOD) && matchesIdentifier2(peek2(2)) && matches4(peek2(3), TokenType.OPEN_PAREN)) {
|
||||
return parseConstructor(commentAndMetadata, modifiers.externalKeyword, validateModifiersForConstructor(modifiers), modifiers.factoryKeyword, parseSimpleIdentifier(), andAdvance, parseSimpleIdentifier(), parseFormalParameterList());
|
||||
@@ -2771,6 +2783,21 @@ class Parser {
|
||||
return _currentToken;
|
||||
}
|
||||
|
||||
/**
|
||||
* If [currentToken] is a semicolon, returns it; otherwise reports error and creates a
|
||||
* synthetic one.
|
||||
*
|
||||
* TODO(scheglov) consider pushing this into [expect]
|
||||
*/
|
||||
Token expectSemicolon() {
|
||||
if (matches5(TokenType.SEMICOLON)) {
|
||||
return andAdvance;
|
||||
} else {
|
||||
reportError14(ParserErrorCode.EXPECTED_TOKEN, _currentToken.previous, [";"]);
|
||||
return createSyntheticToken2(TokenType.SEMICOLON);
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search the given list of ranges for a range that contains the given index. Return the range
|
||||
* that was found, or `null` if none of the ranges contain the index.
|
||||
@@ -3833,7 +3860,8 @@ class Parser {
|
||||
CommentReference parseCommentReference(String referenceSource, int sourceOffset) {
|
||||
// TODO(brianwilkerson) The errors are not getting the right offset/length and are being duplicated.
|
||||
if (referenceSource.length == 0) {
|
||||
return null;
|
||||
Token syntheticToken = new SyntheticStringToken(TokenType.IDENTIFIER, "", sourceOffset);
|
||||
return new CommentReference(null, new SimpleIdentifier(syntheticToken));
|
||||
}
|
||||
try {
|
||||
BooleanErrorListener listener = new BooleanErrorListener();
|
||||
@@ -3900,19 +3928,32 @@ class Parser {
|
||||
while (leftIndex >= 0 && leftIndex + 1 < length) {
|
||||
List<int> range = findRange(codeBlockRanges, leftIndex);
|
||||
if (range == null) {
|
||||
int nameOffset = token.offset + leftIndex + 1;
|
||||
int rightIndex = JavaString.indexOf(comment, ']', leftIndex);
|
||||
if (rightIndex >= 0) {
|
||||
int firstChar = comment.codeUnitAt(leftIndex + 1);
|
||||
if (firstChar != 0x27 && firstChar != 0x22) {
|
||||
if (isLinkText(comment, rightIndex)) {
|
||||
} else {
|
||||
CommentReference reference = parseCommentReference(comment.substring(leftIndex + 1, rightIndex), token.offset + leftIndex + 1);
|
||||
CommentReference reference = parseCommentReference(comment.substring(leftIndex + 1, rightIndex), nameOffset);
|
||||
if (reference != null) {
|
||||
references.add(reference);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// terminating ']' is not typed yet
|
||||
int charAfterLeft = comment.codeUnitAt(leftIndex + 1);
|
||||
if (Character.isLetterOrDigit(charAfterLeft)) {
|
||||
int nameEnd = StringUtilities.indexOfFirstNotLetterDigit(comment, leftIndex + 1);
|
||||
String name = comment.substring(leftIndex + 1, nameEnd);
|
||||
Token nameToken = new StringToken(TokenType.IDENTIFIER, name, nameOffset);
|
||||
references.add(new CommentReference(null, new SimpleIdentifier(nameToken)));
|
||||
} else {
|
||||
Token nameToken = new SyntheticStringToken(TokenType.IDENTIFIER, "", nameOffset);
|
||||
references.add(new CommentReference(null, new SimpleIdentifier(nameToken)));
|
||||
}
|
||||
// next character
|
||||
rightIndex = leftIndex + 1;
|
||||
}
|
||||
leftIndex = JavaString.indexOf(comment, '[', rightIndex);
|
||||
@@ -4322,7 +4363,7 @@ class Parser {
|
||||
Token exportKeyword = expect(Keyword.EXPORT);
|
||||
StringLiteral libraryUri = parseStringLiteral();
|
||||
List<Combinator> combinators = parseCombinators();
|
||||
Token semicolon = expect2(TokenType.SEMICOLON);
|
||||
Token semicolon = expectSemicolon();
|
||||
return new ExportDirective(commentAndMetadata.comment, commentAndMetadata.metadata, exportKeyword, libraryUri, combinators, semicolon);
|
||||
}
|
||||
|
||||
@@ -4815,7 +4856,7 @@ class Parser {
|
||||
prefix = parseSimpleIdentifier();
|
||||
}
|
||||
List<Combinator> combinators = parseCombinators();
|
||||
Token semicolon = expect2(TokenType.SEMICOLON);
|
||||
Token semicolon = expectSemicolon();
|
||||
return new ImportDirective(commentAndMetadata.comment, commentAndMetadata.metadata, importKeyword, libraryUri, asToken, prefix, combinators, semicolon);
|
||||
}
|
||||
|
||||
@@ -5472,9 +5513,7 @@ class Parser {
|
||||
if (!_currentToken.type.isIncrementOperator) {
|
||||
return operand;
|
||||
}
|
||||
if (operand is Literal || operand is FunctionExpressionInvocation) {
|
||||
reportError13(ParserErrorCode.MISSING_ASSIGNABLE_SELECTOR, []);
|
||||
}
|
||||
ensureAssignable(operand);
|
||||
Token operator = andAdvance;
|
||||
return new PostfixExpression(operand, operator);
|
||||
}
|
||||
@@ -6952,7 +6991,7 @@ class Parser {
|
||||
*/
|
||||
Token validateModifiersForConstructor(Modifiers modifiers) {
|
||||
if (modifiers.abstractKeyword != null) {
|
||||
reportError13(ParserErrorCode.ABSTRACT_CLASS_MEMBER, []);
|
||||
reportError14(ParserErrorCode.ABSTRACT_CLASS_MEMBER, modifiers.abstractKeyword, []);
|
||||
}
|
||||
if (modifiers.finalKeyword != null) {
|
||||
reportError14(ParserErrorCode.FINAL_CONSTRUCTOR, modifiers.finalKeyword, []);
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -208,6 +208,11 @@ class SdkLibrariesReader_LibraryBuilder extends RecursiveASTVisitor<Object> {
|
||||
*/
|
||||
static String _IMPLEMENTATION = "implementation";
|
||||
|
||||
/**
|
||||
* The name of the optional parameter used to specify the path used when compiling for dart2js.
|
||||
*/
|
||||
static String _DART2JS_PATH = "dart2jsPath";
|
||||
|
||||
/**
|
||||
* The name of the optional parameter used to indicate whether the library is documented.
|
||||
*/
|
||||
@@ -230,11 +235,34 @@ class SdkLibrariesReader_LibraryBuilder extends RecursiveASTVisitor<Object> {
|
||||
*/
|
||||
static String _VM_PLATFORM = "VM_PLATFORM";
|
||||
|
||||
/**
|
||||
* A flag indicating whether the dart2js path should be used when it is available.
|
||||
*/
|
||||
bool _useDart2jsPaths = false;
|
||||
|
||||
/**
|
||||
* The library map that is populated by visiting the AST structure parsed from the contents of
|
||||
* the libraries file.
|
||||
*/
|
||||
final LibraryMap librariesMap = new LibraryMap();
|
||||
LibraryMap _librariesMap = new LibraryMap();
|
||||
|
||||
/**
|
||||
* Initialize a newly created library builder to use the dart2js path if the given value is
|
||||
* `true`.
|
||||
*
|
||||
* @param useDart2jsPaths `true` if the dart2js path should be used when it is available
|
||||
*/
|
||||
SdkLibrariesReader_LibraryBuilder(bool useDart2jsPaths) {
|
||||
this._useDart2jsPaths = useDart2jsPaths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the library map that was populated by visiting the AST structure parsed from the
|
||||
* contents of the libraries file.
|
||||
*
|
||||
* @return the library map describing the contents of the SDK
|
||||
*/
|
||||
LibraryMap get librariesMap => _librariesMap;
|
||||
|
||||
Object visitMapLiteralEntry(MapLiteralEntry node) {
|
||||
String libraryName = null;
|
||||
@@ -267,10 +295,14 @@ class SdkLibrariesReader_LibraryBuilder extends RecursiveASTVisitor<Object> {
|
||||
library.setDart2JsLibrary();
|
||||
}
|
||||
}
|
||||
} else if (_useDart2jsPaths && name == _DART2JS_PATH) {
|
||||
if (expression is SimpleStringLiteral) {
|
||||
library.path = expression.value;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
librariesMap.setLibrary(libraryName, library);
|
||||
_librariesMap.setLibrary(libraryName, library);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -352,13 +384,12 @@ abstract class DartSdk {
|
||||
/**
|
||||
* Return the source representing the file with the given URI.
|
||||
*
|
||||
* @param contentCache the content cache used to access the contents of the mapped source
|
||||
* @param kind the kind of URI that was originally resolved in order to produce an encoding with
|
||||
* the given URI
|
||||
* @param uri the URI of the file to be returned
|
||||
* @return the source representing the specified file
|
||||
*/
|
||||
Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri);
|
||||
Source fromEncoding(UriKind kind, Uri uri);
|
||||
|
||||
/**
|
||||
* Return the [AnalysisContext] used for all of the sources in this [DartSdk].
|
||||
|
||||
@@ -176,12 +176,20 @@ class DirectoryBasedDartSdk implements DartSdk {
|
||||
*
|
||||
* @param sdkDirectory the directory containing the SDK
|
||||
*/
|
||||
DirectoryBasedDartSdk(JavaFile sdkDirectory) {
|
||||
DirectoryBasedDartSdk(JavaFile sdkDirectory) : this.con1(sdkDirectory, false);
|
||||
|
||||
/**
|
||||
* Initialize a newly created SDK to represent the Dart SDK installed in the given directory.
|
||||
*
|
||||
* @param sdkDirectory the directory containing the SDK
|
||||
* @param useDart2jsPaths `true` if the dart2js path should be used when it is available
|
||||
*/
|
||||
DirectoryBasedDartSdk.con1(JavaFile sdkDirectory, bool useDart2jsPaths) {
|
||||
this._sdkDirectory = sdkDirectory.getAbsoluteFile();
|
||||
initializeSdk();
|
||||
initializeLibraryMap();
|
||||
initializeLibraryMap(useDart2jsPaths);
|
||||
_analysisContext = new AnalysisContextImpl();
|
||||
_analysisContext.sourceFactory = new SourceFactory.con2([new DartUriResolver(this)]);
|
||||
_analysisContext.sourceFactory = new SourceFactory([new DartUriResolver(this)]);
|
||||
List<String> uris = this.uris;
|
||||
ChangeSet changeSet = new ChangeSet();
|
||||
for (String uri in uris) {
|
||||
@@ -190,7 +198,7 @@ class DirectoryBasedDartSdk implements DartSdk {
|
||||
_analysisContext.applyChanges(changeSet);
|
||||
}
|
||||
|
||||
Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) => new FileBasedSource.con2(contentCache, new JavaFile.fromUri(uri), kind);
|
||||
Source fromEncoding(UriKind kind, Uri uri) => new FileBasedSource.con2(new JavaFile.fromUri(uri), kind);
|
||||
|
||||
AnalysisContext get context => _analysisContext;
|
||||
|
||||
@@ -342,7 +350,7 @@ class DirectoryBasedDartSdk implements DartSdk {
|
||||
if (library == null) {
|
||||
return null;
|
||||
}
|
||||
return new FileBasedSource.con2(_analysisContext.sourceFactory.contentCache, new JavaFile.relative(libraryDirectory, library.path), UriKind.DART_URI);
|
||||
return new FileBasedSource.con2(new JavaFile.relative(libraryDirectory, library.path), UriKind.DART_URI);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -382,12 +390,14 @@ class DirectoryBasedDartSdk implements DartSdk {
|
||||
|
||||
/**
|
||||
* Read all of the configuration files to initialize the library maps.
|
||||
*
|
||||
* @param useDart2jsPaths `true` if the dart2js path should be used when it is available
|
||||
*/
|
||||
void initializeLibraryMap() {
|
||||
void initializeLibraryMap(bool useDart2jsPaths) {
|
||||
JavaFile librariesFile = new JavaFile.relative(new JavaFile.relative(libraryDirectory, _INTERNAL_DIR), _LIBRARIES_FILE);
|
||||
try {
|
||||
String contents = librariesFile.readAsStringSync();
|
||||
_libraryMap = new SdkLibrariesReader().readFrom(librariesFile, contents);
|
||||
_libraryMap = new SdkLibrariesReader(useDart2jsPaths).readFrom(librariesFile, contents);
|
||||
} on JavaException catch (exception) {
|
||||
AnalysisEngine.instance.logger.logError2("Could not initialize the library map from ${librariesFile.getAbsolutePath()}", exception);
|
||||
_libraryMap = new LibraryMap();
|
||||
@@ -430,6 +440,21 @@ class DirectoryBasedDartSdk implements DartSdk {
|
||||
* @coverage dart.engine.sdk
|
||||
*/
|
||||
class SdkLibrariesReader {
|
||||
/**
|
||||
* A flag indicating whether the dart2js path should be used when it is available.
|
||||
*/
|
||||
bool _useDart2jsPaths = false;
|
||||
|
||||
/**
|
||||
* Initialize a newly created library reader to use the dart2js path if the given value is
|
||||
* `true`.
|
||||
*
|
||||
* @param useDart2jsPaths `true` if the dart2js path should be used when it is available
|
||||
*/
|
||||
SdkLibrariesReader(bool useDart2jsPaths) {
|
||||
this._useDart2jsPaths = useDart2jsPaths;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the library map read from the given source.
|
||||
*
|
||||
@@ -437,7 +462,7 @@ class SdkLibrariesReader {
|
||||
* @param libraryFileContents the contents from the library file
|
||||
* @return the library map read from the given source
|
||||
*/
|
||||
LibraryMap readFrom(JavaFile file, String libraryFileContents) => readFrom2(new FileBasedSource.con2(null, file, UriKind.FILE_URI), libraryFileContents);
|
||||
LibraryMap readFrom(JavaFile file, String libraryFileContents) => readFrom2(new FileBasedSource.con2(file, UriKind.FILE_URI), libraryFileContents);
|
||||
|
||||
/**
|
||||
* Return the library map read from the given source.
|
||||
@@ -451,7 +476,7 @@ class SdkLibrariesReader {
|
||||
Scanner scanner = new Scanner(source, new CharSequenceReader(libraryFileContents), errorListener);
|
||||
Parser parser = new Parser(source, errorListener);
|
||||
CompilationUnit unit = parser.parseCompilationUnit(scanner.tokenize());
|
||||
SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_LibraryBuilder();
|
||||
SdkLibrariesReader_LibraryBuilder libraryBuilder = new SdkLibrariesReader_LibraryBuilder(_useDart2jsPaths);
|
||||
// If any syntactic errors were found then don't try to visit the AST structure.
|
||||
if (!errorListener.errorReported) {
|
||||
unit.accept(libraryBuilder);
|
||||
|
||||
@@ -9,7 +9,7 @@ library engine.source;
|
||||
|
||||
import 'java_core.dart';
|
||||
import 'sdk.dart' show DartSdk;
|
||||
import 'engine.dart' show AnalysisContext;
|
||||
import 'engine.dart' show AnalysisContext, TimestampedData;
|
||||
|
||||
/**
|
||||
* Instances of interface `LocalSourcePredicate` are used to determine if the given
|
||||
@@ -67,11 +67,6 @@ class SourceFactory {
|
||||
*/
|
||||
AnalysisContext context;
|
||||
|
||||
/**
|
||||
* A cache of content used to override the default content of a source.
|
||||
*/
|
||||
ContentCache _contentCache;
|
||||
|
||||
/**
|
||||
* The resolvers used to resolve absolute URI's.
|
||||
*/
|
||||
@@ -80,27 +75,17 @@ class SourceFactory {
|
||||
/**
|
||||
* The predicate to determine is [Source] is local.
|
||||
*/
|
||||
LocalSourcePredicate _localSourcePredicate;
|
||||
LocalSourcePredicate _localSourcePredicate = LocalSourcePredicate.NOT_SDK;
|
||||
|
||||
/**
|
||||
* Initialize a newly created source factory.
|
||||
*
|
||||
* @param contentCache the cache holding content used to override the default content of a source
|
||||
* @param resolvers the resolvers used to resolve absolute URI's
|
||||
*/
|
||||
SourceFactory.con1(ContentCache contentCache, List<UriResolver> resolvers) {
|
||||
this._contentCache = contentCache;
|
||||
SourceFactory(List<UriResolver> resolvers) {
|
||||
this._resolvers = resolvers;
|
||||
this._localSourcePredicate = LocalSourcePredicate.NOT_SDK;
|
||||
}
|
||||
|
||||
/**
|
||||
* Initialize a newly created source factory.
|
||||
*
|
||||
* @param resolvers the resolvers used to resolve absolute URI's
|
||||
*/
|
||||
SourceFactory.con2(List<UriResolver> resolvers) : this.con1(new ContentCache(), resolvers);
|
||||
|
||||
/**
|
||||
* Return a source object representing the given absolute URI, or `null` if the URI is not a
|
||||
* valid URI or if it is not an absolute URI.
|
||||
@@ -138,7 +123,7 @@ class SourceFactory {
|
||||
try {
|
||||
Uri uri = parseUriWithException(encoding.substring(1));
|
||||
for (UriResolver resolver in _resolvers) {
|
||||
Source result = resolver.fromEncoding(_contentCache, kind, uri);
|
||||
Source result = resolver.fromEncoding(kind, uri);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
@@ -149,13 +134,6 @@ class SourceFactory {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Return a cache of content used to override the default content of a source.
|
||||
*
|
||||
* @return a cache of content used to override the default content of a source
|
||||
*/
|
||||
ContentCache get contentCache => _contentCache;
|
||||
|
||||
/**
|
||||
* Return the [DartSdk] associated with this [SourceFactory], or `null` if there
|
||||
* is no such SDK.
|
||||
@@ -219,17 +197,6 @@ class SourceFactory {
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the contents of the given source to the given contents. This has the effect of overriding
|
||||
* the default contents of the source. If the contents are `null` the override is removed so
|
||||
* that the default contents will be returned.
|
||||
*
|
||||
* @param source the source whose contents are being overridden
|
||||
* @param contents the new contents of the source
|
||||
* @return the original cached contents or `null` if none
|
||||
*/
|
||||
String setContents(Source source, String contents) => _contentCache.setContents(source, contents);
|
||||
|
||||
/**
|
||||
* Sets the [LocalSourcePredicate].
|
||||
*
|
||||
@@ -239,30 +206,6 @@ class SourceFactory {
|
||||
this._localSourcePredicate = localSourcePredicate;
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the contents of the given source, or `null` if this factory does not override the
|
||||
* contents of the source.
|
||||
*
|
||||
* <b>Note:</b> This method is not intended to be used except by
|
||||
* [FileBasedSource#getContents].
|
||||
*
|
||||
* @param source the source whose content is to be returned
|
||||
* @return the contents of the given source
|
||||
*/
|
||||
String getContents(Source source) => _contentCache.getContents(source);
|
||||
|
||||
/**
|
||||
* Return the modification stamp of the given source, or `null` if this factory does not
|
||||
* override the contents of the source.
|
||||
*
|
||||
* <b>Note:</b> This method is not intended to be used except by
|
||||
* [FileBasedSource#getModificationStamp].
|
||||
*
|
||||
* @param source the source whose modification stamp is to be returned
|
||||
* @return the modification stamp of the given source
|
||||
*/
|
||||
int getModificationStamp(Source source) => _contentCache.getModificationStamp(source);
|
||||
|
||||
/**
|
||||
* Return a source object representing the URI that results from resolving the given (possibly
|
||||
* relative) contained URI against the URI associated with an existing source object, or
|
||||
@@ -276,7 +219,7 @@ class SourceFactory {
|
||||
Source resolveUri2(Source containingSource, Uri containedUri) {
|
||||
if (containedUri.isAbsolute) {
|
||||
for (UriResolver resolver in _resolvers) {
|
||||
Source result = resolver.resolveAbsolute(_contentCache, containedUri);
|
||||
Source result = resolver.resolveAbsolute(containedUri);
|
||||
if (result != null) {
|
||||
return result;
|
||||
}
|
||||
@@ -302,23 +245,21 @@ abstract class UriResolver {
|
||||
* [Source] representing the file to which it was resolved, or `null` if it
|
||||
* could not be resolved.
|
||||
*
|
||||
* @param contentCache the content cache used to access the contents of the returned source
|
||||
* @param kind the kind of URI that was originally resolved in order to produce an encoding with
|
||||
* the given URI
|
||||
* @param uri the URI to be resolved
|
||||
* @return a [Source] representing the file to which given URI was resolved
|
||||
*/
|
||||
Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri);
|
||||
Source fromEncoding(UriKind kind, Uri uri);
|
||||
|
||||
/**
|
||||
* Resolve the given absolute URI. Return a [Source] representing the file to which
|
||||
* it was resolved, or `null` if it could not be resolved.
|
||||
*
|
||||
* @param contentCache the content cache used to access the contents of the returned source
|
||||
* @param uri the URI to be resolved
|
||||
* @return a [Source] representing the file to which given URI was resolved
|
||||
*/
|
||||
Source resolveAbsolute(ContentCache contentCache, Uri uri);
|
||||
Source resolveAbsolute(Uri uri);
|
||||
|
||||
/**
|
||||
* Return an absolute URI that represents the given source.
|
||||
@@ -355,20 +296,37 @@ abstract class Source {
|
||||
/**
|
||||
* Return `true` if this source exists.
|
||||
*
|
||||
* Clients should consider using the the method [AnalysisContext#exists] because
|
||||
* contexts can have local overrides of the content of a source that the source is not aware of
|
||||
* and a source with local content is considered to exist even if there is no file on disk.
|
||||
*
|
||||
* @return `true` if this source exists
|
||||
*/
|
||||
bool exists();
|
||||
|
||||
/**
|
||||
* Get the contents of this source and pass it to the given receiver. Exactly one of the methods
|
||||
* defined on the receiver will be invoked unless an exception is thrown. The method that will be
|
||||
* invoked depends on which of the possible representations of the contents is the most efficient.
|
||||
* Whichever method is invoked, it will be invoked before this method returns.
|
||||
* Get the contents and timestamp of this source.
|
||||
*
|
||||
* Clients should consider using the the method [AnalysisContext#getContents]
|
||||
* because contexts can have local overrides of the content of a source that the source is not
|
||||
* aware of.
|
||||
*
|
||||
* @return the contents and timestamp of the source
|
||||
* @throws Exception if the contents of this source could not be accessed
|
||||
*/
|
||||
TimestampedData<String> get contents;
|
||||
|
||||
/**
|
||||
* Get the contents of this source and pass it to the given content receiver.
|
||||
*
|
||||
* Clients should consider using the the method
|
||||
* [AnalysisContext#getContentsToReceiver] because contexts can have local
|
||||
* overrides of the content of a source that the source is not aware of.
|
||||
*
|
||||
* @param receiver the content receiver to which the content of this source will be passed
|
||||
* @throws Exception if the contents of this source could not be accessed
|
||||
*/
|
||||
void getContents(Source_ContentReceiver receiver);
|
||||
void getContentsToReceiver(Source_ContentReceiver receiver);
|
||||
|
||||
/**
|
||||
* Return an encoded representation of this source that can be used to create a source that is
|
||||
@@ -395,6 +353,10 @@ abstract class Source {
|
||||
* of the source have been modified one or more times (even if the net change is zero) the stamps
|
||||
* will be different.
|
||||
*
|
||||
* Clients should consider using the the method
|
||||
* [AnalysisContext#getModificationStamp] because contexts can have local overrides
|
||||
* of the content of a source that the source is not aware of.
|
||||
*
|
||||
* @return the modification stamp for this source
|
||||
*/
|
||||
int get modificationStamp;
|
||||
@@ -739,9 +701,9 @@ class DartUriResolver extends UriResolver {
|
||||
this._sdk = sdk;
|
||||
}
|
||||
|
||||
Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) {
|
||||
Source fromEncoding(UriKind kind, Uri uri) {
|
||||
if (identical(kind, UriKind.DART_URI)) {
|
||||
return _sdk.fromEncoding(contentCache, kind, uri);
|
||||
return _sdk.fromEncoding(kind, uri);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
@@ -753,7 +715,7 @@ class DartUriResolver extends UriResolver {
|
||||
*/
|
||||
DartSdk get dartSdk => _sdk;
|
||||
|
||||
Source resolveAbsolute(ContentCache contentCache, Uri uri) {
|
||||
Source resolveAbsolute(Uri uri) {
|
||||
if (!isDartUri(uri)) {
|
||||
return null;
|
||||
}
|
||||
@@ -854,7 +816,7 @@ class ContentCache {
|
||||
* contents of the source.
|
||||
*
|
||||
* <b>Note:</b> This method is not intended to be used except by
|
||||
* [SourceFactory#getContents].
|
||||
* [AnalysisContext#getContents].
|
||||
*
|
||||
* @param source the source whose content is to be returned
|
||||
* @return the contents of the given source
|
||||
@@ -866,7 +828,7 @@ class ContentCache {
|
||||
* override the contents of the source.
|
||||
*
|
||||
* <b>Note:</b> This method is not intended to be used except by
|
||||
* [SourceFactory#getModificationStamp].
|
||||
* [AnalysisContext#getModificationStamp].
|
||||
*
|
||||
* @param source the source whose modification stamp is to be returned
|
||||
* @return the modification stamp of the given source
|
||||
|
||||
@@ -10,7 +10,7 @@ library engine.source.io;
|
||||
import 'source.dart';
|
||||
import 'java_core.dart';
|
||||
import 'java_io.dart';
|
||||
import 'engine.dart' show AnalysisContext, AnalysisEngine;
|
||||
import 'engine.dart' show AnalysisContext, AnalysisEngine, TimestampedData;
|
||||
export 'source.dart';
|
||||
|
||||
/**
|
||||
@@ -63,12 +63,6 @@ class LocalSourcePredicate_NOT_SDK implements LocalSourcePredicate {
|
||||
* @coverage dart.engine.source
|
||||
*/
|
||||
class FileBasedSource implements Source {
|
||||
/**
|
||||
* The content cache used to access the contents of this source if they have been overridden from
|
||||
* what is on disk or cached.
|
||||
*/
|
||||
ContentCache _contentCache;
|
||||
|
||||
/**
|
||||
* The file represented by this source.
|
||||
*/
|
||||
@@ -88,41 +82,29 @@ class FileBasedSource implements Source {
|
||||
* Initialize a newly created source object. The source object is assumed to not be in a system
|
||||
* library.
|
||||
*
|
||||
* @param contentCache the content cache used to access the contents of this source
|
||||
* @param file the file represented by this source
|
||||
*/
|
||||
FileBasedSource.con1(ContentCache contentCache, JavaFile file) : this.con2(contentCache, file, UriKind.FILE_URI);
|
||||
FileBasedSource.con1(JavaFile file) : this.con2(file, UriKind.FILE_URI);
|
||||
|
||||
/**
|
||||
* Initialize a newly created source object.
|
||||
*
|
||||
* @param contentCache the content cache used to access the contents of this source
|
||||
* @param file the file represented by this source
|
||||
* @param flags `true` if this source is in one of the system libraries
|
||||
*/
|
||||
FileBasedSource.con2(ContentCache contentCache, JavaFile file, UriKind uriKind) {
|
||||
this._contentCache = contentCache;
|
||||
FileBasedSource.con2(JavaFile file, UriKind uriKind) {
|
||||
this._file = file;
|
||||
this._uriKind = uriKind;
|
||||
}
|
||||
|
||||
bool operator ==(Object object) => object != null && this.runtimeType == object.runtimeType && _file == (object as FileBasedSource)._file;
|
||||
|
||||
bool exists() => _contentCache.getContents(this) != null || _file.isFile();
|
||||
bool exists() => _file.isFile();
|
||||
|
||||
void getContents(Source_ContentReceiver receiver) {
|
||||
//
|
||||
// First check to see whether our content cache has an override for our contents.
|
||||
//
|
||||
String contents = _contentCache.getContents(this);
|
||||
if (contents != null) {
|
||||
receiver.accept(contents, _contentCache.getModificationStamp(this));
|
||||
return;
|
||||
}
|
||||
//
|
||||
// If not, read the contents from the file using native I/O.
|
||||
//
|
||||
getContentsFromFile(receiver);
|
||||
TimestampedData<String> get contents => contentsFromFile;
|
||||
|
||||
void getContentsToReceiver(Source_ContentReceiver receiver) {
|
||||
getContentsFromFileToReceiver(receiver);
|
||||
}
|
||||
|
||||
String get encoding {
|
||||
@@ -134,13 +116,7 @@ class FileBasedSource implements Source {
|
||||
|
||||
String get fullName => _file.getAbsolutePath();
|
||||
|
||||
int get modificationStamp {
|
||||
int stamp = _contentCache.getModificationStamp(this);
|
||||
if (stamp != null) {
|
||||
return stamp;
|
||||
}
|
||||
return _file.lastModified();
|
||||
}
|
||||
int get modificationStamp => _file.lastModified();
|
||||
|
||||
String get shortName => _file.getName();
|
||||
|
||||
@@ -153,7 +129,7 @@ class FileBasedSource implements Source {
|
||||
Source resolveRelative(Uri containedUri) {
|
||||
try {
|
||||
Uri resolvedUri = file.toURI().resolveUri(containedUri);
|
||||
return new FileBasedSource.con2(_contentCache, new JavaFile.fromUri(resolvedUri), _uriKind);
|
||||
return new FileBasedSource.con2(new JavaFile.fromUri(resolvedUri), _uriKind);
|
||||
} on JavaException catch (exception) {
|
||||
}
|
||||
return null;
|
||||
@@ -167,24 +143,34 @@ class FileBasedSource implements Source {
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of underlying file and pass it to the given receiver. Exactly one of the
|
||||
* methods defined on the receiver will be invoked unless an exception is thrown. The method that
|
||||
* will be invoked depends on which of the possible representations of the contents is the most
|
||||
* efficient. Whichever method is invoked, it will be invoked before this method returns.
|
||||
* Get the contents and timestamp of the underlying file.
|
||||
*
|
||||
* Clients should consider using the the method [AnalysisContext#getContents]
|
||||
* because contexts can have local overrides of the content of a source that the source is not
|
||||
* aware of.
|
||||
*
|
||||
* @return the contents of the source paired with the modification stamp of the source
|
||||
* @throws Exception if the contents of this source could not be accessed
|
||||
* @see #getContents()
|
||||
*/
|
||||
TimestampedData<String> get contentsFromFile {
|
||||
return new TimestampedData<String>(_file.lastModified(), _file.readAsStringSync());
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the contents of underlying file and pass it to the given receiver.
|
||||
*
|
||||
* @param receiver the content receiver to which the content of this source will be passed
|
||||
* @throws Exception if the contents of this source could not be accessed
|
||||
* @see #getContents(com.google.dart.engine.source.Source.ContentReceiver)
|
||||
* @see #getContentsToReceiver(ContentReceiver)
|
||||
*/
|
||||
void getContentsFromFile(Source_ContentReceiver receiver) {
|
||||
{
|
||||
}
|
||||
receiver.accept(file.readAsStringSync(), file.lastModified());
|
||||
void getContentsFromFileToReceiver(Source_ContentReceiver receiver) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
|
||||
/**
|
||||
* Return the file represented by this source. This is an internal method that is only intended to
|
||||
* be used by [UriResolver].
|
||||
* be used by subclasses of [UriResolver] that are designed to work with file-based sources.
|
||||
*
|
||||
* @return the file represented by this source
|
||||
*/
|
||||
@@ -239,14 +225,14 @@ class PackageUriResolver extends UriResolver {
|
||||
this._packagesDirectories = packagesDirectories;
|
||||
}
|
||||
|
||||
Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) {
|
||||
Source fromEncoding(UriKind kind, Uri uri) {
|
||||
if (identical(kind, UriKind.PACKAGE_SELF_URI) || identical(kind, UriKind.PACKAGE_URI)) {
|
||||
return new FileBasedSource.con2(contentCache, new JavaFile.fromUri(uri), kind);
|
||||
return new FileBasedSource.con2(new JavaFile.fromUri(uri), kind);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Source resolveAbsolute(ContentCache contentCache, Uri uri) {
|
||||
Source resolveAbsolute(Uri uri) {
|
||||
if (!isPackageUri(uri)) {
|
||||
return null;
|
||||
}
|
||||
@@ -277,10 +263,10 @@ class PackageUriResolver extends UriResolver {
|
||||
if (resolvedFile.exists()) {
|
||||
JavaFile canonicalFile = getCanonicalFile(packagesDirectory, pkgName, relPath);
|
||||
UriKind uriKind = isSelfReference(packagesDirectory, canonicalFile) ? UriKind.PACKAGE_SELF_URI : UriKind.PACKAGE_URI;
|
||||
return new FileBasedSource.con2(contentCache, canonicalFile, uriKind);
|
||||
return new FileBasedSource.con2(canonicalFile, uriKind);
|
||||
}
|
||||
}
|
||||
return new FileBasedSource.con2(contentCache, getCanonicalFile(_packagesDirectories[0], pkgName, relPath), UriKind.PACKAGE_URI);
|
||||
return new FileBasedSource.con2(getCanonicalFile(_packagesDirectories[0], pkgName, relPath), UriKind.PACKAGE_URI);
|
||||
}
|
||||
|
||||
Uri restoreAbsolute(Source source) {
|
||||
@@ -425,17 +411,17 @@ class FileUriResolver extends UriResolver {
|
||||
*/
|
||||
static bool isFileUri(Uri uri) => uri.scheme == FILE_SCHEME;
|
||||
|
||||
Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) {
|
||||
Source fromEncoding(UriKind kind, Uri uri) {
|
||||
if (identical(kind, UriKind.FILE_URI)) {
|
||||
return new FileBasedSource.con2(contentCache, new JavaFile.fromUri(uri), kind);
|
||||
return new FileBasedSource.con2(new JavaFile.fromUri(uri), kind);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
Source resolveAbsolute(ContentCache contentCache, Uri uri) {
|
||||
Source resolveAbsolute(Uri uri) {
|
||||
if (!isFileUri(uri)) {
|
||||
return null;
|
||||
}
|
||||
return new FileBasedSource.con1(contentCache, new JavaFile.fromUri(uri));
|
||||
return new FileBasedSource.con1(new JavaFile.fromUri(uri));
|
||||
}
|
||||
}
|
||||
@@ -123,8 +123,9 @@ class ListUtilities {
|
||||
* @param elements the elements to be added to the list
|
||||
*/
|
||||
static void addAll(List list, List<Object> elements) {
|
||||
for (Object element in elements) {
|
||||
list.add(element);
|
||||
int count = elements.length;
|
||||
for (int i = 0; i < count; i++) {
|
||||
list.add(elements[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,6 +5,7 @@
|
||||
library analyzer.string_source;
|
||||
|
||||
import 'generated/source.dart';
|
||||
import 'generated/engine.dart' show TimestampedData;
|
||||
|
||||
/// An implementation of [Source] that's based on an in-memory Dart string.
|
||||
class StringSource implements Source {
|
||||
@@ -25,9 +26,11 @@ class StringSource implements Source {
|
||||
|
||||
bool exists() => true;
|
||||
|
||||
void getContents(Source_ContentReceiver receiver) =>
|
||||
void getContentsToReceiver(Source_ContentReceiver receiver) =>
|
||||
receiver.accept(_contents, modificationStamp);
|
||||
|
||||
TimestampedData<String> get contents => new TimestampedData(modificationStamp, _contents);
|
||||
|
||||
String get encoding => throw new UnsupportedError("StringSource doesn't support "
|
||||
"encoding.");
|
||||
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
name: analyzer
|
||||
version: 0.12.2
|
||||
version: 0.13.0-dev
|
||||
author: Dart Team <misc@dartlang.org>
|
||||
description: Static analyzer for Dart.
|
||||
homepage: http://www.dartlang.org
|
||||
|
||||
@@ -870,6 +870,7 @@ class SimpleIdentifierTest extends ParserTestCase {
|
||||
expression = ASTFactory.propertyAccess2(expression, "_");
|
||||
} else if (wrapper == WrapperKind.PROPERTY_RIGHT) {
|
||||
expression = ASTFactory.propertyAccess(ASTFactory.identifier3("_"), identifier);
|
||||
} else if (wrapper == WrapperKind.NONE) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
@@ -892,6 +893,7 @@ class SimpleIdentifierTest extends ParserTestCase {
|
||||
ASTFactory.assignmentExpression(expression, TokenType.EQ, ASTFactory.identifier3("_"));
|
||||
} else if (assignment == AssignmentKind.SIMPLE_RIGHT) {
|
||||
ASTFactory.assignmentExpression(ASTFactory.identifier3("_"), TokenType.EQ, expression);
|
||||
} else if (assignment == AssignmentKind.NONE) {
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -281,8 +281,8 @@ class LibraryElementImplTest extends EngineTestCase {
|
||||
AnalysisContext context = createAnalysisContext();
|
||||
LibraryElementImpl library = ElementFactory.library(context, "test");
|
||||
CompilationUnitElement unitLib = library.definingCompilationUnit;
|
||||
CompilationUnitElementImpl unitA = ElementFactory.compilationUnit(context, "unit_a.dart");
|
||||
CompilationUnitElementImpl unitB = ElementFactory.compilationUnit(context, "unit_b.dart");
|
||||
CompilationUnitElementImpl unitA = ElementFactory.compilationUnit("unit_a.dart");
|
||||
CompilationUnitElementImpl unitB = ElementFactory.compilationUnit("unit_b.dart");
|
||||
library.parts = <CompilationUnitElement> [unitA, unitB];
|
||||
EngineTestCase.assertEqualsIgnoreOrder(<CompilationUnitElement> [unitLib, unitA, unitB], library.units);
|
||||
}
|
||||
@@ -348,9 +348,9 @@ class LibraryElementImplTest extends EngineTestCase {
|
||||
|
||||
void test_isUpToDate() {
|
||||
AnalysisContext context = createAnalysisContext();
|
||||
context.sourceFactory = new SourceFactory.con2([]);
|
||||
context.sourceFactory = new SourceFactory([]);
|
||||
LibraryElement library = ElementFactory.library(context, "foo");
|
||||
context.sourceFactory.setContents(library.definingCompilationUnit.source, "sdfsdff");
|
||||
context.setContents(library.definingCompilationUnit.source, "sdfsdff");
|
||||
// Assert that we are not up to date if the target has an old time stamp.
|
||||
JUnitTestCase.assertFalse(library.isUpToDate2(0));
|
||||
// Assert that we are up to date with a target modification time in the future.
|
||||
@@ -2486,8 +2486,8 @@ class ElementFactory {
|
||||
|
||||
static ClassElementImpl classElement2(String typeName, List<String> parameterNames) => classElement(typeName, object.type, parameterNames);
|
||||
|
||||
static CompilationUnitElementImpl compilationUnit(AnalysisContext context, String fileName) {
|
||||
FileBasedSource source = new FileBasedSource.con1(context.sourceFactory.contentCache, FileUtilities2.createFile(fileName));
|
||||
static CompilationUnitElementImpl compilationUnit(String fileName) {
|
||||
FileBasedSource source = new FileBasedSource.con1(FileUtilities2.createFile(fileName));
|
||||
CompilationUnitElementImpl unit = new CompilationUnitElementImpl(fileName);
|
||||
unit.source = source;
|
||||
return unit;
|
||||
@@ -2495,7 +2495,7 @@ class ElementFactory {
|
||||
|
||||
static ConstructorElementImpl constructorElement(ClassElement definingClass, String name, bool isConst, List<Type2> argumentTypes) {
|
||||
Type2 type = definingClass.type;
|
||||
ConstructorElementImpl constructor = new ConstructorElementImpl(name == null ? null : ASTFactory.identifier3(name));
|
||||
ConstructorElementImpl constructor = new ConstructorElementImpl.con1(name == null ? null : ASTFactory.identifier3(name));
|
||||
constructor.const2 = isConst;
|
||||
int count = argumentTypes.length;
|
||||
List<ParameterElement> parameters = new List<ParameterElement>(count);
|
||||
@@ -2654,7 +2654,7 @@ class ElementFactory {
|
||||
}
|
||||
|
||||
static HtmlElementImpl htmlUnit(AnalysisContext context, String fileName) {
|
||||
FileBasedSource source = new FileBasedSource.con1(context.sourceFactory.contentCache, FileUtilities2.createFile(fileName));
|
||||
FileBasedSource source = new FileBasedSource.con1(FileUtilities2.createFile(fileName));
|
||||
HtmlElementImpl unit = new HtmlElementImpl(context, fileName);
|
||||
unit.source = source;
|
||||
return unit;
|
||||
@@ -2670,7 +2670,7 @@ class ElementFactory {
|
||||
|
||||
static LibraryElementImpl library(AnalysisContext context, String libraryName) {
|
||||
String fileName = "/${libraryName}.dart";
|
||||
CompilationUnitElementImpl unit = compilationUnit(context, fileName);
|
||||
CompilationUnitElementImpl unit = compilationUnit(fileName);
|
||||
LibraryElementImpl library = new LibraryElementImpl(context, ASTFactory.libraryIdentifier2([libraryName]));
|
||||
library.definingCompilationUnit = unit;
|
||||
return library;
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -14,7 +14,7 @@ import 'package:analyzer/src/generated/error.dart';
|
||||
import 'package:analyzer/src/generated/scanner.dart';
|
||||
import 'package:analyzer/src/generated/ast.dart' show ASTNode, NodeLocator;
|
||||
import 'package:analyzer/src/generated/element.dart' show InterfaceType, MethodElement, PropertyAccessorElement;
|
||||
import 'package:analyzer/src/generated/engine.dart' show AnalysisContext, AnalysisContextImpl, RecordingErrorListener;
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:unittest/unittest.dart' as _ut;
|
||||
|
||||
/**
|
||||
@@ -781,7 +781,7 @@ class EngineTestCase extends JUnitTestCase {
|
||||
|
||||
AnalysisContextImpl createAnalysisContext() {
|
||||
AnalysisContextImpl context = new AnalysisContextImpl();
|
||||
context.sourceFactory = new SourceFactory.con2([]);
|
||||
context.sourceFactory = new SourceFactory([]);
|
||||
return context;
|
||||
}
|
||||
|
||||
@@ -836,7 +836,7 @@ class TestSource implements Source {
|
||||
AnalysisContext get context {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
void getContents(Source_ContentReceiver receiver) {
|
||||
void getContentsToReceiver(Source_ContentReceiver receiver) {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
String get fullName {
|
||||
@@ -864,6 +864,9 @@ class TestSource implements Source {
|
||||
UriKind get uriKind {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
TimestampedData<String> get contents {
|
||||
throw new UnsupportedOperationException();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -6,7 +6,7 @@ library test_utils;
|
||||
|
||||
import 'package:unittest/unittest.dart';
|
||||
|
||||
import 'package:analyzer/src/generated/engine.dart' show AnalysisContext, AnalysisContextImpl;
|
||||
import 'package:analyzer/src/generated/engine.dart';
|
||||
import 'package:analyzer/src/generated/source.dart';
|
||||
import 'package:analyzer/src/generated/error.dart';
|
||||
import 'package:analyzer/src/generated/scanner.dart';
|
||||
@@ -162,7 +162,7 @@ class _TestSource implements Source {
|
||||
|
||||
AnalysisContext get context => _unsupported();
|
||||
|
||||
void getContents(Source_ContentReceiver receiver) => _unsupported();
|
||||
void getContentsToReceiver(Source_ContentReceiver receiver) => _unsupported();
|
||||
|
||||
String get fullName => _unsupported();
|
||||
|
||||
@@ -182,6 +182,7 @@ class _TestSource implements Source {
|
||||
|
||||
Source resolveRelative(Uri uri) => _unsupported();
|
||||
|
||||
TimestampedData<String> get contents => _unsupported();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -69,7 +69,7 @@ class ResolverImpl implements Resolver {
|
||||
_dartSdk = new _DirectoryBasedDartSdkProxy(new JavaFile(sdkDir));
|
||||
_dartSdk.context.analysisOptions = options;
|
||||
|
||||
_context.sourceFactory = new SourceFactory.con2([
|
||||
_context.sourceFactory = new SourceFactory([
|
||||
new DartUriResolverProxy(_dartSdk),
|
||||
new _AssetUriResolver(this)]);
|
||||
}
|
||||
@@ -241,7 +241,7 @@ class ResolverImpl implements Resolver {
|
||||
var sourceFile = _getSourceFile(element);
|
||||
if (sourceFile == null) return null;
|
||||
|
||||
return new TextEditTransaction(source.contents, sourceFile);
|
||||
return new TextEditTransaction(source.rawContents, sourceFile);
|
||||
}
|
||||
|
||||
/// Gets the SourceFile for the source of the element.
|
||||
@@ -251,7 +251,7 @@ class ResolverImpl implements Resolver {
|
||||
|
||||
var importUri = _getSourceUri(element, from: entryPoint);
|
||||
var spanPath = importUri != null ? importUri.toString() : assetId.path;
|
||||
return new SourceFile.text(spanPath, sources[assetId].contents);
|
||||
return new SourceFile.text(spanPath, sources[assetId].rawContents);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -303,7 +303,11 @@ class _AssetBasedSource extends Source {
|
||||
}
|
||||
|
||||
/// Contents of the file.
|
||||
String get contents => _contents;
|
||||
TimestampedData<String> get contents =>
|
||||
new TimestampedData<String>(modificationStamp, _contents);
|
||||
|
||||
/// Contents of the file.
|
||||
String get rawContents => _contents;
|
||||
|
||||
/// Logger for the current transform.
|
||||
///
|
||||
@@ -320,8 +324,8 @@ class _AssetBasedSource extends Source {
|
||||
|
||||
int get hashCode => assetId.hashCode;
|
||||
|
||||
void getContents(Source_ContentReceiver receiver) {
|
||||
receiver.accept(contents, modificationStamp);
|
||||
void getContentsToReceiver(Source_ContentReceiver receiver) {
|
||||
receiver.accept(rawContents, modificationStamp);
|
||||
}
|
||||
|
||||
String get encoding =>
|
||||
@@ -359,7 +363,7 @@ class _AssetBasedSource extends Source {
|
||||
var uri = getSourceUri(_resolver.entryPoint);
|
||||
var path = uri != null ? uri.toString() : assetId.path;
|
||||
|
||||
return new SourceFile.text(path, contents);
|
||||
return new SourceFile.text(path, rawContents);
|
||||
}
|
||||
|
||||
/// Gets a URI which would be appropriate for importing this file.
|
||||
@@ -384,7 +388,7 @@ class _AssetUriResolver implements UriResolver {
|
||||
final ResolverImpl _resolver;
|
||||
_AssetUriResolver(this._resolver);
|
||||
|
||||
Source resolveAbsolute(ContentCache contentCache, Uri uri) {
|
||||
Source resolveAbsolute(Uri uri) {
|
||||
var assetId = _resolve(null, uri.toString(), logger, null);
|
||||
var source = _resolver.sources[assetId];
|
||||
/// All resolved assets should be available by this point.
|
||||
@@ -394,7 +398,7 @@ class _AssetUriResolver implements UriResolver {
|
||||
return source;
|
||||
}
|
||||
|
||||
Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) =>
|
||||
Source fromEncoding(UriKind kind, Uri uri) =>
|
||||
throw new UnsupportedError('fromEncoding is not supported');
|
||||
|
||||
Uri restoreAbsolute(Source source) =>
|
||||
@@ -423,12 +427,12 @@ class DartUriResolverProxy implements DartUriResolver {
|
||||
DartUriResolverProxy(DirectoryBasedDartSdk sdk) :
|
||||
_proxy = new DartUriResolver(sdk);
|
||||
|
||||
Source resolveAbsolute(ContentCache contentCache, Uri uri) =>
|
||||
_DartSourceProxy.wrap(_proxy.resolveAbsolute(contentCache, uri), uri);
|
||||
Source resolveAbsolute(Uri uri) =>
|
||||
_DartSourceProxy.wrap(_proxy.resolveAbsolute(uri), uri);
|
||||
|
||||
DartSdk get dartSdk => _proxy.dartSdk;
|
||||
|
||||
Source fromEncoding(ContentCache contentCache, UriKind kind, Uri uri) =>
|
||||
Source fromEncoding(UriKind kind, Uri uri) =>
|
||||
throw new UnsupportedError('fromEncoding is not supported');
|
||||
|
||||
Uri restoreAbsolute(Source source) =>
|
||||
@@ -468,10 +472,12 @@ class _DartSourceProxy implements Source {
|
||||
|
||||
int get hashCode => _proxy.hashCode;
|
||||
|
||||
void getContents(Source_ContentReceiver receiver) {
|
||||
_proxy.getContents(receiver);
|
||||
void getContentsToReceiver(Source_ContentReceiver receiver) {
|
||||
_proxy.getContentsToReceiver(receiver);
|
||||
}
|
||||
|
||||
TimestampedData<String> get contents => _proxy.contents;
|
||||
|
||||
String get encoding => _proxy.encoding;
|
||||
|
||||
String get fullName => _proxy.fullName;
|
||||
|
||||
@@ -20,14 +20,6 @@ call_type_literal_test/01: fail
|
||||
override_field_test/03: fail
|
||||
method_override7_test/03: Fail # Issue 11496
|
||||
|
||||
assignable_expression_test/02: Fail # Issue 15471
|
||||
assignable_expression_test/12: Fail # Issue 15471
|
||||
assignable_expression_test/22: Fail # Issue 15471
|
||||
assignable_expression_test/32: Fail # Issue 15471
|
||||
assignable_expression_test/42: Fail # Issue 15471
|
||||
|
||||
unicode_bom_test: Fail # Issue 16314
|
||||
|
||||
type_check_const_function_typedef2_test/00: MissingCompileTimeError, Ok # Compile-time error in checked mode, because of constants.
|
||||
|
||||
# Please add new failing tests before this line.
|
||||
@@ -181,9 +173,6 @@ least_upper_bound_expansive_test/12: MissingStaticWarning # Issue 15060
|
||||
proxy_test/05: StaticWarning # Issue 15467
|
||||
proxy_test/06: StaticWarning # Issue 15467
|
||||
|
||||
# test issue 15714
|
||||
typevariable_substitution2_test/01: StaticWarning # Issue 15714
|
||||
|
||||
# analyzer does not handle @proxy and noSuchMethod correctly
|
||||
override_inheritance_no_such_method_test/03: StaticWarning # Issue 16132
|
||||
override_inheritance_no_such_method_test/04: StaticWarning # Issue 16132
|
||||
@@ -198,7 +187,6 @@ override_inheritance_abstract_test/27: StaticWarning # Issue 16134
|
||||
override_inheritance_generic_test/03: StaticWarning # Issue 16134
|
||||
|
||||
# missing warning for override
|
||||
override_inheritance_field_test/10: MissingStaticWarning # Issue 16135
|
||||
override_inheritance_generic_test/04: MissingStaticWarning # Issue 16135
|
||||
override_inheritance_generic_test/06: MissingStaticWarning # Issue 16135
|
||||
override_inheritance_generic_test/07: MissingStaticWarning # Issue 16135
|
||||
@@ -342,14 +330,11 @@ method_override6_test: StaticWarning
|
||||
method_override_test: StaticWarning
|
||||
mixin_illegal_static_access_test: StaticWarning
|
||||
mixin_illegal_syntax_test/13: CompileTimeError
|
||||
mixin_typedef_constructor_test: StaticWarning
|
||||
mixin_type_parameter2_test: StaticWarning
|
||||
mixin_type_parameters_mixin_extends_test: StaticWarning
|
||||
mixin_type_parameters_mixin_test: StaticWarning
|
||||
mixin_type_parameters_super_extends_test: StaticWarning
|
||||
mixin_type_parameters_super_test: StaticWarning
|
||||
mixin_with_two_implicit_constructors_test: StaticWarning
|
||||
mixin_bound_test: StaticWarning
|
||||
mixin_invalid_bound_test/none: StaticWarning # legitimate StaticWarning, cannot be annotated
|
||||
mixin_invalid_bound2_test/none: StaticWarning # legitimate StaticWarning, cannot be annotated
|
||||
named_constructor_test/01: StaticWarning
|
||||
@@ -483,4 +468,3 @@ unresolved_top_level_method_negative_test: CompileTimeError
|
||||
vm/type_cast_vm_test: StaticWarning
|
||||
vm/type_vm_test: StaticWarning
|
||||
void_type_test: StaticWarning
|
||||
|
||||
|
||||
@@ -15,6 +15,3 @@ dart2js_test: Skip # Uses dart:io.
|
||||
|
||||
[ $compiler == none && $runtime == dartium ]
|
||||
dart2js_test: Skip # Uses dart:io.
|
||||
|
||||
[ $compiler == dart2analyzer ]
|
||||
source_mirrors_test: StaticWarning # issue 16466
|
||||
|
||||
Reference in New Issue
Block a user