Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Modeling » Epsilon » [Patch] Clash between "default" variables and "default" (new?) keyword in Epsilo
[Patch] Clash between "default" variables and "default" (new?) keyword in Epsilo [message #590222] Sun, 20 June 2010 19:56
Eclipse UserFriend
Originally posted by: antonio.garciadominguez.uca.es

--nextPart4661172.zPGA5PUh9M
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 7Bit

Hi all,

I just updated to the latest version of Epsilon in SVN (r1064) and I ran
into some problems when running my EuGENia fix scripts for the Ecore code
generation models. Apparently, there was a parse error in this file:

plugins/org.eclipse.epsilon.eugenia/transformations/ECoreUti l.eol

It said that there was a problem line 1, but when I opened this file with
the Epsilon editor, the parsing errors were around line 211. It looks like
"default" has now become a keyword, and there is a variable named "default"
in the labelHasIcon operation for the ECore!EClass type. Renaming it to
something else (such as defaultValue) solved the problem. Now everything
works great, as usual ;-).

I've attached a patch which seems to fix it for the previous file and this
one, which also uses "default" as a variable:

plugins/org.eclipse.epsilon.eugenia/transformations/Ecore2Ge nModel.etl

However, there seems to be an access to a field called "default" in this
other file. Would that parse correctly?

examples/org.eclipse.epsilon.examples.oo2db/OO2DB.etl

Well, that's all my quick "grep"ping turned up. Hope it helps :-).

Keep up the good work,
Antonio
--nextPart4661172.zPGA5PUh9M
Content-Type: text/x-patch; name="fix-for-default.patch"
Content-Disposition: attachment; filename="fix-for-default.patch"
Content-Transfer-Encoding: 8Bit

diff --git a/plugins/org.eclipse.epsilon.eugenia/transformations/ECoreU til.eol b/plugins/org.eclipse.epsilon.eugenia/transformations/ECoreU til.eol
index d1f5ac1..5c274a7 100644
--- a/plugins/org.eclipse.epsilon.eugenia/transformations/ECoreU til.eol
+++ b/plugins/org.eclipse.epsilon.eugenia/transformations/ECoreU til.eol
@@ -211,7 +211,7 @@ operation ECore!EClass hasInternalLabel() : Boolean {
}



@cached

-operation ECore!EClass labelHasIcon(default : Boolean) : Boolean {

+operation ECore!EClass labelHasIcon(defaultValue : Boolean) : Boolean {



var ann : String;

if (self.isNode()) ann := 'gmf.node';

@@ -219,7 +219,7 @@ operation ECore!EClass labelHasIcon(default : Boolean) : Boolean {


var hasIcon := self.getAnnotationValue(ann, 'label.icon');



- if (hasIcon.isUndefined()) return default;

+ if (hasIcon.isUndefined()) return defaultValue;

else if (hasIcon = 'true') return true;

else return false;



diff --git a/plugins/org.eclipse.epsilon.eugenia/transformations/Ecore2 GenModel.etl b/plugins/org.eclipse.epsilon.eugenia/transformations/Ecore2 GenModel.etl
index 81ec21d..5584e49 100644
--- a/plugins/org.eclipse.epsilon.eugenia/transformations/Ecore2 GenModel.etl
+++ b/plugins/org.eclipse.epsilon.eugenia/transformations/Ecore2 GenModel.etl
@@ -196,7 +196,7 @@ operation Ecore!EModelElement hasAnnotation(label : String) : Boolean {
return false;

}



-operation Ecore!EModelElement getAnnotation(label : String, default : Any) : Any {

+operation Ecore!EModelElement getAnnotation(label : String, defaultValue : Any) : Any {



// GenModel -> "http://www.eclipse.org/emf/2002/GenModel"



@@ -212,13 +212,13 @@ operation Ecore!EModelElement getAnnotation(label : String, default : Any) : Any
return det.value;

}

else {

- return default;

+ return defaultValue;

}

}



-operation Ecore!EModelElement getEnumerationAnnotation(label : String, eObject : Any, default : Any) {

+operation Ecore!EModelElement getEnumerationAnnotation(label : String, eObject : Any, defaultValue : Any) {



- var result = self.getAnnotation(label, default);

+ var result = self.getAnnotation(label, defaultValue);



if (result.isTypeOf(String)) {



@@ -236,26 +236,26 @@ operation Ecore!EModelElement getEnumerationAnnotation(label : String, eObject :
eEnum.getELiterals().collect(l|l.name).concat("/") +

" but was " + result + " instead");



- return default;

+ return defaultValue;

}

}

else {

- return default;

+ return defaultValue;

}

}



-operation Ecore!EModelElement getBooleanAnnotation(label : String, default : Boolean) : Boolean {

- var result = self.getAnnotation(label, default);

+operation Ecore!EModelElement getBooleanAnnotation(label : String, defaultValue : Boolean) : Boolean {

+ var result = self.getAnnotation(label, defaultValue);

if (result.isTypeOf(String)) {

if (result == "true") return true;

else if (result == "false") return false;

else {

printWarning("Value of " + label + " was expected to be true/false but was " + result + " instead");

- return default;

+ return defaultValue;

}

}

else {

- return default;

+ return defaultValue;

}

}





--nextPart4661172.zPGA5PUh9M--
Previous Topic:EPackage Registry View - Drag and Drop support?
Next Topic:[Patch] Clash between "default" variables and "default" (new?) keyword in Epsilo
Goto Forum:
  


Current Time: Fri Apr 26 03:04:56 GMT 2024

Powered by FUDForum. Page generated in 0.02996 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top