Cleaned Code by Removing Location Tracking for Errors
This commit is contained in:
@@ -28,7 +28,7 @@
|
||||
[tokenStream beginIgnoringWhitespaceTokens];
|
||||
MPToken *token = tokenStream.currentToken;
|
||||
if (token.tokenType == MPVariableToken) {
|
||||
self.variableName = token.stringValue;
|
||||
_variableName = token.stringValue;
|
||||
_range = token.range;
|
||||
} else {
|
||||
@throw [NSException exceptionWithName:NSInternalInconsistencyException reason:@"Expected Variable" userInfo:nil];
|
||||
@@ -44,11 +44,13 @@
|
||||
return _range;
|
||||
}
|
||||
|
||||
- (BOOL)validate:(MPParseError *__autoreleasing *)error
|
||||
- (BOOL)validate:(NSError *__autoreleasing *)error
|
||||
{
|
||||
if (![[MPEvaluationContext sharedContext] isVariableDefined:self.variableName]) {
|
||||
if (error) {
|
||||
*error = MPParseError(self.range, @"Undefined Variable");
|
||||
*error = MPParseError(9,
|
||||
NSLocalizedString(@"Undefined Variable.", @"Error message. This is displayed when an expression contains an undefined variable."),
|
||||
nil);
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
@@ -60,9 +62,4 @@
|
||||
return [[MPEvaluationContext sharedContext] valueForVariable:self.variableName];
|
||||
}
|
||||
|
||||
- (NSArray *)expressionElements
|
||||
{
|
||||
return @[self.variableName];
|
||||
}
|
||||
|
||||
@end
|
||||
|
||||
Reference in New Issue
Block a user