| Index: frog/leg/elements/elements.dart
|
| ===================================================================
|
| --- frog/leg/elements/elements.dart (revision 2754)
|
| +++ frog/leg/elements/elements.dart (working copy)
|
| @@ -29,12 +29,13 @@
|
| static final ElementKind FUNCTION = const ElementKind('function');
|
| static final ElementKind CLASS = const ElementKind('class');
|
| static final ElementKind FOREIGN = const ElementKind('foreign');
|
| - static final ElementKind CONSTRUCTOR = const ElementKind('constructor');
|
| + static final ElementKind GENERATIVE_CONSTRUCTOR =
|
| + const ElementKind('generative_constructor');
|
| static final ElementKind FIELD = const ElementKind('field');
|
| static final ElementKind VARIABLE_LIST = const ElementKind('variable_list');
|
| static final ElementKind FIELD_LIST = const ElementKind('field_list');
|
| - static final ElementKind CONSTRUCTOR_BODY =
|
| - const ElementKind('constructor_body');
|
| + static final ElementKind GENERATIVE_CONSTRUCTOR_BODY =
|
| + const ElementKind('generative_constructor_body');
|
|
|
| toString() => id;
|
| }
|
| @@ -48,6 +49,7 @@
|
| bool isMember() =>
|
| enclosingElement !== null && enclosingElement.kind == ElementKind.CLASS;
|
| bool isInstanceMember() => false;
|
| + bool isGenerativeConstructor() => kind == ElementKind.GENERATIVE_CONSTRUCTOR;
|
|
|
| const Element(this.name, this.kind, this.enclosingElement);
|
|
|
| @@ -173,7 +175,8 @@
|
|
|
| bool isInstanceMember() {
|
| return isMember()
|
| - && kind != ElementKind.CONSTRUCTOR
|
| + && kind != ElementKind.GENERATIVE_CONSTRUCTOR
|
| + && !modifiers.isFactory()
|
| && !modifiers.isStatic();
|
| }
|
|
|
| @@ -183,7 +186,7 @@
|
| FunctionExpression node =
|
| compiler.parser.measure(() => parseNode(compiler, compiler));
|
| Type returnType = getType(node.returnType, compiler, types);
|
| - if (returnType === null) compiler.cancel('unknown type ${node.returnType}');
|
| + if (returnType === null) returnType = types.dynamicType;
|
|
|
| LinkBuilder<Type> parameterTypes = new LinkBuilder<Type>();
|
| for (Link<Element> link = parameters; !link.isEmpty(); link = link.tail) {
|
| @@ -202,7 +205,7 @@
|
| ConstructorBodyElement(FunctionElement constructor)
|
| : this.constructor = constructor,
|
| super(constructor.name,
|
| - ElementKind.CONSTRUCTOR_BODY,
|
| + ElementKind.GENERATIVE_CONSTRUCTOR_BODY,
|
| null,
|
| constructor.enclosingElement) {
|
| assert(constructor.node !== null);
|
| @@ -219,7 +222,8 @@
|
|
|
| class SynthesizedConstructorElement extends FunctionElement {
|
| SynthesizedConstructorElement(Element enclosing)
|
| - : super(enclosing.name, ElementKind.CONSTRUCTOR, null, enclosing) {
|
| + : super(enclosing.name, ElementKind.GENERATIVE_CONSTRUCTOR,
|
| + null, enclosing) {
|
| parameters = const EmptyLink<Element>();
|
| }
|
|
|
| @@ -287,15 +291,16 @@
|
| Element lookupLocalMember(SourceString name) {
|
| bool matches(Element element) {
|
| return element.name == name
|
| - && element.kind != ElementKind.CONSTRUCTOR;
|
| + && element.kind != ElementKind.GENERATIVE_CONSTRUCTOR;
|
| }
|
| return lookupLocalElement(name, matches);
|
| }
|
|
|
| Element lookupConstructor(SourceString name) {
|
| - bool matches(Element element) {
|
| + bool matches(FunctionElement element) {
|
| return element.name == name
|
| - && element.kind == ElementKind.CONSTRUCTOR;
|
| + && (element.kind == ElementKind.GENERATIVE_CONSTRUCTOR
|
| + || element.modifiers.isFactory());
|
| }
|
| return lookupLocalElement(name, matches);
|
| }
|
|
|