diff --git a/ceylon-dart-compiler/source/com/vasileff/ceylon/dart/compiler/core/TopLevelVisitor.ceylon b/ceylon-dart-compiler/source/com/vasileff/ceylon/dart/compiler/core/TopLevelVisitor.ceylon index 3095841d..548eaf66 100644 --- a/ceylon-dart-compiler/source/com/vasileff/ceylon/dart/compiler/core/TopLevelVisitor.ceylon +++ b/ceylon-dart-compiler/source/com/vasileff/ceylon/dart/compiler/core/TopLevelVisitor.ceylon @@ -110,7 +110,8 @@ import com.vasileff.ceylon.dart.compiler.nodeinfo { objectDefinitionInfo, valueDefinitionInfo, valueGetterDefinitionInfo, - callableParameterInfo + callableParameterInfo, + valueDeclarationInfo } "For Dart TopLevel declarations." @@ -132,7 +133,17 @@ class TopLevelVisitor(CompilationContext ctx) return; } - super.visitValueDeclaration(that); + value info = valueDeclarationInfo(that); + + "toplevel ValueDeclarations are always late and never transient." + assert (!info.declarationModel.transient); + + addAll { + DartTopLevelVariableDeclaration { + generateForValueDeclarationRaw(info, info.declarationModel); + }, + *generateForwardingGetterSetter(that) + }; } shared actual @@ -1788,8 +1799,9 @@ class TopLevelVisitor(CompilationContext ctx) // toplevel interface aliases are not reified } - [DartFunctionDeclaration*] generateForwardingGetterSetter - (ValueDefinition | ValueGetterDefinition | ObjectDefinition that) { + [DartFunctionDeclaration*] generateForwardingGetterSetter( + ValueDeclaration | ValueDefinition | ValueGetterDefinition | + ObjectDefinition that) { value info = nodeInfo(that); @@ -1797,6 +1809,8 @@ class TopLevelVisitor(CompilationContext ctx) switch (that) case (is ValueDefinition) valueDefinitionInfo(that).declarationModel + case (is ValueDeclaration) + valueDeclarationInfo(that).declarationModel case (is ValueGetterDefinition) valueGetterDefinitionInfo(that).declarationModel case (is ObjectDefinition)