From 80b84e6c7d3d5ccca62ed60bcc0bb3f097fc7a68 Mon Sep 17 00:00:00 2001 From: inoussa Date: Thu, 6 Sep 2012 12:31:10 +0000 Subject: [PATCH] Handle untyped properties git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@2507 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- wst/trunk/ws_helper/ws_parser_imp.pas | 30 +++++++++++++++------------ 1 file changed, 17 insertions(+), 13 deletions(-) diff --git a/wst/trunk/ws_helper/ws_parser_imp.pas b/wst/trunk/ws_helper/ws_parser_imp.pas index ff59c764a..43bb6d4d8 100644 --- a/wst/trunk/ws_helper/ws_parser_imp.pas +++ b/wst/trunk/ws_helper/ws_parser_imp.pas @@ -257,7 +257,7 @@ var typNode : TDOMNode; begin if not AEltNode.HasChildNodes() then begin; - raise EXsdParserException.Create(AEltNode.NodeName+' : '+SERR_InvalidTypeDef_NoChild); + raise EXsdParserException.CreateFmt('%s : Type Name = "%s", NodeName = "%s" .',[SERR_InvalidTypeDef_NoChild,ATypeName,AEltNode.NodeName]); end; typName := ATypeName; if IsStrEmpty(typName) then begin @@ -942,14 +942,18 @@ var locTypeHint := ExtractTypeHint(AElement); end else begin locTypeName := Format('%s_%s_Type',[FTypeName,locName]); - locType := TAbstractTypeParser.ExtractEmbeddedTypeFromElement(Context,AElement,FSymbols,locTypeName); - if ( locType = nil ) then begin - raise EXsdInvalidElementDefinitionException.CreateFmt(SERR_InvalidElementDef_Type,[FTypeName,locName]); - end; - Self.Module.InterfaceSection.Declarations.Add(locType); - Self.Module.InterfaceSection.Types.Add(locType); - if locType.InheritsFrom(TPasClassType) then begin - Self.Module.InterfaceSection.Classes.Add(locType); + if AElement.HasChildNodes() then begin + locType := TAbstractTypeParser.ExtractEmbeddedTypeFromElement(Context,AElement,FSymbols,locTypeName); + if ( locType = nil ) then begin + raise EXsdInvalidElementDefinitionException.CreateFmt(SERR_InvalidElementDef_Type,[FTypeName,locName]); + end; + Self.Module.InterfaceSection.Declarations.Add(locType); + Self.Module.InterfaceSection.Types.Add(locType); + if locType.InheritsFrom(TPasClassType) then begin + Self.Module.InterfaceSection.Classes.Add(locType); + end; + end else begin + locTypeName := 'anyType'; end; end; end; @@ -1667,7 +1671,7 @@ function TSimpleTypeParser.ParseEnumContent(): TPasType; var locRes : TPasEnumType; - locOrder : Integer; + //locOrder : Integer; prefixItems : Boolean; procedure ParseEnumItem(AItemNode : TDOMNode); @@ -1709,11 +1713,11 @@ var end; end; locItem := TPasEnumValue(FSymbols.CreateElement(TPasEnumValue,locInternalItemName,locRes,visDefault,'',0)); - locItem.Value := locOrder; + //locItem.Value := locOrder; locRes.Values.Add(locItem); if locHasInternalName then FSymbols.RegisterExternalAlias(locItem,locItemName); - Inc(locOrder); + //Inc(locOrder); end; var @@ -1736,7 +1740,7 @@ begin if hasIntrnName then FSymbols.RegisterExternalAlias(locRes,FTypeName); locEnumCrs.Reset(); - locOrder := 0; + //locOrder := 0; while locEnumCrs.MoveNext() do begin ParseEnumItem((locEnumCrs.GetCurrent() as TDOMNodeRttiExposer).InnerObject); end;